mirror of
https://github.com/ipxe/ipxe
synced 2026-04-16 03:00:10 +03:00
[crypto] Allow for extraction of ASN.1 algorithm parameters
Some ASN.1 OID-identified algorithms require additional parameters, such as an initialisation vector for a block cipher. The structure of the parameters is defined by the individual algorithm. Extend asn1_algorithm() to allow these additional parameters to be returned via a separate ASN.1 cursor. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
+17
-2
@@ -363,6 +363,15 @@ struct asn1_algorithm {
|
||||
struct cipher_algorithm *cipher;
|
||||
/** Elliptic curve (if applicable) */
|
||||
struct elliptic_curve *curve;
|
||||
/**
|
||||
* Parse algorithm parameters (optional)
|
||||
*
|
||||
* @v algorithm Algorithm
|
||||
* @v param Parameters to parse (and potentially modify)
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
int ( * parse ) ( struct asn1_algorithm *algorithm,
|
||||
struct asn1_cursor *params );
|
||||
};
|
||||
|
||||
/** ASN.1 OID-identified algorithms */
|
||||
@@ -467,17 +476,23 @@ extern int asn1_integral_bit_string ( const struct asn1_cursor *cursor,
|
||||
extern int asn1_compare ( const struct asn1_cursor *cursor1,
|
||||
const struct asn1_cursor *cursor2 );
|
||||
extern int asn1_algorithm ( const struct asn1_cursor *cursor,
|
||||
struct asn1_algorithm **algorithm );
|
||||
struct asn1_algorithm **algorithm,
|
||||
struct asn1_cursor *params );
|
||||
extern int asn1_pubkey_algorithm ( const struct asn1_cursor *cursor,
|
||||
struct asn1_algorithm **algorithm );
|
||||
extern int asn1_digest_algorithm ( const struct asn1_cursor *cursor,
|
||||
struct asn1_algorithm **algorithm );
|
||||
extern int asn1_cipher_algorithm ( const struct asn1_cursor *cursor,
|
||||
struct asn1_algorithm **algorithm );
|
||||
struct asn1_algorithm **algorithm,
|
||||
struct asn1_cursor *params );
|
||||
extern int asn1_signature_algorithm ( const struct asn1_cursor *cursor,
|
||||
struct asn1_algorithm **algorithm );
|
||||
extern int asn1_check_algorithm ( const struct asn1_cursor *cursor,
|
||||
struct asn1_algorithm *expected );
|
||||
extern int asn1_parse_cbc ( struct asn1_algorithm *algorithm,
|
||||
struct asn1_cursor *params );
|
||||
extern int asn1_parse_gcm ( struct asn1_algorithm *algorithm,
|
||||
struct asn1_cursor *params );
|
||||
extern int asn1_generalized_time ( const struct asn1_cursor *cursor,
|
||||
time_t *time );
|
||||
extern int asn1_grow ( struct asn1_builder *builder, size_t extra );
|
||||
|
||||
Reference in New Issue
Block a user