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 | |
parent | df3eef3a9faa16cb91a330a4b48c7829d8cb845d (diff) | |
parent | 946ac84930edecd917d4b99896ad4448e629b1f0 (diff) |
Merge GH #710 Allow custom EC curve to be specified at build time
Diffstat (limited to 'src')
-rw-r--r-- | src/build-data/buildh.in | 5 | ||||
-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 | ||||
-rwxr-xr-x | src/scripts/oids.py | 10 | ||||
-rw-r--r-- | src/tests/unit_tls.cpp | 4 |
6 files changed, 45 insertions, 1 deletions
diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in index fe5210698..fea18fd90 100644 --- a/src/build-data/buildh.in +++ b/src/build-data/buildh.in @@ -268,6 +268,11 @@ Each read generates 32 bits of output */ %{local_config} +/* +* Miscellaneous configuration options (if any) follow +*/ +%{misc_config} + /** * Controls how AutoSeeded_RNG is instantiated */ 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; } diff --git a/src/scripts/oids.py b/src/scripts/oids.py index e3c232211..8d5cd6d8f 100755 --- a/src/scripts/oids.py +++ b/src/scripts/oids.py @@ -94,12 +94,22 @@ std::string lookup(const OID& oid) { const std::string oid_str = oid.as_string(); %s + +#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(); } OID lookup(const std::string& name) { %s + +#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/tests/unit_tls.cpp b/src/tests/unit_tls.cpp index 8a074db0c..ab37cffd1 100644 --- a/src/tests/unit_tls.cpp +++ b/src/tests/unit_tls.cpp @@ -1017,6 +1017,10 @@ class TLS_Unit_Tests : public Test test_modern_versions(results, *client_ses, *server_ses, *creds, "DHE_PSK", "AES-128", "SHA-1"); #endif +#if defined(BOTAN_HOUSE_ECC_CURVE_NAME) + test_modern_versions(results, *client_ses, *server_ses, *creds, "ECDH", "AES-128/GCM", "AEAD", + { { "ecc_curves", BOTAN_HOUSE_ECC_CURVE_NAME } }); +#endif return results; } |