diff options
author | Daniel Pinto <danielpinto52@gmail.com> | 2020-06-06 10:44:28 +0100 |
---|---|---|
committer | Daniel Pinto <danielpinto52@gmail.com> | 2020-06-06 10:44:28 +0100 |
commit | 27315de590da24fe55353332c29a3a4454ee7da2 (patch) | |
tree | 87dd59d3530d963e586c44f74da100839c1fdffa /src/test/test_crypto.c | |
parent | 1d32c3114fa3ebcd4219eba6ad7bb2a57b878511 (diff) | |
download | tor-27315de590da24fe55353332c29a3a4454ee7da2.tar.gz tor-27315de590da24fe55353332c29a3a4454ee7da2.zip |
Make curve25519_public_to_base64 output padding optional #7869
Diffstat (limited to 'src/test/test_crypto.c')
-rw-r--r-- | src/test/test_crypto.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c index 0d75a212e9..ffd6a25bd5 100644 --- a/src/test/test_crypto.c +++ b/src/test/test_crypto.c @@ -2107,21 +2107,21 @@ test_crypto_curve25519_encode(void *arg) { curve25519_secret_key_t seckey; curve25519_public_key_t key1, key2, key3; - char buf[64]; + char buf[64], buf_nopad[64]; (void)arg; curve25519_secret_key_generate(&seckey, 0); curve25519_public_key_generate(&key1, &seckey); - curve25519_public_to_base64(buf, &key1); + curve25519_public_to_base64(buf, &key1, true); tt_int_op(CURVE25519_BASE64_PADDED_LEN, OP_EQ, strlen(buf)); tt_int_op(0, OP_EQ, curve25519_public_from_base64(&key2, buf)); tt_mem_op(key1.public_key,OP_EQ, key2.public_key, CURVE25519_PUBKEY_LEN); - buf[CURVE25519_BASE64_PADDED_LEN - 1] = '\0'; - tt_int_op(CURVE25519_BASE64_PADDED_LEN-1, OP_EQ, strlen(buf)); - tt_int_op(0, OP_EQ, curve25519_public_from_base64(&key3, buf)); + curve25519_public_to_base64(buf_nopad, &key1, false); + tt_int_op(CURVE25519_BASE64_LEN, OP_EQ, strlen(buf_nopad)); + tt_int_op(0, OP_EQ, curve25519_public_from_base64(&key3, buf_nopad)); tt_mem_op(key1.public_key,OP_EQ, key3.public_key, CURVE25519_PUBKEY_LEN); /* Now try bogus parses. */ |