aboutsummaryrefslogtreecommitdiff
path: root/src/common/crypto.h
diff options
context:
space:
mode:
authorYawning Angel <yawning@schwanenlied.me>2015-12-18 22:31:12 +0000
committerYawning Angel <yawning@schwanenlied.me>2015-12-19 22:45:21 +0000
commit9467485517b69a99fb42e71416b856a2ef18a729 (patch)
treef4548bf9596832181db5af526f0c892200374528 /src/common/crypto.h
parent687f9b3bd7b55bcf4d984d745e978c2a03aeb4e1 (diff)
downloadtor-9467485517b69a99fb42e71416b856a2ef18a729.tar.gz
tor-9467485517b69a99fb42e71416b856a2ef18a729.zip
Add `crypto_xof_t` and assorted routines, backed by SHAKE256.
This is an eXtendable-Output Function with the following claimed security strengths against *all* adversaries: Collision: min(d/2, 256) Preimage: >= min(d, 256) 2nd Preimage: min(d, 256) where d is the amount of output used, in bits.
Diffstat (limited to 'src/common/crypto.h')
-rw-r--r--src/common/crypto.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/crypto.h b/src/common/crypto.h
index ff640ced0e..cf7b9ee408 100644
--- a/src/common/crypto.h
+++ b/src/common/crypto.h
@@ -117,6 +117,7 @@ typedef struct {
typedef struct crypto_pk_t crypto_pk_t;
typedef struct crypto_cipher_t crypto_cipher_t;
typedef struct crypto_digest_t crypto_digest_t;
+typedef struct crypto_xof_t crypto_xof_t;
typedef struct crypto_dh_t crypto_dh_t;
/* global state */
@@ -246,6 +247,10 @@ void crypto_digest_assign(crypto_digest_t *into,
void crypto_hmac_sha256(char *hmac_out,
const char *key, size_t key_len,
const char *msg, size_t msg_len);
+crypto_xof_t *crypto_xof_new(void);
+void crypto_xof_add_bytes(crypto_xof_t *xof, const uint8_t *data, size_t len);
+void crypto_xof_squeeze_bytes(crypto_xof_t *xof, uint8_t *out, size_t len);
+void crypto_xof_free(crypto_xof_t *xof);
/* Key negotiation */
#define DH_TYPE_CIRCUIT 1