diff options
Diffstat (limited to 'crypto/poly1305/poly1305.c')
-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 a7c4a0824e..fd6d32090d 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) |