mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-01 08:03:31 +01:00
crypto_format: Stop adding padding in ed25519_signature_from_base64()
base64_decode() does not require padding. Part of 29660.
This commit is contained in:
parent
ce5e38642d
commit
5e2cba8eb4
@ -246,14 +246,11 @@ int
|
|||||||
ed25519_signature_from_base64(ed25519_signature_t *sig,
|
ed25519_signature_from_base64(ed25519_signature_t *sig,
|
||||||
const char *input)
|
const char *input)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (strlen(input) != ED25519_SIG_BASE64_LEN)
|
if (strlen(input) != ED25519_SIG_BASE64_LEN)
|
||||||
return -1;
|
return -1;
|
||||||
char buf[ED25519_SIG_BASE64_LEN+3];
|
char buf[ED25519_SIG_BASE64_LEN+1];
|
||||||
memcpy(buf, input, ED25519_SIG_BASE64_LEN);
|
memcpy(buf, input, ED25519_SIG_BASE64_LEN);
|
||||||
buf[ED25519_SIG_BASE64_LEN+0] = '=';
|
buf[ED25519_SIG_BASE64_LEN] = 0;
|
||||||
buf[ED25519_SIG_BASE64_LEN+1] = '=';
|
|
||||||
buf[ED25519_SIG_BASE64_LEN+2] = 0;
|
|
||||||
char decoded[128];
|
char decoded[128];
|
||||||
int n = base64_decode(decoded, sizeof(decoded), buf, strlen(buf));
|
int n = base64_decode(decoded, sizeof(decoded), buf, strlen(buf));
|
||||||
if (n < 0 || n != ED25519_SIG_LEN)
|
if (n < 0 || n != ED25519_SIG_LEN)
|
||||||
|
Loading…
Reference in New Issue
Block a user