X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Ftest-aes128.c;h=19874b10be3c12b1bd61f066a350cf416c061fdf;hb=4ce9c31573b0dc01696d1b0080b67b726b31cc19;hp=8a6c28cde04a05e1e87c901f8578a33be9813021;hpb=58fda1dab104041fc693032475ec4662c1a52849;p=openvswitch diff --git a/tests/test-aes128.c b/tests/test-aes128.c index 8a6c28cd..19874b10 100644 --- a/tests/test-aes128.c +++ b/tests/test-aes128.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nicira Networks. + * Copyright (c) 2009, 2010 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,13 +28,12 @@ hex_to_uint8(const char *input, uint8_t *output, size_t n) goto error; } for (i = 0; i < n; i++) { - unsigned char hi = input[i * 2]; - unsigned char lo = input[i * 2 + 1]; + bool ok; - if (!isxdigit(hi) || !isxdigit(lo)) { + output[i] = hexits_value(&input[i * 2], 2, &ok); + if (!ok) { goto error; } - output[i] = (hexit_value(hi) << 4) + hexit_value(lo); } return;