diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-10-24 10:20:53 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-10-24 10:20:53 -0400 |
commit | b77889fc5f40208a7c79a82c7c6b9d7f48fbcd51 (patch) | |
tree | d29e2a5f7b28d031b60b951d6f24c06e894c136d /src | |
parent | c6d3bebb1e32fa62712a475081a6724ffa5c9d67 (diff) | |
parent | 6851a08090325dc51b26e80350395c4a0c778cf8 (diff) | |
download | tor-b77889fc5f40208a7c79a82c7c6b9d7f48fbcd51.tar.gz tor-b77889fc5f40208a7c79a82c7c6b9d7f48fbcd51.zip |
Merge branch 'maint-0.3.5'
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/crypt_ops/crypto_ope.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/crypt_ops/crypto_ope.c b/src/lib/crypt_ops/crypto_ope.c index fd5d5f3770..789517eba2 100644 --- a/src/lib/crypt_ops/crypto_ope.c +++ b/src/lib/crypt_ops/crypto_ope.c @@ -48,17 +48,17 @@ struct crypto_ope_t { /** The type to add up in order to produce our OPE ciphertexts */ typedef uint16_t ope_val_t; -#ifdef WORDS_BIG_ENDIAN -/** Convert an OPE value to little-endian */ +#ifdef WORDS_BIGENDIAN +/** Convert an OPE value from little-endian. */ static inline ope_val_t -ope_val_to_le(ope_val_t x) +ope_val_from_le(ope_val_t x) { return ((x) >> 8) | (((x)&0xff) << 8); } #else -#define ope_val_to_le(x) (x) +#define ope_val_from_le(x) (x) #endif /** @@ -104,7 +104,7 @@ sum_values_from_cipher(crypto_cipher_t *c, size_t n) crypto_cipher_crypt_inplace(c, (char*)buf, BUFSZ*sizeof(ope_val_t)); for (i = 0; i < BUFSZ; ++i) { - total += ope_val_to_le(buf[i]); + total += ope_val_from_le(buf[i]); total += 1; } n -= BUFSZ; @@ -113,7 +113,7 @@ sum_values_from_cipher(crypto_cipher_t *c, size_t n) memset(buf, 0, n*sizeof(ope_val_t)); crypto_cipher_crypt_inplace(c, (char*)buf, n*sizeof(ope_val_t)); for (i = 0; i < n; ++i) { - total += ope_val_to_le(buf[i]); + total += ope_val_from_le(buf[i]); total += 1; } |