MD5 block update operation. Continues an MD5 message-digest operation, processing another message block, and updating the context. MD5_CTX *context - context unsigned char *input - input block unsigned int inputLen - length of input block */
| 126 | unsigned int inputLen - length of input block |
| 127 | */ |
| 128 | void MD5Update (MD5_CTX *context, const char *input, unsigned int inputLen) |
| 129 | { |
| 130 | unsigned int i, index, partLen; |
| 131 | |
| 132 | /* Compute number of bytes mod 64 */ |
| 133 | index = (unsigned int)((context->count[0] >> 3) & 0x3F); |
| 134 | |
| 135 | /* Update number of bits */ |
| 136 | if ((context->count[0] += ((UINT4)inputLen << 3)) |
| 137 | |
| 138 | < ((UINT4)inputLen << 3)) |
| 139 | context->count[1]++; |
| 140 | context->count[1] += ((UINT4)inputLen >> 29); |
| 141 | |
| 142 | partLen = 64 - index; |
| 143 | |
| 144 | /* Transform as many times as possible. |
| 145 | */ |
| 146 | if (inputLen >= partLen) { |
| 147 | MD5_memcpy |
| 148 | ((POINTER)&context->buffer[index], (POINTER)input, partLen); |
| 149 | MD5Transform (context->state, context->buffer); |
| 150 | |
| 151 | for (i = partLen; i + 63 < inputLen; i += 64) |
| 152 | MD5Transform (context->state, (const unsigned char *)(&input[i])); |
| 153 | |
| 154 | index = 0; |
| 155 | } |
| 156 | else |
| 157 | i = 0; |
| 158 | |
| 159 | /* Buffer remaining input */ |
| 160 | MD5_memcpy |
| 161 | ((POINTER)&context->buffer[index], (POINTER)&input[i], |
| 162 | inputLen-i); |
| 163 | } |
| 164 | |
| 165 | /* MD5 finalization. Ends an MD5 message-digest operation, writing the |
| 166 | the message digest and zeroizing the context. |
no test coverage detected