diff options
author | Jack Lloyd <[email protected]> | 2018-05-31 20:47:38 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-05-31 20:47:38 -0400 |
commit | 9a58ec0b5b9ef491985f160d6f04c9ba834c22bb (patch) | |
tree | 688c44e353b5bda4c63d9e99ca26a983712a2268 | |
parent | 027faff1357c738483f5dd33f88b01949a9a7205 (diff) | |
parent | 2f08b493b3ad817673a8c49cebb017cff61b6eb3 (diff) |
Merge GH #1594 Add EdDSA/X25519 Wycheproof tests
-rw-r--r-- | src/tests/data/pubkey/ed25519.vec | 237 | ||||
-rw-r--r-- | src/tests/data/pubkey/ed25519_verify.vec | 194 | ||||
-rw-r--r-- | src/tests/data/pubkey/x25519.vec | 363 | ||||
-rw-r--r-- | src/tests/test_c25519.cpp | 28 | ||||
-rw-r--r-- | src/tests/test_ed25519.cpp | 10 |
5 files changed, 831 insertions, 1 deletions
diff --git a/src/tests/data/pubkey/ed25519.vec b/src/tests/data/pubkey/ed25519.vec index 87a9c8684..da328259b 100644 --- a/src/tests/data/pubkey/ed25519.vec +++ b/src/tests/data/pubkey/ed25519.vec @@ -3305,3 +3305,240 @@ Privkey = 1a8b1ff05ded48e18bf50166c664ab023ea70003d78d9e41f5758a91d850f8d2 Pubkey = 3f098994bdd916ed4053197934e4a87c80733a1280d62f8010992e43ee3b2406 Msg = f6220a3f757814f4c2176ffbb68b00249cd4ccdc059c4b34ad871f30b1740280 Signature = 56f90cca98e2102637bd983fdb16c131dfd27ed82bf4dde5606e0d756aed3366d09c4fa11527f038e0f57f2201d82f2ea2c9033265fa6ceb489e854bae61b404 + +# From Wycheproof + +# Test 1 +Privkey = add4bb8103785baf9ac534258e8aaf65f5f1adb5ef5f3df19bb80ab989c4d64b +Pubkey = 7d4d0e7f6153a69b6242b522abbee685fda4420f8834b108c3bdae369ef549fa +Msg = +Signature = d4fbdb52bfa726b44d1786a8c0d171c3e62ca83c9e5bbe63de0bb2483f8fd6cc1429ab72cafc41ab56af02ff8fcc43b99bfe4c7ae940f60f38ebaa9d311c4007 + +# Test 2 +Msg = 78 +Signature = d80737358ede548acb173ef7e0399f83392fe8125b2ce877de7975d8b726ef5b1e76632280ee38afad12125ea44b961bf92f1178c9fa819d020869975bcbe109 + +# Test 3 +Msg = 54657374 +Signature = 7c38e026f29e14aabd059a0f2db8b0cd783040609a8be684db12f82a27774ab07a9155711ecfaf7f99f277bad0c6ae7e39d4eef676573336a5c51eb6f946b30d + +# Test 4 +Msg = 48656c6c6f +Signature = 1c1ad976cbaae3b31dee07971cf92c928ce2091a85f5899f5e11ecec90fc9f8e93df18c5037ec9b29c07195ad284e63d548cd0a6fe358cc775bd6c1608d2c905 + +# Test 5 +Msg = 313233343030 +Signature = 657c1492402ab5ce03e2c3a7f0384d051b9cf3570f1207fc78c1bcc98c281c2bf0cf5b3a289976458a1be6277a5055545253b45b07dcc1abd96c8b989c00f301 + +# Test 6 +Msg = 000000000000000000000000 +Signature = d46543bfb892f84ec124dcdfc847034c19363bf3fc2fa89b1267833a14856e52e60736918783f950b6f1dd8d40dc343247cd43ce054c2d68ef974f7ed0f3c60f + +# Test 7 +Msg = 6161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161 +Signature = 879350045543bc14ed2c08939b68c30d22251d83e018cacbaf0c9d7a48db577e80bdf76ce99e5926762bc13b7b3483260a5ef63d07e34b58eb9c14621ac92f00 + +# Test 8 +Msg = 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f60 +Signature = 7bdc3f9919a05f1d5db4a3ada896094f6871c1f37afc75db82ec3147d84d6f237b7e5ecc26b59cfea0c7eaf1052dc427b0f724615be9c3d3e01356c65b9b5109 + +# Test 9 +Msg = ffffffffffffffffffffffffffffffff +Signature = 5dbd7360e55aa38e855d6ad48c34bd35b7871628508906861a7c4776765ed7d1e13d910faabd689ec8618b78295c8ab8f0e19c8b4b43eb8685778499e943ae04 + +# Test 69 +Privkey = 0a23a20072891237aa0864b5765139514908787878cd77135a0059881d313f00 +Pubkey = a12c2beb77265f2aac953b5009349d94155a03ada416aad451319480e983ca4c +Msg = +Signature = 5056325d2ab440bf30bbf0f7173199aa8b4e6fbc091cf3eb6bc6cf87cd73d992ffc216c85e4ab5b8a0bbc7e9a6e9f8d33b7f6e5ac0ffdc22d9fcaf784af84302 + +# Test 70 +Msg = 78 +Signature = 481fafbf4364d7b682475282f517a3ac0538c9a6b6a562e99a3d8e5afb4f90a559b056b9f07af023905753b02d95eb329a35c77f154b79abbcd291615ce42f02 + +# Test 71 +Msg = 54657374 +Signature = 8a9bb4c465a3863abc9fd0dd35d80bb28f7d33d37d74679802d63f82b20da114b8d765a1206b3e9ad7cf2b2d8d778bb8651f1fa992db293c0039eacb6161480f + +# Test 72 +Msg = 48656c6c6f +Signature = d839c20abfda1fd429531831c64f813f84b913e9928540310cf060b44c3dbf9457d44a7721fdc0d67724ff81cb450dd39b10cfb65db15dda4b8bf09d26bd3801 + +# Test 73 +Msg = 313233343030 +Signature = 9bbb1052dcfa8ad2715c2eb716ae4f1902dea353d42ee09fd4c0b4fcb8b52b5219e2200016e1199d0061891c263e31b0bc3b55673c19610c4e0fa5408004160b + +# Test 74 +Msg = 000000000000000000000000 +Signature = f63b5c0667c7897fc283296416f7f60e84bbde9cbd832e56be463ed9f568069702b17a2f7c341ebf590706a6388ac76ac613c1675ec0f2c7118f2573422a500b + +# Test 75 +Msg = 6161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161 +Signature = 1bc44d7001e6b5b9090fef34b2ca480f9786bbefa7d279353e5881e8dfb91b803ccd46500e270ef0109bfd741037558832120bc2a4f20fbe7b5fb3c3aaf23e08 + +# Test 76 +Msg = 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f60 +Signature = ea8e22143b02372e76e99aece3ed36aec529768a27e2bb49bdc135d44378061e1f62d1ac518f33ebf37b2ee8cc6dde68a4bd7d4a2f4d6cb77f015f71ca9fc30d + +# Test 77 +Msg = ffffffffffffffffffffffffffffffff +Signature = 8acd679e1a914fc45d5fa83d3021f0509c805c8d271df54e52f43cfbd00cb6222bf81d58fe1de2de378df67ee9f453786626961fe50a9b05f12b6f0899ebdd0a + +# Test 78 (draft-josefsson-eddsa-ed25519-02: Test 1) +Privkey = 9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60 +Pubkey = d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a +Msg = +Signature = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b + +# Test 79 (draft-josefsson-eddsa-ed25519-02: Test 2) +Privkey = 4ccd089b28ff96da9db6c346ec114e0f5b8a319f35aba624da8cf6ed4fb8a6fb +Pubkey = 3d4017c3e843895a92b70aa74d1b7ebc9c982ccf2ec4968cc0cd55f12af4660c +Msg = 72 +Signature = 92a009a9f0d4cab8720e820b5f642540a2b27b5416503f8fb3762223ebdb69da085ac1e43e15996e458f3613d0f11d8c387b2eaeb4302aeeb00d291612bb0c00 + +# Test 80 (draft-josefsson-eddsa-ed25519-02: Test 3) +Privkey = c5aa8df43f9f837bedb7442f31dcb7b166d38535076f094b85ce3a2e0b4458f7 +Pubkey = fc51cd8e6218a1a38da47ed00230f0580816ed13ba3303ac5deb911548908025 +Msg = af82 +Signature = 6291d657deec24024827e69c3abe01a30ce548a284743a445e3680d7db5ac3ac18ff9b538d16f290ae67f760984dc6594a7c15e9716ed28dc027beceea1ec40a + +# Test 81 (draft-josefsson-eddsa-ed25519-02: Test 1024) +Privkey = f5e5767cf153319517630f226876b86c8160cc583bc013744c6bf255f5cc0ee5 +Pubkey = 278117fc144c72340f67d0f2316e8386ceffbf2b2428c9c51fef7c597f1d426e +Msg = 08b8b2b733424243760fe426a4b54908632110a66c2f6591eabd3345e3e4eb98fa6e264bf09efe12ee50f8f54e9f77b1e355f6c50544e23fb1433ddf73be84d879de7c0046dc4996d9e773f4bc9efe5738829adb26c81b37c93a1b270b20329d658675fc6ea534e0810a4432826bf58c941efb65d57a338bbd2e26640f89ffbc1a858efcb8550ee3a5e1998bd177e93a7363c344fe6b199ee5d02e82d522c4feba15452f80288a821a579116ec6dad2b3b310da903401aa62100ab5d1a36553e06203b33890cc9b832f79ef80560ccb9a39ce767967ed628c6ad573cb116dbefefd75499da96bd68a8a97b928a8bbc103b6621fcde2beca1231d206be6cd9ec7aff6f6c94fcd7204ed3455c68c83f4a41da4af2b74ef5c53f1d8ac70bdcb7ed185ce81bd84359d44254d95629e9855a94a7c1958d1f8ada5d0532ed8a5aa3fb2d17ba70eb6248e594e1a2297acbbb39d502f1a8c6eb6f1ce22b3de1a1f40cc24554119a831a9aad6079cad88425de6bde1a9187ebb6092cf67bf2b13fd65f27088d78b7e883c8759d2c4f5c65adb7553878ad575f9fad878e80a0c9ba63bcbcc2732e69485bbc9c90bfbd62481d9089beccf80cfe2df16a2cf65bd92dd597b0707e0917af48bbb75fed413d238f5555a7a569d80c3414a8d0859dc65a46128bab27af87a71314f318c782b23ebfe808b82b0ce26401d2e22f04d83d1255dc51addd3b75a2b1ae0784504df543af8969be3ea7082ff7fc9888c144da2af58429ec96031dbcad3dad9af0dcbaaaf268cb8fcffead94f3c7ca495e056a9b47acdb751fb73e666c6c655ade8297297d07ad1ba5e43f1bca32301651339e22904cc8c42f58c30c04aafdb038dda0847dd988dcda6f3bfd15c4b4c4525004aa06eeff8ca61783aacec57fb3d1f92b0fe2fd1a85f6724517b65e614ad6808d6f6ee34dff7310fdc82aebfd904b01e1dc54b2927094b2db68d6f903b68401adebf5a7e08d78ff4ef5d63653a65040cf9bfd4aca7984a74d37145986780fc0b16ac451649de6188a7dbdf191f64b5fc5e2ab47b57f7f7276cd419c17a3ca8e1b939ae49e488acba6b965610b5480109c8b17b80e1b7b750dfc7598d5d5011fd2dcc5600a32ef5b52a1ecc820e308aa342721aac0943bf6686b64b2579376504ccc493d97e6aed3fb0f9cd71a43dd497f01f17c0e2cb3797aa2a2f256656168e6c496afc5fb93246f6b1116398a346f1a641f3b041e989f7914f90cc2c7fff357876e506b50d334ba77c225bc307ba537152f3f1610e4eafe595f6d9d90d11faa933a15ef1369546868a7f3a45a96768d40fd9d03412c091c6315cf4fde7cb68606937380db2eaaa707b4c4185c32eddcdd306705e4dc1ffc872eeee475a64dfac86aba41c0618983f8741c5ef68d3a101e8a3b8cac60c905c15fc910840b94c00a0b9d0 +Signature = 0aab4c900501b3e24d7cdf4663326a3a87df5e4843b2cbdb67cbf6e460fec350aa5371b1508f9f4528ecea23c436d94b5e8fcd4f681e30a6ac00a9704a188a03 + +# Test 82 (Random test failure 1) +Privkey = d7ad3f1f6bbe0477c3c357a806a19eb41ae3f94025035bc87f281f8ee9fc0e34 +Pubkey = 8fd659b77b558ed93882c1157438450ac86ec62d421d568e98ee236f3810295a +Msg = b0729a713593a92e46b56eaa66b9e435f7a09a8e7de03b078f6f282285276635f301e7aaafe42187c45d6f5b13f9f16b11195cc125c05b90d24dfe4c +Signature = 7db17557ac470c0eda4eedaabce99197ab62565653cf911f632ee8be0e5ffcfc88fb94276b42e0798fd3aa2f0318be7fc6a29fae75f70c3dcdc414a0ad866601 + +# Test 83 (Random test failure 2) +Privkey = ad9b22793336fcdac10e136c4deea599be187a38eef91c1cf7c7a4ec884dda08 +Pubkey = 2a606bf67ac770c607038b004101b325edb569efd3413d2d1f2c3e6b4e6e3082 +Msg = a8546e50ba31cae3234310d32672447be213fad91a227a19669c53d309b959782b0e6b71f8791fdb470043b58122003157d2d96a43a6cbd7d3a8d86bf4c97391883e268d50af80e1e6e12939c2bd50ca746cdadfad4edf1bda875299740724148efb1ebe73fb60088cda890317658627a5f7ab5a0c075d9d8f3f97b6492b35519e50ff6b38377432a7081f9176bb1c29a862deac1336ca20b097a47829cec10a6a7cec178eda2d12f6dc6c87f910454af0123555ba184e68804d9cced60fd5c8c90943e56599c8f0ba59a38491ba5e5a53460682474c07e40ca142983314fd762856bb1093f359da6eb0a756bd93a3160c10dd8feea6b97e7c6a17cb54bd5d7649c05c66d7bdee056671dfdaf689fa3945bb8e29a429f4bd5d355dce9687b06f01d5e33e3999f0e8 +Signature = 67d84d4c3945aaf06e06d524be63acbfb5dbb1988c4aea96a5ee9f7a9b9eecc29df4f66b8aa1d9e8607a58fb1ef0c2ad69aac005b4f58e34103344a9c8871a09 + +# Test 84 (Random test failure 24) +Msg = b477b0480bb84642608b908d29a51cf2fce63f24ee95 +Signature = 28fafbb62b4d688fa79e1ac92851f46e319b161f801d4dc09acc21fdd6780a2c4292b8c1003c61c2bcebe7f3f88ccc4bb26d407387c5f27cb8c94cf6ce810405 + +# Test 85 (Random test failure 3) +Privkey = 04a6553d68a9baef78a2175af375458eaa01cdb77350c61e282ef5f0c7116599 +Pubkey = c9c946cbc5544ac74eef491f07c5881c16faf7ec31ce4aa91bb60ae7b4539051 +Msg = cd2212eddb0706f62c995cef958634f0cb7793444cbf4d30e81c27c41ebea6cb02607510131f9c015692dfd521b148841e9a2d3564d20ac401f6cb8e40f520fe0cafbeaa88840b83013369d879f013463fe52a13267aa0c8c59c45cde9399cd1e6be8cc64cf48315ac2eb31a1c567a4fb7d601746d1f63b5ac020712adbbe07519bded6f +Signature = 24087d47f3e20af51b9668ae0a88ce76586802d0ec75d8c0f28fc30962b5e1d1a1d509571a1624ed125a8df92a6e963728d6b5de99200b8e285f70feb6f05207 + +# Test 86 (Random test failure 20) +Msg = 27d465bc632743522aefa23c +Signature = c2656951e2a0285585a51ff0eda7e9a23c2dfd2ffa273aee7808f4604e8f9a8c8ea49e9fce4eb2d8d75d36b7238fe6fc13b6c5d9427dd58f8c6615d033c0bd0f + +# Test 87 (Random test failure 4) +Privkey = c367c8d2ebeeecd70c1e8985b70c3808b75657f243b21ba4f322792540e92257 +Pubkey = 32ad026f693d0d2afe7f4388d91c4c964426fcb9e3665c3ebd8650009b815c8e +Msg = ec5c7cb078 +Signature = d920d421a5956b69bfe1ba834c025e2babb6c7a6d78c97de1d9bb1116dfdd1185147b2887e34e15578172e150774275ea2aad9e02106f7e8ca1caa669a066f0c + +# Test 88 (Random test failure 5) +Msg = 4668c6a76f0e482190a7175b9f3806a5fe4314a004fa69f988373f7a +Signature = 4f62daf7f7c162038552ad7d306e195baa37ecf6ca7604142679d7d1128e1f8af52e4cb3545748c44ef1ff1c64e877e4f4d248259b7f6eb56e3ef72097dc8e0c + +# Test 89 (Random test failure 8) +Msg = 5dc9bb87eb11621a93f92abe53515697d2611b2eef73 +Signature = deecafb6f2ede73fec91a6f10e45b9c1c61c4b9bfbe6b6147e2de0b1df6938971f7896c3ab83851fb5d9e537037bff0fca0ccb4a3cc38f056f91f7d7a0557e08 + +# Test 90 (Random test failure 10) +Msg = 7dcfe60f881e1285676f35b68a1b2dbcdd7be6f719a288ababc28d36e3a42ac3010a1ca54b32760e74 +Signature = 7f8663cf98cbd39d5ff553f00bcf3d0d520605794f8866ce75714d77cc51e66c91818b657d7b0dae430a68353506edc4a714c345f5ddb5c8b958ba3d035f7a01 + +# Test 91 (Random test failure 12) +Msg = 58e456064dff471109def4ca27fa8310a1df32739655b624f27e6418d34b7f007173f3faa5 +Signature = 6aab49e5c0bc309b783378ee03ffda282f0185cdf94c847701ff307a6ee8d0865411c44e0a8206f6a5f606107451940c2593af790ce1860f4c14ab25b2deae08 + +# Test 92 (Random test failure 15) +Msg = a1 +Signature = 1a74ed2cbdc7d8f3827014e8e6ecf8fd2698ac8f86833acccdd400df710fe0d6b0543c9cfa00d52bf024ab7ce0d91981944097233ec134d5c7abbd44bfd32d0d + +# Test 93 (Random test failure 19) +Msg = 11cb1eafa4c42a8402c4193c4696f7b2e6d4585e4b42dcf1a8b67a80b2da80bc9d4b649fb2f35eaf1f56c426fd0b +Signature = 14ceb2eaf4688d995d482f44852d71ad878cd7c77b41e60b0065fd01a59b054ee74759224187dbde9e59a763a70277c960892ef89fba997aba2576b2c54ba608 + +# Test 94 (Random test failure 25) +Msg = aa365b442d12b7f3c925 +Signature = 83c40ce13d483cc58ff65844875862d93df4bd367af77efa469ec06a8ed9e6d7905a04879535708ddf225567a815c9b941d405c98e918fd0c151165cea7fb101 + +# Test 95 (Random test failure 28) +Msg = 475f +Signature = 71a4a06a34075f2fd47bc3abf4714d46db7e97b08cb6180d3f1539ac50b18ce51f8af8ae95ed21d4fa0daab7235925631ecea1fd9d0d8a2ba7a7583fd04b900c + +# Test 96 (Random test failure 6) +Privkey = 56c1e22d616cbb6dea869288b4b1c02bb98696583c2f6e650013a03e17049c62 +Pubkey = c29ec1894e06d27b4e40486b4fa5063d66a746c7f9c323b12203c03b72b8b78a +Msg = 0f325ffd87e58131ffa23c05ea4579513b287fdba87b44 +Signature = 6669acf94667c5b541afe5307bde9476b13ae7e0e6058a772101ac8eb0a94331428eb4db0a2c68a9b6c1763b8624dab259b0876cdcfaeacc17b21a18e3fc010a + +# Test 97 (Random test failure 21) +Msg = 5ffa +Signature = 931e5152fcef078c22cc5d6a3a65f06e396289f6f5f2d1efa6340254a53526ef5dc6874eeddf35c3f50991c53cd02bf06313e37d93ee1f7022128ffa3b8f300b + +# Test 98 (Random test failure 7) +Privkey = b7d2f64276df417fed27d8e15b4e90f6fd93dace707294c338bd32bc4bbd8fdb +Pubkey = cfda5b899e35764c5229e59295fe1222b7ddce176643697c29e46ecbba10cf10 +Msg = ec5c7cb078 +Signature = 30490c28f806298225df62103521dcee047153912c33ab8ab8bbdd1ffabd70fd4fdb360f05be535b067d1cf4e78c2cb432206bf280aab3bd21aaa1cb894c5b06 + +# Test 99 (Random test failure 9) +Msg = 67484059b2490b1a0a4f8dee77979e26 +Signature = 4cd4f77ed473a6647387f3163541c67a1708a3c3bd1673247cb87f0cb68b3c56f04bfa72970c8a483efe659c87009ab4020b590b6641316b3deddb5450544e02 + +# Test 100 (Random test failure 11) +Msg = a020a4381dc9141f47ee508871ab7a8b5a3648727c4281ae9932376f23a8e1bcda0626b7129197d864178631ec89c4332dbb18 +Signature = 1e41a24fe732bd7cab14c2a2f5134ee8c87fcbd2e987e60957ed9239e5c32404d56977e1b4282871896cb10625a1937468e4dc266e16a9c1b8e9891177eca802 + +# Test 101 (Random test failure 14) +Msg = a25176b3afea318b2ec11ddacb10caf7179c0b3f8eabbfa2895581138d3c1e0e +Signature = 2a833aadecd9f28235cb5896bf3781521dc71f28af2e91dbe1735a61dce3e31ac15ca24b3fc47817a59d386bbbb2ce60a6adc0a2703bb2bdea8f70f91051f706 + +# Test 102 (Random test failure 18) +Msg = a9e6d94870a67a9fe1cf13b1e6f9150cdd407bf6480ec841ea586ae3935e9787163cf419c1 +Signature = c97e3190f83bae7729ba473ad46b420b8aad735f0808ea42c0f898ccfe6addd4fd9d9fa3355d5e67ee21ab7e1f805cd07f1fce980e307f4d7ad36cc924eef00c + +# Test 103 (Random test failure 13) +Privkey = 7d597c3b7283929d07ed8f01f31d2596823e5e46ab226c7be4234d1a9dcaef37 +Pubkey = 529919c9c780985a841c42ba6c180ff2d67a276ccfbe281080e47ab71a758f56 +Msg = e1cbf2d86827825613fb7a85811d +Signature = 01abfa4d6bbc726b196928ec84fd03f0c953a4fa2b228249562ff1442a4f63a7150b064f3712b51c2af768d2c2711a71aabf8d186833e941a0301b82f0502905 + +# Test 104 (Random test failure 22) +Msg = 25 +Signature = e4ae21f7a8f4b3b325c161a8c6e53e2edd7005b9c2f8a2e3b0ac4ba94aa80be6f2ee22ac8d4a96b9a3eb73a825e7bb5aff4a3393bf5b4a38119e9c9b1b041106 + +# Test 105 (Random test failure 16) +Privkey = f401cee4bfb1732f0e9b8d8ba79469565c3115296141dbdf7e9c311a0ac1823b +Pubkey = 2252b3d57c74cbf8bc460dc2e082847926bc022f09ab6ae95756362bfd1167c1 +Msg = 975ef941710071a9e1e6325a0c860becd7c695b5117c3107b686e330e5 +Signature = af0fd9dda7e03e12313410d8d8844ebb6fe6b7f65141f22d7bcba5695a25414a9e54326fb44d59fb14707899a8aae70857b23d4080d7ab2c396ef3a36d45ce02 + +# Test 106 (Random test failure 23) +Msg = 80fdd6218f29c8c8f6bd820945f9b0854e3a8824 +Signature = e097e0bd0370bff5bde359175a11b728ee9639095d5df8eda496395565616edfe079977f7d4dc8c75d6113a83d6a55e6e1676408c0967a2906339b43337dcb01 + +# Test 107 (Random test failure 17) +Privkey = 3d658956410377d0644676d2599542412a4f3b0e4eadfb7f3f836615f42b18bc +Pubkey = c0a773110f975de3732355bb7ec7f0c41c091c0252966070205516693b992a4a +Msg = +Signature = 0280427e713378f49d478df6373c6cac847b622b567daa2376c839e7ac10e22c380ab0fa8617c9dcfe76c4d9db5459b21dc1413726e46cc8f387d359e344f407 + +# Test 108 (Random test failure 26) +Privkey = bccb61323840c2a96fc36f7e54ea6c8e55f9d221f7f05791ed60025e06064439 +Pubkey = 54cda623245759ad6d43e620a606908befc633d60792bc7798447a0ef38e7311 +Msg = 27e792b28b2f1702 +Signature = 14d9b497c19b91d43481c55bb6f5056de252d9ecb637575c807e58e9b4c5eac8b284089d97e2192dc242014363208e2c9a3435edf8928fb1d893553e9be4c703 + +# Test 109 (Random test failure 27) +Privkey = f2d3023b9c19e241748bc4039a7a43c595701f23675505015213a8a2a0274c1b +Pubkey = 2362bac514d5fad33802642e979a1e82de6eb6f1bcbf6a5b304f2bb02b9e57fe +Msg = eef3bb0f617c17d0420c115c21c28e3762edc7b7fb048529b84a9c2bc6 +Signature = 242ddb3a5d938d07af690b1b0ef0fa75842c5f9549bf39c8750f75614c712e7cbaf2e37cc0799db38b858d41aec5b9dd2fca6a3c8e082c10408e2cf3932b9d08 + diff --git a/src/tests/data/pubkey/ed25519_verify.vec b/src/tests/data/pubkey/ed25519_verify.vec index ad918969c..326a92ad3 100644 --- a/src/tests/data/pubkey/ed25519_verify.vec +++ b/src/tests/data/pubkey/ed25519_verify.vec @@ -1,7 +1,199 @@ [Pure] +Valid = 0 + # OSS-Fuzz #7156 Pubkey = 29A5670182010000000000002007643AE1720EF35AA223252F021A68F707511A Msg = 30820143A0030201020209009C28A1A9B4502044300506032B65703045310B30090603550406130241553113301106035504080C0A536F6D652D53746174653121301F060355040A0C18496E7465726E6574205769646769747320507479204C7464301E170D3134303432333233323135375A170D3134303532333233323135375A3045310B30090603550406130241553113301106035504080C0A536F6D652D53746174653121301F060355040A0C18496E7465726E6574205769646769747320507479204C7464302A300506032B657003210029A5670182010000000000002007643AE1720EF35AA223252F021A68F707511AA350304E301D060362E3E704160414A29B7B795F9F24ADAFDDA87A40F526963D7FFBB5301F0603555F2304183016821421EC7B795F9F1F000000A87AC0F53D7FB5963FFB300C0603551DAA040530030101FF -Valid = 0 Signature = 6EFA4FC58BA3BCF7C51598710C8D7182857E28C06D8C310BB5090603550406132020202020202020202020202020202020202020202020202020202020202016 + +# Wycheproof invalid tests +# (Valid tests are test in both sign and verify direction) + +# Test 10 (special values for r and s) +Pubkey = 7d4d0e7f6153a69b6242b522abbee685fda4420f8834b108c3bdae369ef549fa +Msg = 3f +Valid = 0 +Signature = 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + +# Test 11 (special values for r and s) +Signature = 00000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000 + +# Test 12 (special values for r and s) +Signature = 0000000000000000000000000000000000000000000000000000000000000000ecd3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010 + +# Test 13 (special values for r and s) +Signature = 0000000000000000000000000000000000000000000000000000000000000000edd3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010 + +# Test 14 (special values for r and s) +Signature = 0000000000000000000000000000000000000000000000000000000000000000edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f + +# Test 15 (special values for r and s) +Signature = 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + +# Test 16 (special values for r and s) +Signature = 01000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000 + +# Test 17 (special values for r and s) +Signature = 0100000000000000000000000000000000000000000000000000000000000000ecd3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010 + +# Test 18 (special values for r and s) +Signature = 0100000000000000000000000000000000000000000000000000000000000000edd3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010 + +# Test 19 (special values for r and s) +Signature = 0100000000000000000000000000000000000000000000000000000000000000edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f + +# Test 20 (special values for r and s) +Signature = edd3f55c1a631258d69cf7a2def9de14000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000 + +# Test 21 (special values for r and s) +Signature = edd3f55c1a631258d69cf7a2def9de14000000000000000000000000000000100100000000000000000000000000000000000000000000000000000000000000 + +# Test 22 (special values for r and s) +Signature = edd3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010ecd3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010 + +# Test 23 (special values for r and s) +Signature = edd3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010edd3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010 + +# Test 24 (special values for r and s) +Signature = edd3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f + +# Test 25 (special values for r and s) +Signature = edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000 + +# Test 26 (special values for r and s) +Signature = edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f0100000000000000000000000000000000000000000000000000000000000000 + +# Test 27 (special values for r and s) +Signature = edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fecd3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010 + +# Test 28 (special values for r and s) +Signature = edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fedd3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010 + +# Test 29 (special values for r and s) +Signature = edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fedffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f + +# Test 30 (empty signature) +Msg = 54657374 +Signature = + +# Test 31 (s missing) +Signature = 7c38e026f29e14aabd059a0f2db8b0cd783040609a8be684db12f82a27774ab0 + +# Test 32 (signature too short) +Signature = 7c38e026f29e14aabd059a0f2db8b0cd783040609a8be684db12f82a27774ab07a9155711ecfaf7f99f277bad0c6ae7e39d4eef676573336a5c51eb6f946 + +# Test 33 (signature too long) +Signature = 7c38e026f29e14aabd059a0f2db8b0cd783040609a8be684db12f82a27774ab07a9155711ecfaf7f99f277bad0c6ae7e39d4eef676573336a5c51eb6f946b30d2020 + +# Test 34 (include pk in signature) +Signature = 7c38e026f29e14aabd059a0f2db8b0cd783040609a8be684db12f82a27774ab07a9155711ecfaf7f99f277bad0c6ae7e39d4eef676573336a5c51eb6f946b30d7d4d0e7f6153a69b6242b522abbee685fda4420f8834b108c3bdae369ef549fa + +# Test 35 (prepending 0 byte to signature) +Signature = 007c38e026f29e14aabd059a0f2db8b0cd783040609a8be684db12f82a27774ab07a9155711ecfaf7f99f277bad0c6ae7e39d4eef676573336a5c51eb6f946b30d + +# Test 36 (prepending 0 byte to s) +Signature = 7c38e026f29e14aabd059a0f2db8b0cd783040609a8be684db12f82a27774ab0007a9155711ecfaf7f99f277bad0c6ae7e39d4eef676573336a5c51eb6f946b30d + +# Test 37 (appending 0 byte to signature) +Signature = 7c38e026f29e14aabd059a0f2db8b0cd783040609a8be684db12f82a27774ab07a9155711ecfaf7f99f277bad0c6ae7e39d4eef676573336a5c51eb6f946b30d00 + +# Test 38 (removing 0 byte from signature) +Msg = 54657374313236 +Signature = 7c38e026f29e14aabd059a0f2db8b0cd783040609a8be684db12f82a27774ab09155711ecfaf7f99f277bad0c6ae7e39d4eef676573336a5c51eb6f946b30d + +# Test 39 (removing 0 byte from signature) +Msg = 546573743137 +Signature = 7c38e026f29e14aabd059a0f2db8b0cd783040609a8be684db12f82a27774ab07a9155711ecfaf7f99f277bad0c6ae7e39d4eef676573336a5c51eb6f946b3 + +# Test 40 (modified bit 0 in R) +Msg = 313233343030 +Signature = 647c1492402ab5ce03e2c3a7f0384d051b9cf3570f1207fc78c1bcc98c281c2b1d125e5538f38afbcc1c84e489521083041d24bc6240767029da063271a1ff0c + +# Test 41 (modified bit 1 in R) +Signature = 677c1492402ab5ce03e2c3a7f0384d051b9cf3570f1207fc78c1bcc98c281c2bc108ca4b87a49c9ed2cf383aecad8f54a962b2899da891e12004d7993a627e01 + +# Test 42 (modified bit 2 in R) +Signature = 617c1492402ab5ce03e2c3a7f0384d051b9cf3570f1207fc78c1bcc98c281c2b9ce23fc6213ed5b87912e9bbf92f5e2c780eae26d15c50a112d1e97d2ea33c06 + +# Test 43 (modified bit 7 in R) +Signature = e57c1492402ab5ce03e2c3a7f0384d051b9cf3570f1207fc78c1bcc98c281c2bbb3eb51cd98dddb235a5f46f2bded6af184a58d09cce928bda43f41d69118a03 + +# Test 44 (modified bit 8 in R) +Signature = 657d1492402ab5ce03e2c3a7f0384d051b9cf3570f1207fc78c1bcc98c281c2bcd237dda9a116501f67a5705a854b9adc304f34720803a91b324f2c13e0f5a09 + +# Test 45 (modified bit 16 in R) +Signature = 657c1592402ab5ce03e2c3a7f0384d051b9cf3570f1207fc78c1bcc98c281c2b6b167bbdc0d881cc04d28905552c1876f3709851abc5007376940cc8a435c300 + +# Test 46 (modified bit 31 in R) +Signature = 657c1412402ab5ce03e2c3a7f0384d051b9cf3570f1207fc78c1bcc98c281c2b7fd2ac7da14afffcceeb13f2a0d6b887941cb1a5eb57a52f3cb131a16cce7b0e + +# Test 47 (modified bit 32 in R) +Signature = 657c1492412ab5ce03e2c3a7f0384d051b9cf3570f1207fc78c1bcc98c281c2b7373ba13ebbef99cd2a8ead55ce735c987d85a35320925a8e871702dc7c5c40d + +# Test 48 (modified bit 63 in R) +Signature = 657c1492402ab54e03e2c3a7f0384d051b9cf3570f1207fc78c1bcc98c281c2bd35bd331c03f0855504ca1cab87b83c36a028425a3cf007ede4f4254c261cb00 + +# Test 49 (modified bit 64 in R) +Signature = 657c1492402ab5ce02e2c3a7f0384d051b9cf3570f1207fc78c1bcc98c281c2bcb35101f73cf467deac8c1a03b6c3dc35af544132734b7e57ab20c89b2e4750d + +# Test 50 (modified bit 97 in R) +Signature = 657c1492402ab5ce03e2c3a7f2384d051b9cf3570f1207fc78c1bcc98c281c2bb58d2e8878290bff8d3355fdd4ea381924ee578752354eb6dee678ab4011c301 + +# Test 51 (modified bit 127 in R) +Signature = 657c1492402ab5ce03e2c3a7f0384d851b9cf3570f1207fc78c1bcc98c281c2bb978c866187ffb1cc7b29a0b4045aefc08768df65717194ff0c6e63f4dea0d02 + +# Test 52 (modified bit 240 in R) +Signature = 657c1492402ab5ce03e2c3a7f0384d051b9cf3570f1207fc78c1bcc98c281d2b0576ecf8eaf675f00f3dfbe19f75b83b7607a6c96414f6821af920a2498d0305 + +# Test 53 (modified bit 247 in R) +Signature = 657c1492402ab5ce03e2c3a7f0384d051b9cf3570f1207fc78c1bcc98c289c2be5241a345c7b5428054c74b7c382fa10d4a5f1e8f8b79a71d3fdea2254f1ff0e + +# Test 54 (modified bit 248 in R) +Signature = 657c1492402ab5ce03e2c3a7f0384d051b9cf3570f1207fc78c1bcc98c281c2a63950c85cd6dc96364e768de50ff7732b538f8a0b1615d799190ab600849230e + +# Test 55 (modified bit 253 in R) +Signature = 657c1492402ab5ce03e2c3a7f0384d051b9cf3570f1207fc78c1bcc98c281c0b543bd3da0a56a8c9c152f59c9fec12f31fa66434d48b817b30d90cb4efa8b501 + +# Test 56 (modified bit 254 in R) +Signature = 657c1492402ab5ce03e2c3a7f0384d051b9cf3570f1207fc78c1bcc98c281c6b8da07efd07a6dafb015ed6a32fe136319a972ffbc341f3a0beae97ccf8136505 + +# Test 57 (modified bit 255 in R) +Signature = 657c1492402ab5ce03e2c3a7f0384d051b9cf3570f1207fc78c1bcc98c281cab227aedf259f910f0f3a759a335062665217925d019173b88917eae294f75d40f + +# Test 58 (R==0) +Signature = 0000000000000000000000000000000000000000000000000000000000000000e0b8e7770d51c7a36375d006c5bffd6af43ff54aaf47e4330dc118c71d61ec02 + +# Test 59 (invalid R) +Signature = ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff463a1908382e7eb7693acef9884f7cf931a215e0791876be22c631a59881fd0e + +# Test 60 (all bits flipped in R) +Signature = 9a83eb6dbfd54a31fc1d3c580fc7b2fae4630ca8f0edf803873e433673d7e3d40e94254586cb6188c5386c3febed477cb9a6cb29e3979adc4cb27cf5278fb70a + +# Test 61 (checking malleability ) +Msg = 54657374 + +# This signature verifies, but shouldn't: why? +#Signature = 7c38e026f29e14aabd059a0f2db8b0cd783040609a8be684db12f82a27774ab067654bce3832c2d76f8f6f5dafc08d9339d4eef676573336a5c51eb6f946b31d + +# Test 62 (checking malleability ) +Signature = 7c38e026f29e14aabd059a0f2db8b0cd783040609a8be684db12f82a27774ab05439412b5395d42f462c67008eba6ca839d4eef676573336a5c51eb6f946b32d + +# Test 63 (checking malleability ) +Signature = 7c38e026f29e14aabd059a0f2db8b0cd783040609a8be684db12f82a27774ab02ee12ce5875bf9dff26556464bae2ad239d4eef676573336a5c51eb6f946b34d + +# Test 64 (checking malleability ) +Signature = 7c38e026f29e14aabd059a0f2db8b0cd783040609a8be684db12f82a27774ab0e2300459f1e742404cd934d2c595a6253ad4eef676573336a5c51eb6f946b38d + +# Test 65 (checking malleability ) +Signature = 7c38e026f29e14aabd059a0f2db8b0cd783040609a8be684db12f82a27774ab07a9155711ecfaf7f99f277bad0c6ae7e39d4eef676573336a5c51eb6f946b32d + +# Test 66 (checking malleability ) +Signature = 7c38e026f29e14aabd059a0f2db8b0cd783040609a8be684db12f82a27774ab07a9155711ecfaf7f99f277bad0c6ae7e39d4eef676573336a5c51eb6f946b34d + +# Test 67 (checking malleability ) +Signature = 7c38e026f29e14aabd059a0f2db8b0cd783040609a8be684db12f82a27774ab07a9155711ecfaf7f99f277bad0c6ae7e39d4eef676573336a5c51eb6f946b38d + +# Test 68 (checking malleability ) +Signature = 7c38e026f29e14aabd059a0f2db8b0cd783040609a8be684db12f82a27774ab0679155711ecfaf7f99f277bad0c6ae7e39d4eef676573336a5c51eb6f946b38d + diff --git a/src/tests/data/pubkey/x25519.vec b/src/tests/data/pubkey/x25519.vec new file mode 100644 index 000000000..3148f7be2 --- /dev/null +++ b/src/tests/data/pubkey/x25519.vec @@ -0,0 +1,363 @@ + +# Wycheproof tests + +# Test 1 (normal case) +Secret = 4852834d9d6b77dadeabaaf2e11dca66d19fe74993a7bec36c6e16a0983feaba +CounterKey = 9c647d9ae589b9f58fdc3ca4947efbc915c4b2e08e744a0edf469dac59c8f85a +K = 87b7f212b627f7a54ca5e0bcdaddd5389d9de6156cdbcf8ebe14ffbcfb436551 + +# Test 2 (public key on twist) +Secret = 588c061a50804ac488ad774ac716c3f5ba714b2712e048491379a500211998a8 +CounterKey = 63aa40c6e38346c5caf23a6df0a5e6c80889a08647e551b3563449befcfc9733 +K = b1a707519495ffffb298ff941716b06dfab87cf8d91123fe2be9a233dda22212 + +# Test 3 (public key on twist) +Secret = b05bfd32e55325d9fd648cb302848039000b390e44d521e58aab3b29a6960ba8 +CounterKey = 0f83c36fded9d32fadf4efa3ae93a90bb5cfa66893bc412c43fa7287dbb99779 +K = 67dd4a6e165533534c0e3f172e4ab8576bca923a5f07b2c069b4c310ff2e935b + +# Test 4 (public key on twist) +Secret = 70e34bcbe1f47fbc0fddfd7c1e1aa53d57bfe0f66d243067b424bb6210bed19c +CounterKey = 0b8211a2b6049097f6871c6c052d3c5fc1ba17da9e32ae458403b05bb283092a +K = 4a0638cfaa9ef1933b47f8939296a6b25be541ef7f70e844c0bcc00b134de64a + +# Test 5 (public key on twist) +Secret = 68c1f3a653a4cdb1d37bba94738f8b957a57beb24d646e994dc29a276aad458d +CounterKey = 343ac20a3b9c6a27b1008176509ad30735856ec1c8d8fcae13912d08d152f46c +K = 399491fce8dfab73b4f9f611de8ea0b27b28f85994250b0f475d585d042ac207 + +# Test 6 (public key on twist) +Secret = d877b26d06dff9d9f7fd4c5b3769f8cdd5b30516a5ab806be324ff3eb69ea0b2 +CounterKey = fa695fc7be8d1be5bf704898f388c452bafdd3b8eae805f8681a8d15c2d4e142 +K = 2c4fe11d490a53861776b13b4354abd4cf5a97699db6e6c68c1626d07662f758 + +# Test 7 (public key = 0) +Secret = 207494038f2bb811d47805bcdf04a2ac585ada7f2f23389bfd4658f9ddd4debc +CounterKey = 0000000000000000000000000000000000000000000000000000000000000000 +K = 0000000000000000000000000000000000000000000000000000000000000000 + +# Test 8 (public key = 1) +Secret = 202e8972b61c7e61930eb9450b5070eae1c670475685541f0476217e4818cfab +CounterKey = 0100000000000000000000000000000000000000000000000000000000000000 +K = 0000000000000000000000000000000000000000000000000000000000000000 + +# Test 9 (edge case on twist) +Secret = 38dde9f3e7b799045f9ac3793d4a9277dadeadc41bec0290f81f744f73775f84 +CounterKey = 0200000000000000000000000000000000000000000000000000000000000000 +K = 9a2cfe84ff9c4a9739625cae4a3b82a906877a441946f8d7b3d795fe8f5d1639 + +# Test 10 (edge case on twist) +Secret = 9857a914e3c29036fd9a442ba526b5cdcdf28216153e636c10677acab6bd6aa5 +CounterKey = 0300000000000000000000000000000000000000000000000000000000000000 +K = 4da4e0aa072c232ee2f0fa4e519ae50b52c1edd08a534d4ef346c2e106d21d60 + +# Test 11 (edge case on twist) +Secret = 48e2130d723305ed05e6e5894d398a5e33367a8c6aac8fcdf0a88e4b42820db7 +CounterKey = ffffff030000f8ffff1f0000c0ffffff000000feffff070000f0ffff3f000000 +K = 9ed10c53747f647f82f45125d3de15a1e6b824496ab40410ffcc3cfe95760f3b + +# Test 12 (edge case on twist) +Secret = 28f41011691851b3a62b641553b30d0dfddcb8fffcf53700a7be2f6a872e9fb0 +CounterKey = 000000fcffff070000e0ffff3f000000ffffff010000f8ffff0f0000c0ffff7f +K = cf72b4aa6aa1c9f894f4165b86109aa468517648e1f0cc70e1ab08460176506b + +# Test 13 (edge case on twist) +Secret = 18a93b6499b9f6b3225ca02fef410e0adec23532321d2d8ef1a6d602a8c65b83 +CounterKey = 00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffff7f +K = 5d50b62836bb69579410386cf7bb811c14bf85b1c7b17e5924c7ffea91ef9e12 + +# Test 14 (edge case on twist) +Secret = c01d1305a1338a1fcac2ba7e2e032b427e0b04903165aca957d8d0553d8717b0 +CounterKey = eaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f +K = 19230eb148d5d67c3c22ab1daeff80a57eae4265ce2872657b2c8099fc698e50 + +# Test 15 (edge case for public key) +Secret = 386f7f16c50731d64f82e6a170b142a4e34f31fd7768fcb8902925e7d1e21abe +CounterKey = 0400000000000000000000000000000000000000000000000000000000000000 +K = 0fcab5d842a078d7a71fc59b57bfb4ca0be6873b49dcdb9f44e14ae8fbdfa542 + +# Test 16 (edge case for public key) +Secret = e023a289bd5e90fa2804ddc019a05ef3e79d434bb6ea2f522ecb643a75296e95 +CounterKey = ffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000 +K = 54ce8f2275c077e3b1306a3939c5e03eef6bbb88060544758d9fef59b0bc3e4f + +# Test 17 (edge case for public key) +Secret = 68f010d62ee8d926053a361c3a75c6ea4ebdc8606ab285003a6f8f4076b01e83 +CounterKey = ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03 +K = f136775c5beb0af8110af10b20372332043cab752419678775a223df57c9d30d + +# Test 18 (edge case for public key) +Secret = 58ebcb35b0f8845caf1ec630f96576b62c4b7b6c36b29deb2cb0084651755c96 +CounterKey = fffffffbfffffbffffdfffffdffffffffefffffefffff7fffff7ffffbfffff3f +K = bf9affd06b844085586460962ef2146ff3d4533d9444aab006eb88cc3054407d + +# Test 19 (edge case for public key) +Secret = 188c4bc5b9c44b38bb658b9b2ae82d5b01015e093184b17cb7863503a783e1bb +CounterKey = ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3f +K = d480de04f699cb3be0684a9cc2e31281ea0bc5a9dcc157d3d20158d46ca5246d + +# Test 20 (edge case for public key) +Secret = e06c11bb2e13ce3dc7673f67f5482242909423a9ae95ee986a988d98faee23a2 +CounterKey = fffffffffeffff7ffffffffffeffff7ffffffffffeffff7ffffffffffeffff7f +K = 4c4401cce6b51e4cb18f2790246c9bf914db667750a1cb89069092af07292276 + +# Test 21 (edge case for public key) +Secret = c0658c46dde18129293877535b1162b6f9f5414a23cf4d2cbc140a4d99da2b8f +CounterKey = ebffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f +K = 578ba8cc2dbdc575afcf9df2b3ee6189f5337d6854c79b4ce165ea12293b3a0f + +# Test 22 (public key with low order) +Secret = 10255c9230a97a30a458ca284a629669293a31890cda9d147febc7d1e22d6bb1 +CounterKey = e0eb7a7c3b41b8ae1656e3faf19fc46ada098deb9c32b1fd866205165f49b800 +K = 0000000000000000000000000000000000000000000000000000000000000000 + +# Test 23 (public key with low order) +Secret = 78f1e8edf14481b389448dac8f59c70b038e7cf92ef2c7eff57a72466e115296 +CounterKey = 5f9c95bca3508c24b1d0b1559c83ef5b04445cc4581c8e86d8224eddd09f1157 +K = 0000000000000000000000000000000000000000000000000000000000000000 + +# Test 24 (public key with low order) +Secret = a0a05a3e8f9f44204d5f8059a94ac7dfc39a49ac016dd743dbfa43c5d671fd88 +CounterKey = ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f +K = 0000000000000000000000000000000000000000000000000000000000000000 + +# Test 25 (public key with low order) +Secret = d0dbb3ed1906663f15420af31f4eaf6509d9a9949723500605ad7c1c6e7450a9 +CounterKey = edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f +K = 0000000000000000000000000000000000000000000000000000000000000000 + +# Test 26 (public key with low order) +Secret = c0b1d0eb22b244fe3291140072cdd9d989b5f0ecd96c100feb5bca241c1d9f8f +CounterKey = eeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f +K = 0000000000000000000000000000000000000000000000000000000000000000 + +# Test 27 (public key with low order) +Secret = 480bf45f594942a8bc0f3353c6e8b8853d77f351f1c2ca6c2d1abf8a00b4229c +CounterKey = 0000000000000000000000000000000000000000000000000000000000000080 +K = 0000000000000000000000000000000000000000000000000000000000000000 + +# Test 28 (public key with low order) +Secret = 30f993fcf8514fc89bd8db14cd43ba0d4b2530e73c4276a05e1b145d420cedb4 +CounterKey = 0100000000000000000000000000000000000000000000000000000000000080 +K = 0000000000000000000000000000000000000000000000000000000000000000 + +# Test 29 (public key with low order) +Secret = c04974b758380e2a5b5df6eb09bb2f6b3434f982722a8e676d3da251d1b3de83 +CounterKey = e0eb7a7c3b41b8ae1656e3faf19fc46ada098deb9c32b1fd866205165f49b880 +K = 0000000000000000000000000000000000000000000000000000000000000000 + +# Test 30 (public key with low order) +Secret = 502a31373db32446842fe5add3e024022ea54f274182afc3d9f1bb3d39534eb5 +CounterKey = 5f9c95bca3508c24b1d0b1559c83ef5b04445cc4581c8e86d8224eddd09f11d7 +K = 0000000000000000000000000000000000000000000000000000000000000000 + +# Test 31 (public key with low order) +Secret = 90fa6417b0e37030fd6e43eff2abaef14c6793117a039cf621318ba90f4e98be +CounterKey = ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +K = 0000000000000000000000000000000000000000000000000000000000000000 + +# Test 32 (public key with low order) +Secret = 78ad3f26027f1c9fdd975a1613b947779bad2cf2b741ade01840885a30bb979c +CounterKey = edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +K = 0000000000000000000000000000000000000000000000000000000000000000 + +# Test 33 (public key with low order) +Secret = 98e23de7b1e0926ed9c87e7b14baf55f497a1d7096f93977680e44dc1c7b7b8b +CounterKey = eeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +K = 0000000000000000000000000000000000000000000000000000000000000000 + +# Test 34 (public key >= p) +Secret = f01e48dafac9d7bcf589cbc382c878d18bda3550589ffb5d50b523bebe329dae +CounterKey = efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f +K = bd36a0790eb883098c988b21786773de0b3a4df162282cf110de18dd484ce74b + +# Test 35 (public key >= p) +Secret = 288796bc5aff4b81a37501757bc0753a3c21964790d38699308debc17a6eaf8d +CounterKey = f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f +K = b4e0dd76da7b071728b61f856771aa356e57eda78a5b1655cc3820fb5f854c5c + +# Test 36 (public key >= p) +Secret = 98df845f6651bf1138221f119041f72b6dbc3c4ace7143d99fd55ad867480da8 +CounterKey = f1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f +K = 6fdf6c37611dbd5304dc0f2eb7c9517eb3c50e12fd050ac6dec27071d4bfc034 + +# Test 37 (public key >= p) +Secret = f09498e46f02f878829e78b803d316a2ed695d0498a08abdf8276930e24edcb0 +CounterKey = ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f +K = 4c8fc4b1c6ab88fb21f18f6d4c810240d4e94651ba44f7a2c863cec7dc56602d + +# Test 38 (public key >= p) +Secret = 1813c10a5c7f21f96e17f288c0cc37607c04c5f5aea2db134f9e2ffc66bd9db8 +CounterKey = 0200000000000000000000000000000000000000000000000000000000000080 +K = 1cd0b28267dc541c642d6d7dca44a8b38a63736eef5c4e6501ffbbb1780c033c + +# Test 39 (public key >= p) +Secret = 7857fb808653645a0beb138a64f5f4d733a45ea84c3cda11a9c06f7e7139149e +CounterKey = 0300000000000000000000000000000000000000000000000000000000000080 +K = 8755be01c60a7e825cff3e0e78cb3aa4333861516aa59b1c51a8b2a543dfa822 + +# Test 40 (public key >= p) +Secret = e03aa842e2abc56e81e87b8b9f417b2a1e5913c723eed28d752f8d47a59f498f +CounterKey = 0400000000000000000000000000000000000000000000000000000000000080 +K = 54c9a1ed95e546d27822a360931dda60a1df049da6f904253c0612bbdc087476 + +# Test 41 (public key >= p) +Secret = f8f707b7999b18cb0d6b96124f2045972ca274bfc154ad0c87038c24c6d0d4b2 +CounterKey = daffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +K = cc1f40d743cdc2230e1043daba8b75e810f1fbab7f255269bd9ebb29e6bf494f + +# Test 42 (public key >= p) +Secret = a034f684fa631e1a348118c1ce4c98231f2d9eec9ba5365b4a05d69a785b0796 +CounterKey = dbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +K = 54998ee43a5b007bf499f078e736524400a8b5c7e9b9b43771748c7cdf880412 + +# Test 43 (public key >= p) +Secret = 30b6c6a0f2ffa680768f992ba89e152d5bc9893d38c9119be4f767bfab6e0ca5 +CounterKey = dcffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +K = ead9b38efdd723637934e55ab717a7ae09eb86a21dc36a3feeb88b759e391e09 + +# Test 44 (public key >= p) +Secret = 901b9dcf881e01e027575035d40b43bdc1c5242e030847495b0c7286469b6591 +CounterKey = eaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +K = 602ff40789b54b41805915fe2a6221f07a50ffc2c3fc94cf61f13d7904e88e0e + +# Test 45 (public key >= p) +Secret = 8046677c28fd82c9a1bdb71a1a1a34faba1225e2507fe3f54d10bd5b0d865f8e +CounterKey = ebffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +K = e00ae8b143471247ba24f12c885536c3cb981b58e1e56b2baf35c12ae1f79c26 + +# Test 46 (public key >= p) +Secret = 602f7e2f68a846b82cc269b1d48e939886ae54fd636c1fe074d710127d472491 +CounterKey = efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +K = 98cb9b50dd3fc2b0d4f2d2bf7c5cfdd10c8fcd31fc40af1ad44f47c131376362 + +# Test 47 (public key >= p) +Secret = 60887b3dc72443026ebedbbbb70665f42b87add1440e7768fbd7e8e2ce5f639d +CounterKey = f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +K = 38d6304c4a7e6d9f7959334fb5245bd2c754525d4c91db950206926234c1f633 + +# Test 48 (public key >= p) +Secret = 78d31dfa854497d72d8def8a1b7fb006cec2d8c4924647c93814ae56faeda495 +CounterKey = f1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +K = 786cd54996f014a5a031ec14db812ed08355061fdb5de680a800ac521f318e23 + +# Test 49 (public key >= p) +Secret = c04c5baefa8302ddded6a4bb957761b4eb97aefa4fc3b8043085f96a5659b3a5 +CounterKey = ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +K = 29ae8bc73e9b10a08b4f681c43c3e0ac1a171d31b38f1a48efba29ae639ea134 + +# Test 50 (RFC 7748) +Secret = a046e36bf0527c9d3b16154b82465edd62144c0ac1fc5a18506a2244ba449a44 +CounterKey = e6db6867583030db3594c1a424b15f7c726624ec26b3353b10a903a6d0ab1c4c +K = c3da55379de9c6908e94ea4df28d084f32eccf03491c71f754b4075577a28552 + +# Test 51 (RFC 7748) +Secret = 4866e9d4d1b4673c5ad22691957d6af5c11b6421e0ea01d42ca4169e7918ba4d +CounterKey = e5210f12786811d3f4b7959d0538ae2c31dbe7106fc03c3efc4cd549c715a413 +K = 95cbde9476e8907d7aade45cb4b873f88b595a68799fa152e6f8f7647aac7957 + +# Test 52 (edge case for shared secret) +Secret = a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63 +CounterKey = 0ab4e76380d84dde4f6833c58f2a9fb8f83bb0169b172be4b6e0592887741a36 +K = 0200000000000000000000000000000000000000000000000000000000000000 + +# Test 53 (edge case for shared secret) +Secret = a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63 +CounterKey = 89e10d5701b4337d2d032181538b1064bd4084401ceca1fd12663a1959388000 +K = 0900000000000000000000000000000000000000000000000000000000000000 + +# Test 54 (edge case for shared secret) +Secret = a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63 +CounterKey = 2b55d3aa4a8f80c8c0b2ae5f933e85af49beac36c2fa7394bab76c8933f8f81d +K = 1000000000000000000000000000000000000000000000000000000000000000 + +# Test 55 (edge case for shared secret) +Secret = a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63 +CounterKey = 63e5b1fe9601fe84385d8866b0421262f78fbfa5aff9585e626679b18547d959 +K = feffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3f + +# Test 56 (edge case for shared secret) +Secret = a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63 +CounterKey = e428f3dac17809f827a522ce32355058d07369364aa78902ee10139b9f9dd653 +K = fcffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3f + +# Test 57 (edge case for shared secret) +Secret = a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63 +CounterKey = b3b50e3ed3a407b95de942ef74575b5ab8a10c09ee103544d60bdfed8138ab2b +K = f9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3f + +# Test 58 (edge case for shared secret) +Secret = a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63 +CounterKey = 213fffe93d5ea8cd242e462844029922c43c77c9e3e42f562f485d24c501a20b +K = f3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3f + +# Test 59 (edge case for shared secret) +Secret = a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63 +CounterKey = 91b232a178b3cd530932441e6139418f72172292f1da4c1834fc5ebfefb51e3f +K = ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03 + +# Test 60 (edge case for shared secret) +Secret = a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63 +CounterKey = 045c6e11c5d332556c7822fe94ebf89b56a3878dc27ca079103058849fabcb4f +K = e5ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f + +# Test 61 (edge case for shared secret) +Secret = a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63 +CounterKey = 1ca2190b71163539063c35773bda0c9c928e9136f0620aeb093f099197b7f74e +K = e3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f + +# Test 62 (edge case for shared secret) +Secret = a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63 +CounterKey = f76e9010ac33c5043b2d3b76a842171000c4916222e9e85897a0aec7f6350b3c +K = ddffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f + +# Test 63 (edge case for shared secret) +Secret = a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63 +CounterKey = bb72688d8f8aa7a39cd6060cd5c8093cdec6fe341937c3886a99346cd07faa55 +K = dbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f + +# Test 64 (edge case for shared secret) +Secret = a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63 +CounterKey = 88fddea193391c6a5933ef9b71901549447205aae9da928a6b91a352ba10f41f +K = 0000000000000000000000000000000000000000000000000000000000000002 + +# Test 65 (edge case for shared secret) +Secret = a0a4f130b98a5be4b1cedb7cb85584a3520e142d474dc9ccb909a073a976bf63 +CounterKey = 303b392f153116cad9cc682a00ccc44c95ff0d3bbe568beb6c4e739bafdc2c68 +K = 0000000000000000000000000000000000000000000000000000000000008000 + +# Test 66 (checking for overflow) +Secret = c81724704000b26d31703cc97e3a378d56fad8219361c88cca8bd7c5719b12b2 +CounterKey = fd300aeb40e1fa582518412b49b208a7842b1e1f056a040178ea4141534f652d +K = b734105dc257585d73b566ccb76f062795ccbec89128e52b02f3e59639f13c46 + +# Test 67 (checking for overflow) +Secret = c81724704000b26d31703cc97e3a378d56fad8219361c88cca8bd7c5719b12b2 +CounterKey = c8ef79b514d7682677bc7931e06ee5c27c9b392b4ae9484473f554e6678ecc2e +K = 647a46b6fc3f40d62141ee3cee706b4d7a9271593a7b143e8e2e2279883e4550 + +# Test 68 (checking for overflow) +Secret = c81724704000b26d31703cc97e3a378d56fad8219361c88cca8bd7c5719b12b2 +CounterKey = 64aeac2504144861532b7bbcb6c87d67dd4c1f07ebc2e06effb95aecc6170b2c +K = 4ff03d5fb43cd8657a3cf37c138cadcecce509e4eba089d0ef40b4e4fb946155 + +# Test 69 (checking for overflow) +Secret = c81724704000b26d31703cc97e3a378d56fad8219361c88cca8bd7c5719b12b2 +CounterKey = bf68e35e9bdb7eee1b50570221860f5dcdad8acbab031b14974cc49013c49831 +K = 21cee52efdbc812e1d021a4af1e1d8bc4db3c400e4d2a2c56a3926db4d99c65b + +# Test 70 (checking for overflow) +Secret = c81724704000b26d31703cc97e3a378d56fad8219361c88cca8bd7c5719b12b2 +CounterKey = 5347c491331a64b43ddc683034e677f53dc32b52a52a577c15a83bf298e99f19 +K = 18cb89e4e20c0c2bd324305245266c9327690bbe79acb88f5b8fb3f74eca3e52 + +# Test 71 (private key == -1 (mod order)) +Secret = a023cdd083ef5bb82f10d62e59e15a6800000000000000000000000000000050 +CounterKey = 258e04523b8d253ee65719fc6906c657192d80717edc828fa0af21686e2faa75 +K = 258e04523b8d253ee65719fc6906c657192d80717edc828fa0af21686e2faa75 + +# Test 72 (private key == 1 (mod order) on twist) +Secret = 58083dd261ad91eff952322ec824c682ffffffffffffffffffffffffffffff5f +CounterKey = 2eae5ec3dd494e9f2d37d258f873a8e6e9d0dbd1e383ef64d98bb91b3e0be035 +K = 2eae5ec3dd494e9f2d37d258f873a8e6e9d0dbd1e383ef64d98bb91b3e0be035 + diff --git a/src/tests/test_c25519.cpp b/src/tests/test_c25519.cpp index 9fa1a955b..88352f7ce 100644 --- a/src/tests/test_c25519.cpp +++ b/src/tests/test_c25519.cpp @@ -41,6 +41,34 @@ class Curve25519_Sclarmult_Tests final : public Text_Based_Test }; BOTAN_REGISTER_TEST("curve25519_scalar", Curve25519_Sclarmult_Tests); +class Curve25519_Agreement_Tests final : public PK_Key_Agreement_Test + { + public: + Curve25519_Agreement_Tests() : PK_Key_Agreement_Test( + "X25519", + "pubkey/x25519.vec", + "Secret,CounterKey,K") {} + + std::string default_kdf(const VarMap&) const override + { + return "Raw"; + } + + std::unique_ptr<Botan::Private_Key> load_our_key(const std::string&, + const VarMap& vars) override + { + const std::vector<uint8_t> secret_vec = vars.get_req_bin("Secret"); + Botan::secure_vector<uint8_t> secret(secret_vec.begin(), secret_vec.end()); + return std::unique_ptr<Botan::Private_Key>(new Botan::Curve25519_PrivateKey(secret)); + } + + std::vector<uint8_t> load_their_key(const std::string&, const VarMap& vars) override + { + return vars.get_req_bin("CounterKey"); + } + }; +BOTAN_REGISTER_TEST("curve25519_agreement", Curve25519_Agreement_Tests); + class Curve25519_Roundtrip_Test final : public Test { public: diff --git a/src/tests/test_ed25519.cpp b/src/tests/test_ed25519.cpp index 05a5ce30c..2aaed1c46 100644 --- a/src/tests/test_ed25519.cpp +++ b/src/tests/test_ed25519.cpp @@ -28,6 +28,11 @@ class Ed25519_Verification_Tests : public PK_Signature_Verification_Test "pubkey/ed25519_verify.vec", "Pubkey,Msg,Signature", "Valid") {} + bool clear_between_callbacks() const override + { + return false; + } + std::unique_ptr<Botan::Public_Key> load_public_key(const VarMap& vars) override { const std::vector<uint8_t> pubkey = vars.get_req_bin("Pubkey"); @@ -47,6 +52,11 @@ class Ed25519_Signature_Tests final : public PK_Signature_Generation_Test "pubkey/ed25519.vec", "Privkey,Pubkey,Msg,Signature") {} + bool clear_between_callbacks() const override + { + return false; + } + std::unique_ptr<Botan::Private_Key> load_private_key(const VarMap& vars) override { const std::vector<uint8_t> privkey = vars.get_req_bin("Privkey"); |