diff options
Diffstat (limited to 'src/include/ipxe/asn1.h')
| -rw-r--r-- | src/include/ipxe/asn1.h | 53 |
1 files changed, 33 insertions, 20 deletions
diff --git a/src/include/ipxe/asn1.h b/src/include/ipxe/asn1.h index efc66631d..fdf06f109 100644 --- a/src/include/ipxe/asn1.h +++ b/src/include/ipxe/asn1.h @@ -11,6 +11,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #include <stddef.h> #include <stdint.h> +#include <stdarg.h> #include <assert.h> #include <time.h> #include <ipxe/tables.h> @@ -75,6 +76,9 @@ struct asn1_builder_header { /** ASN.1 enumeration */ #define ASN1_ENUMERATED 0x0a +/** ASN.1 UTF-8 string */ +#define ASN1_UTF8_STRING 0x0c + /** ASN.1 UTC time */ #define ASN1_UTC_TIME 0x17 @@ -96,6 +100,10 @@ struct asn1_builder_header { /** ASN.1 "any tag" magic value */ #define ASN1_ANY -1U +/** Construct a short ASN.1 value */ +#define ASN1_SHORT( tag, ... ) \ + (tag), VA_ARG_COUNT ( __VA_ARGS__ ), __VA_ARGS__ + /** Initial OID byte */ #define ASN1_OID_INITIAL( first, second ) ( ( (first) * 40 ) + (second) ) @@ -288,10 +296,10 @@ struct asn1_builder_header { ASN1_OID_INITIAL ( 2, 5 ), ASN1_OID_SINGLE ( 29 ), \ ASN1_OID_SINGLE ( 17 ) -/** Define an ASN.1 cursor containing an OID */ -#define ASN1_OID_CURSOR( oid_value ) { \ - .data = oid_value, \ - .len = sizeof ( oid_value ), \ +/** Define an ASN.1 cursor for a static value */ +#define ASN1_CURSOR( value ) { \ + .data = value, \ + .len = sizeof ( value ), \ } /** An ASN.1 OID-identified algorithm */ @@ -313,22 +321,27 @@ struct asn1_algorithm { #define __asn1_algorithm __table_entry ( ASN1_ALGORITHMS, 01 ) /* ASN.1 OID-identified algorithms */ -extern struct asn1_algorithm rsa_encryption_algorithm; -extern struct asn1_algorithm md5_with_rsa_encryption_algorithm; -extern struct asn1_algorithm sha1_with_rsa_encryption_algorithm; -extern struct asn1_algorithm sha256_with_rsa_encryption_algorithm; -extern struct asn1_algorithm sha384_with_rsa_encryption_algorithm; -extern struct asn1_algorithm sha512_with_rsa_encryption_algorithm; -extern struct asn1_algorithm sha224_with_rsa_encryption_algorithm; -extern struct asn1_algorithm oid_md4_algorithm; -extern struct asn1_algorithm oid_md5_algorithm; -extern struct asn1_algorithm oid_sha1_algorithm; -extern struct asn1_algorithm oid_sha256_algorithm; -extern struct asn1_algorithm oid_sha384_algorithm; -extern struct asn1_algorithm oid_sha512_algorithm; -extern struct asn1_algorithm oid_sha224_algorithm; -extern struct asn1_algorithm oid_sha512_224_algorithm; -extern struct asn1_algorithm oid_sha512_256_algorithm; +extern struct asn1_algorithm rsa_encryption_algorithm __asn1_algorithm; +extern struct asn1_algorithm md5_with_rsa_encryption_algorithm __asn1_algorithm; +extern struct asn1_algorithm +sha1_with_rsa_encryption_algorithm __asn1_algorithm; +extern struct asn1_algorithm +sha256_with_rsa_encryption_algorithm __asn1_algorithm; +extern struct asn1_algorithm +sha384_with_rsa_encryption_algorithm __asn1_algorithm; +extern struct asn1_algorithm +sha512_with_rsa_encryption_algorithm __asn1_algorithm; +extern struct asn1_algorithm +sha224_with_rsa_encryption_algorithm __asn1_algorithm; +extern struct asn1_algorithm oid_md4_algorithm __asn1_algorithm; +extern struct asn1_algorithm oid_md5_algorithm __asn1_algorithm; +extern struct asn1_algorithm oid_sha1_algorithm __asn1_algorithm; +extern struct asn1_algorithm oid_sha256_algorithm __asn1_algorithm; +extern struct asn1_algorithm oid_sha384_algorithm __asn1_algorithm; +extern struct asn1_algorithm oid_sha512_algorithm __asn1_algorithm; +extern struct asn1_algorithm oid_sha224_algorithm __asn1_algorithm; +extern struct asn1_algorithm oid_sha512_224_algorithm __asn1_algorithm; +extern struct asn1_algorithm oid_sha512_256_algorithm __asn1_algorithm; /** An ASN.1 bit string */ struct asn1_bit_string { |
