Commit 8ec793c9 authored by Niels Möller's avatar Niels Möller

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.

Rev: src/nettle/ChangeLog:1.167
Rev: src/nettle/examples/rsa-keygen.c:1.8
Rev: src/nettle/examples/rsa-sign.c:1.4
Rev: src/nettle/examples/rsa-verify.c:1.3
Rev: src/nettle/rsa-compat.c:1.7
Rev: src/nettle/sexp2rsa.c:1.10
Rev: src/nettle/testsuite/rsa-keygen-test.c:1.5
Rev: src/nettle/testsuite/rsa-test.c:1.6
Rev: src/nettle/testsuite/rsa2sexp-test.c:1.5
Rev: src/nettle/testsuite/sexp2rsa-test.c:1.6
parent 42721f77
2003-01-27 Niels Mller <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 Mller <nisse@cuckoo.hack.org>
* Makefile.am (libnettle_a_SOURCES): Added new rsa and pkcs1
......
......@@ -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,
......
......@@ -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;
}
......@@ -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;
}
......@@ -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;
......
......@@ -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;
}
......
......@@ -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();
......
......@@ -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();
......
......@@ -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();
......
......@@ -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();
......
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