From be480caf0f21d4bcaab17d1614e5932b9720a597 Mon Sep 17 00:00:00 2001 From: lloyd Date: Mon, 5 Jan 2015 23:39:57 +0000 Subject: Add Brainpool and secp160r1 ECDSA tests --- src/tests/data/pubkey/ecdsa.vec | 151 ++++++++++++++++++++++++++++++++++++++++ src/tests/test_ecdsa.cpp | 3 +- 2 files changed, 153 insertions(+), 1 deletion(-) diff --git a/src/tests/data/pubkey/ecdsa.vec b/src/tests/data/pubkey/ecdsa.vec index d074e064b..311734c97 100644 --- a/src/tests/data/pubkey/ecdsa.vec +++ b/src/tests/data/pubkey/ecdsa.vec @@ -189,3 +189,154 @@ Signature = 014BEE21A18B6D8B3C93FAB08D43E739707953244FDBE924FA926D76669E7AC8C89D Hash = SHA-512 Signature = 013E99020ABF5CEE7525D16B69B229652AB6BDF2AFFCAEF38773B4B7D08725F10CDB93482FDCC54EDCEE91ECA4166B2A7C6265EF0CE2BD7051B7CEF945BABD47EE6D01FBD0013C674AA79CB39849527916CE301C66EA7CE8B80682786AD60F98F7E78A19CA69EFF5C57400E3B3A0AD66CE0978214D13BAF4E9AC60752F7B155E2DE4DCE3 + +# Brainpool tests (generated by botan) + +Group = brainpool256r1 +X = 0xC9AFA9D845BA75166B5C215767B1D6934E50C3DB36E89B127B8A622B120F6721 + +Msg = 73616D706C65 +Hash = SHA-1 +Signature = 3145D09CC6F119C5CBF7DFF330C248108E2DDB190B07488125CD88AE2BE0BB305E13FFB288494C288AE30B6C932E72330541E39A288F658699BC53381951AE37 + +Hash = SHA-224 +Signature = 2BA902B3465D975F99DF5013D9D1BE908F71455DD8B9C3B3867F974C9D9805EA4FBE5F6F2C3534B059EA23FBE783DBAF9B15F534264F43927162956D30FF484A + +Hash = SHA-256 +Signature = 591D196BFD2BCD2AFAF6FC303934EE957EED8593082D9FFAA83893D5F168E56E0DCEE6583F22E2E686CB55ECC66B894895E6D300F8693ACE3DA8C2D4A2A615D6 + +Hash = SHA-384 +Signature = 1F6D853E37EACECC978C75DAEC814FC09317092F4A2B9EC663BF0BC51E57B15A00B76461EB72776236BA54BE13D56498860C6D3C417F07AEB1D0B42E3261B4E0 + +Hash = SHA-512 +Signature = 3861F86C0B5A5D93342F734EAFB0F85757901A7D2696D2DDDC30B38102987BDC0521AABEC38CD35FCC0B0188BA66D9E18DE4F6E8FE9FF5E53569B502639477B7 + +Msg = 74657374 + +Hash = SHA-1 +Signature = 222F9288B54516A39A0735F69DD83DE1652DD31DEB95FA7A950B2234BAE0887E2DA98516C4B374F9172894CEDDF7208EAD3F6060A2B4B11C96458E209A6AB279 + +Hash = SHA-224 +Signature = 2813785404749F87DE6D07AB80292E86FB9492122C0A35F236880210C377E5BC81E31C02BD457D19346B2DC293E81EE9DC5B8897E4ED1C8B5185B8C39776444A + +Hash = SHA-256 +Signature = 8B75FB302FE9253278815380D1B8D98D3EC3ACA7DB1B4BEAC1ACBE32D1249417230C64E3D5B4EFCF8073CB794322AA35FC6E38DBAC70199AC06034E7259E2558 + +Hash = SHA-384 +Signature = 26119D75A15EE75084792FA79D07660A87A43A0BC9E01CFE6E0D5B5C996CC7141952B973BD81DE39EC7FD0FD0E2C5D8CDE2B70DB933B07028D85A6AC643A8947 + +Hash = SHA-512 +Signature = 84039C443BB9D976701D639B3E4F49762A23ED313BC009D71EF48EBCF317E61306B712F9ADE609D50394C2EEA3380A29029347823216165769E69C7AFB0021FF + +Group = brainpool384r1 +X = 0x6B9D3DAD2E1B8C1C05B19875B6659F4DE23C3B667BF297BA9AA47740787137D896D5724E4C70A825F872C9EA60D2EDF5 + +Msg = 73616D706C65 + +Hash = SHA-1 +Signature = 209F80A46A49C00C5604AEF2396C463AB315042E69BCEC63230DA22C980C748C91FA57487A0685BE22777FDC9DBDAC5A7F78CEB52092CA04C4941CE86DF060FF8315EDDBEA744556CCC5D62BA11BE6F6F113E5AD92262884FD33A50F7E58BB54 + +Hash = SHA-224 +Signature = 852CA38D56B5F471B9C27790A65277768866A530759E89F37FBF92C66F0022A40840F784A7E91E32EDBA6E24F9FE6FC62C5DAE40E2BD3B4F566C059B5169BD401CAABA3CDB7B191F2DE9AC271390F689363CC9EC2FA6AA36237B1DDAD7BB34A5 + +Hash = SHA-256 +Signature = 738A695B46D4F93E1C4EAF2B07EC2AEF9B4029A7131C1BE131788D07E09EF1C63BCE6783CA6D2692914258CAF8348246792D75E0363246CA0A973CB475541A61FD1B43B5F606E3C35F85F59B75B076F4C322D736B8986C3D7C52E6981E5B678F + +Hash = SHA-384 +Signature = 7F58979116F712AD482269BC1A0101B054087BDB7F18085688DF7A1D284CA526793400FF547150F2FD3331BAF96050596FFECC3671F57DCE14F16997E54732FA37250EC7068C9475808AA22D23D310CE07EE00DC24C58FAE11FF63CF6C61A016 + +Hash = SHA-512 +Signature = 213AE17E4FE67D867D14B6E58640BCC450F20E507B0CE327C8FA13F7D879442CE5A68526B46EA1B57A77DC8176C919367A09BF974C01D6692DF70B7B79570B48DBFF8E793FF468D46D63B09E9E9D0F44F10DCA4654E736A72C18016AE4DC617B + +Msg = 74657374 + +Hash = SHA-1 +Signature = 135BF8DD5FF35EC782C471E0828650A8B35C6587EB409EBC7A75BB55F8BA13DE425E8E1C5295AEE390B6072A612F729142590B734F6F4F847BF8F3C0FB07071D5F053307EE308ECE3E027A0EC4D02CC5C3BB985A833616B38719D2B4DADF6A5A + +Hash = SHA-224 +Signature = 514C9D8D17AD45EA567490D21A8E28740C3C9A685D66763550653779A8023C8C9A7DFC1A0AA372D9AEA01F97E0449F4831CB476893F68D841CD4BFCD4C278252A95B62EBB74F7A4483F6DBA3691DA60B0B516A9124C9C8A74C2C5F357FDA5361 + +Hash = SHA-256 +Signature = 04C918A74D48214A976C013D1F861DE877AFC14BE079E9D24064956317AAE7A92B9D5FC3B353ED252F97E2DB5FA1FD747744C79C8FD968F8F0DD5E84F42C324EB59FC579507C06C31A73446A945B65617BF50D170A6449F71C1E8A0207A6BB7C + +Hash = SHA-384 +Signature = 665944E820E0052D34A720E08A5A63508D24DA14D67C88636E1362756ED4C3BFED946532F20E088260C0ED4E714157070AF09D9150C711361A2DD58E148841D797C0D6B98C8D032365BB1DD8C39383F6F7E6E19946143E5DEA08D4EC1FAB350D + +Hash = SHA-512 +Signature = 14AA3D90105782F288176707FBF3B239D1301E34D76018B5194C1CDD8C878D7FF44351CD22AFA130CB3C722A69172A881F9B1E4A98C9BEA26C8750708DF7AB6946FEBA23E328C980942092B8C3F8FE4ECCD24F7B7A316F39AFAB696F30E6BDF8 + + +Group = brainpool512r1 +X = 0xD06DAA62BA3B25D2FB40133DA757205DE67F5BB0018FEE8C86E1B68C7E75CAA896EB32F1F47C70855836A6D16FCC1466F6D8FBEC67DB89EC0C08B0E996B83538 + +Msg = 73616D706C65 + +Hash = SHA-1 +Signature = 9F359636EA685CBE5EE9C4CD81118880F28D0BCC4F2085ECF6C6ECD12D32983AC47F81FFC6F76C2F76BBA7731EC5758BCC637BEFE3D7193FC121A17E6828EED98164C35FCDBFDC6C7049209FB2237F206EC31DAA9C6DE12E9F3A3E5CDA7845A7969EC82F0944905352328FA94BDEDBFD1BF20FEE91D2AAF67280B8C2CF8097B2 + +Hash = SHA-224 +Signature = 185D75AA7DD7EB59CA38480C262F7062B09533CA294E4CEEC9356076A359828D2527A695002FF1D1FF27DD8A88F5B28DFCED0E2AB964A38F7BD6CFD57C5784A59C07761461DEB3E6561B809E9C76EEE87FD3DE6023A8E4FE3C0E0B35449922345E308CDDD4E0161AD4E5912780FC492B9EBE70E642537F243BAFDCC129415358 + +Hash = SHA-256 +Signature = 4CF9E0866DCA62AF7E49B1BCC2C7DE589238E2C6B592A05AFBFB3B48078477D1204CFEE8EE7EEDF9254FB86A162ED1C87B2892811B51DCF305FD0946DA94F06B086F4908EC8AE3E680EDBE29B9E52B9856C6E4E134810408C062A6E8D383C585D3D5A5D6202379FD765E80C74C9E6760A03DC2F02B8342EBA09BC71DB3F6B394 + +Hash = SHA-384 +Signature = 7FF6052F11A704057815619986D820B357404B6EC085FC7F0745BF2098A06C4CB6624713259281E3EF8A99DBD643BA45C94DC96EFD9577E7C4E5913F888224530A22E727CF63B8FE86F191D198244A12E7BB10E610E4A704246EEC676DCDB4D134D2052ECB067B506A7ECB68AC5C6CFBD36461B79F1C00DAEC826053819C88EB + +Hash = SHA-512 +Signature = 53A5E6AB40FA0092DAA5D57307D60288FD1EFEA3D87CC8AFEC926D5D5850C584BDD24924056670CE54E68C273EEF6227708D052F14AE21F34417279DDE107A4F2445FD8D08F6DF2933D2A16C9851022D7D62C370B08F65282BCD0425CC3938C0D4B1069D430AFA1ACC5F0A708458E821AE448D9036634961709E1AEBE30FAAC7 + +Msg = 74657374 + +Hash = SHA-1 +Signature = 1A17F1667459C2725AF2295739DB03A8E01D2DF796744D6A0345181ACBCFFE09EDEDD5C38104F4CD190F7E36269322AAEA6CB909AEB580EB80DDF9C90246B45F46084FEC2E22ACB8A73589539AAAAF826CCCA560F426E43B1EED0E0322AE6AD84CAE7B1A313D2DF2D113A36306F0D9D7DC72824DC355AD0323B1FD10742E32C8 + +Hash = SHA-224 +Signature = 95869AF9CB492DB00FE123B30F682E9B97054F9B29DBA6396FCEAFA4ECAA30317441AA526CC5FD666A920072FECBA1761141140CC1EC37C359A51ED3B22742C93C072CAD99DF9397320FF7A4B2AAF699D1657461BFEC85A81A0B194D6669DFA94BA7B7803930289E1D27B7CFE216EA3821AAD80C5E7D94BD8E532678CDFA4B25 + +Hash = SHA-256 +Signature = 0F008D33B72EBDFA4B712B9507E17AE14F228A9E3F3B94C71BAAEB78C811EDDA3750ECF54A70E7F30ABF4B358C787FCFA22631D4D258D023C32464F6C977BB40599024AAF2853937CB04E9D42976CD11CDC3706258571C7383300BC8576BE63B58D247C37961F78F70D38A2E959DFBE4D7E4D83FBE5541AEDD6E2C4CCDBEF97F + +Hash = SHA-384 +Signature = 68A9D5E7EB435DB2BD4EA20BEBBBFD17DEADADC318E88D87C7799B68EFB423BFA48F691A2A52BDD972CDECA3C4DBBABD486199D2D1B33C683CB8C237C8F6F4955C14B440C7FA677D809007A9F03D1F6A55181A9438066E226BF3785FD55130ABB6D13A78FA7AFCCC28C442004C4EC1FBCC75D7C9FF7D64F16FE75833860B4078 + +Hash = SHA-512 +Signature = 582D94BDDA4C53EF4148AA4663D5183F122A5E4210E955E2D28E00C00EFC41FB91B340915C0D8C47A0AE7FEBD12A5C2DF1C72DD9DD7369A818689F5F3D5D1E5BA7F13830FCB00FC85A9DA30314BBC11CD8ECA63D296237ADD513B30C8D9A33C590BE0927C5E879207A3B84B317BB859590832818C0DD054FD6F709C8D24BFC56 + +# secp160r1 RFC 6979 signatures, generated by botan + +Group = secp160r1 +X = 0x6FAB034934E4C0FC9AE67F5B5659A9D7D1FEFD18 + +Msg = 73616D706C65 +Hash = SHA-1 +Signature = 00CC9CD383D3EA80ADC9165C25F6F82A2ABB41943E00A74AEB2B96B8F7D6FC03F67ED226FCE0BAA6D7EB + +Hash = SHA-224 +Signature = 00AB01FAF31D1044023725665A95CE1AEF6680CE6E00ECEE1D6FED07ACF9ED7F197D2C29022D1592E5DF + +Hash = SHA-256 +Signature = 00766B26E5C3201982F5B3AB1AC92C018F5A990CB6008C16BF4AB8CF6EE3ED4A821B3A890CD30E2F6925 + +Hash = SHA-384 +Signature = 009AD138B36636B550705112D14574EF6E7996263F00F360D79AD85661B305D56D64A20DA33182E1462B + +Hash = SHA-512 +Signature = 0024A0B0069722A4A3DDAF40B0EE66BAD0B117D658003A6DB6DEEF2EB563115FA48D7E0FECB540802E13 + +Msg = 74657374 + +Hash = SHA-1 +Signature = 007FF876220B4EAF1E1F9C9694685CDA37B1DF45CA00D2A7917831648FB5A3351C22ED605BA8B8B6C16C + +Hash = SHA-224 +Signature = 00A616A5A4C482D60F44900916D9665BFD090854FC003BD6C529D45F5F70BD6F242981E23A119EEAE23A + +Hash = SHA-256 +Signature = 007F281E95A74F5EF24B40D489AD270284E8E52E5D00F4803ACFD86356DC95E9AD39930C09050C6CCA4B + +Hash = SHA-384 +Signature = 00C114E2B133AD8E725AF43AEFC381BE87063DB3FC00CAFAEB1949015CF4EC9EC2476F3970D3D97E08FF + +Hash = SHA-512 +Signature = 0080F3C4742E7341BE2E4D86E88757AB96F62427B500FD634D64F554BEC04211952798147420BBC98E15 diff --git a/src/tests/test_ecdsa.cpp b/src/tests/test_ecdsa.cpp index e413d04df..fa7e03001 100644 --- a/src/tests/test_ecdsa.cpp +++ b/src/tests/test_ecdsa.cpp @@ -31,7 +31,8 @@ size_t ecdsa_sig_kat(const std::string& group_id, PK_Verifier verify(ecdsa, padding); PK_Signer sign(ecdsa, padding); - return validate_signature(verify, sign, "DSA/" + hash, msg, rng, nonce, signature); + return validate_signature(verify, sign, "ECDSA/" + group_id + '/' + hash, + msg, rng, nonce, signature); } size_t ecc_point_mul(const std::string& group_id, -- cgit v1.2.3