summaryrefslogtreecommitdiff
path: root/src/lib/crypt_ops
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2019-04-12 13:00:02 +1000
committerteor <teor@torproject.org>2019-04-12 13:00:02 +1000
commitebbc2c3d8f8268c09b6df8270907a1123f926caa (patch)
treed10c275fa636bcec7595edfe3b2503b7a9dbe1fc /src/lib/crypt_ops
parentac269d5c30d09194b6ab80232f72bfbd6fa69ed2 (diff)
downloadtor-ebbc2c3d8f8268c09b6df8270907a1123f926caa.tar.gz
tor-ebbc2c3d8f8268c09b6df8270907a1123f926caa.zip
crypt_ops: Stop using a separate buffer in ed25519_signature_from_base64()
Part of 29960.
Diffstat (limited to 'src/lib/crypt_ops')
-rw-r--r--src/lib/crypt_ops/crypto_format.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/lib/crypt_ops/crypto_format.c b/src/lib/crypt_ops/crypto_format.c
index 1827168c75..e11b391194 100644
--- a/src/lib/crypt_ops/crypto_format.c
+++ b/src/lib/crypt_ops/crypto_format.c
@@ -248,11 +248,9 @@ ed25519_signature_from_base64(ed25519_signature_t *sig,
{
if (strlen(input) != ED25519_SIG_BASE64_LEN)
return -1;
- char buf[ED25519_SIG_BASE64_LEN+1];
- memcpy(buf, input, ED25519_SIG_BASE64_LEN);
- buf[ED25519_SIG_BASE64_LEN] = 0;
char decoded[128];
- int n = base64_decode(decoded, sizeof(decoded), buf, strlen(buf));
+ int n = base64_decode(decoded, sizeof(decoded), input,
+ ED25519_SIG_BASE64_LEN);
if (n < 0 || n != ED25519_SIG_LEN)
return -1;
memcpy(sig->sig, decoded, ED25519_SIG_LEN);