summaryrefslogtreecommitdiffstats
path: root/src/crypto/x509.c
diff options
context:
space:
mode:
authorMichael Brown2012-03-09 16:45:56 +0100
committerMichael Brown2012-03-09 18:14:39 +0100
commit1c29b4d979a9ea9be49bb942a2c41b7b6dc0dc9e (patch)
tree0738704fea59e225361b051adfabdd3769320317 /src/crypto/x509.c
parent[ath9k] Fix compilation on older gcc versions (diff)
downloadipxe-1c29b4d979a9ea9be49bb942a2c41b7b6dc0dc9e.tar.gz
ipxe-1c29b4d979a9ea9be49bb942a2c41b7b6dc0dc9e.tar.xz
ipxe-1c29b4d979a9ea9be49bb942a2c41b7b6dc0dc9e.zip
[crypto] Upgrade AES and RSA code to upstream axTLS version 1.4.5
All axTLS files are now vanilla versions of the upstream axTLS files, with one minor exception: the unused "ctx" parameter of bi_int_divide() has been marked with "__unused" to avoid a compilation error. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/crypto/x509.c')
-rw-r--r--src/crypto/x509.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/crypto/x509.c b/src/crypto/x509.c
index 28d28fc14..50593bc6d 100644
--- a/src/crypto/x509.c
+++ b/src/crypto/x509.c
@@ -155,6 +155,11 @@ int x509_rsa_public_key ( const struct asn1_cursor *certificate,
DBG_HDA ( 0, certificate->data, certificate->len );
return -ENOTSUP;
}
+ if ( modulus.len && ( ! *( ( uint8_t * ) modulus.data ) ) ) {
+ /* Skip positive sign byte */
+ modulus.data++;
+ modulus.len--;
+ }
memcpy ( &exponent, &pubkey, sizeof ( exponent ) );
rc = ( asn1_skip ( &exponent, ASN1_INTEGER ), /* modulus */
asn1_enter ( &exponent, ASN1_INTEGER ) /* publicExponent */ );
@@ -163,6 +168,11 @@ int x509_rsa_public_key ( const struct asn1_cursor *certificate,
DBG_HDA ( 0, certificate->data, certificate->len );
return -ENOTSUP;
}
+ if ( exponent.len && ( ! *( ( uint8_t * ) exponent.data ) ) ) {
+ /* Skip positive sign byte */
+ exponent.data++;
+ exponent.len--;
+ }
/* Allocate space and copy out modulus and exponent */
rsa_pubkey->modulus = malloc ( modulus.len + exponent.len );