|
iPXE
|
ASN.1 encoding. More...
#include <stdint.h>#include <stddef.h>#include <stdlib.h>#include <string.h>#include <ctype.h>#include <errno.h>#include <time.h>#include <ipxe/tables.h>#include <ipxe/image.h>#include <ipxe/crypto.h>#include <ipxe/asn1.h>Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| static int | asn1_start (struct asn1_cursor *cursor, unsigned int type) |
| Start parsing ASN.1 object. More... | |
| int | asn1_enter (struct asn1_cursor *cursor, unsigned int type) |
| Enter ASN.1 object. More... | |
| int | asn1_skip_if_exists (struct asn1_cursor *cursor, unsigned int type) |
| Skip ASN.1 object if present. More... | |
| int | asn1_skip (struct asn1_cursor *cursor, unsigned int type) |
| Skip ASN.1 object. More... | |
| int | asn1_shrink (struct asn1_cursor *cursor, unsigned int type) |
| Shrink ASN.1 cursor to fit object. More... | |
| int | asn1_enter_any (struct asn1_cursor *cursor) |
| Enter ASN.1 object of any type. More... | |
| int | asn1_skip_any (struct asn1_cursor *cursor) |
| Skip ASN.1 object of any type. More... | |
| int | asn1_shrink_any (struct asn1_cursor *cursor) |
| Shrink ASN.1 object of any type. More... | |
| int | asn1_enter_bits (struct asn1_cursor *cursor, unsigned int *unused) |
| Enter ASN.1 bit string. More... | |
| int | asn1_boolean (const struct asn1_cursor *cursor) |
| Parse value of ASN.1 boolean. More... | |
| int | asn1_integer (const struct asn1_cursor *cursor, int *value) |
| Parse value of ASN.1 integer. More... | |
| int | asn1_compare (const struct asn1_cursor *cursor1, const struct asn1_cursor *cursor2) |
| Compare two ASN.1 objects. More... | |
| static struct asn1_algorithm * | asn1_find_algorithm (const struct asn1_cursor *cursor) |
| Identify ASN.1 algorithm by OID. More... | |
| int | asn1_algorithm (const struct asn1_cursor *cursor, struct asn1_algorithm **algorithm, struct asn1_cursor *params) |
| Parse ASN.1 OID-identified algorithm. More... | |
| int | asn1_pubkey_algorithm (const struct asn1_cursor *cursor, struct asn1_algorithm **algorithm) |
| Parse ASN.1 OID-identified public-key algorithm. More... | |
| int | asn1_digest_algorithm (const struct asn1_cursor *cursor, struct asn1_algorithm **algorithm) |
| Parse ASN.1 OID-identified digest algorithm. More... | |
| int | asn1_cipher_algorithm (const struct asn1_cursor *cursor, struct asn1_algorithm **algorithm, struct asn1_cursor *params) |
| Parse ASN.1 OID-identified cipher algorithm. More... | |
| int | asn1_signature_algorithm (const struct asn1_cursor *cursor, struct asn1_algorithm **algorithm) |
| Parse ASN.1 OID-identified signature algorithm. More... | |
| int | asn1_curve_algorithm (const struct asn1_cursor *cursor, struct asn1_algorithm **algorithm) |
| Parse ASN.1 OID-identified elliptic curve algorithm. More... | |
| int | asn1_check_algorithm (const struct asn1_cursor *cursor, struct asn1_algorithm *expected, struct asn1_cursor *params) |
| Check ASN.1 OID-identified algorithm. More... | |
| int | asn1_parse_cbc (struct asn1_algorithm *algorithm, struct asn1_cursor *params) |
| Parse ASN.1 CBC cipher parameters. More... | |
| int | asn1_parse_gcm (struct asn1_algorithm *algorithm __unused, struct asn1_cursor *params) |
| Parse ASN.1 GCM cipher parameters. More... | |
| int | asn1_generalized_time (const struct asn1_cursor *cursor, time_t *time) |
| Parse ASN.1 GeneralizedTime. More... | |
| static size_t | asn1_header (struct asn1_builder_header *header, unsigned int type, size_t len) |
| Construct ASN.1 header. More... | |
| int | asn1_grow (struct asn1_builder *builder, size_t extra) |
| Grow ASN.1 builder. More... | |
| int | asn1_prepend_raw (struct asn1_builder *builder, const void *data, size_t len) |
| Prepend raw data to ASN.1 builder. More... | |
| int | asn1_prepend (struct asn1_builder *builder, unsigned int type, const void *data, size_t len) |
| Prepend data to ASN.1 builder. More... | |
| int | asn1_wrap (struct asn1_builder *builder, unsigned int type) |
| Wrap ASN.1 builder. More... | |
| int | image_asn1 (struct image *image, size_t offset, struct asn1_cursor **cursor) |
| Extract ASN.1 object from image. More... | |
| REQUIRING_SYMBOL (image_asn1) | |
| REQUIRE_OBJECT (config_asn1) | |
Variables | |
| static uint8_t | oid_ecpublickey [] = { ASN1_OID_ECPUBLICKEY } |
| "ecPublicKey" object identifier More... | |
| struct asn1_algorithm ecpubkey_algorithm | __asn1_algorithm |
| Generic elliptic curve container algorithm. More... | |
ASN.1 encoding.
Definition in file asn1.c.
| #define EINVAL_ASN1_EMPTY __einfo_error ( EINFO_EINVAL_ASN1_EMPTY ) |
| #define EINFO_EINVAL_ASN1_EMPTY __einfo_uniqify ( EINFO_EINVAL, 0x01, "Empty or underlength cursor" ) |
| #define EINVAL_ASN1_LEN_LEN __einfo_error ( EINFO_EINVAL_ASN1_LEN_LEN ) |
| #define EINFO_EINVAL_ASN1_LEN_LEN __einfo_uniqify ( EINFO_EINVAL, 0x02, "Length field overruns cursor" ) |
| #define EINVAL_ASN1_LEN __einfo_error ( EINFO_EINVAL_ASN1_LEN ) |
| #define EINFO_EINVAL_ASN1_LEN __einfo_uniqify ( EINFO_EINVAL, 0x03, "Field overruns cursor" ) |
| #define EINVAL_ASN1_BOOLEAN __einfo_error ( EINFO_EINVAL_ASN1_BOOLEAN ) |
| #define EINFO_EINVAL_ASN1_BOOLEAN __einfo_uniqify ( EINFO_EINVAL, 0x04, "Invalid boolean" ) |
| #define EINVAL_ASN1_INTEGER __einfo_error ( EINFO_EINVAL_ASN1_INTEGER ) |
| #define EINFO_EINVAL_ASN1_INTEGER __einfo_uniqify ( EINFO_EINVAL, 0x04, "Invalid integer" ) |
| #define EINVAL_ASN1_TIME __einfo_error ( EINFO_EINVAL_ASN1_TIME ) |
| #define EINFO_EINVAL_ASN1_TIME __einfo_uniqify ( EINFO_EINVAL, 0x05, "Invalid time" ) |
| #define EINVAL_ASN1_ALGORITHM __einfo_error ( EINFO_EINVAL_ASN1_ALGORITHM ) |
| #define EINFO_EINVAL_ASN1_ALGORITHM __einfo_uniqify ( EINFO_EINVAL, 0x06, "Invalid algorithm" ) |
| #define EINVAL_BIT_STRING __einfo_error ( EINFO_EINVAL_BIT_STRING ) |
| #define EINFO_EINVAL_BIT_STRING __einfo_uniqify ( EINFO_EINVAL, 0x07, "Invalid bit string" ) |
| #define ENOTSUP_ALGORITHM __einfo_error ( EINFO_ENOTSUP_ALGORITHM ) |
| #define EINFO_ENOTSUP_ALGORITHM __einfo_uniqify ( EINFO_ENOTSUP, 0x01, "Unsupported algorithm" ) |
| #define ENOTTY_ALGORITHM __einfo_error ( EINFO_ENOTTY_ALGORITHM ) |
| #define EINFO_ENOTTY_ALGORITHM __einfo_uniqify ( EINFO_ENOTTY, 0x01, "Inappropriate algorithm" ) |
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Start parsing ASN.1 object.
| cursor | ASN.1 object cursor |
| type | Expected type, or ASN1_ANY |
| len | Length of object body, or negative error |
The object cursor will be updated to point to the start of the object body (i.e. the first byte following the length byte(s)), and the length of the object body (i.e. the number of bytes until the following object tag, if any) is returned.
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 115 of file asn1.c.
References ASN1_ANY, asn1_invalidate_cursor(), asn1_type(), asn1_cursor::data, DBGC, EINVAL_ASN1_EMPTY, EINVAL_ASN1_LEN, EINVAL_ASN1_LEN_LEN, ENXIO, asn1_cursor::len, len, and type.
Referenced by asn1_enter(), asn1_shrink(), and asn1_skip_if_exists().
| int asn1_enter | ( | struct asn1_cursor * | cursor, |
| unsigned int | type | ||
| ) |
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 181 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_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(), 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_integer(), 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().
| int asn1_skip_if_exists | ( | struct asn1_cursor * | cursor, |
| unsigned int | type | ||
| ) |
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 214 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().
| int asn1_skip | ( | struct asn1_cursor * | cursor, |
| unsigned int | type | ||
| ) |
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 243 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(), ocsp_parse_cert_id(), ocsp_request(), and rsa_parse_mod_exp().
| int asn1_shrink | ( | struct asn1_cursor * | cursor, |
| unsigned int | type | ||
| ) |
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 266 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().
| int asn1_enter_any | ( | struct asn1_cursor * | cursor | ) |
Enter ASN.1 object of any type.
| cursor | ASN.1 object cursor |
| rc | Return status code |
Definition at line 292 of file asn1.c.
References ASN1_ANY, and asn1_enter().
Referenced by ocsp_parse_responder_id(), x509_check_alt_name(), and x509_parse_common_name().
| int asn1_skip_any | ( | struct asn1_cursor * | cursor | ) |
Skip ASN.1 object of any type.
| cursor | ASN.1 object cursor |
| rc | Return status code |
Definition at line 302 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(), 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().
| int asn1_shrink_any | ( | struct asn1_cursor * | cursor | ) |
Shrink ASN.1 object of any type.
| cursor | ASN.1 object cursor |
| rc | Return status code |
Definition at line 312 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().
| int asn1_enter_bits | ( | struct asn1_cursor * | cursor, |
| unsigned int * | unused | ||
| ) |
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 323 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 ocsp_parse_basic_response(), rsa_parse_mod_exp(), x509_parse(), x509_parse_key_usage(), and x509_parse_public_key().
| int asn1_boolean | ( | const struct asn1_cursor * | cursor | ) |
Parse value of ASN.1 boolean.
| cursor | ASN.1 object cursor |
| value | Value, or negative error |
Definition at line 381 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().
| int asn1_integer | ( | const struct asn1_cursor * | cursor, |
| int * | value | ||
| ) |
Parse value of ASN.1 integer.
| cursor | ASN.1 object cursor |
| value | Value to fill in |
| rc | Return status code |
Definition at line 405 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().
| int asn1_compare | ( | const struct asn1_cursor * | cursor1, |
| const struct asn1_cursor * | cursor2 | ||
| ) |
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 447 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().
|
static |
Identify ASN.1 algorithm by OID.
| cursor | ASN.1 object cursor |
| algorithm | Algorithm, or NULL |
Definition at line 464 of file asn1.c.
References algorithm, ASN1_ALGORITHMS, asn1_compare(), for_each_table_entry, and NULL.
Referenced by asn1_algorithm(), and asn1_curve_algorithm().
| int asn1_algorithm | ( | const struct asn1_cursor * | cursor, |
| struct asn1_algorithm ** | algorithm, | ||
| struct asn1_cursor * | params | ||
| ) |
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 483 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().
| int asn1_pubkey_algorithm | ( | const struct asn1_cursor * | cursor, |
| struct asn1_algorithm ** | algorithm | ||
| ) |
Parse ASN.1 OID-identified public-key algorithm.
| cursor | ASN.1 object cursor |
| algorithm | Algorithm |
| rc | Return status code |
Definition at line 533 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().
| int asn1_digest_algorithm | ( | const struct asn1_cursor * | cursor, |
| struct asn1_algorithm ** | algorithm | ||
| ) |
Parse ASN.1 OID-identified digest algorithm.
| cursor | ASN.1 object cursor |
| algorithm | Algorithm |
| rc | Return status code |
Definition at line 559 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().
| int asn1_cipher_algorithm | ( | const struct asn1_cursor * | cursor, |
| struct asn1_algorithm ** | algorithm, | ||
| struct asn1_cursor * | params | ||
| ) |
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 586 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().
| int asn1_signature_algorithm | ( | const struct asn1_cursor * | cursor, |
| struct asn1_algorithm ** | algorithm | ||
| ) |
Parse ASN.1 OID-identified signature algorithm.
| cursor | ASN.1 object cursor |
| algorithm | Algorithm |
| rc | Return status code |
Definition at line 613 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().
| int asn1_curve_algorithm | ( | const struct asn1_cursor * | cursor, |
| struct asn1_algorithm ** | algorithm | ||
| ) |
Parse ASN.1 OID-identified elliptic curve algorithm.
| cursor | ASN.1 object cursor |
| algorithm | Algorithm |
| rc | Return status code |
Definition at line 647 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, and memcpy().
| int asn1_check_algorithm | ( | const struct asn1_cursor * | cursor, |
| struct asn1_algorithm * | expected, | ||
| struct asn1_cursor * | params | ||
| ) |
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 692 of file asn1.c.
References DBGC, ENOTTY_ALGORITHM, asn1_algorithm::name, and rc.
Referenced by asn1_curve_algorithm(), and rsa_parse_mod_exp().
| int asn1_parse_cbc | ( | struct asn1_algorithm * | algorithm, |
| struct asn1_cursor * | params | ||
| ) |
Parse ASN.1 CBC cipher parameters.
| algorithm | Algorithm |
| param | Parameters to parse |
| rc | Return status code |
Definition at line 719 of file asn1.c.
References algorithm, asn1_enter(), ASN1_OCTET_STRING, assert(), cipher_algorithm::blocksize, EINVAL, asn1_cursor::len, and NULL.
| int asn1_parse_gcm | ( | struct asn1_algorithm *algorithm | __unused, |
| struct asn1_cursor * | params | ||
| ) |
Parse ASN.1 GCM cipher parameters.
| algorithm | Algorithm |
| param | Parameters to parse |
| rc | Return status code |
Definition at line 743 of file asn1.c.
References asn1_enter(), ASN1_OCTET_STRING, and ASN1_SEQUENCE.
| int asn1_generalized_time | ( | const struct asn1_cursor * | cursor, |
| time_t * | time | ||
| ) |
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 764 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().
|
static |
Construct ASN.1 header.
| header | ASN.1 builder header |
| type | Type |
| len | Content length |
| header_len | Header length |
Definition at line 874 of file asn1.c.
References header, len, and type.
Referenced by asn1_prepend(), and asn1_wrap().
| int asn1_grow | ( | struct asn1_builder * | builder, |
| size_t | extra | ||
| ) |
Grow ASN.1 builder.
| builder | ASN.1 builder |
| extra | Extra space to prepend |
| rc | Return status code |
Definition at line 903 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().
| int asn1_prepend_raw | ( | struct asn1_builder * | builder, |
| const void * | data, | ||
| size_t | len | ||
| ) |
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 936 of file asn1.c.
References asn1_grow(), data, asn1_builder::data, len, memcpy(), and rc.
Referenced by icert_cert(), icert_certs(), ocsp_request(), tls_send_certificate_verify(), and tls_send_client_key_exchange_pubkey().
| int asn1_prepend | ( | struct asn1_builder * | builder, |
| unsigned int | type, | ||
| const void * | data, | ||
| size_t | len | ||
| ) |
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 959 of file asn1.c.
References asn1_grow(), asn1_header(), data, asn1_builder::data, header, len, memcpy(), rc, and type.
Referenced by icert_certs(), and ocsp_request().
| int asn1_wrap | ( | struct asn1_builder * | builder, |
| unsigned int | type | ||
| ) |
Wrap ASN.1 builder.
| builder | ASN.1 builder |
| type | Type |
| rc | Return status code |
Definition at line 986 of file asn1.c.
References asn1_grow(), asn1_header(), asn1_builder::data, header, asn1_builder::len, memcpy(), rc, and type.
Referenced by icert_cert(), icert_certs(), and ocsp_request().
| int image_asn1 | ( | struct image * | image, |
| size_t | offset, | ||
| struct asn1_cursor ** | cursor | ||
| ) |
Extract ASN.1 object from image.
| image | Image |
| offset | Offset within image |
| cursor | ASN.1 cursor to fill in |
| next | Offset to next image, or negative error |
The caller is responsible for eventually calling free() on the allocated ASN.1 cursor.
Definition at line 1015 of file asn1.c.
References image_type::asn1, assert(), DBGC, ENOTSUP, len, image::name, next, offset, rc, strerror(), and image::type.
Referenced by asn1_okx(), cms_message(), and image_x509().
| REQUIRING_SYMBOL | ( | image_asn1 | ) |
| REQUIRE_OBJECT | ( | config_asn1 | ) |
|
static |
| struct asn1_algorithm ecpubkey_algorithm __asn1_algorithm |
Generic elliptic curve container algorithm.
The actual curve to be used is identified via the algorithm parameters, rather than the top-level OID.
1.8.15