diff options
author | Niels Möller <nisse@lysator.liu.se> | 2012-04-09 22:00:02 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2012-04-09 22:00:02 +0200 |
commit | 17a0f7e88e847c47525f15583a5bfb12628faf76 (patch) | |
tree | cfb54b6edb3ce1a5d2af3f258367a7ad7ddb432d /rsa.h | |
parent | 479aafcc16f505a5e3127fedabb624a2cf6e70c9 (diff) | |
download | nettle-17a0f7e88e847c47525f15583a5bfb12628faf76.tar.gz |
Implemented rsa_decrypt_tr, based on RSA blinding code
contributed by Nikos Mavrogiannopoulos.
Diffstat (limited to 'rsa.h')
-rw-r--r-- | rsa.h | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -32,9 +32,6 @@ #include "md5.h" #include "sha.h" -/* For nettle_random_func */ -#include "nettle-meta.h" - #ifdef __cplusplus extern "C" { #endif @@ -64,6 +61,7 @@ extern "C" { #define rsa_sha512_verify_digest nettle_rsa_sha512_verify_digest #define rsa_encrypt nettle_rsa_encrypt #define rsa_decrypt nettle_rsa_decrypt +#define rsa_decrypt_tr nettle_rsa_decrypt_tr #define rsa_compute_root nettle_rsa_compute_root #define rsa_generate_keypair nettle_rsa_generate_keypair #define rsa_keypair_to_sexp nettle_rsa_keypair_to_sexp @@ -260,7 +258,7 @@ rsa_sha512_verify_digest(const struct rsa_public_key *key, int rsa_encrypt(const struct rsa_public_key *key, /* For padding */ - void *random_ctx, nettle_random_func random, + void *random_ctx, nettle_random_func *random, unsigned length, const uint8_t *cleartext, mpz_t cipher); @@ -274,6 +272,14 @@ rsa_decrypt(const struct rsa_private_key *key, unsigned *length, uint8_t *cleartext, const mpz_t ciphertext); +/* Timing-resistant version, using randomized RSA blinding. */ +int +rsa_decrypt_tr(const struct rsa_public_key *pub, + const struct rsa_private_key *key, + void *random_ctx, nettle_random_func *random, + unsigned *length, uint8_t *message, + const mpz_t gibberish); + /* Compute x, the e:th root of m. Calling it with x == m is allowed. */ void rsa_compute_root(const struct rsa_private_key *key, @@ -287,8 +293,8 @@ int rsa_generate_keypair(struct rsa_public_key *pub, struct rsa_private_key *key, - void *random_ctx, nettle_random_func random, - void *progress_ctx, nettle_progress_func progress, + void *random_ctx, nettle_random_func *random, + void *progress_ctx, nettle_progress_func *progress, /* Desired size of modulo, in bits */ unsigned n_size, |