From: Niels Möller Date: Mon, 14 Jan 2002 20:09:45 +0000 (+0100) Subject: * rsa.h (struct rsa_private_key): Reintroduced d attribute, to be X-Git-Tag: nettle_1.5_release_20020131~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5cd9cc100348d0de80e8a349b0b6f2ac1249140e;p=thirdparty%2Fnettle.git * 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 --- diff --git a/rsa.h b/rsa.h index 23ee7a7e..21f5d6d9 100644 --- a/rsa.h +++ b/rsa.h @@ -48,6 +48,10 @@ struct rsa_public_key struct rsa_private_key { unsigned size; + + /* d is filled in by the key generation function; otherwise it's + * completely unused. */ + mpz_t d; /* The two factors */ mpz_t p; mpz_t q; @@ -134,6 +138,21 @@ rsa_sha1_verify(struct rsa_public_key *key, void 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) ( \ algorithm##_update(ctx, length, data), \ rsa_##algorithm##_sign(key, ctx, signature) \