diff options
author | Daniel Neus <[email protected]> | 2016-05-02 12:31:46 +0200 |
---|---|---|
committer | Daniel Neus <[email protected]> | 2016-05-02 12:31:46 +0200 |
commit | a32deb7296d6052092601c5900e1f71c84382736 (patch) | |
tree | 03574d4b0efd22dc42700be68bb366d785bf5801 /src | |
parent | 7c85cf078445841699b67d12b3baec011bd129f6 (diff) |
remove all uses of EMSA1_BSI
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/asn1/oid_lookup/default.cpp | 7 | ||||
-rw-r--r-- | src/lib/cert/cvc/cvc_self.cpp | 4 | ||||
-rw-r--r-- | src/lib/cert/x509/x509_ca.cpp | 4 | ||||
-rw-r--r-- | src/lib/pk_pad/emsa.cpp | 8 | ||||
-rw-r--r-- | src/tests/unit_ecdsa.cpp | 28 |
5 files changed, 8 insertions, 43 deletions
diff --git a/src/lib/asn1/oid_lookup/default.cpp b/src/lib/asn1/oid_lookup/default.cpp index 9e16cfc0b..b6bb25344 100644 --- a/src/lib/asn1/oid_lookup/default.cpp +++ b/src/lib/asn1/oid_lookup/default.cpp @@ -102,13 +102,6 @@ const char* default_oid_list() "2.16.840.1.101.3.4.3.1 = DSA/EMSA1(SHA-224)" "\n" "2.16.840.1.101.3.4.3.2 = DSA/EMSA1(SHA-256)" "\n" - "0.4.0.127.0.7.1.1.4.1.1 = ECDSA/EMSA1_BSI(SHA-160)" "\n" - "0.4.0.127.0.7.1.1.4.1.2 = ECDSA/EMSA1_BSI(SHA-224)" "\n" - "0.4.0.127.0.7.1.1.4.1.3 = ECDSA/EMSA1_BSI(SHA-256)" "\n" - "0.4.0.127.0.7.1.1.4.1.4 = ECDSA/EMSA1_BSI(SHA-384)" "\n" - "0.4.0.127.0.7.1.1.4.1.5 = ECDSA/EMSA1_BSI(SHA-512)" "\n" - "0.4.0.127.0.7.1.1.4.1.6 = ECDSA/EMSA1_BSI(RIPEMD-160)" "\n" - "1.2.840.10045.4.1 = ECDSA/EMSA1(SHA-160)" "\n" "1.2.840.10045.4.3.1 = ECDSA/EMSA1(SHA-224)" "\n" "1.2.840.10045.4.3.2 = ECDSA/EMSA1(SHA-256)" "\n" diff --git a/src/lib/cert/cvc/cvc_self.cpp b/src/lib/cert/cvc/cvc_self.cpp index fdc66bbfd..fa59f4c6d 100644 --- a/src/lib/cert/cvc/cvc_self.cpp +++ b/src/lib/cert/cvc/cvc_self.cpp @@ -99,7 +99,7 @@ EAC1_1_CVC create_self_signed_cert(Private_Key const& key, ASN1_Chr chr(opt.car.value()); AlgorithmIdentifier sig_algo; - std::string padding_and_hash("EMSA1_BSI(" + opt.hash_alg + ")"); + std::string padding_and_hash("EMSA1(" + opt.hash_alg + ")"); sig_algo.oid = OIDS::lookup(priv_key->algo_name() + "/" + padding_and_hash); sig_algo = AlgorithmIdentifier(sig_algo.oid, AlgorithmIdentifier::USE_NULL_PARAM); @@ -126,7 +126,7 @@ EAC1_1_Req create_cvc_req(Private_Key const& key, throw Invalid_Argument("CVC_EAC::create_self_signed_cert(): unsupported key type"); } AlgorithmIdentifier sig_algo; - std::string padding_and_hash("EMSA1_BSI(" + hash_alg + ")"); + std::string padding_and_hash("EMSA1(" + hash_alg + ")"); sig_algo.oid = OIDS::lookup(priv_key->algo_name() + "/" + padding_and_hash); sig_algo = AlgorithmIdentifier(sig_algo.oid, AlgorithmIdentifier::USE_NULL_PARAM); diff --git a/src/lib/cert/x509/x509_ca.cpp b/src/lib/cert/x509/x509_ca.cpp index 46c8c65f2..147fdd6ad 100644 --- a/src/lib/cert/x509/x509_ca.cpp +++ b/src/lib/cert/x509/x509_ca.cpp @@ -234,10 +234,8 @@ PK_Signer* choose_sig_format(const Private_Key& key, std::string padding; if(algo_name == "RSA") padding = "EMSA3"; - else if(algo_name == "DSA") + else if(algo_name == "DSA" || algo_name == "ECDSA" ) padding = "EMSA1"; - else if(algo_name == "ECDSA") - padding = "EMSA1_BSI"; else throw Invalid_Argument("Unknown X.509 signing key type: " + algo_name); diff --git a/src/lib/pk_pad/emsa.cpp b/src/lib/pk_pad/emsa.cpp index 3b8641357..0501bc5f4 100644 --- a/src/lib/pk_pad/emsa.cpp +++ b/src/lib/pk_pad/emsa.cpp @@ -11,10 +11,6 @@ #include <botan/emsa1.h> #endif -#if defined(BOTAN_HAS_EMSA1_BSI) - #include <botan/emsa1_bsi.h> -#endif - #if defined(BOTAN_HAS_EMSA_X931) #include <botan/emsa_x931.h> #endif @@ -58,10 +54,6 @@ EMSA* get_emsa(const std::string& algo_spec) BOTAN_REGISTER_EMSA_1HASH(EMSA1, "EMSA1"); #endif -#if defined(BOTAN_HAS_EMSA1_BSI) -BOTAN_REGISTER_EMSA_1HASH(EMSA1_BSI, "EMSA1_BSI"); -#endif - #if defined(BOTAN_HAS_EMSA_PKCS1) BOTAN_REGISTER_NAMED_T(EMSA, "EMSA_PKCS1", EMSA_PCS1v15, EMSA_PKCS1v15::make); #endif diff --git a/src/tests/unit_ecdsa.cpp b/src/tests/unit_ecdsa.cpp index ecafb3c7f..3f2dcd0cf 100644 --- a/src/tests/unit_ecdsa.cpp +++ b/src/tests/unit_ecdsa.cpp @@ -41,7 +41,6 @@ Test::Result test_hash_larger_than_n() Botan::EC_Group dom_pars(Botan::OIDS::lookup("1.3.132.0.8")); // secp160r1 // n = 0x0100000000000000000001f4c8f927aed3ca752257 (21 bytes) - // -> shouldn't work with SHA224 which outputs 28 bytes Botan::ECDSA_PrivateKey priv_key(Test::rng(), dom_pars); @@ -49,35 +48,18 @@ Test::Result test_hash_larger_than_n() for(size_t i = 0; i != message.size(); ++i) message[i] = i; - Botan::PK_Signer pk_signer_160(priv_key, "EMSA1_BSI(SHA-1)"); - Botan::PK_Verifier pk_verifier_160(priv_key, "EMSA1_BSI(SHA-1)"); - - Botan::PK_Signer pk_signer_224(priv_key, "EMSA1_BSI(SHA-224)"); + Botan::PK_Signer pk_signer_160(priv_key, "EMSA1(SHA-1)"); + Botan::PK_Verifier pk_verifier_160(priv_key, "EMSA1(SHA-1)"); // Verify we can sign and verify with SHA-160 std::vector<byte> signature_160 = pk_signer_160.sign_message(message, Test::rng()); - result.test_eq("message verifies", pk_verifier_160.verify_message(message, signature_160), true); - try - { - pk_signer_224.sign_message(message, Test::rng()); - result.test_failure("bad key/hash combination not rejected"); - } - catch(Botan::Encoding_Error) - { - result.test_note("bad key/hash combination rejected"); - } - - // now check that verification alone fails - - // sign it with the normal EMSA1 + // Verify we can sign and verify with SHA-224 Botan::PK_Signer pk_signer(priv_key, "EMSA1(SHA-224)"); std::vector<byte> signature = pk_signer.sign_message(message, Test::rng()); - - Botan::PK_Verifier pk_verifier(priv_key, "EMSA1_BSI(SHA-224)"); - - result.test_eq("corrupt message does not verify", pk_verifier.verify_message(message, signature), false); + Botan::PK_Verifier pk_verifier(priv_key, "EMSA1(SHA-224)"); + result.test_eq("message verifies", pk_verifier.verify_message(message, signature), true); return result; } |