aboutsummaryrefslogtreecommitdiffstats
path: root/fips/fips_utl.h
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2011-02-14 19:42:49 +0000
committerDr. Stephen Henson <steve@openssl.org>2011-02-14 19:42:49 +0000
commit943a0ceed0c35bd17c6c4deae087bb77308d6830 (patch)
tree5712a6d75046086c726bdd466b0bf6e110424be7 /fips/fips_utl.h
parent5d2f1538a0d73cbb3cfd663e5859f78ad9362de2 (diff)
downloadopenssl-943a0ceed0c35bd17c6c4deae087bb77308d6830.tar.gz
Update ECDSA test program to handle ECDSA2 format files.
Correctly handle hex strings with an odd number of digits.
Diffstat (limited to 'fips/fips_utl.h')
-rw-r--r--fips/fips_utl.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/fips/fips_utl.h b/fips/fips_utl.h
index 7ead612478..63541d996e 100644
--- a/fips/fips_utl.h
+++ b/fips/fips_utl.h
@@ -116,6 +116,15 @@ int hex2bin(const char *in, unsigned char *out)
out[n2++]=ch;
break;
}
+ /* If input is odd length first digit is least significant: assumes
+ * all digits valid hex and null terminated which is true for the
+ * strings we pass.
+ */
+ if (n1 == 1 && strlen(in) & 1)
+ {
+ out[n2++] = ch;
+ continue;
+ }
out[n2] = ch << 4;
/* second byte */
if ((in[n1] >= '0') && (in[n1] <= '9'))