aboutsummaryrefslogtreecommitdiff
path: root/src/core/crypto
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2019-04-29 11:29:05 -0400
committerDavid Goulet <dgoulet@torproject.org>2019-04-29 12:17:57 -0400
commit67c22541830cf1dfc1c02843a1d4dd81c2df16ff (patch)
tree129dbff1261b55f3338f532910902198c70ed9d1 /src/core/crypto
parentd084f9115d7d46ad5e029b9c75cea716fa7d65a5 (diff)
downloadtor-67c22541830cf1dfc1c02843a1d4dd81c2df16ff.tar.gz
tor-67c22541830cf1dfc1c02843a1d4dd81c2df16ff.zip
sendme: Move note_cell_digest() to relay_crypto module
Because this function is poking within the relay_crypto_t object, move the function to the module so we can keep it opaque as much as possible. Part of #26288 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/core/crypto')
-rw-r--r--src/core/crypto/relay_crypto.c9
-rw-r--r--src/core/crypto/relay_crypto.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/src/core/crypto/relay_crypto.c b/src/core/crypto/relay_crypto.c
index eddc4298e2..3a6dad4b1d 100644
--- a/src/core/crypto/relay_crypto.c
+++ b/src/core/crypto/relay_crypto.c
@@ -91,6 +91,15 @@ relay_crypt_one_payload(crypto_cipher_t *cipher, uint8_t *in)
crypto_cipher_crypt_inplace(cipher, (char*) in, CELL_PAYLOAD_SIZE);
}
+/** Record the b_digest from <b>crypto</b> and put it in the sendme_digest. */
+void
+relay_crypto_record_sendme_digest(relay_crypto_t *crypto)
+{
+ tor_assert(crypto);
+ crypto_digest_get_digest(crypto->b_digest, (char *) crypto->sendme_digest,
+ sizeof(crypto->sendme_digest));
+}
+
/** Do the appropriate en/decryptions for <b>cell</b> arriving on
* <b>circ</b> in direction <b>cell_direction</b>.
*
diff --git a/src/core/crypto/relay_crypto.h b/src/core/crypto/relay_crypto.h
index 45a21d14ab..1009f1841b 100644
--- a/src/core/crypto/relay_crypto.h
+++ b/src/core/crypto/relay_crypto.h
@@ -27,5 +27,7 @@ void relay_crypto_clear(relay_crypto_t *crypto);
void relay_crypto_assert_ok(const relay_crypto_t *crypto);
+void relay_crypto_record_sendme_digest(relay_crypto_t *crypto);
+
#endif /* !defined(TOR_RELAY_CRYPTO_H) */