aboutsummaryrefslogtreecommitdiff
path: root/src/lib/crypt_ops/crypto_digest.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-06-05 09:33:35 -0400
committerNick Mathewson <nickm@torproject.org>2019-06-05 09:33:35 -0400
commit60213a3621c5fa354fd7b3f3feb1a2a336d5c9ce (patch)
tree18ac4ae7f6e06b1b52d66175dc449ad08d5c68aa /src/lib/crypt_ops/crypto_digest.c
parentd1b02456c107256ee562b36b0ef2f5544eb27cee (diff)
downloadtor-60213a3621c5fa354fd7b3f3feb1a2a336d5c9ce.tar.gz
tor-60213a3621c5fa354fd7b3f3feb1a2a336d5c9ce.zip
Run "make autostyle."
Diffstat (limited to 'src/lib/crypt_ops/crypto_digest.c')
-rw-r--r--src/lib/crypt_ops/crypto_digest.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/crypt_ops/crypto_digest.c b/src/lib/crypt_ops/crypto_digest.c
index 9da135e9c4..64a7d2d52c 100644
--- a/src/lib/crypt_ops/crypto_digest.c
+++ b/src/lib/crypt_ops/crypto_digest.c
@@ -149,9 +149,9 @@ struct crypto_xof_t {
* outside the tests yet.
*/
EVP_MD_CTX *ctx;
-#else
+#else /* !(defined(OPENSSL_HAS_SHAKE3_EVP)) */
keccak_state s;
-#endif
+#endif /* defined(OPENSSL_HAS_SHAKE3_EVP) */
};
/** Allocate a new XOF object backed by SHAKE-256. The security level
@@ -169,9 +169,9 @@ crypto_xof_new(void)
tor_assert(xof->ctx);
int r = EVP_DigestInit(xof->ctx, EVP_shake256());
tor_assert(r == 1);
-#else
+#else /* !(defined(OPENSSL_HAS_SHAKE256)) */
keccak_xof_init(&xof->s, 256);
-#endif
+#endif /* defined(OPENSSL_HAS_SHAKE256) */
return xof;
}
@@ -188,7 +188,7 @@ crypto_xof_add_bytes(crypto_xof_t *xof, const uint8_t *data, size_t len)
#else
int i = keccak_xof_absorb(&xof->s, data, len);
tor_assert(i == 0);
-#endif
+#endif /* defined(OPENSSL_HAS_SHAKE256) */
}
/** Squeeze bytes out of a XOF object. Calling this routine will render
@@ -203,7 +203,7 @@ crypto_xof_squeeze_bytes(crypto_xof_t *xof, uint8_t *out, size_t len)
#else
int i = keccak_xof_squeeze(&xof->s, out, len);
tor_assert(i == 0);
-#endif
+#endif /* defined(OPENSSL_HAS_SHAKE256) */
}
/** Cleanse and deallocate a XOF object. */
@@ -236,10 +236,10 @@ crypto_xof(uint8_t *output, size_t output_len,
r = EVP_DigestFinalXOF(ctx, output, output_len);
tor_assert(r == 1);
EVP_MD_CTX_free(ctx);
-#else
+#else /* !(defined(OPENSSL_HAS_SHA3)) */
crypto_xof_t *xof = crypto_xof_new();
crypto_xof_add_bytes(xof, input, input_len);
crypto_xof_squeeze_bytes(xof, output, output_len);
crypto_xof_free(xof);
-#endif
+#endif /* defined(OPENSSL_HAS_SHA3) */
}