Changeset 988 for vendor/current/lib/crypto/md5.c
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/lib/crypto/md5.c
r740 r988 44 44 * initialization constants. 45 45 */ 46 _PUBLIC_ void MD5Init( struct MD5Context*ctx)46 _PUBLIC_ void MD5Init(MD5_CTX *ctx) 47 47 { 48 48 ctx->buf[0] = 0x67452301; … … 59 59 * of bytes. 60 60 */ 61 _PUBLIC_ void MD5Update( struct MD5Context*ctx, const uint8_t *buf, size_t len)61 _PUBLIC_ void MD5Update(MD5_CTX *ctx, const uint8_t *buf, size_t len) 62 62 { 63 63 register uint32_t t; … … 107 107 * 1 0* (64-bit count of bits processed, MSB-first) 108 108 */ 109 _PUBLIC_ void MD5Final(uint8_t digest[16], struct MD5Context*ctx)109 _PUBLIC_ void MD5Final(uint8_t digest[16], MD5_CTX *ctx) 110 110 { 111 111 unsigned int count; … … 138 138 byteReverse(ctx->in, 14); 139 139 140 /* Append length in bits and transform */ 141 ((uint32_t *) ctx->in)[14] = ctx->bits[0]; 142 ((uint32_t *) ctx->in)[15] = ctx->bits[1]; 140 /* Append length in bits and transform. 141 * Use memcpy to avoid strict-aliasing problems. 142 * This way it can be optimized. 143 */ 144 memcpy(&ctx->in[14 * sizeof(uint32_t)], &ctx->bits[0], sizeof(uint32_t)); 145 memcpy(&ctx->in[15 * sizeof(uint32_t)], &ctx->bits[1], sizeof(uint32_t)); 143 146 144 147 MD5Transform(ctx->buf, (uint32_t *) ctx->in);
Note:
See TracChangeset
for help on using the changeset viewer.