提交 90cc4091 编写于 作者: A Andy Polyakov

Don't zap AES CBC IV, when decrypting truncated content in place.

上级 a7201e9a
......@@ -120,9 +120,11 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
}
if (len) {
memcpy(tmp, in, AES_BLOCK_SIZE);
AES_decrypt(tmp, tmp, key);
AES_decrypt(tmp, out, key);
for(n=0; n < len; ++n)
out[n] = tmp[n] ^ ivec[n];
out[n] ^= ivec[n];
for(n=len; n < AES_BLOCK_SIZE; ++n)
out[n] = tmp[n];
memcpy(ivec, tmp, AES_BLOCK_SIZE);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册