From: Nick Mathewson Date: Thu, 5 Jun 2025 20:12:24 +0000 (-0400) Subject: cgo: Use the correct operation to re-align AES. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bddd835d6938bf2489ff8970dd3e172444f73052;p=thirdparty%2Ftor.git 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. --- diff --git a/src/core/crypto/relay_crypto_cgo.c b/src/core/crypto/relay_crypto_cgo.c index d3622de228..1e900861fe 100644 --- 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); }