diff options
author | Rich Salz <rsalz@openssl.org> | 2016-05-12 15:52:58 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2016-05-16 15:21:10 -0400 |
commit | 49445f21da5ad436a117d0d4cc6220c4bbbbf8a7 (patch) | |
tree | b8013a1a1dc02e3b721e137a5bd8847c5a2766d3 /crypto/poly1305 | |
parent | 589902b2cbc667564642a0fdedfb2ef176dba0e8 (diff) | |
download | openssl-49445f21da5ad436a117d0d4cc6220c4bbbbf8a7.zip openssl-49445f21da5ad436a117d0d4cc6220c4bbbbf8a7.tar.gz openssl-49445f21da5ad436a117d0d4cc6220c4bbbbf8a7.tar.bz2 |
Use OPENSSL_hexchar2int
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/poly1305')
-rw-r--r-- | crypto/poly1305/poly1305.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/crypto/poly1305/poly1305.c b/crypto/poly1305/poly1305.c index a7c4a08..fd6d320 100644 --- a/crypto/poly1305/poly1305.c +++ b/crypto/poly1305/poly1305.c @@ -871,14 +871,11 @@ static const struct poly1305_test poly1305_tests[] = { static unsigned char hex_digit(char h) { - if (h >= '0' && h <= '9') - return h - '0'; - else if (h >= 'a' && h <= 'f') - return h - 'a' + 10; - else if (h >= 'A' && h <= 'F') - return h - 'A' + 10; - else + int i = OPENSSL_hexchar2int(h); + + if (i < 0) abort(); + return i; } static void hex_decode(unsigned char *out, const char *hex) |