3 * RSA decryption, using randomized RSA blinding to be more resistant
7 /* nettle, low-level cryptographics library
9 * Copyright (C) 2001, 2012 Niels Möller, Nikos Mavrogiannopoulos
11 * The nettle library is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation; either version 2.1 of the License, or (at your
14 * option) any later version.
16 * The nettle library is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
19 * License for more details.
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with the nettle library; see the file COPYING.LIB. If not, write to
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
37 rsa_decrypt_tr(const struct rsa_public_key *pub,
38 const struct rsa_private_key *key,
39 void *random_ctx, nettle_random_func *random,
40 unsigned *length, uint8_t *message,
41 const mpz_t gibberish)
46 mpz_init_set(m, gibberish);
49 _rsa_blind (pub, random_ctx, random, m, ri);
50 rsa_compute_root(key, m, m);
51 _rsa_unblind (pub, m, ri);
54 res = pkcs1_decrypt (key->size, m, length, message);