summaryrefslogtreecommitdiff
path: root/src/common/crypto.c
diff options
context:
space:
mode:
authorFernando Fernandez Mancera <ffmancera@riseup.net>2018-02-03 15:50:56 +0100
committerFernando Fernandez Mancera <ffmancera@riseup.net>2018-02-03 17:04:29 +0100
commit202d27af71014169539863cbf81ddf3411a05258 (patch)
tree5232e8f7ac9f979f89f528e79735dc5306c3b0fc /src/common/crypto.c
parentf8b1493681f8b881adac5f4fbdec61c99d9fb1e1 (diff)
downloadtor-202d27af71014169539863cbf81ddf3411a05258.tar.gz
tor-202d27af71014169539863cbf81ddf3411a05258.zip
Add xof functions into crypto_digest.[ch]
Added xof functions and operations into xof+digest module. Follows #24658. Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
Diffstat (limited to 'src/common/crypto.c')
-rw-r--r--src/common/crypto.c50
1 files changed, 0 insertions, 50 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 88cf353a15..edc9e9535d 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -672,56 +672,6 @@ crypto_cipher_decrypt_with_iv(const char *key,
return (int)(fromlen - CIPHER_IV_LEN);
}
-/** Internal state for a eXtendable-Output Function (XOF). */
-struct crypto_xof_t {
- keccak_state s;
-};
-
-/** Allocate a new XOF object backed by SHAKE-256. The security level
- * provided is a function of the length of the output used. Read and
- * understand FIPS-202 A.2 "Additional Consideration for Extendable-Output
- * Functions" before using this construct.
- */
-crypto_xof_t *
-crypto_xof_new(void)
-{
- crypto_xof_t *xof;
- xof = tor_malloc(sizeof(crypto_xof_t));
- keccak_xof_init(&xof->s, 256);
- return xof;
-}
-
-/** Absorb bytes into a XOF object. Must not be called after a call to
- * crypto_xof_squeeze_bytes() for the same instance, and will assert
- * if attempted.
- */
-void
-crypto_xof_add_bytes(crypto_xof_t *xof, const uint8_t *data, size_t len)
-{
- int i = keccak_xof_absorb(&xof->s, data, len);
- tor_assert(i == 0);
-}
-
-/** Squeeze bytes out of a XOF object. Calling this routine will render
- * the XOF instance ineligible to absorb further data.
- */
-void
-crypto_xof_squeeze_bytes(crypto_xof_t *xof, uint8_t *out, size_t len)
-{
- int i = keccak_xof_squeeze(&xof->s, out, len);
- tor_assert(i == 0);
-}
-
-/** Cleanse and deallocate a XOF object. */
-void
-crypto_xof_free_(crypto_xof_t *xof)
-{
- if (!xof)
- return;
- memwipe(xof, 0, sizeof(crypto_xof_t));
- tor_free(xof);
-}
-
/* DH */
/** Our DH 'g' parameter */