aboutsummaryrefslogtreecommitdiff
path: root/src/lib/crypt_ops/crypto_format.c
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2019-04-05 15:08:54 +1000
committerteor <teor@torproject.org>2019-04-05 15:17:19 +1000
commitce5e38642d1f5e48a7e5c98422e0fa23145f0363 (patch)
treeae91e9e569da5507cf407acb9c43306240881ce7 /src/lib/crypt_ops/crypto_format.c
parente3124fef54f90828f7b06c41fd4e39ef7778f2e3 (diff)
downloadtor-ce5e38642d1f5e48a7e5c98422e0fa23145f0363.tar.gz
tor-ce5e38642d1f5e48a7e5c98422e0fa23145f0363.zip
crypto_format: Remove the return value from ed25519_signature_to_base64()
Also remove all checks for the return value, which were redundant anyway, because the function never failed. Part of 29660.
Diffstat (limited to 'src/lib/crypt_ops/crypto_format.c')
-rw-r--r--src/lib/crypt_ops/crypto_format.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/crypt_ops/crypto_format.c b/src/lib/crypt_ops/crypto_format.c
index 800f4ad5bc..269e6d9da9 100644
--- a/src/lib/crypt_ops/crypto_format.c
+++ b/src/lib/crypt_ops/crypto_format.c
@@ -223,17 +223,20 @@ ed25519_public_to_base64(char *output,
/** Encode the signature <b>sig</b> into the buffer at <b>output</b>,
* which must have space for ED25519_SIG_BASE64_LEN bytes of encoded signature,
- * plus one byte for a terminating NUL. Return 0 on success, -1 on failure.
+ * plus one byte for a terminating NUL.
+ * Can not fail.
*/
-int
+void
ed25519_signature_to_base64(char *output,
const ed25519_signature_t *sig)
{
char buf[256];
int n = base64_encode_nopad(buf, sizeof(buf), sig->sig, ED25519_SIG_LEN);
+ /* These asserts should always succeed, unless there is a bug in
+ * base64_encode_nopad(). */
tor_assert(n == ED25519_SIG_BASE64_LEN);
+ tor_assert(buf[ED25519_SIG_BASE64_LEN] == '\0');
memcpy(output, buf, ED25519_SIG_BASE64_LEN+1);
- return 0;
}
/** Try to decode the string <b>input</b> into an ed25519 signature. On