aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-08-15 17:15:22 -0400
committerJack Lloyd <[email protected]>2017-08-15 17:15:22 -0400
commitdefe02db7b384ce2454122bf61949379e4a8181b (patch)
tree896e395560a7180b381e459fc4b7bf7be5ded77a /src/tests
parentba75558b723ae0c8b1e3b8718d972ef2fa567dfd (diff)
Allow signature using `Raw(hashname)`
This confirms the message is exactly the size of the expected hash, and also causes RFC 6979 nonces to be generated using the specified hash. See also https://github.com/riboseinc/rnp/issues/367
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/data/pubkey/ecdsa_prob.vec22
-rw-r--r--src/tests/data/pubkey/ecdsa_rfc6979.vec18
-rw-r--r--src/tests/test_ecdsa.cpp2
3 files changed, 41 insertions, 1 deletions
diff --git a/src/tests/data/pubkey/ecdsa_prob.vec b/src/tests/data/pubkey/ecdsa_prob.vec
index dcfc5664e..e5a5ad8e5 100644
--- a/src/tests/data/pubkey/ecdsa_prob.vec
+++ b/src/tests/data/pubkey/ecdsa_prob.vec
@@ -1004,9 +1004,31 @@ Nonce = A808BBBBCDB8C60C097DD2839FA2B4DEA13777D27D11C8BD3ABE7F16FFDA4BF6
Msg = 0000000000000000000000000000000000000000000000000000000000000000
Signature = AE15A0963B6E0144E7F801616DBBBF1BB4C4943CA85B0AF9D00F3FA5CACB95FB02032D911851E27F8E5C565A43F54DE6E03EFF81A9BF73B9ACC47B363979F101
+Hash = Raw(SHA-256)
+Group = secp256r1
+X = 5
+Nonce = 35F6E341405E516C2FD796CA12F039C6971AB7A0F69B254E38CA7191F298DFB2
+Msg = 0000000000000000000000000000000000000000000000000000000000000000
+Signature = 921D2C2012856C4F8BD1AB9229C302848AB99CFCF92A512BD24B9A08F3C0DF99CE18D76B930B81493E77737E24285D07F2919C98AFE32F2450A28BA50FBE32E8
+
Hash = Raw
Group = secp384r1
X = 5
Nonce = 77294F6D855441C4DBEC66E1494DA0F2C6BFA3FB8518A9ED8D271D72BB3BE45302DCDEE6FF66555489756BECB8BF6CB9
Msg = 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Signature = 53C99B5021F9DD7B8D2EC1C1BB17C03FCFF324DED361B4845D9C98E1A3F490C63946BA68DF0FA26AE62BB6E04531581C9D29FF7775BE15F14C1AA86B292F987241E42241E08DBA4229597260A4D9F433AC78F36D772F83499C5E2E3AF68F83E4
+
+X = 5
+Group = secp384r1
+Hash = Raw(SHA-384)
+Msg = 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+Nonce = 6BE36DD30F03CB45B2F20A1F38025BBF7701561C163FBB426CB0B210E601EF85B3E5F60058B706C56575712A05BB780D
+Signature = 7A5C707564BF8DA1261387DFD5D5ED2A8C10B3AA4D00C9A927D5729E8BB555954F94799B972CD6F976B99703A561A1AD62929113627D363F5765D5FFCEBCF529B6B74D78B91D7A400D7E09C7613571C25E55AC98989635BE251EE123AA9A63CC
+
+X = 5
+Group = secp521r1
+Hash = Raw(SHA-512)
+Msg = 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+Nonce = 0169EBB978C1B61CCE759A67B828F8213960B2E1D041DF948ABC435C99E1080D650612D1C7284E1B1F1B9D16D477B722B59545407137D0FBC17C05344A7BB2033E60
+Signature = 0157BC701722FB4853DD9F3E9BBAE977137CF04659B3CF4BD9A3FF47D8E1DF3D7B9A1E291234CD8AE9C9B9711F22C9B3B127F6217A582A9830D75184CB6A6AC174570164A920D8059F8BC21F4FBFDEE3140CF1033F3AB10260A71CBD32197822C3B575BC44DA681EBBB4612357A1E81670B2A76A35DDA2AAE708F7FD7D66D1EAE453249C
+
diff --git a/src/tests/data/pubkey/ecdsa_rfc6979.vec b/src/tests/data/pubkey/ecdsa_rfc6979.vec
index a56970fa5..7132038db 100644
--- a/src/tests/data/pubkey/ecdsa_rfc6979.vec
+++ b/src/tests/data/pubkey/ecdsa_rfc6979.vec
@@ -385,9 +385,27 @@ Hash = Raw
Msg = 0000000000000000000000000000000000000000000000000000000000000000
Signature = AE15A0963B6E0144E7F801616DBBBF1BB4C4943CA85B0AF9D00F3FA5CACB95FB02032D911851E27F8E5C565A43F54DE6E03EFF81A9BF73B9ACC47B363979F101
+X = 5
+Group = secp256r1
+Hash = Raw(SHA-256)
+Msg = 0000000000000000000000000000000000000000000000000000000000000000
+Signature = 921D2C2012856C4F8BD1AB9229C302848AB99CFCF92A512BD24B9A08F3C0DF99CE18D76B930B81493E77737E24285D07F2919C98AFE32F2450A28BA50FBE32E8
+
X = 5
Group = secp384r1
Hash = Raw
Msg = 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Signature = 53C99B5021F9DD7B8D2EC1C1BB17C03FCFF324DED361B4845D9C98E1A3F490C63946BA68DF0FA26AE62BB6E04531581C9D29FF7775BE15F14C1AA86B292F987241E42241E08DBA4229597260A4D9F433AC78F36D772F83499C5E2E3AF68F83E4
+
+X = 5
+Group = secp384r1
+Hash = Raw(SHA-384)
+Msg = 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+Signature = 7A5C707564BF8DA1261387DFD5D5ED2A8C10B3AA4D00C9A927D5729E8BB555954F94799B972CD6F976B99703A561A1AD62929113627D363F5765D5FFCEBCF529B6B74D78B91D7A400D7E09C7613571C25E55AC98989635BE251EE123AA9A63CC
+
+X = 5
+Group = secp521r1
+Hash = Raw(SHA-512)
+Msg = 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+Signature = 0157BC701722FB4853DD9F3E9BBAE977137CF04659B3CF4BD9A3FF47D8E1DF3D7B9A1E291234CD8AE9C9B9711F22C9B3B127F6217A582A9830D75184CB6A6AC174570164A920D8059F8BC21F4FBFDEE3140CF1033F3AB10260A71CBD32197822C3B575BC44DA681EBBB4612357A1E81670B2A76A35DDA2AAE708F7FD7D66D1EAE453249C
diff --git a/src/tests/test_ecdsa.cpp b/src/tests/test_ecdsa.cpp
index 9b8c2200e..5d9c327a8 100644
--- a/src/tests/test_ecdsa.cpp
+++ b/src/tests/test_ecdsa.cpp
@@ -52,7 +52,7 @@ class ECDSA_Signature_KAT_Tests : public PK_Signature_Generation_Test
std::string default_padding(const VarMap& vars) const override
{
const std::string hash = get_req_str(vars, "Hash");
- if(hash == "Raw")
+ if(hash.substr(0,3) == "Raw")
return hash;
return "EMSA1(" + hash + ")";
}