[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>
This commit is contained in:
Michael Brown
2012-03-09 15:45:56 +00:00
parent 74b1e706a8
commit 1c29b4d979
12 changed files with 508 additions and 602 deletions

View File

@@ -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 );