gcm: Convert source data to a uint8_t pointer before subscripting it

It's not well-formed to subscript a pointer to void
This commit is contained in:
Lioncash 2018-02-22 21:32:09 -05:00
parent a798df5a2c
commit b11225e9db
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7

View File

@ -148,9 +148,10 @@ size_t gcm_decrypt_key(void *dst, size_t dst_size, const void *src, size_t src_s
ghash(calc_mac, dst, src_size - 0x20, j_block, 1); ghash(calc_mac, dst, src_size - 0x20, j_block, 1);
/* Const-time memcmp. */ /* Const-time memcmp. */
const uint8_t *src_bytes = src;
int different = 0; int different = 0;
for (unsigned int i = 0; i < 0x10; i++) { for (unsigned int i = 0; i < 0x10; i++) {
different |= src[src_size - 0x10 + i] ^ calc_mac[i]; different |= src_bytes[src_size - 0x10 + i] ^ calc_mac[i];
} }
if (different) { if (different) {
return 0; return 0;