From ce1f47739759c648dc9f0f04653d0f8b020c4f10 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 31 Jan 2020 17:10:48 +0200 Subject: [PATCH] ASN.1: More OID definitions Signed-off-by: Jouni Malinen --- src/tls/asn1.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++-- src/tls/asn1.h | 23 ++++++++++++-- 2 files changed, 103 insertions(+), 4 deletions(-) diff --git a/src/tls/asn1.c b/src/tls/asn1.c index 54c17deae..0d8dd44ec 100644 --- a/src/tls/asn1.c +++ b/src/tls/asn1.c @@ -11,16 +11,96 @@ #include "common.h" #include "asn1.h" -struct asn1_oid asn1_sha1_oid = { +const struct asn1_oid asn1_sha1_oid = { .oid = { 1, 3, 14, 3, 2, 26 }, .len = 6 }; -struct asn1_oid asn1_sha256_oid = { +const struct asn1_oid asn1_sha256_oid = { .oid = { 2, 16, 840, 1, 101, 3, 4, 2, 1 }, .len = 9 }; +const struct asn1_oid asn1_ec_public_key_oid = { + .oid = { 1, 2, 840, 10045, 2, 1 }, + .len = 6 +}; + +const struct asn1_oid asn1_prime256v1_oid = { + .oid = { 1, 2, 840, 10045, 3, 1, 7 }, + .len = 7 +}; + +const struct asn1_oid asn1_secp384r1_oid = { + .oid = { 1, 3, 132, 0, 34 }, + .len = 5 +}; + +const struct asn1_oid asn1_secp521r1_oid = { + .oid = { 1, 3, 132, 0, 35 }, + .len = 5 +}; + +const struct asn1_oid asn1_brainpoolP256r1_oid = { + .oid = { 1, 3, 36, 3, 3, 2, 8, 1, 1, 7 }, + .len = 10 +}; + +const struct asn1_oid asn1_brainpoolP384r1_oid = { + .oid = { 1, 3, 36, 3, 3, 2, 8, 1, 1, 11 }, + .len = 10 +}; + +const struct asn1_oid asn1_brainpoolP512r1_oid = { + .oid = { 1, 3, 36, 3, 3, 2, 8, 1, 1, 13 }, + .len = 10 +}; + +const struct asn1_oid asn1_aes_siv_cmac_aead_256_oid = { + .oid = { 1, 2, 840, 113549, 1, 9, 16, 3, 22 }, + .len = 9 +}; + +const struct asn1_oid asn1_aes_siv_cmac_aead_384_oid = { + .oid = { 1, 2, 840, 113549, 1, 9, 16, 3, 23 }, + .len = 9 +}; + +const struct asn1_oid asn1_aes_siv_cmac_aead_512_oid = { + .oid = { 1, 2, 840, 113549, 1, 9, 16, 3, 24 }, + .len = 9 +}; + +const struct asn1_oid asn1_pbkdf2_oid = { + .oid = { 1, 2, 840, 113549, 1, 5, 12 }, + .len = 7 +}; + +const struct asn1_oid asn1_pbkdf2_hmac_sha256_oid = { + .oid = { 1, 2, 840, 113549, 2, 9 }, + .len = 6 +}; + +const struct asn1_oid asn1_pbkdf2_hmac_sha384_oid = { + .oid = { 1, 2, 840, 113549, 2, 10 }, + .len = 6 +}; + +const struct asn1_oid asn1_pbkdf2_hmac_sha512_oid = { + .oid = { 1, 2, 840, 113549, 2, 11 }, + .len = 6 +}; + +const struct asn1_oid asn1_dpp_config_params_oid = { + .oid = { 1, 3, 6, 1, 4, 1, 40808, 1, 2, 1 }, + .len = 10 +}; + +const struct asn1_oid asn1_dpp_asymmetric_key_package_oid = { + .oid = { 1, 3, 6, 1, 4, 1, 40808, 1, 2, 2 }, + .len = 10 +}; + static int asn1_valid_der_boolean(struct asn1_hdr *hdr) { diff --git a/src/tls/asn1.h b/src/tls/asn1.h index 25a05c78b..fcfb5cb71 100644 --- a/src/tls/asn1.h +++ b/src/tls/asn1.h @@ -71,7 +71,26 @@ int asn1_get_sequence(const u8 *buf, size_t len, struct asn1_hdr *hdr, int asn1_get_alg_id(const u8 *buf, size_t len, struct asn1_oid *oid, const u8 **params, size_t *params_len, const u8 **next); -extern struct asn1_oid asn1_sha1_oid; -extern struct asn1_oid asn1_sha256_oid; +extern const struct asn1_oid asn1_sha1_oid; +extern const struct asn1_oid asn1_sha256_oid; +extern const struct asn1_oid asn1_ec_public_key_oid; +extern const struct asn1_oid asn1_prime256v1_oid; +extern const struct asn1_oid asn1_secp384r1_oid; +extern const struct asn1_oid asn1_secp521r1_oid; +extern const struct asn1_oid asn1_brainpoolP256r1_oid; +extern const struct asn1_oid asn1_brainpoolP384r1_oid; +extern const struct asn1_oid asn1_brainpoolP512r1_oid; +extern const struct asn1_oid asn1_aes_siv_cmac_aead_256_oid; +extern const struct asn1_oid asn1_aes_siv_cmac_aead_384_oid; +extern const struct asn1_oid asn1_aes_siv_cmac_aead_512_oid; +extern const struct asn1_oid asn1_aes_siv_cmac_aead_256_oid; +extern const struct asn1_oid asn1_aes_siv_cmac_aead_384_oid; +extern const struct asn1_oid asn1_aes_siv_cmac_aead_512_oid; +extern const struct asn1_oid asn1_pbkdf2_oid; +extern const struct asn1_oid asn1_pbkdf2_hmac_sha256_oid; +extern const struct asn1_oid asn1_pbkdf2_hmac_sha384_oid; +extern const struct asn1_oid asn1_pbkdf2_hmac_sha512_oid; +extern const struct asn1_oid asn1_dpp_config_params_oid; +extern const struct asn1_oid asn1_dpp_asymmetric_key_package_oid; #endif /* ASN1_H */ -- 2.39.2