diff options
author | nikkolasg <nikkolasg@gmail.com> | 2016-06-17 10:41:45 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-06-20 08:44:58 -0400 |
commit | 568dc27a1943305f6e11a9a497f56a6aabe27c99 (patch) | |
tree | 0768e827b287c2d07f1b7e84342d21af48dcf353 /src/test/test_crypto.c | |
parent | 48b25e6811bb822542ea898e30aebc75e185f29d (diff) | |
download | tor-568dc27a1943305f6e11a9a497f56a6aabe27c99.tar.gz tor-568dc27a1943305f6e11a9a497f56a6aabe27c99.zip |
Make base16_decodes return number of decoded bytes
base16_decodes() now returns the number of decoded bytes. It's interface
changes from returning a "int" to a "ssize_t". Every callsite now checks the
returned value.
Fixes #14013
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/test/test_crypto.c')
-rw-r--r-- | src/test/test_crypto.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c index bf4b68efe2..ba2fb86246 100644 --- a/src/test/test_crypto.c +++ b/src/test/test_crypto.c @@ -1521,7 +1521,7 @@ test_crypto_formats(void *arg) strlcpy(data1, "f0d678affc000100", 1024); i = base16_decode(data2, 8, data1, 16); - tt_int_op(i,OP_EQ, 0); + tt_int_op(i,OP_EQ, 8); tt_mem_op(data2,OP_EQ, "\xf0\xd6\x78\xaf\xfc\x00\x01\x00",8); /* now try some failing base16 decodes */ @@ -2537,8 +2537,9 @@ test_crypto_ed25519_testvectors(void *arg) #define DECODE(p,s) base16_decode((char*)(p),sizeof(p),(s),strlen(s)) #define EQ(a,h) test_memeq_hex((const char*)(a), (h)) - tt_int_op(0, OP_EQ, DECODE(sk, ED25519_SECRET_KEYS[i])); - tt_int_op(0, OP_EQ, DECODE(blinding_param, ED25519_BLINDING_PARAMS[i])); + tt_int_op(sizeof(sk), OP_EQ, DECODE(sk, ED25519_SECRET_KEYS[i])); + tt_int_op(sizeof(blinding_param), OP_EQ, DECODE(blinding_param, + ED25519_BLINDING_PARAMS[i])); tt_int_op(0, OP_EQ, ed25519_secret_key_from_seed(&esk, sk)); EQ(esk.seckey, ED25519_EXPANDED_SECRET_KEYS[i]); |