[crypto] Generalise x509_parse_bit_string() to asn1_bit_string()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2012-05-14 09:54:19 +01:00
parent 7deb610881
commit 4aad46ac70
5 changed files with 119 additions and 126 deletions

View File

@@ -200,18 +200,14 @@ struct asn1_algorithm {
/** Declare an ASN.1 OID-identified algorithm */
#define __asn1_algorithm __table_entry ( ASN1_ALGORITHMS, 01 )
/** An ASN.1 boolean */
struct asn1_boolean {
/** Value */
uint8_t value;
} __attribute__ (( packed ));
/** An ASN.1 bit string */
struct asn1_bit_string {
/** Number of unused bits */
uint8_t unused;
/** Data */
uint8_t data[0];
const void *data;
/** Length */
size_t len;
/** Unused bits at end of data */
unsigned int unused;
} __attribute__ (( packed ));
/**
@@ -236,6 +232,10 @@ extern int asn1_skip_any ( struct asn1_cursor *cursor );
extern int asn1_shrink_any ( struct asn1_cursor *cursor );
extern int asn1_boolean ( const struct asn1_cursor *cursor );
extern int asn1_integer ( const struct asn1_cursor *cursor, int *value );
extern int asn1_bit_string ( const struct asn1_cursor *cursor,
struct asn1_bit_string *bits );
extern int asn1_integral_bit_string ( const struct asn1_cursor *cursor,
struct asn1_bit_string *bits );
extern int asn1_compare ( const struct asn1_cursor *cursor1,
const struct asn1_cursor *cursor2 );
extern int asn1_algorithm ( const struct asn1_cursor *cursor,

View File

@@ -16,16 +16,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/refcnt.h>
#include <ipxe/list.h>
/** An X.509 bit string */
struct x509_bit_string {
/** Data */
const void *data;
/** Length */
size_t len;
/** Unused bits at end of data */
unsigned int unused;
};
/** An X.509 serial number */
struct x509_serial {
/** Raw serial number */
@@ -59,7 +49,7 @@ struct x509_public_key {
/** Public key algorithm */
struct asn1_algorithm *algorithm;
/** Raw public key bit string */
struct x509_bit_string raw_bits;
struct asn1_bit_string raw_bits;
};
/** An X.509 certificate subject */
@@ -77,7 +67,7 @@ struct x509_signature {
/** Signature algorithm */
struct asn1_algorithm *algorithm;
/** Signature value */
struct x509_bit_string value;
struct asn1_bit_string value;
};
/** An X.509 certificate basic constraints set */