[rsa] Actually check the unused-bits byte in the public key bit string
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
3ec773cd2b
commit
d6979e0d55
|
@ -236,12 +236,13 @@ static int rsa_init ( void *ctx, const void *key, size_t key_len ) {
|
||||||
|
|
||||||
/* Check and skip unused-bits byte of bit string */
|
/* Check and skip unused-bits byte of bit string */
|
||||||
bit_string = cursor.data;
|
bit_string = cursor.data;
|
||||||
if ( cursor.len < 1 ) {
|
if ( ( cursor.len < sizeof ( *bit_string ) ) ||
|
||||||
|
( bit_string->unused != 0 ) ) {
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto err_parse;
|
goto err_parse;
|
||||||
}
|
}
|
||||||
cursor.data++;
|
cursor.data = &bit_string->data;
|
||||||
cursor.len--;
|
cursor.len -= offsetof ( typeof ( *bit_string ), data );
|
||||||
|
|
||||||
/* Enter RSAPublicKey */
|
/* Enter RSAPublicKey */
|
||||||
asn1_enter ( &cursor, ASN1_SEQUENCE );
|
asn1_enter ( &cursor, ASN1_SEQUENCE );
|
||||||
|
|
Reference in New Issue