From dc06bb075df0a6cfef4c29f5c90abafcea2e69d0 Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Sat, 15 Sep 2018 08:34:26 +0900 Subject: [PATCH] moving and consoridating NID defines to enum in asn.h --- wolfssl/openssl/ssl.h | 46 ----------------------------------------- wolfssl/wolfcrypt/asn.h | 44 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 47 deletions(-) diff --git a/wolfssl/openssl/ssl.h b/wolfssl/openssl/ssl.h index 7728dba47..a2dee5b63 100644 --- a/wolfssl/openssl/ssl.h +++ b/wolfssl/openssl/ssl.h @@ -584,21 +584,6 @@ typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX; #define SSL_dup_CA_list wolfSSL_dup_CA_list #define X509_check_ca wolfSSL_X509_check_ca - -/* NIDs */ -enum { - NID_undef = 0, - NID_des = 66, - NID_des3 = 67, - NID_sha256 = 672, - NID_sha384 = 673, - NID_sha512 = 674, - NID_hw_name_oid = 73, - NID_id_pkix_OCSP_basic = 74, - NID_any_policy = 75, - NID_anyExtendedKeyUsage = 76, -}; - enum { GEN_DNS = 0x02, /* ASN_DNS_TYPE */ GEN_EMAIL = 0x01, /* ASN_RFC822_TYPE */ @@ -826,37 +811,6 @@ typedef WOLFSSL_ASN1_BIT_STRING ASN1_BIT_STRING; #define SSL_CTX_get_default_passwd_cb wolfSSL_CTX_get_default_passwd_cb #define SSL_CTX_get_default_passwd_cb_userdata wolfSSL_CTX_get_default_passwd_cb_userdata -/* certificate extension NIDs */ -#define NID_basic_constraints 133 -#define NID_key_usage 129 /* 2.5.29.15 */ -#define NID_ext_key_usage 151 /* 2.5.29.37 */ -#define NID_subject_key_identifier 128 -#define NID_authority_key_identifier 149 -#define NID_private_key_usage_period 130 /* 2.5.29.16 */ -#define NID_subject_alt_name 131 -#define NID_issuer_alt_name 132 -#define NID_info_access 69 -#define NID_sinfo_access 79 /* id-pe 11 */ -#define NID_name_constraints 144 /* 2.5.29.30 */ -#define NID_certificate_policies 146 -#define NID_policy_mappings 147 -#define NID_policy_constraints 150 -#define NID_inhibit_any_policy 168 /* 2.5.29.54 */ -#define NID_tlsfeature 92 /* id-pe 24 */ -#define NID_commonName 0x03 /* matchs ASN_COMMON_NAME in asn.h */ -#define NID_domainComponent 0x19 - /* matchs ASN_DOMAIN_COMPONENT in asn.h */ - - /* matchs ASN_..._NAME in asn.h */ -#define NID_surname 0x04 /* SN */ -#define NID_serialNumber 0x05 /* serialNumber */ -#define NID_countryName 0x06 /* C */ -#define NID_localityName 0x07 /* L */ -#define NID_stateOrProvinceName 0x08 /* ST */ -#define NID_organizationName 0x0a /* O */ -#define NID_organizationalUnitName 0x0b /* OU */ -#define NID_emailAddress 0x30 /* emailAddress */ - #define SSL_CTX_set_msg_callback wolfSSL_CTX_set_msg_callback #define SSL_set_msg_callback wolfSSL_set_msg_callback #define SSL_CTX_set_msg_callback_arg wolfSSL_CTX_set_msg_callback_arg diff --git a/wolfssl/wolfcrypt/asn.h b/wolfssl/wolfcrypt/asn.h index 5ab2f84e8..7f63ce6eb 100644 --- a/wolfssl/wolfcrypt/asn.h +++ b/wolfssl/wolfcrypt/asn.h @@ -139,7 +139,49 @@ enum DN_Tags { #define WOLFSSL_JOI_ST "/jurisdictionST=" #define WOLFSSL_EMAIL_ADDR "/emailAddress=" -enum ECC_TYPES { +/* NIDs */ +enum +{ + NID_undef = 0, + NID_des = 66, + NID_des3 = 67, + NID_sha256 = 672, + NID_sha384 = 673, + NID_sha512 = 674, + NID_hw_name_oid = 73, + NID_id_pkix_OCSP_basic = 74, + NID_any_policy = 75, + NID_anyExtendedKeyUsage = 76, + NID_basic_constraints = 133, + NID_key_usage = 129, /* 2.5.29.15 */ + NID_ext_key_usage = 151, /* 2.5.29.37 */ + NID_subject_key_identifier = 128, + NID_authority_key_identifier = 149, + NID_private_key_usage_period = 130, /* 2.5.29.16 */ + NID_subject_alt_name = 131, + NID_issuer_alt_name = 132, + NID_info_access = 69, + NID_sinfo_access = 79, /* id-pe 11 */ + NID_name_constraints = 144, /* 2.5.29.30 */ + NID_certificate_policies = 146, + NID_policy_mappings = 147, + NID_policy_constraints = 150, + NID_inhibit_any_policy = 168, /* 2.5.29.54 */ + NID_tlsfeature = 92, /* id-pe 24 */ + NID_commonName = 0x03, /* matchs ASN_COMMON_NAME in asn.h */ + NID_surname = 0x04, /* SN */ + NID_serialNumber = 0x05, /* serialNumber */ + NID_countryName = 0x06, /* C */ + NID_localityName = 0x07, /* L */ + NID_stateOrProvinceName = 0x08, /* ST */ + NID_organizationName = 0x0a, /* O */ + NID_organizationalUnitName = 0x0b, /* OU */ + NID_domainComponent = 0x19, /* matchs ASN_DOMAIN_COMPONENT in asn.h */ + NID_emailAddress = 0x30, /* emailAddress */ +}; + +enum ECC_TYPES +{ ECC_PREFIX_0 = 160, ECC_PREFIX_1 = 161 };