Commit cbfdd27c authored by Niels Möller's avatar Niels Möller

Fix broken use of sizeof.

parent 50d670de
2015-09-07 Niels Möller <nisse@lysator.liu.se>
* testsuite/rsa-sign-tr-test.c: Drop include of nettle-internal.h.
(test_main): Fix incorrect use of sizeof, and use LDATA macro.
From Nikos Mavrogiannopoulos.
* rsa-pkcs1-sign-tr.c (rsa_verify_res): New function.
(rsa_pkcs1_sign_tr): Check result of private key operation, to
......@@ -7,6 +10,7 @@
key.
* testsuite/rsa-sign-tr-test.c: New testcase.
2015-09-06 Niels Möller <nisse@lysator.liu.se>
* nettle.texinfo: Updated SHA3 documentation.
......
#include "testutils.h"
#include "knuth-lfib.h"
#define MSG1 ((uint8_t*)"None so blind as those who will not see")
#define MSG2 ((uint8_t*)"Fortune knocks once at every man's door")
#define MSG1 "None so blind as those who will not see"
#define MSG2 "Fortune knocks once at every man's door"
static void
test_rsa_sign_tr(struct rsa_public_key *pub,
......@@ -76,23 +76,23 @@ test_main(void)
/* Test signatures */
mpz_set_str(expected,
"5a1d95b71a244dec17887b3fa4502439fd9d868ee12f716fbb53b2"
"e7ca60e6922bfdb893cd62dba8e16ca7a4374962d407b6137b4322"
"c76331588e087c823162349e40bb0cca762c7f253ea46141f88118"
"78788b0759e2c880a089ecbdf447ea02ffa504336cb65bd79f20e1"
"3d9af6ac5ac49656fa5cc06cae4f9df510",
"23bd361a622bc35450a30ae332d8dad050c6bad5cae0b61c5bee29"
"db876d7fe098472fc7933f2cc1121c0fc8a414c71a98189c66077b"
"fe3d58d08dc242bbcfdf2c905b91de0e479a8b4b159a45fe1789db"
"abdaf88aa704e7558f24f5a0be382619758061cde89e9c730ac6db"
"ef005bfad5a936633e3dfccc37b2214e2",
16);
test_rsa_sign_tr(&pub, &key, sizeof(MSG1)-1, MSG1, expected);
test_rsa_sign_tr(&pub, &key, LDATA(MSG1), expected);
mpz_set_str(expected,
"86114b62c2d22e2c9b075852df18dfb60c2f86ae8c4a852aff5db7"
"164984b1ca3752ae0c1174604ceb46bc72870e87687e298210b88b"
"48d0c5ac039c94a40349aaea1399aa60d953697916fbe5020c6751"
"060e114588a9ef14751326432d564863d4e11e1e73dabd1f628c6e"
"8866f8072d2a2dfd10d716d5d07a6ee57", 16);
"15bd817f53501f8eb6693283004546ba14f19dd4da742b1e30a7b2"
"1db309cd3f36f821f565d31c1ed2df8b6648dd8bdb218f841f5506"
"a437825999aaf3ef77dff9a1fc7631ce0e99f851f4166ae67caed9"
"820a764e44274a898ddd72f4c7115ba49d332f4fa929ee6dce4d61"
"39fef8d8d25d4c9ff857689846e5cac26d", 16);
test_rsa_sign_tr(&pub, &key, sizeof(MSG2)-1, MSG2, expected);
test_rsa_sign_tr(&pub, &key, LDATA(MSG2), expected);
/* 777-bit key, generated by
*
......@@ -171,21 +171,21 @@ test_main(void)
/* Test signatures */
mpz_set_str(expected,
"63629074879115869fbe830c7cd28ac7fb87df06312572428ba412"
"f730f1f88e1f26cd60955a7ff81743bb0f8a0ebb4a05ad621544b3"
"2d189b436f753de1dcdf9d29ae048585f1408397dcf9381324498e"
"c7df9d35f7b221ec1a2a9e426e07ca8b", 16);
"5493d4d774d03f54de2e9bef6818b74a8e22bbe9628b6dec3f178d"
"cc0090dab933a0f24bc9ac8aec949558868ea4f8e29d0248e70717"
"6c113e8fbd9f1428c45a120378e32febffd4e9aca8102081bb5b90"
"0f2914395a220823b700dbd7bd32646e", 16);
test_rsa_sign_tr(&pub, &key, sizeof(MSG1)-1, MSG1, expected);
test_rsa_sign_tr(&pub, &key, LDATA(MSG1), expected);
/* Test sha1 signature */
mpz_set_str(expected,
"9f87de78ee3c6df00444b290aef88765c8367a166e3aeb7e4de0fb"
"94a38a48452902f6cd5ebefbd1eaa095ca855e565c1d95c4d8ef2d"
"3962a4c707001e1e2112028bda4c78d2d303b11b6cae33a777fd4d"
"96d766be5e1bff00defc7628a8a7e8a0", 16);
"126bbd3d9e8649187069d8b6f0f43bd234a53249f765f616647049"
"ca49b2c4cc8049440d5a9f1d10fcdf162b40afd9b761bcd30e2c60"
"133b2c6f0504fe447038422b835d35448acb0881e894144e4ccaea"
"59ce8dd16d3540fcbb84ebd1c5fb37510", 16);
test_rsa_sign_tr(&pub, &key, sizeof(MSG2)-1, MSG2, expected);
test_rsa_sign_tr(&pub, &key, LDATA(MSG2), expected);
rsa_private_key_clear(&key);
rsa_public_key_clear(&pub);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment