3 The RSA publickey algorithm.
5 Copyright (C) 2001, 2002 Niels Möller
7 This file is part of GNU Nettle.
9 GNU Nettle is free software: you can redistribute it and/or
10 modify it under the terms of either:
12 * the GNU Lesser General Public License as published by the Free
13 Software Foundation; either version 3 of the License, or (at your
14 option) any later version.
18 * the GNU General Public License as published by the Free
19 Software Foundation; either version 2 of the License, or (at your
20 option) any later version.
22 or both in parallel, as here.
24 GNU Nettle is distributed in the hope that it will be useful,
25 but WITHOUT ANY WARRANTY; without even the implied warranty of
26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 General Public License for more details.
29 You should have received copies of the GNU General Public License and
30 the GNU Lesser General Public License along with this program. If
31 not, see http://www.gnu.org/licenses/.
34 #ifndef NETTLE_RSA_INTERNAL_H_INCLUDED
35 #define NETTLE_RSA_INTERNAL_H_INCLUDED
39 #define _rsa_verify _nettle_rsa_verify
40 #define _rsa_verify_recover _nettle_rsa_verify_recover
41 #define _rsa_check_size _nettle_rsa_check_size
42 #define _rsa_blind _nettle_rsa_blind
43 #define _rsa_unblind _nettle_rsa_unblind
44 #define _rsa_sec_compute_root_itch _nettle_rsa_sec_compute_root_itch
45 #define _rsa_sec_compute_root _nettle_rsa_sec_compute_root
46 #define _rsa_sec_compute_root_tr _nettle_rsa_sec_compute_root_tr
48 /* Internal functions. */
50 _rsa_verify(const struct rsa_public_key *key,
55 _rsa_verify_recover(const struct rsa_public_key *key,
60 _rsa_check_size(mpz_t n);
62 /* _rsa_blind and _rsa_unblind are deprecated, unused in the library,
63 and will likely be removed with the next ABI break. */
65 _rsa_blind (const struct rsa_public_key *pub,
66 void *random_ctx, nettle_random_func *random,
67 mpz_t c, mpz_t ri) _NETTLE_ATTRIBUTE_DEPRECATED;
69 _rsa_unblind (const struct rsa_public_key *pub, mpz_t c, const mpz_t ri)
70 _NETTLE_ATTRIBUTE_DEPRECATED;
72 /* side-channel silent root computation */
74 _rsa_sec_compute_root_itch(const struct rsa_private_key *key);
76 _rsa_sec_compute_root(const struct rsa_private_key *key,
77 mp_limb_t *rp, const mp_limb_t *mp,
80 /* Safe side-channel silent variant, using RSA blinding, and checking the
81 * result after CRT. */
83 _rsa_sec_compute_root_tr(const struct rsa_public_key *pub,
84 const struct rsa_private_key *key,
85 void *random_ctx, nettle_random_func *random,
86 mp_limb_t *x, const mp_limb_t *m, size_t mn);
88 #endif /* NETTLE_RSA_INTERNAL_H_INCLUDED */