commit bddd835d6938bf2489ff8970dd3e172444f73052
parent 933c5491db00c703d5d8264fdabd5a5b10aff96f
Author: Nick Mathewson <nickm@torproject.org>
Date: Thu, 5 Jun 2025 16:12:24 -0400
cgo: Use the correct operation to re-align AES.
By accident, this doesn't cause a bug, since 480 = 15*16*2.
Still, it's better to avoid problems in the future.
Closes #41091.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/crypto/relay_crypto_cgo.c b/src/core/crypto/relay_crypto_cgo.c
@@ -190,7 +190,7 @@ cgo_prf_xor_t0(cgo_prf_t *prf, const uint8_t *input,
// Re-align the cipher.
//
// This approach is faster than EVP_CIPHER_set_num!
- const int ns = 16 - (PRF_T0_DATA_LEN % 0xf);
+ const int ns = 16 - (PRF_T0_DATA_LEN & 0xf);
// We're not using the hash for anything, so it's okay to overwrite
aes_crypt_inplace(prf->k, (char*)hash, ns);
}