aboutsummaryrefslogtreecommitdiff
path: root/src/include/ipxe
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2012-05-14 09:54:19 +0100
committerMichael Brown <mcb30@ipxe.org>2012-05-14 11:02:38 +0100
commit4aad46ac70933458f118f59506044de35eb9f7cf (patch)
treeebdac8ad53dbfd64df37a9a4d498e2c52c9d733b /src/include/ipxe
parent7deb610881d36dd156edbf705f923cf43cc0fdf5 (diff)
downloadipxe-4aad46ac70933458f118f59506044de35eb9f7cf.zip
ipxe-4aad46ac70933458f118f59506044de35eb9f7cf.tar.gz
ipxe-4aad46ac70933458f118f59506044de35eb9f7cf.tar.bz2
[crypto] Generalise x509_parse_bit_string() to asn1_bit_string()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe')
-rw-r--r--src/include/ipxe/asn1.h18
-rw-r--r--src/include/ipxe/x509.h14
2 files changed, 11 insertions, 21 deletions
diff --git a/src/include/ipxe/asn1.h b/src/include/ipxe/asn1.h
index cd0d534..222e32e 100644
--- a/src/include/ipxe/asn1.h
+++ b/src/include/ipxe/asn1.h
@@ -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,
diff --git a/src/include/ipxe/x509.h b/src/include/ipxe/x509.h
index a55511b..8b1dda2 100644
--- a/src/include/ipxe/x509.h
+++ b/src/include/ipxe/x509.h
@@ -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 */