summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-07-24 14:32:59 -0400
committerNick Mathewson <nickm@torproject.org>2017-07-24 14:34:53 -0400
commit6c8c9731915a796c8a1bc11f376793459db1200f (patch)
tree2df0e14503b35d2b70e0ca4ae08d115d81ffb3db /src/test
parentdb1664e5932ae0435b23c2ca92e74f3a5c64c1f8 (diff)
downloadtor-6c8c9731915a796c8a1bc11f376793459db1200f.tar.gz
tor-6c8c9731915a796c8a1bc11f376793459db1200f.zip
Rename the hybrid_encrypt/decrypt functions; label them as dangerous
We need to keep these around for TAP and old-style hidden services, but they're obsolete, and we shouldn't encourage anyone to use them. So I've added "obsolete" to their names, and a comment explaining what the problem is. Closes ticket 23026.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test.c3
-rw-r--r--src/test/test_crypto.c4
-rw-r--r--src/test/test_introduce.c4
3 files changed, 6 insertions, 5 deletions
diff --git a/src/test/test.c b/src/test/test.c
index b6b11ce94a..c5c394900c 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -142,7 +142,8 @@ test_bad_onion_handshake(void *arg)
/* Server: Case 1: the encrypted data is degenerate. */
memset(junk_buf, 0, sizeof(junk_buf));
- crypto_pk_public_hybrid_encrypt(pk, junk_buf2, TAP_ONIONSKIN_CHALLENGE_LEN,
+ crypto_pk_obsolete_public_hybrid_encrypt(pk,
+ junk_buf2, TAP_ONIONSKIN_CHALLENGE_LEN,
junk_buf, DH_KEY_LEN, PK_PKCS1_OAEP_PADDING, 1);
tt_int_op(-1, OP_EQ,
onion_skin_TAP_server_handshake(junk_buf2, pk, NULL,
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index 4d9651db9c..11200b4e98 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -1252,10 +1252,10 @@ test_crypto_pk(void *arg)
for (i = 85; i < 140; ++i) {
memset(data2,0,1024);
memset(data3,0,1024);
- len = crypto_pk_public_hybrid_encrypt(pk1,data2,sizeof(data2),
+ len = crypto_pk_obsolete_public_hybrid_encrypt(pk1,data2,sizeof(data2),
data1,i,PK_PKCS1_OAEP_PADDING,0);
tt_int_op(len, OP_GE, 0);
- len = crypto_pk_private_hybrid_decrypt(pk1,data3,sizeof(data3),
+ len = crypto_pk_obsolete_private_hybrid_decrypt(pk1,data3,sizeof(data3),
data2,len,PK_PKCS1_OAEP_PADDING,1);
tt_int_op(len,OP_EQ, i);
tt_mem_op(data1,OP_EQ, data3,i);
diff --git a/src/test/test_introduce.c b/src/test/test_introduce.c
index cfb8d83b1d..5a24630475 100644
--- a/src/test/test_introduce.c
+++ b/src/test/test_introduce.c
@@ -355,7 +355,7 @@ make_intro_from_plaintext(
/*
* Figure out an upper bound on how big the ciphertext will be
- * (see crypto_pk_public_hybrid_encrypt())
+ * (see crypto_pk_obsolete_public_hybrid_encrypt())
*/
ciphertext_size = PKCS1_OAEP_PADDING_OVERHEAD;
ciphertext_size += crypto_pk_keysize(key);
@@ -372,7 +372,7 @@ make_intro_from_plaintext(
tt_assert(r >= 0);
/* Do encryption */
- r = crypto_pk_public_hybrid_encrypt(
+ r = crypto_pk_obsolete_public_hybrid_encrypt(
key, cell + DIGEST_LEN, ciphertext_size,
buf, len,
PK_PKCS1_OAEP_PADDING, 0);