|
iPXE
|
ASN.1 encoding. More...
#include <stddef.h>#include <stdint.h>#include <stdarg.h>#include <assert.h>#include <time.h>#include <ipxe/tables.h>Go to the source code of this file.
Data Structures | |
| struct | asn1_cursor |
| An ASN.1 object cursor. More... | |
| struct | asn1_builder |
| An ASN.1 object builder. More... | |
| struct | asn1_builder_header |
| An ASN.1 header. More... | |
| struct | asn1_algorithm |
| An ASN.1 OID-identified algorithm. More... | |
Macros | |
| #define | ASN1_MAX_LEN_LEN ( 1 + sizeof ( size_t ) ) |
| Maximum (viable) length of ASN.1 length. | |
| #define | ASN1_END 0x00 |
| ASN.1 end. | |
| #define | ASN1_BOOLEAN 0x01 |
| ASN.1 boolean. | |
| #define | ASN1_INTEGER 0x02 |
| ASN.1 integer. | |
| #define | ASN1_BIT_STRING 0x03 |
| ASN.1 bit string. | |
| #define | ASN1_OCTET_STRING 0x04 |
| ASN.1 octet string. | |
| #define | ASN1_NULL 0x05 |
| ASN.1 null. | |
| #define | ASN1_OID 0x06 |
| ASN.1 object identifier. | |
| #define | ASN1_ENUMERATED 0x0a |
| ASN.1 enumeration. | |
| #define | ASN1_UTF8_STRING 0x0c |
| ASN.1 UTF-8 string. | |
| #define | ASN1_UTC_TIME 0x17 |
| ASN.1 UTC time. | |
| #define | ASN1_GENERALIZED_TIME 0x18 |
| ASN.1 generalized time. | |
| #define | ASN1_SEQUENCE 0x30 |
| ASN.1 sequence. | |
| #define | ASN1_SET 0x31 |
| ASN.1 set. | |
| #define | ASN1_IMPLICIT_TAG(number) |
| ASN.1 implicit tag. | |
| #define | ASN1_EXPLICIT_TAG(number) |
| ASN.1 explicit tag. | |
| #define | ASN1_ANY -1U |
| ASN.1 "any tag" magic value. | |
| #define | ASN1_SHORT(tag, ...) |
| Construct a short ASN.1 value. | |
| #define | ASN1_OID_INITIAL(first, second) |
| Initial OID byte. | |
| #define | ASN1_OID_SINGLE(value) |
| Single-byte OID value. | |
| #define | ASN1_OID_DOUBLE(value) |
| Double-byte OID value. | |
| #define | ASN1_OID_TRIPLE(value) |
| Double-byte OID value. | |
| #define | ASN1_OID_ECPUBLICKEY |
| ASN.1 OID for ecPublicKey (1.2.840.10045.2.1) | |
| #define | ASN1_OID_PRIME256V1 |
| ASN.1 OID for prime256v1 (1.2.840.10045.3.1.7) | |
| #define | ASN1_OID_ECDSA_WITH_SHA224 |
| ASN.1 OID for ecdsa-with-SHA224 (1.2.840.10045.4.3.1) | |
| #define | ASN1_OID_ECDSA_WITH_SHA256 |
| ASN.1 OID for ecdsa-with-SHA256 (1.2.840.10045.4.3.2) | |
| #define | ASN1_OID_ECDSA_WITH_SHA384 |
| ASN.1 OID for ecdsa-with-SHA384 (1.2.840.10045.4.3.3) | |
| #define | ASN1_OID_ECDSA_WITH_SHA512 |
| ASN.1 OID for ecdsa-with-SHA512 (1.2.840.10045.4.3.4) | |
| #define | ASN1_OID_RSAENCRYPTION |
| ASN.1 OID for rsaEncryption (1.2.840.113549.1.1.1) | |
| #define | ASN1_OID_MD5WITHRSAENCRYPTION |
| ASN.1 OID for md5WithRSAEncryption (1.2.840.113549.1.1.4) | |
| #define | ASN1_OID_SHA1WITHRSAENCRYPTION |
| ASN.1 OID for sha1WithRSAEncryption (1.2.840.113549.1.1.5) | |
| #define | ASN1_OID_SHA256WITHRSAENCRYPTION |
| ASN.1 OID for sha256WithRSAEncryption (1.2.840.113549.1.1.11) | |
| #define | ASN1_OID_SHA384WITHRSAENCRYPTION |
| ASN.1 OID for sha384WithRSAEncryption (1.2.840.113549.1.1.12) | |
| #define | ASN1_OID_SHA512WITHRSAENCRYPTION |
| ASN.1 OID for sha512WithRSAEncryption (1.2.840.113549.1.1.13) | |
| #define | ASN1_OID_SHA224WITHRSAENCRYPTION |
| ASN.1 OID for sha224WithRSAEncryption (1.2.840.113549.1.1.14) | |
| #define | ASN1_OID_MD4 |
| ASN.1 OID for id-md4 (1.2.840.113549.2.4) | |
| #define | ASN1_OID_MD5 |
| ASN.1 OID for id-md5 (1.2.840.113549.2.5) | |
| #define | ASN1_OID_SHA1 |
| ASN.1 OID for id-sha1 (1.3.14.3.2.26) | |
| #define | ASN1_OID_X25519 |
| ASN.1 OID for id-x25519 (1.3.101.110) | |
| #define | ASN1_OID_SECP384R1 |
| ASN.1 OID for secp384r1 (1.3.132.0.34) | |
| #define | ASN1_OID_AES128_CBC |
| ASN.1 OID for id-aes128-cbc (2.16.840.1.101.3.4.1.2) | |
| #define | ASN1_OID_AES128_GCM |
| ASN.1 OID for id-aes128-gcm (2.16.840.1.101.3.4.1.6) | |
| #define | ASN1_OID_AES192_CBC |
| ASN.1 OID for id-aes192-cbc (2.16.840.1.101.3.4.1.22) | |
| #define | ASN1_OID_AES192_GCM |
| ASN.1 OID for id-aes192-gcm (2.16.840.1.101.3.4.1.26) | |
| #define | ASN1_OID_AES256_CBC |
| ASN.1 OID for id-aes256-cbc (2.16.840.1.101.3.4.1.42) | |
| #define | ASN1_OID_AES256_GCM |
| ASN.1 OID for id-aes256-gcm (2.16.840.1.101.3.4.1.46) | |
| #define | ASN1_OID_SHA256 |
| ASN.1 OID for id-sha256 (2.16.840.1.101.3.4.2.1) | |
| #define | ASN1_OID_SHA384 |
| ASN.1 OID for id-sha384 (2.16.840.1.101.3.4.2.2) | |
| #define | ASN1_OID_SHA512 |
| ASN.1 OID for id-sha512 (2.16.840.1.101.3.4.2.3) | |
| #define | ASN1_OID_SHA224 |
| ASN.1 OID for id-sha224 (2.16.840.1.101.3.4.2.4) | |
| #define | ASN1_OID_SHA512_224 |
| ASN.1 OID for id-sha512-224 (2.16.840.1.101.3.4.2.5) | |
| #define | ASN1_OID_SHA512_256 |
| ASN.1 OID for id-sha512-256 (2.16.840.1.101.3.4.2.6) | |
| #define | ASN1_OID_COMMON_NAME |
| ASN.1 OID for commonName (2.5.4.3) | |
| #define | ASN1_OID_KEYUSAGE |
| ASN.1 OID for id-ce-keyUsage (2.5.29.15) | |
| #define | ASN1_OID_BASICCONSTRAINTS |
| ASN.1 OID for id-ce-basicConstraints (2.5.29.19) | |
| #define | ASN1_OID_EXTKEYUSAGE |
| ASN.1 OID for id-ce-extKeyUsage (2.5.29.37) | |
| #define | ASN1_OID_CODESIGNING |
| ASN.1 OID for id-kp-codeSigning (1.3.6.1.5.5.7.3.3) | |
| #define | ASN1_OID_SIGNEDDATA |
| ASN.1 OID for id-signedData (1.2.840.113549.1.7.2) | |
| #define | ASN1_OID_ENVELOPEDDATA |
| ASN.1 OID for id-envelopedData (1.2.840.113549.1.7.3) | |
| #define | ASN1_OID_AUTHENVELOPEDDATA |
| ASN.1 OID for id-authEnvelopedData (1.2.840.113549.1.9.16.1.23) | |
| #define | ASN1_OID_AUTHORITYINFOACCESS |
| ASN.1 OID for id-pe-authorityInfoAccess (1.3.6.1.5.5.7.1.1) | |
| #define | ASN1_OID_OCSP |
| ASN.1 OID for id-ad-ocsp (1.3.6.1.5.5.7.48.1) | |
| #define | ASN1_OID_OCSP_BASIC |
| ASN.1 OID for id-pkix-ocsp-basic ( 1.3.6.1.5.5.7.48.1.1) | |
| #define | ASN1_OID_OCSPSIGNING |
| ASN.1 OID for id-kp-OCSPSigning (1.3.6.1.5.5.7.3.9) | |
| #define | ASN1_OID_SUBJECTALTNAME |
| ASN.1 OID for id-ce-subjectAltName (2.5.29.17) | |
| #define | ASN1_CURSOR(value) |
| Define an ASN.1 cursor for a static value. | |
| #define | ASN1_ALGORITHMS __table ( struct asn1_algorithm, "asn1_algorithms" ) |
| ASN.1 OID-identified algorithms. | |
| #define | __asn1_algorithm __table_entry ( ASN1_ALGORITHMS, 01 ) |
| Declare an ASN.1 OID-identified algorithm. | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| FILE_SECBOOT (PERMITTED) | |
| static void | asn1_invalidate_cursor (struct asn1_cursor *cursor) |
| Invalidate ASN.1 object cursor. | |
| static unsigned int | asn1_type (const struct asn1_cursor *cursor) |
| Extract ASN.1 type. | |
| static struct asn1_cursor * | asn1_built (struct asn1_builder *builder) |
| Get cursor for built object. | |
| int | asn1_enter (struct asn1_cursor *cursor, unsigned int type) |
| Enter ASN.1 object. | |
| int | asn1_skip_if_exists (struct asn1_cursor *cursor, unsigned int type) |
| Skip ASN.1 object if present. | |
| int | asn1_skip (struct asn1_cursor *cursor, unsigned int type) |
| Skip ASN.1 object. | |
| int | asn1_shrink (struct asn1_cursor *cursor, unsigned int type) |
| Shrink ASN.1 cursor to fit object. | |
| int | asn1_enter_any (struct asn1_cursor *cursor) |
| Enter ASN.1 object of any type. | |
| int | asn1_skip_any (struct asn1_cursor *cursor) |
| Skip ASN.1 object of any type. | |
| int | asn1_shrink_any (struct asn1_cursor *cursor) |
| Shrink ASN.1 object of any type. | |
| int | asn1_enter_bits (struct asn1_cursor *cursor, unsigned int *unused) |
| Enter ASN.1 bit string. | |
| int | asn1_enter_unsigned (struct asn1_cursor *cursor) |
| Enter ASN.1 unsigned integer. | |
| int | asn1_boolean (const struct asn1_cursor *cursor) |
| Parse value of ASN.1 boolean. | |
| int | asn1_integer (const struct asn1_cursor *cursor, int *value) |
| Parse value of ASN.1 integer. | |
| int | asn1_compare (const struct asn1_cursor *cursor1, const struct asn1_cursor *cursor2) |
| Compare two ASN.1 objects. | |
| int | asn1_algorithm (const struct asn1_cursor *cursor, struct asn1_algorithm **algorithm, struct asn1_cursor *params) |
| Parse ASN.1 OID-identified algorithm. | |
| int | asn1_pubkey_algorithm (const struct asn1_cursor *cursor, struct asn1_algorithm **algorithm) |
| Parse ASN.1 OID-identified public-key algorithm. | |
| int | asn1_digest_algorithm (const struct asn1_cursor *cursor, struct asn1_algorithm **algorithm) |
| Parse ASN.1 OID-identified digest algorithm. | |
| int | asn1_cipher_algorithm (const struct asn1_cursor *cursor, struct asn1_algorithm **algorithm, struct asn1_cursor *params) |
| Parse ASN.1 OID-identified cipher algorithm. | |
| int | asn1_signature_algorithm (const struct asn1_cursor *cursor, struct asn1_algorithm **algorithm) |
| Parse ASN.1 OID-identified signature algorithm. | |
| int | asn1_curve_algorithm (const struct asn1_cursor *cursor, struct asn1_algorithm *wrapper, struct asn1_algorithm **algorithm) |
| Parse ASN.1 OID-identified elliptic curve algorithm. | |
| int | asn1_check_algorithm (const struct asn1_cursor *cursor, struct asn1_algorithm *expected, struct asn1_cursor *params) |
| Check ASN.1 OID-identified algorithm. | |
| int | asn1_parse_cbc (struct asn1_algorithm *algorithm, struct asn1_cursor *params) |
| Parse ASN.1 CBC cipher parameters. | |
| int | asn1_parse_gcm (struct asn1_algorithm *algorithm, struct asn1_cursor *params) |
| int | asn1_generalized_time (const struct asn1_cursor *cursor, time_t *time) |
| Parse ASN.1 GeneralizedTime. | |
| int | asn1_grow (struct asn1_builder *builder, size_t extra) |
| Grow ASN.1 builder. | |
| int | asn1_prepend_raw (struct asn1_builder *builder, const void *data, size_t len) |
| Prepend raw data to ASN.1 builder. | |
| int | asn1_prepend (struct asn1_builder *builder, unsigned int type, const void *data, size_t len) |
| Prepend data to ASN.1 builder. | |
| int | asn1_wrap (struct asn1_builder *builder, unsigned int type) |
| Wrap ASN.1 builder. | |
Variables | |
| struct asn1_algorithm rsa_encryption_algorithm | __asn1_algorithm |
| Generic elliptic curve container algorithm. | |
ASN.1 encoding.
Definition in file asn1.h.
| #define ASN1_MAX_LEN_LEN ( 1 + sizeof ( size_t ) ) |
| #define ASN1_END 0x00 |
| #define ASN1_BOOLEAN 0x01 |
ASN.1 boolean.
Definition at line 60 of file asn1.h.
Referenced by asn1_boolean(), x509_parse_basic_constraints(), and x509_parse_extension().
| #define ASN1_INTEGER 0x02 |
ASN.1 integer.
Definition at line 63 of file asn1.h.
Referenced by asn1_enter_unsigned(), asn1_integer(), cms_parse_enveloped(), cms_parse_identifier(), cms_parse_participant(), cms_parse_signed(), ecdsa_parse_key(), ecdsa_prepend_signature(), icert_certs(), rsa_parse_mod_exp(), x509_parse_basic_constraints(), and x509_parse_serial().
| #define ASN1_BIT_STRING 0x03 |
ASN.1 bit string.
Definition at line 66 of file asn1.h.
Referenced by asn1_enter_bits(), and icert_cert().
| #define ASN1_OCTET_STRING 0x04 |
ASN.1 octet string.
Definition at line 69 of file asn1.h.
Referenced by asn1_parse_cbc(), asn1_parse_gcm(), cms_parse_mac(), cms_parse_value(), ecdsa_parse_key(), ocsp_compare_responder_key_hash(), ocsp_parse_response_bytes(), ocsp_request(), rsa_parse_mod_exp(), and x509_parse_extension().
| #define ASN1_OID 0x06 |
ASN.1 object identifier.
Definition at line 75 of file asn1.h.
Referenced by asn1_algorithm(), asn1_curve_algorithm(), cms_parse_content_type(), cms_parse_encrypted(), ocsp_parse_cert_id(), ocsp_parse_response_type(), x509_parse_access_description(), x509_parse_common_name(), x509_parse_extension(), and x509_parse_key_purpose().
| #define ASN1_ENUMERATED 0x0a |
ASN.1 enumeration.
Definition at line 78 of file asn1.h.
Referenced by ocsp_parse_response_status().
| #define ASN1_UTC_TIME 0x17 |
| #define ASN1_GENERALIZED_TIME 0x18 |
ASN.1 generalized time.
Definition at line 87 of file asn1.h.
Referenced by asn1_generalized_time().
| #define ASN1_SEQUENCE 0x30 |
ASN.1 sequence.
Definition at line 90 of file asn1.h.
Referenced by asn1_algorithm(), asn1_parse_gcm(), cms_parse(), cms_parse_encrypted(), cms_parse_enveloped(), cms_parse_identifier(), cms_parse_participant(), cms_parse_signed(), der_image_probe(), ecdsa_parse_key(), ecdsa_sign(), ecdsa_verify(), efisig_asn1(), icert_cert(), icert_certs(), ocsp_parse_basic_response(), ocsp_parse_cert_id(), ocsp_parse_certs(), ocsp_parse_response(), ocsp_parse_response_bytes(), ocsp_parse_responses(), ocsp_parse_tbs_response_data(), ocsp_request(), rsa_parse_mod_exp(), x509_parse(), x509_parse_access_description(), x509_parse_authority_info_access(), x509_parse_basic_constraints(), x509_parse_common_name(), x509_parse_extended_key_usage(), x509_parse_extension(), x509_parse_extensions(), x509_parse_issuer(), x509_parse_public_key(), x509_parse_subject_alt_name(), x509_parse_tbscertificate(), and x509_parse_validity().
| #define ASN1_SET 0x31 |
ASN.1 set.
Definition at line 93 of file asn1.h.
Referenced by cms_parse_participants(), cms_parse_signed(), validator_append(), and x509_parse_common_name().
| #define ASN1_IMPLICIT_TAG | ( | number | ) |
ASN.1 implicit tag.
Definition at line 96 of file asn1.h.
Referenced by cms_parse_enveloped(), and ocsp_parse_responses().
| #define ASN1_EXPLICIT_TAG | ( | number | ) |
ASN.1 explicit tag.
Definition at line 99 of file asn1.h.
Referenced by cms_parse(), cms_parse_certificates(), cms_parse_participant(), cms_parse_signed(), ecdsa_parse_key(), ocsp_parse_basic_response(), ocsp_parse_certs(), ocsp_parse_responder_id(), ocsp_parse_response_bytes(), ocsp_parse_responses(), ocsp_parse_tbs_response_data(), x509_parse_extensions(), x509_parse_tbscertificate(), and x509_parse_version().
| #define ASN1_ANY -1U |
ASN.1 "any tag" magic value.
Definition at line 102 of file asn1.h.
Referenced by asn1_enter_any(), asn1_shrink_any(), asn1_skip_any(), and asn1_start().
| #define ASN1_SHORT | ( | tag, | |
| ... ) |
Construct a short ASN.1 value.
Definition at line 105 of file asn1.h.
| #define ASN1_OID_INITIAL | ( | first, | |
| second ) |
| #define ASN1_OID_SINGLE | ( | value | ) |
| #define ASN1_OID_DOUBLE | ( | value | ) |
| #define ASN1_OID_TRIPLE | ( | value | ) |
| #define ASN1_OID_ECPUBLICKEY |
ASN.1 OID for ecPublicKey (1.2.840.10045.2.1)
Definition at line 132 of file asn1.h.
| #define ASN1_OID_PRIME256V1 |
ASN.1 OID for prime256v1 (1.2.840.10045.3.1.7)
Definition at line 138 of file asn1.h.
| #define ASN1_OID_ECDSA_WITH_SHA224 |
ASN.1 OID for ecdsa-with-SHA224 (1.2.840.10045.4.3.1)
Definition at line 144 of file asn1.h.
| #define ASN1_OID_ECDSA_WITH_SHA256 |
ASN.1 OID for ecdsa-with-SHA256 (1.2.840.10045.4.3.2)
Definition at line 150 of file asn1.h.
| #define ASN1_OID_ECDSA_WITH_SHA384 |
ASN.1 OID for ecdsa-with-SHA384 (1.2.840.10045.4.3.3)
Definition at line 156 of file asn1.h.
| #define ASN1_OID_ECDSA_WITH_SHA512 |
ASN.1 OID for ecdsa-with-SHA512 (1.2.840.10045.4.3.4)
Definition at line 162 of file asn1.h.
| #define ASN1_OID_RSAENCRYPTION |
ASN.1 OID for rsaEncryption (1.2.840.113549.1.1.1)
Definition at line 168 of file asn1.h.
| #define ASN1_OID_MD5WITHRSAENCRYPTION |
ASN.1 OID for md5WithRSAEncryption (1.2.840.113549.1.1.4)
Definition at line 174 of file asn1.h.
| #define ASN1_OID_SHA1WITHRSAENCRYPTION |
ASN.1 OID for sha1WithRSAEncryption (1.2.840.113549.1.1.5)
Definition at line 180 of file asn1.h.
| #define ASN1_OID_SHA256WITHRSAENCRYPTION |
ASN.1 OID for sha256WithRSAEncryption (1.2.840.113549.1.1.11)
Definition at line 186 of file asn1.h.
| #define ASN1_OID_SHA384WITHRSAENCRYPTION |
ASN.1 OID for sha384WithRSAEncryption (1.2.840.113549.1.1.12)
Definition at line 192 of file asn1.h.
| #define ASN1_OID_SHA512WITHRSAENCRYPTION |
ASN.1 OID for sha512WithRSAEncryption (1.2.840.113549.1.1.13)
Definition at line 198 of file asn1.h.
| #define ASN1_OID_SHA224WITHRSAENCRYPTION |
ASN.1 OID for sha224WithRSAEncryption (1.2.840.113549.1.1.14)
Definition at line 204 of file asn1.h.
| #define ASN1_OID_MD4 |
ASN.1 OID for id-md4 (1.2.840.113549.2.4)
Definition at line 210 of file asn1.h.
| #define ASN1_OID_MD5 |
ASN.1 OID for id-md5 (1.2.840.113549.2.5)
Definition at line 216 of file asn1.h.
| #define ASN1_OID_SHA1 |
ASN.1 OID for id-sha1 (1.3.14.3.2.26)
Definition at line 222 of file asn1.h.
| #define ASN1_OID_X25519 |
ASN.1 OID for id-x25519 (1.3.101.110)
Definition at line 228 of file asn1.h.
| #define ASN1_OID_SECP384R1 |
ASN.1 OID for secp384r1 (1.3.132.0.34)
Definition at line 233 of file asn1.h.
| #define ASN1_OID_AES128_CBC |
ASN.1 OID for id-aes128-cbc (2.16.840.1.101.3.4.1.2)
Definition at line 238 of file asn1.h.
| #define ASN1_OID_AES128_GCM |
ASN.1 OID for id-aes128-gcm (2.16.840.1.101.3.4.1.6)
Definition at line 245 of file asn1.h.
| #define ASN1_OID_AES192_CBC |
ASN.1 OID for id-aes192-cbc (2.16.840.1.101.3.4.1.22)
Definition at line 252 of file asn1.h.
| #define ASN1_OID_AES192_GCM |
ASN.1 OID for id-aes192-gcm (2.16.840.1.101.3.4.1.26)
Definition at line 259 of file asn1.h.
| #define ASN1_OID_AES256_CBC |
ASN.1 OID for id-aes256-cbc (2.16.840.1.101.3.4.1.42)
Definition at line 266 of file asn1.h.
| #define ASN1_OID_AES256_GCM |
ASN.1 OID for id-aes256-gcm (2.16.840.1.101.3.4.1.46)
Definition at line 273 of file asn1.h.
| #define ASN1_OID_SHA256 |
ASN.1 OID for id-sha256 (2.16.840.1.101.3.4.2.1)
Definition at line 280 of file asn1.h.
| #define ASN1_OID_SHA384 |
ASN.1 OID for id-sha384 (2.16.840.1.101.3.4.2.2)
Definition at line 287 of file asn1.h.
| #define ASN1_OID_SHA512 |
ASN.1 OID for id-sha512 (2.16.840.1.101.3.4.2.3)
Definition at line 294 of file asn1.h.
| #define ASN1_OID_SHA224 |
ASN.1 OID for id-sha224 (2.16.840.1.101.3.4.2.4)
Definition at line 301 of file asn1.h.
| #define ASN1_OID_SHA512_224 |
ASN.1 OID for id-sha512-224 (2.16.840.1.101.3.4.2.5)
Definition at line 308 of file asn1.h.
| #define ASN1_OID_SHA512_256 |
ASN.1 OID for id-sha512-256 (2.16.840.1.101.3.4.2.6)
Definition at line 315 of file asn1.h.
| #define ASN1_OID_COMMON_NAME |
ASN.1 OID for commonName (2.5.4.3)
Definition at line 322 of file asn1.h.
| #define ASN1_OID_KEYUSAGE |
ASN.1 OID for id-ce-keyUsage (2.5.29.15)
Definition at line 327 of file asn1.h.
| #define ASN1_OID_BASICCONSTRAINTS |
ASN.1 OID for id-ce-basicConstraints (2.5.29.19)
Definition at line 332 of file asn1.h.
| #define ASN1_OID_EXTKEYUSAGE |
ASN.1 OID for id-ce-extKeyUsage (2.5.29.37)
Definition at line 337 of file asn1.h.
| #define ASN1_OID_CODESIGNING |
ASN.1 OID for id-kp-codeSigning (1.3.6.1.5.5.7.3.3)
Definition at line 342 of file asn1.h.
| #define ASN1_OID_SIGNEDDATA |
ASN.1 OID for id-signedData (1.2.840.113549.1.7.2)
Definition at line 349 of file asn1.h.
| #define ASN1_OID_ENVELOPEDDATA |
ASN.1 OID for id-envelopedData (1.2.840.113549.1.7.3)
Definition at line 355 of file asn1.h.
| #define ASN1_OID_AUTHENVELOPEDDATA |
ASN.1 OID for id-authEnvelopedData (1.2.840.113549.1.9.16.1.23)
Definition at line 361 of file asn1.h.
| #define ASN1_OID_AUTHORITYINFOACCESS |
ASN.1 OID for id-pe-authorityInfoAccess (1.3.6.1.5.5.7.1.1)
Definition at line 368 of file asn1.h.
| #define ASN1_OID_OCSP |
ASN.1 OID for id-ad-ocsp (1.3.6.1.5.5.7.48.1)
Definition at line 375 of file asn1.h.
| #define ASN1_OID_OCSP_BASIC |
ASN.1 OID for id-pkix-ocsp-basic ( 1.3.6.1.5.5.7.48.1.1)
Definition at line 382 of file asn1.h.
| #define ASN1_OID_OCSPSIGNING |
ASN.1 OID for id-kp-OCSPSigning (1.3.6.1.5.5.7.3.9)
Definition at line 390 of file asn1.h.
| #define ASN1_OID_SUBJECTALTNAME |
ASN.1 OID for id-ce-subjectAltName (2.5.29.17)
Definition at line 397 of file asn1.h.
| #define ASN1_CURSOR | ( | value | ) |
| #define ASN1_ALGORITHMS __table ( struct asn1_algorithm, "asn1_algorithms" ) |
ASN.1 OID-identified algorithms.
Definition at line 433 of file asn1.h.
Referenced by asn1_find_algorithm().
| struct asn1_algorithm ecpubkey_algorithm __asn1_algorithm __table_entry ( ASN1_ALGORITHMS, 01 ) |
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| FILE_SECBOOT | ( | PERMITTED | ) |
|
inlinestatic |
Invalidate ASN.1 object cursor.
| cursor | ASN.1 object cursor |
Definition at line 468 of file asn1.h.
References asn1_cursor::len.
Referenced by asn1_enter(), asn1_enter_bits(), asn1_shrink(), asn1_skip(), asn1_start(), and ecdsa_parse_key().
|
inlinestatic |
Extract ASN.1 type.
| cursor | ASN.1 object cursor |
| type | Type, or ASN1_END if cursor is invalid |
Definition at line 479 of file asn1.h.
References ASN1_END, asn1_cursor::data, asn1_cursor::len, and type.
Referenced by asn1_generalized_time(), asn1_start(), ecdsa_parse_key(), ocsp_parse_basic_response(), ocsp_parse_responder_id(), ocsp_parse_responses(), rsa_parse_mod_exp(), x509_check_alt_name(), x509_parse_basic_constraints(), x509_parse_extension(), and x509_parse_tbscertificate().
|
inlinestatic |
Get cursor for built object.
| builder | ASN.1 object builder |
| cursor | ASN.1 object cursor |
Definition at line 492 of file asn1.h.
References build_assert, container_of, typeof(), and u.
Referenced by icert_certs(), privkey_cursor(), pubkey_okx(), and pubkey_sign_okx().
|
extern |
Enter ASN.1 object.
| cursor | ASN.1 object cursor |
| type | Expected type, or ASN1_ANY |
| rc | Return status code |
The object cursor will be updated to point to the body of the current ASN.1 object.
If any error occurs, the object cursor will be invalidated.
Definition at line 169 of file asn1.c.
References asn1_invalidate_cursor(), asn1_start(), DBGC, asn1_cursor::len, len, and type.
Referenced by asn1_algorithm(), asn1_boolean(), asn1_curve_algorithm(), asn1_enter_any(), asn1_enter_bits(), asn1_enter_unsigned(), asn1_generalized_time(), asn1_integer(), asn1_parse_cbc(), asn1_parse_gcm(), cms_parse(), cms_parse_certificates(), cms_parse_content_type(), cms_parse_encrypted(), cms_parse_enveloped(), cms_parse_identifier(), cms_parse_mac(), cms_parse_participant(), cms_parse_participants(), cms_parse_signed(), cms_parse_value(), ecdsa_parse_key(), ecdsa_verify(), ocsp_compare_responder_key_hash(), ocsp_parse_basic_response(), ocsp_parse_cert_id(), ocsp_parse_certs(), ocsp_parse_response(), ocsp_parse_response_bytes(), ocsp_parse_response_status(), ocsp_parse_response_type(), ocsp_parse_responses(), ocsp_parse_tbs_response_data(), ocsp_request(), rsa_parse_mod_exp(), validator_append(), x509_parse(), x509_parse_access_description(), x509_parse_authority_info_access(), x509_parse_basic_constraints(), x509_parse_common_name(), x509_parse_extended_key_usage(), x509_parse_extension(), x509_parse_extensions(), x509_parse_key_purpose(), x509_parse_ocsp(), x509_parse_public_key(), x509_parse_subject_alt_name(), x509_parse_tbscertificate(), x509_parse_validity(), and x509_parse_version().
|
extern |
Skip ASN.1 object if present.
| cursor | ASN.1 object cursor |
| type | Expected type, or ASN1_ANY |
| rc | Return status code |
The object cursor will be updated to point to the next ASN.1 object.
If the expected type is not found, the object cursor will not be modified. If any other error occurs, the object cursor will be invalidated.
Definition at line 202 of file asn1.c.
References asn1_start(), asn1_cursor::data, DBGC, asn1_cursor::len, len, and type.
Referenced by asn1_skip(), cms_parse_enveloped(), cms_parse_participant(), cms_parse_signed(), and ocsp_parse_tbs_response_data().
|
extern |
Skip ASN.1 object.
| cursor | ASN.1 object cursor |
| type | Expected type, or ASN1_ANY |
| rc | Return status code |
The object cursor will be updated to point to the next ASN.1 object.
If any error occurs, the object cursor will be invalidated.
Definition at line 231 of file asn1.c.
References asn1_invalidate_cursor(), asn1_skip_if_exists(), rc, and type.
Referenced by asn1_skip_any(), cms_parse_encrypted(), cms_parse_enveloped(), cms_parse_participant(), cms_parse_signed(), der_image_probe(), ecdsa_parse_key(), ocsp_parse_cert_id(), ocsp_request(), and rsa_parse_mod_exp().
|
extern |
Shrink ASN.1 cursor to fit object.
| cursor | ASN.1 object cursor |
| type | Expected type, or ASN1_ANY |
| rc | Return status code |
The object cursor will be shrunk to contain only the current ASN.1 object.
If any error occurs, the object cursor will be invalidated.
Definition at line 254 of file asn1.c.
References asn1_invalidate_cursor(), asn1_start(), asn1_cursor::data, end, asn1_cursor::len, len, memcpy(), and type.
Referenced by asn1_shrink_any(), cms_parse_identifier(), ocsp_parse_cert_id(), x509_parse_issuer(), and x509_parse_serial().
|
extern |
Enter ASN.1 object of any type.
| cursor | ASN.1 object cursor |
| rc | Return status code |
Definition at line 280 of file asn1.c.
References ASN1_ANY, and asn1_enter().
Referenced by ecdsa_parse_key(), ocsp_parse_responder_id(), x509_check_alt_name(), and x509_parse_common_name().
|
extern |
Skip ASN.1 object of any type.
| cursor | ASN.1 object cursor |
| rc | Return status code |
Definition at line 290 of file asn1.c.
References ASN1_ANY, and asn1_skip().
Referenced by asn1_algorithm(), cms_parse(), cms_parse_certificates(), cms_parse_enveloped(), cms_parse_identifier(), cms_parse_participant(), cms_parse_participants(), cms_parse_signed(), ecdsa_parse_key(), ecdsa_verify(), ocsp_parse_basic_response(), ocsp_parse_certs(), ocsp_parse_response(), ocsp_parse_response_bytes(), ocsp_parse_responses(), ocsp_parse_tbs_response_data(), rsa_parse_mod_exp(), validator_append(), x509_check_name(), x509_parse(), x509_parse_access_description(), x509_parse_authority_info_access(), x509_parse_basic_constraints(), x509_parse_common_name(), x509_parse_extended_key_usage(), x509_parse_extension(), x509_parse_extensions(), x509_parse_public_key(), x509_parse_tbscertificate(), and x509_parse_validity().
|
extern |
Shrink ASN.1 object of any type.
| cursor | ASN.1 object cursor |
| rc | Return status code |
Definition at line 300 of file asn1.c.
References ASN1_ANY, and asn1_shrink().
Referenced by cms_message(), der_asn1(), ocsp_parse_tbs_response_data(), x509_certificate(), x509_parse_public_key(), x509_parse_subject(), and x509_parse_tbscertificate().
|
extern |
Enter ASN.1 bit string.
| cursor | ASN.1 cursor |
| unused | Unused bits to fill in (or NULL to require all used) |
| rc | Return status code |
Definition at line 311 of file asn1.c.
References __attribute__, ASN1_BIT_STRING, asn1_enter(), asn1_invalidate_cursor(), asn1_cursor::data, data, DBGC, DBGC_HDA, EINVAL_BIT_STRING, asn1_cursor::len, offsetof, rc, typeof(), and unused.
Referenced by ecdsa_parse_key(), ocsp_parse_basic_response(), rsa_parse_mod_exp(), x509_parse(), x509_parse_key_usage(), and x509_parse_public_key().
|
extern |
Enter ASN.1 unsigned integer.
| cursor | ASN.1 object cursor |
| rc | Return status code |
Definition at line 369 of file asn1.c.
References asn1_enter(), ASN1_INTEGER, asn1_cursor::data, asn1_cursor::len, and rc.
Referenced by ecdsa_parse_signature(), and rsa_parse_mod_exp().
|
extern |
Parse value of ASN.1 boolean.
| cursor | ASN.1 object cursor |
| value | Value, or negative error |
Definition at line 392 of file asn1.c.
References __attribute__, ASN1_BOOLEAN, asn1_enter(), asn1_cursor::data, EINVAL_ASN1_BOOLEAN, asn1_cursor::len, memcpy(), and value.
Referenced by x509_parse_basic_constraints(), and x509_parse_extension().
|
extern |
Parse value of ASN.1 integer.
| cursor | ASN.1 object cursor |
| value | Value to fill in |
| rc | Return status code |
Definition at line 416 of file asn1.c.
References asn1_enter(), ASN1_INTEGER, asn1_cursor::data, DBGC, EINVAL_ASN1_INTEGER, asn1_cursor::len, memcpy(), rc, and value.
Referenced by x509_parse_basic_constraints(), and x509_parse_version().
|
extern |
Compare two ASN.1 objects.
| cursor1 | ASN.1 object cursor |
| cursor2 | ASN.1 object cursor |
| difference | Difference as returned by memcmp() |
Note that invalid and empty cursors will compare as equal with each other.
Definition at line 458 of file asn1.c.
References asn1_cursor::data, asn1_cursor::len, and memcmp().
Referenced by asn1_find_algorithm(), cms_parse_content_type(), ocsp_compare_responder_name(), ocsp_parse_cert_id(), ocsp_parse_response_type(), pubkey_okx(), pubkey_sign_okx(), rsa_match(), x509_check_issuer(), x509_find(), x509_find_access_method(), x509_find_extension(), x509_find_issuer_serial(), x509_find_subject(), x509_is_self_signed(), x509_parse_common_name(), and x509_parse_key_purpose().
|
extern |
Parse ASN.1 OID-identified algorithm.
| cursor | ASN.1 object cursor |
| algorithm | Algorithm |
| params | Algorithm parameters, or NULL |
| rc | Return status code |
Definition at line 494 of file asn1.c.
References algorithm, asn1_enter(), asn1_find_algorithm(), ASN1_OID, ASN1_SEQUENCE, asn1_skip_any(), asn1_cursor::data, DBGC, DBGC_HDA, EINVAL_ASN1_ALGORITHM, ENOTSUP_ALGORITHM, asn1_cursor::len, memcpy(), rc, and strerror().
|
extern |
Parse ASN.1 OID-identified public-key algorithm.
| cursor | ASN.1 object cursor |
| algorithm | Algorithm |
| rc | Return status code |
Definition at line 544 of file asn1.c.
References algorithm, asn1_cursor::data, DBGC, DBGC_HDA, ENOTTY_ALGORITHM, asn1_cursor::len, NULL, and rc.
Referenced by cms_parse_pubkey_algorithm(), and x509_parse_public_key().
|
extern |
Parse ASN.1 OID-identified digest algorithm.
| cursor | ASN.1 object cursor |
| algorithm | Algorithm |
| rc | Return status code |
Definition at line 570 of file asn1.c.
References algorithm, asn1_cursor::data, DBGC, DBGC_HDA, ENOTTY_ALGORITHM, asn1_cursor::len, NULL, and rc.
Referenced by cms_parse_digest_algorithm().
|
extern |
Parse ASN.1 OID-identified cipher algorithm.
| cursor | ASN.1 object cursor |
| algorithm | Algorithm |
| params | Algorithm parameters, or NULL |
| rc | Return status code |
Definition at line 597 of file asn1.c.
References algorithm, asn1_cursor::data, DBGC, DBGC_HDA, ENOTTY_ALGORITHM, asn1_cursor::len, and rc.
Referenced by cms_parse_cipher_algorithm().
|
extern |
Parse ASN.1 OID-identified signature algorithm.
| cursor | ASN.1 object cursor |
| algorithm | Algorithm |
| rc | Return status code |
Definition at line 624 of file asn1.c.
References algorithm, asn1_cursor::data, DBGC, DBGC_HDA, ENOTTY_ALGORITHM, asn1_cursor::len, NULL, and rc.
Referenced by ocsp_parse_basic_response(), x509_parse(), and x509_parse_tbscertificate().
|
extern |
Parse ASN.1 OID-identified elliptic curve algorithm.
| cursor | ASN.1 object cursor |
| wrapper | Optional wrapper algorithm, or NULL |
| algorithm | Algorithm |
| rc | Return status code |
Definition at line 659 of file asn1.c.
References algorithm, asn1_check_algorithm(), asn1_enter(), asn1_find_algorithm(), ASN1_OID, asn1_cursor::data, DBGC, DBGC_HDA, ENOTSUP_ALGORITHM, ENOTTY_ALGORITHM, asn1_cursor::len, memcpy(), and NULL.
Referenced by ecdsa_parse_key().
|
extern |
Check ASN.1 OID-identified algorithm.
| cursor | ASN.1 object cursor |
| expected | Expected algorithm |
| params | Algorithm parameters, or NULL |
| rc | Return status code |
Definition at line 705 of file asn1.c.
References DBGC, ENOTTY_ALGORITHM, asn1_algorithm::name, and rc.
Referenced by asn1_curve_algorithm(), and rsa_parse_mod_exp().
|
extern |
Parse ASN.1 CBC cipher parameters.
| algorithm | Algorithm |
| param | Parameters to parse |
| rc | Return status code |
Definition at line 732 of file asn1.c.
References algorithm, asn1_enter(), ASN1_OCTET_STRING, assert, cipher_algorithm::blocksize, EINVAL, asn1_cursor::len, and NULL.
|
extern |
|
extern |
Parse ASN.1 GeneralizedTime.
| cursor | ASN.1 cursor |
| time | Time to fill in |
| rc | Return status code |
RFC 5280 section 4.1.2.5 places several restrictions on the allowed formats for UTCTime and GeneralizedTime, and mandates the interpretation of centuryless year values.
Definition at line 777 of file asn1.c.
References __attribute__, asn1_enter(), ASN1_GENERALIZED_TIME, asn1_type(), ASN1_UTC_TIME, century, asn1_cursor::data, data, day, DBGC, DBGC_HDA, EINVAL_ASN1_TIME, isdigit(), asn1_cursor::len, memcpy(), memset(), mktime(), month, raw, rc, tm::tm_hour, tm::tm_mday, tm::tm_min, tm::tm_mon, tm::tm_sec, tm::tm_year, type, and year.
Referenced by ocsp_parse_responses(), and x509_parse_validity().
|
extern |
Grow ASN.1 builder.
| builder | ASN.1 builder |
| extra | Extra space to prepend |
| rc | Return status code |
Definition at line 916 of file asn1.c.
References asn1_builder::data, ENOMEM, extra, free, asn1_builder::len, memmove(), NULL, and realloc().
Referenced by asn1_prepend(), asn1_prepend_raw(), asn1_wrap(), rsa_decrypt(), rsa_encrypt(), and rsa_sign().
|
extern |
Prepend raw data to ASN.1 builder.
| builder | ASN.1 builder |
| data | Data to prepend |
| len | Length of data to prepend |
| rc | Return status code |
Definition at line 949 of file asn1.c.
References asn1_grow(), asn1_builder::data, data, len, memcpy(), and rc.
Referenced by icert_cert(), icert_certs(), ocsp_request(), tls_send_certificate_verify(), and tls_send_client_key_exchange_pubkey().
|
extern |
Prepend data to ASN.1 builder.
| builder | ASN.1 builder |
| type | Type |
| data | Data to prepend |
| len | Length of data to prepend |
| rc | Return status code |
Definition at line 972 of file asn1.c.
References asn1_grow(), asn1_header(), asn1_builder::data, data, header, len, memcpy(), rc, and type.
Referenced by ecdsa_prepend_signature(), icert_certs(), and ocsp_request().
|
extern |
Wrap ASN.1 builder.
| builder | ASN.1 builder |
| type | Type |
| rc | Return status code |
Definition at line 999 of file asn1.c.
References asn1_grow(), asn1_header(), asn1_builder::data, header, asn1_builder::len, memcpy(), rc, and type.
Referenced by ecdsa_sign(), icert_cert(), icert_certs(), and ocsp_request().
|
extern |
Generic elliptic curve container algorithm.
The actual curve to be used is identified via the algorithm parameters, rather than the top-level OID.
Generic elliptic curve container algorithm.
Generic elliptic curve container algorithm.
"aes256-cbc" OID-identified algorithm
"aes192-cbc" OID-identified algorithm
Generic elliptic curve container algorithm.
"aes256-gcm" OID-identified algorithm
"aes192-gcm" OID-identified algorithm