diff --git a/ChangeLog b/ChangeLog index 7f1b32ddd16be9c5055cd066de74a2cc0f1b9ae9..0bb0189c7b9723518c82960b8be0950d27d87dc1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2003-01-27 Niels Möller <nisse@cuckoo.hack.org> + + * sexp2dsa.c (dsa_signature_from_sexp): New function. + + RSA renaming. Updated all callers. + * rsa-sign.c (rsa_private_key_init, rsa_private_key_clear) + (rsa_private_key_prepare): Renamed functions. + * rsa.c (rsa_public_key_init, rsa_public_key_clear) + (rsa_public_key_prepare): Renamed functions. + 2003-01-23 Niels Möller <nisse@cuckoo.hack.org> * Makefile.am (libnettle_a_SOURCES): Added new rsa and pkcs1 diff --git a/examples/rsa-keygen.c b/examples/rsa-keygen.c index 6b683cd3188e146b44f73c52d8deaa8bfeb15f76..e1a4c85efbcc12d3ab296df68521badf8e1cb4d9 100644 --- a/examples/rsa-keygen.c +++ b/examples/rsa-keygen.c @@ -108,8 +108,8 @@ main(int argc, char **argv) /* Read some data to seed the generator */ simple_random(&yarrow, random_name); - rsa_init_public_key(&pub); - rsa_init_private_key(&priv); + rsa_public_key_init(&pub); + rsa_private_key_init(&priv); if (!rsa_generate_keypair (&pub, &priv, diff --git a/examples/rsa-sign.c b/examples/rsa-sign.c index a96d3b1e6f9d56a718f5a55fba663849d351619d..ad653a534e456dabc0b86f09dc13472b40978fe8 100644 --- a/examples/rsa-sign.c +++ b/examples/rsa-sign.c @@ -44,7 +44,7 @@ main(int argc, char **argv) return EXIT_FAILURE; } - rsa_init_private_key(&key); + rsa_private_key_init(&key); if (!read_rsa_key(argv[1], NULL, &key)) { @@ -73,7 +73,7 @@ main(int argc, char **argv) putchar('\n'); mpz_clear(s); - rsa_clear_private_key(&key); + rsa_private_key_clear(&key); return EXIT_SUCCESS; } diff --git a/examples/rsa-verify.c b/examples/rsa-verify.c index 5dcd90b248965d441ecf7fa5343f23a93190783c..95fa608d0c1aa014077faf3565c8958f7e264bc2 100644 --- a/examples/rsa-verify.c +++ b/examples/rsa-verify.c @@ -61,7 +61,7 @@ main(int argc, char **argv) return EXIT_FAILURE; } - rsa_init_public_key(&key); + rsa_public_key_init(&key); if (!read_rsa_key(argv[1], &key, NULL)) { @@ -93,7 +93,7 @@ main(int argc, char **argv) } mpz_clear(s); - rsa_clear_public_key(&key); + rsa_public_key_clear(&key); return EXIT_SUCCESS; } diff --git a/rsa-compat.c b/rsa-compat.c index edcc0ddd471e0c1c3e17d4c4b69207276efc0d2a..a5db6755138faddf535f0f8377d00bd6b28afb5f 100644 --- a/rsa-compat.c +++ b/rsa-compat.c @@ -78,7 +78,7 @@ R_SignFinal(R_SIGNATURE_CTX *ctx, nettle_mpz_init_set_str_256_u(k.c, MAX_RSA_MODULUS_LEN, key->coefficient); - if (rsa_prepare_private_key(&k) && (k.size <= MAX_RSA_MODULUS_LEN)) + if (rsa_private_key_prepare(&k) && (k.size <= MAX_RSA_MODULUS_LEN)) { mpz_t s; mpz_init(s); @@ -135,7 +135,7 @@ R_VerifyFinal(R_SIGNATURE_CTX *ctx, nettle_mpz_init_set_str_256_u(k.e, MAX_RSA_MODULUS_LEN, key->exponent); - if (rsa_prepare_public_key(&k) && (k.size == length)) + if (rsa_public_key_prepare(&k) && (k.size == length)) { mpz_t s; diff --git a/sexp2rsa.c b/sexp2rsa.c index c5795db3d1f71bc4bee0f6738662a9dfe9c28c94..f0084d60b3e87261ac252451bc9cdb574183ecf8 100644 --- a/sexp2rsa.c +++ b/sexp2rsa.c @@ -71,7 +71,7 @@ rsa_keypair_from_sexp_alist(struct rsa_public_key *pub, GET(priv->b, limit, &values[6]); GET(priv->c, limit, &values[7]); - if (!rsa_prepare_private_key(priv)) + if (!rsa_private_key_prepare(priv)) return 0; } @@ -80,7 +80,7 @@ rsa_keypair_from_sexp_alist(struct rsa_public_key *pub, GET(pub->n, limit, &values[0]); GET(pub->e, limit, &values[1]); - if (!rsa_prepare_public_key(pub)) + if (!rsa_public_key_prepare(pub)) return 0; } diff --git a/testsuite/rsa-keygen-test.c b/testsuite/rsa-keygen-test.c index 438a6298209713160dfc77c112be4f7dab284b26..51df44b297d9f75ee9741524b54f34f501a6c50a 100644 --- a/testsuite/rsa-keygen-test.c +++ b/testsuite/rsa-keygen-test.c @@ -28,8 +28,8 @@ test_main(void) mpz_init(expected); - rsa_init_private_key(&key); - rsa_init_public_key(&pub); + rsa_private_key_init(&key); + rsa_public_key_init(&pub); /* Generate a 1024 bit key with random e */ knuth_lfib_init(&lfib, 13); @@ -79,8 +79,8 @@ test_main(void) test_rsa_sha1(&pub, &key, expected); - rsa_clear_private_key(&key); - rsa_clear_public_key(&pub); + rsa_private_key_clear(&key); + rsa_public_key_clear(&pub); mpz_clear(expected); SUCCESS(); diff --git a/testsuite/rsa-test.c b/testsuite/rsa-test.c index a43c43d8b8d3e706c4432222873f1408acb0ac8e..0744720dd2436f7ee6117fba66c8d3522937e39b 100644 --- a/testsuite/rsa-test.c +++ b/testsuite/rsa-test.c @@ -12,8 +12,8 @@ test_main(void) mpz_init(expected); - rsa_init_private_key(&key); - rsa_init_public_key(&pub); + rsa_private_key_init(&key); + rsa_public_key_init(&pub); /* 1000-bit key, generated by * @@ -59,7 +59,7 @@ test_main(void) "e545fbb4cf", 16); mpz_set_str(pub.e, "0db2ad57", 16); - if (!rsa_prepare_public_key(&pub)) + if (!rsa_public_key_prepare(&pub)) FAIL(); /* d is not used */ @@ -98,7 +98,7 @@ test_main(void) "e2df9607cee95fa8" "daec7a389a7d9afc" "8dd21fef9d83805a" "40d46f49676a2f6b" "2926f70c572c00", 16); - if (!rsa_prepare_private_key(&key)) + if (!rsa_private_key_prepare(&key)) FAIL(); if (pub.size != key.size) @@ -171,7 +171,7 @@ test_main(void) mpz_set_str(pub.e, "3f1a012d", 16); - if (!rsa_prepare_public_key(&pub)) + if (!rsa_public_key_prepare(&pub)) FAIL(); #if 0 @@ -208,7 +208,7 @@ test_main(void) "05e1831619db2f10" "bb9b6a8fd5c95df2" "eb78f303ea0c0cc8" "06", 16); - if (!rsa_prepare_private_key(&key)) + if (!rsa_private_key_prepare(&key)) FAIL(); if (pub.size != key.size) @@ -234,8 +234,8 @@ test_main(void) test_rsa_sha1(&pub, &key, expected); - rsa_clear_private_key(&key); - rsa_clear_public_key(&pub); + rsa_private_key_clear(&key); + rsa_public_key_clear(&pub); mpz_clear(expected); SUCCESS(); diff --git a/testsuite/rsa2sexp-test.c b/testsuite/rsa2sexp-test.c index 2220fa0bc52984b09b51b0c28056d352ac7ac846..3c0d83423fbd1d67768ccae3b03226313ba3a68f 100644 --- a/testsuite/rsa2sexp-test.c +++ b/testsuite/rsa2sexp-test.c @@ -11,8 +11,8 @@ test_main(void) struct nettle_buffer buffer; - rsa_init_public_key(&pub); - rsa_init_private_key(&priv); + rsa_public_key_init(&pub); + rsa_private_key_init(&priv); mpz_set_str(pub.n, "085c3408989acae4faec3cbbad91c90d34c1d259cd74121a" @@ -20,6 +20,8 @@ test_main(void) "cc8b5e9661189b86a7b22239907c25", 16); mpz_set_str(pub.e, "36ad4b1d", 16); + ASSERT(rsa_public_key_prepare(&pub)); + mpz_set_str(priv.d, "06ee6d4ff3c239e408150daf8117abfa36a40ad4455d9059" "a86d52f33a2de07418a0a699594588c64810248c9412d554" @@ -45,6 +47,8 @@ test_main(void) "f8a458ea73a018dc6fa56863e3bc6de405f364f77dee6f09" "62679ea1a8282e", 16); + ASSERT(rsa_private_key_prepare(&priv)); + nettle_buffer_init(&buffer); ASSERT(rsa_keypair_to_sexp(&buffer, &pub, &priv)); @@ -96,6 +100,9 @@ test_main(void) "77113a6cdafe79dd7d5f2ecc8b5e9661" "189b86a7b22239907c252928313a6534" "3a36ad4b1d292929")); + + rsa_public_key_clear(&pub); + rsa_private_key_clear(&priv); SUCCESS(); diff --git a/testsuite/sexp2rsa-test.c b/testsuite/sexp2rsa-test.c index 8185c5a8bcb6ff1a5440b67ee385126dd4d940a9..2e2c53b28d09b88b16f2b33736f7e40860c26e5b 100644 --- a/testsuite/sexp2rsa-test.c +++ b/testsuite/sexp2rsa-test.c @@ -7,8 +7,8 @@ test_main(void) struct rsa_public_key pub; struct rsa_private_key priv; - rsa_init_public_key(&pub); - rsa_init_private_key(&priv); + rsa_public_key_init(&pub); + rsa_private_key_init(&priv); ASSERT(rsa_keypair_from_sexp (&pub, &priv, 0, @@ -38,6 +38,9 @@ test_main(void) "9ea1a8282e292929"))); test_rsa_key(&pub, &priv); + + rsa_public_key_clear(&pub); + rsa_private_key_clear(&priv); SUCCESS();