Text   |  XML   |  ReML   |   Visible Warnings:

Unreasonable Size Argument  at crypt-md5.c:135

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

snmp_usm_auth_md5

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-snmp.c)expand/collapse
Show more  
 1222  static gboolean snmp_usm_auth_md5(snmp_usm_params_t* p, guint8** calc_auth_p, guint* calc_auth_len_p, gchar const** error) {
 1223          guint msg_len;
 1224          guint8* msg;
 1225          guint auth_len;
 1226          guint8* auth;
 1227          guint8* key;
 1228          guint key_len;
 1229          guint8 *calc_auth;
 1230          guint start;
 1231          guint end;
 1232          guint i;
 1233   
 1234          if (!p->auth_tvb) {
 1235                  *error = "No Authenticator";
 1236                  return FALSE;
 1237          }
 1238   
 1239          key = p->user_assoc->user.authKey.data;
 1240          key_len = p->user_assoc->user.authKey.len;
 1241   
 1242          if (! key ) {
 1243                  *error = "User has no authKey";
 1244                  return FALSE;
 1245          }
 1246   
 1247   
 1248[+]         auth_len = tvb_length_remaining(p->auth_tvb,0);
 1249   
 1250          if (auth_len != 12) {
 1251                  *error = "Authenticator length wrong";
 1252                  return FALSE;
 1253          }
 1254   
 1255[+]         msg_len = tvb_length_remaining(p->msg_tvb,0);
 1256          msg = ep_tvb_memdup(p->msg_tvb,0,msg_len);
 1257   
 1258   
 1259          auth = ep_tvb_memdup(p->auth_tvb,0,auth_len);
 1260   
 1261          start = p->auth_offset - p->start_offset;
 1262          end =   start + auth_len;
 1263   
 1264          /* fill the authenticator with zeros */
 1265          for ( i = start ; i < end ; i++ ) {
 1266                  msg[i] = '\0';
 1267          }
 1268   
 1269          calc_auth = ep_alloc(16);
 1270   
 1271[+]         md5_hmac(msg, msg_len, key, key_len, calc_auth);
expand/collapse

md5_hmac

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/crypt/crypt-md5.c)expand/collapse
Show more  
 295  void md5_hmac(const guint8* text, size_t text_len, const guint8* key, size_t key_len, guint8 digest[16]) {
 296          MD5_CTX context;
 297          guint8 k_ipad[65];    /* inner padding -
 298                  * key XORd with ipad
 299                  */
 300          guint8 k_opad[65];    /* outer padding -
 301                  * key XORd with opad
 302                  */
 303          guint8 tk[16];
 304          int i;
 305          /* if key is longer than 64 bytes reset it to key=MD5(key) */
 306          if (key_len > 64) {
 307   
 308                  MD5_CTX      tctx;
 309   
 310                  MD5Init(&tctx);
 311                  MD5Update(&tctx, key, key_len);
 312                  MD5Final(tk, &tctx);
 313   
 314                  key = tk;
 315                  key_len = 16;
 316          }
 317
327
Show [ Lines 317 to 327 omitted. ]
 328           Krawczyk, et. al.            Informational                      [Page 8]
 329   
 330           RFC 2104                          HMAC                     February 1997 
 331   
 332   
 333           * opad is the byte 0x5c repeated 64 times
 334           * and text is the data being protected 
 335           */
 336   
 337          /* start out by storing key in pads */
 338          memset(k_ipad, 0, sizeof(k_ipad));
 339          memset(k_opad, 0, sizeof(k_opad));
 340          memcpy(k_ipad, key, key_len);
 341          memcpy(k_opad, key, key_len);
 342   
 343          /* XOR key with ipad and opad values */
 344          for (i=0; i<64; i++) {
 345                  k_ipad[i] ^= 0x36;
 346                  k_opad[i] ^= 0x5c;
 347          }
 348          /*
 349           * perform inner MD5 
 350           */
 351          MD5Init(&context);                   /* init context for 1st  pass */
 352          MD5Update(&context, k_ipad, 64);      /* start with inner pad */
 353[+]         MD5Update(&context, text, text_len); /* then text of datagram */
expand/collapse

md5_append

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/crypt/crypt-md5.c)expand/collapse
Show more  
 94  void md5_append( md5_state_t *ctx, unsigned char const *buf, size_t len)
 95  {
 96      guint32 t;
 97   
 98      /* Update bitcount */
 99   
 100      t = ctx->bits[0];
 101      if ((ctx->bits[0] = t + ((guint32) len << 3)) < t)
 102          ctx->bits[1]++;         /* Carry from low to high */
 103      ctx->bits[1] += (guint32) len >> 29;
 104   
 105      t = (t >> 3) & 0x3f;        /* Bytes already in shsInfo->data */
 106   
 107      /* Handle any leading odd-sized chunks */
 108   
 109      if (t) {
 110          unsigned char *p = (unsigned char *) ctx->in + t;
 111   
 112          t = 64 - t;
 113          if (len < t) {
 114              memcpy(p, buf, len);
 115              return;
 116          }
 117          memcpy(p, buf, t);
 118          byteReverse(ctx->in, 16);
 119          MD5Transform(ctx->buf, ctx->in);
 120          buf += t;
 121          len -= t;
 122      }
 123      /* Process data in 64-byte chunks */
 124   
 125      while (len >= 64) {
 126          memcpy(ctx->in, buf, 64);
 127          byteReverse(ctx->in, 16);
 128          MD5Transform(ctx->buf, ctx->in);
 129          buf += 64;
 130          len -= 64;
 131      }
 132   
 133      /* Handle any remaining bytes of data. */
 134   
 135      memcpy(ctx->in, buf, len);
Show more  
Show more  
Show more  




Change Warning 1640.30861 : Unreasonable Size Argument

Priority:
State:
Finding:
Owner:
Note: