diff options
author | Jack Lloyd <[email protected]> | 2016-11-04 13:49:42 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-11-04 13:49:42 -0400 |
commit | 5dd1da28a40e7f2d2897a5258f008fba6481a5c7 (patch) | |
tree | 2268bc1b05add5a8cee09f362a3580e24b0f92d1 /src/lib | |
parent | df3eef3a9faa16cb91a330a4b48c7829d8cb845d (diff) | |
parent | 946ac84930edecd917d4b99896ad4448e629b1f0 (diff) |
Merge GH #710 Allow custom EC curve to be specified at build time
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/asn1/oids.cpp | 12 | ||||
-rw-r--r-- | src/lib/pubkey/ec_group/named.cpp | 5 | ||||
-rw-r--r-- | src/lib/tls/tls_extensions.cpp | 10 |
3 files changed, 26 insertions, 1 deletions
diff --git a/src/lib/asn1/oids.cpp b/src/lib/asn1/oids.cpp index a9651187c..b07e8a8b9 100644 --- a/src/lib/asn1/oids.cpp +++ b/src/lib/asn1/oids.cpp @@ -1,7 +1,7 @@ /* * OID maps * -* This file was automatically generated by ./src/scripts/oids.py on 2016-11-02 +* This file was automatically generated by ./src/scripts/oids.py on 2016-11-03 * * Botan is released under the Simplified BSD License (see license.txt) */ @@ -171,6 +171,11 @@ std::string lookup(const OID& oid) if(oid_str == "2.5.4.7") return "X520.Locality"; if(oid_str == "2.5.4.8") return "X520.State"; if(oid_str == "2.5.8.1.1") return "RSA"; + +#if defined(BOTAN_HOUSE_ECC_CURVE_NAME) + if(oid_str == BOTAN_HOUSE_ECC_CURVE_OID) return BOTAN_HOUSE_ECC_CURVE_NAME; +#endif + return std::string(); } @@ -329,6 +334,11 @@ OID lookup(const std::string& name) if(name == "x962_p239v1") return OID("1.2.840.10045.3.1.4"); if(name == "x962_p239v2") return OID("1.2.840.10045.3.1.5"); if(name == "x962_p239v3") return OID("1.2.840.10045.3.1.6"); + +#if defined(BOTAN_HOUSE_ECC_CURVE_NAME) + if(name == BOTAN_HOUSE_ECC_CURVE_NAME) return OID(BOTAN_HOUSE_ECC_CURVE_OID); +#endif + return OID(); } diff --git a/src/lib/pubkey/ec_group/named.cpp b/src/lib/pubkey/ec_group/named.cpp index 6df8a3169..c19b8ed37 100644 --- a/src/lib/pubkey/ec_group/named.cpp +++ b/src/lib/pubkey/ec_group/named.cpp @@ -265,6 +265,11 @@ const char* EC_Group::PEM_for_named_group(const std::string& name) "8f0XjAs61Y8QEm3ozkJDW1PcZ+FA0r+UH/3UWcbWVeECAQE=" "-----END EC PARAMETERS-----"; +#if defined(BOTAN_HOUSE_ECC_CURVE_NAME) + if(name == BOTAN_HOUSE_ECC_CURVE_NAME) + return BOTAN_HOUSE_ECC_CURVE_PEM; +#endif + return nullptr; } diff --git a/src/lib/tls/tls_extensions.cpp b/src/lib/tls/tls_extensions.cpp index a2db1faaf..f8eef5ac6 100644 --- a/src/lib/tls/tls_extensions.cpp +++ b/src/lib/tls/tls_extensions.cpp @@ -299,6 +299,11 @@ std::string Supported_Elliptic_Curves::curve_id_to_name(u16bit id) return "x25519"; #endif +#if defined(BOTAN_HOUSE_ECC_CURVE_NAME) + case BOTAN_HOUSE_ECC_CURVE_TLS_ID: + return BOTAN_HOUSE_ECC_CURVE_NAME; +#endif + default: return ""; // something we don't know or support } @@ -324,6 +329,11 @@ u16bit Supported_Elliptic_Curves::name_to_curve_id(const std::string& name) return 29; #endif +#if defined(BOTAN_HOUSE_ECC_CURVE_NAME) + if(name == BOTAN_HOUSE_ECC_CURVE_NAME) + return BOTAN_HOUSE_ECC_CURVE_TLS_ID; +#endif + // Unknown/unavailable EC curves are ignored return 0; } |