(context, in, inputLen)
| 151 | */ |
| 152 | |
| 153 | void |
| 154 | MD5Update (context, in, inputLen) |
| 155 | MD5_CTX *context; |
| 156 | const void *in; |
| 157 | unsigned int inputLen; |
| 158 | { |
| 159 | unsigned int i, index, partLen; |
| 160 | const unsigned char *input = in; |
| 161 | |
| 162 | /* Compute number of bytes mod 64 */ |
| 163 | index = (unsigned int)((context->count[0] >> 3) & 0x3F); |
| 164 | |
| 165 | /* Update number of bits */ |
| 166 | if ((context->count[0] += ((u_int32_t)inputLen << 3)) |
| 167 | < ((u_int32_t)inputLen << 3)) |
| 168 | context->count[1]++; |
| 169 | context->count[1] += ((u_int32_t)inputLen >> 29); |
| 170 | |
| 171 | partLen = 64 - index; |
| 172 | |
| 173 | /* Transform as many times as possible. */ |
| 174 | if (inputLen >= partLen) { |
| 175 | memcpy((void *)&context->buffer[index], (const void *)input, |
| 176 | partLen); |
| 177 | MD5Transform (context->state, context->buffer); |
| 178 | |
| 179 | for (i = partLen; i + 63 < inputLen; i += 64) |
| 180 | MD5Transform (context->state, &input[i]); |
| 181 | |
| 182 | index = 0; |
| 183 | } |
| 184 | else |
| 185 | i = 0; |
| 186 | |
| 187 | /* Buffer remaining input */ |
| 188 | memcpy ((void *)&context->buffer[index], (const void *)&input[i], |
| 189 | inputLen-i); |
| 190 | } |
| 191 | |
| 192 | /* |
| 193 | * MD5 padding. Adds padding followed by original length. |
no test coverage detected