summaryrefslogtreecommitdiff
path: root/rsa.h
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2002-01-09 16:14:39 +0100
committerNiels Möller <nisse@lysator.liu.se>2002-01-09 16:14:39 +0100
commit6e0c5d8e9872a059eaed2afd7ef22fbcfd9f545d (patch)
tree3c88779a7c22871c14a2e264e1b7f4dfd9e8fa64 /rsa.h
parent5cb171eb6de47dae287e8bdd47f7abfef437ff47 (diff)
downloadnettle-6e0c5d8e9872a059eaed2afd7ef22fbcfd9f545d.tar.gz
* rsa_md5.c: Represent a signature as an mpz_t, not a string.
Updated calls of md5 functions. * rsa_sha1.c: Likewise. * rsa.c (rsa_prepare_public_key): Renamed function, was rsa_init_public_key. (rsa_prepare_private_key): Renamed function, was rsa_init_private_key. Rev: src/nettle/rsa.c:1.2 Rev: src/nettle/rsa.h:1.3 Rev: src/nettle/rsa_md5.c:1.2 Rev: src/nettle/rsa_sha1.c:1.2
Diffstat (limited to 'rsa.h')
-rw-r--r--rsa.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/rsa.h b/rsa.h
index 52c6d94c..47c56185 100644
--- a/rsa.h
+++ b/rsa.h
@@ -69,7 +69,7 @@ struct rsa_private_key
*
* Store the private key in a rsa_private_key struct.
*
- * Call rsa_init_private_key. This initializes the size attribute
+ * Call rsa_prepare_private_key. This initializes the size attribute
* to the length of a signature.
*
* Initialize a hashing context, by callling
@@ -78,44 +78,46 @@ struct rsa_private_key
* Hash the message by calling
* md5_update
*
- * Finally, call
+ * Create the signature by calling
* rsa_md5_sign
*
- * The final call stores the signature, of length size, in the supplied buffer,
- * and resets the hashing context.
+ * The signature is represented as a mpz_t bignum. This call also
+ * resets the hashing context.
+ *
+ * When done with the key, don't forget to call mpz_clear.
*/
int
-rsa_init_public_key(struct rsa_public_key *key);
+rsa_prepare_public_key(struct rsa_public_key *key);
int
-rsa_init_private_key(struct rsa_private_key *key);
+rsa_prepare_private_key(struct rsa_private_key *key);
/* PKCS#1 style signatures */
void
rsa_md5_sign(struct rsa_private_key *key,
struct md5_ctx *hash,
- uint8_t *signature);
+ mpz_t signature);
int
rsa_md5_verify(struct rsa_public_key *key,
struct md5_ctx *hash,
- const uint8_t *signature);
+ const mpz_t signature);
void
rsa_sha1_sign(struct rsa_private_key *key,
struct sha1_ctx *hash,
- uint8_t *signature);
+ mpz_t signature);
int
rsa_sha1_verify(struct rsa_public_key *key,
struct sha1_ctx *hash,
- const uint8_t *signature);
+ const mpz_t signature);
/* Compute x, the d:th root of m. Calling it with x == m is allowed. */
void
-rsa_compute_root(struct rsa_private_key *key, mpz_t x, mpz_t m);
+rsa_compute_root(struct rsa_private_key *key, mpz_t x, const mpz_t m);
#endif /* NETTLE_RSA_H_INCLUDED */