Skip to content
Snippets Groups Projects
Commit 5cd9cc10 authored by Niels Möller's avatar Niels Möller
Browse files

* rsa.h (struct rsa_private_key): Reintroduced d attribute, to be

used only for key generation output.
(rsa_generate_keypair): Wrote a prototype.

Rev: src/nettle/rsa.h:1.7
parent d47dccb1
No related branches found
No related tags found
No related merge requests found
...@@ -48,6 +48,10 @@ struct rsa_public_key ...@@ -48,6 +48,10 @@ struct rsa_public_key
struct rsa_private_key struct rsa_private_key
{ {
unsigned size; unsigned size;
/* d is filled in by the key generation function; otherwise it's
* completely unused. */
mpz_t d;
/* The two factors */ /* The two factors */
mpz_t p; mpz_t q; mpz_t p; mpz_t q;
...@@ -134,6 +138,21 @@ rsa_sha1_verify(struct rsa_public_key *key, ...@@ -134,6 +138,21 @@ rsa_sha1_verify(struct rsa_public_key *key,
void void
rsa_compute_root(struct rsa_private_key *key, mpz_t x, const mpz_t m); rsa_compute_root(struct rsa_private_key *key, mpz_t x, const mpz_t m);
/* Key generation */
int
rsa_generate_keypair(struct rsa_public_key *pub,
struct rsa_public_key *key,
void *random_ctx,
void (*random)(void *ctx, unsigned length, uint8_t *dst),
/* Desired size of modulo, in bits */
unsigned n_size,
/* Desired size of public exponent, in bits. If
* zero, the passed in value pub->e is used. */
unsigned e_size);
#define RSA_SIGN(key, algorithm, ctx, length, data, signature) ( \ #define RSA_SIGN(key, algorithm, ctx, length, data, signature) ( \
algorithm##_update(ctx, length, data), \ algorithm##_update(ctx, length, data), \
rsa_##algorithm##_sign(key, ctx, signature) \ rsa_##algorithm##_sign(key, ctx, signature) \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment