summaryrefslogtreecommitdiffstats
path: root/crypto/poly1305
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2016-05-12 15:52:58 -0400
committerRich Salz <rsalz@openssl.org>2016-05-16 15:21:10 -0400
commit49445f21da5ad436a117d0d4cc6220c4bbbbf8a7 (patch)
treeb8013a1a1dc02e3b721e137a5bd8847c5a2766d3 /crypto/poly1305
parent589902b2cbc667564642a0fdedfb2ef176dba0e8 (diff)
Use OPENSSL_hexchar2int
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/poly1305')
-rw-r--r--crypto/poly1305/poly1305.c11
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)