Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 1 | /** |
| 2 | * \file rsa.h |
Paul Bakker | e0ccd0a | 2009-01-04 16:27:10 +0000 | [diff] [blame] | 3 | * |
Paul Bakker | 37ca75d | 2011-01-06 12:28:03 +0000 | [diff] [blame] | 4 | * \brief The RSA public-key cryptosystem |
| 5 | * |
Paul Bakker | 407a0da | 2013-06-27 14:29:21 +0200 | [diff] [blame] | 6 | * Copyright (C) 2006-2013, Brainspark B.V. |
Paul Bakker | b96f154 | 2010-07-18 20:36:00 +0000 | [diff] [blame] | 7 | * |
| 8 | * This file is part of PolarSSL (http://www.polarssl.org) |
Paul Bakker | 84f12b7 | 2010-07-18 10:13:04 +0000 | [diff] [blame] | 9 | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> |
Paul Bakker | b96f154 | 2010-07-18 20:36:00 +0000 | [diff] [blame] | 10 | * |
Paul Bakker | 77b385e | 2009-07-28 17:23:11 +0000 | [diff] [blame] | 11 | * All rights reserved. |
Paul Bakker | e0ccd0a | 2009-01-04 16:27:10 +0000 | [diff] [blame] | 12 | * |
Paul Bakker | e0ccd0a | 2009-01-04 16:27:10 +0000 | [diff] [blame] | 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License as published by |
| 15 | * the Free Software Foundation; either version 2 of the License, or |
| 16 | * (at your option) any later version. |
| 17 | * |
| 18 | * This program is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 | * GNU General Public License for more details. |
| 22 | * |
| 23 | * You should have received a copy of the GNU General Public License along |
| 24 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 25 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 26 | */ |
Paul Bakker | 40e4694 | 2009-01-03 21:51:57 +0000 | [diff] [blame] | 27 | #ifndef POLARSSL_RSA_H |
| 28 | #define POLARSSL_RSA_H |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 29 | |
Paul Bakker | ed27a04 | 2013-04-18 22:46:23 +0200 | [diff] [blame] | 30 | #include "config.h" |
| 31 | |
Paul Bakker | 314052f | 2011-08-15 09:07:52 +0000 | [diff] [blame] | 32 | #include "bignum.h" |
Paul Bakker | c70b982 | 2013-04-07 22:00:46 +0200 | [diff] [blame] | 33 | #include "md.h" |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 34 | |
Paul Bakker | 13e2dfe | 2009-07-28 07:18:38 +0000 | [diff] [blame] | 35 | /* |
| 36 | * RSA Error codes |
| 37 | */ |
Paul Bakker | 9d78140 | 2011-05-09 16:17:09 +0000 | [diff] [blame] | 38 | #define POLARSSL_ERR_RSA_BAD_INPUT_DATA -0x4080 /**< Bad input parameters to function. */ |
| 39 | #define POLARSSL_ERR_RSA_INVALID_PADDING -0x4100 /**< Input data contains invalid padding and is rejected. */ |
| 40 | #define POLARSSL_ERR_RSA_KEY_GEN_FAILED -0x4180 /**< Something failed during generation of a key. */ |
| 41 | #define POLARSSL_ERR_RSA_KEY_CHECK_FAILED -0x4200 /**< Key failed to pass the libraries validity check. */ |
| 42 | #define POLARSSL_ERR_RSA_PUBLIC_FAILED -0x4280 /**< The public key operation failed. */ |
| 43 | #define POLARSSL_ERR_RSA_PRIVATE_FAILED -0x4300 /**< The private key operation failed. */ |
| 44 | #define POLARSSL_ERR_RSA_VERIFY_FAILED -0x4380 /**< The PKCS#1 verification failed. */ |
| 45 | #define POLARSSL_ERR_RSA_OUTPUT_TOO_LARGE -0x4400 /**< The output buffer for decryption is not large enough. */ |
| 46 | #define POLARSSL_ERR_RSA_RNG_FAILED -0x4480 /**< The random generator failed to generate non-zeros. */ |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 47 | |
| 48 | /* |
Paul Bakker | c70b982 | 2013-04-07 22:00:46 +0200 | [diff] [blame] | 49 | * RSA constants |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 50 | */ |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 51 | #define RSA_PUBLIC 0 |
| 52 | #define RSA_PRIVATE 1 |
| 53 | |
| 54 | #define RSA_PKCS_V15 0 |
| 55 | #define RSA_PKCS_V21 1 |
| 56 | |
| 57 | #define RSA_SIGN 1 |
| 58 | #define RSA_CRYPT 2 |
| 59 | |
Manuel Pégourié-Gonnard | e511ffc | 2013-08-22 17:33:21 +0200 | [diff] [blame] | 60 | /* |
| 61 | * The above constants may be used even if the RSA module is compile out, |
| 62 | * eg for alternative (PKCS#11) RSA implemenations in the PK layers. |
| 63 | */ |
| 64 | #if defined(POLARSSL_RSA_C) |
| 65 | |
Paul Bakker | 407a0da | 2013-06-27 14:29:21 +0200 | [diff] [blame] | 66 | #ifdef __cplusplus |
| 67 | extern "C" { |
| 68 | #endif |
| 69 | |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 70 | /** |
| 71 | * \brief RSA context structure |
| 72 | */ |
| 73 | typedef struct |
| 74 | { |
| 75 | int ver; /*!< always 0 */ |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 76 | size_t len; /*!< size(N) in chars */ |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 77 | |
| 78 | mpi N; /*!< public modulus */ |
| 79 | mpi E; /*!< public exponent */ |
| 80 | |
| 81 | mpi D; /*!< private exponent */ |
| 82 | mpi P; /*!< 1st prime factor */ |
| 83 | mpi Q; /*!< 2nd prime factor */ |
| 84 | mpi DP; /*!< D % (P - 1) */ |
| 85 | mpi DQ; /*!< D % (Q - 1) */ |
| 86 | mpi QP; /*!< 1 / (Q % P) */ |
| 87 | |
| 88 | mpi RN; /*!< cached R^2 mod N */ |
| 89 | mpi RP; /*!< cached R^2 mod P */ |
| 90 | mpi RQ; /*!< cached R^2 mod Q */ |
| 91 | |
Paul Bakker | 9dcc322 | 2011-03-08 14:16:06 +0000 | [diff] [blame] | 92 | int padding; /*!< RSA_PKCS_V15 for 1.5 padding and |
| 93 | RSA_PKCS_v21 for OAEP/PSS */ |
| 94 | int hash_id; /*!< Hash identifier of md_type_t as |
| 95 | specified in the md.h header file |
| 96 | for the EME-OAEP and EMSA-PSS |
| 97 | encoding */ |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 98 | } |
| 99 | rsa_context; |
| 100 | |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 101 | /** |
| 102 | * \brief Initialize an RSA context |
| 103 | * |
Paul Bakker | 9a73632 | 2012-11-14 12:39:52 +0000 | [diff] [blame] | 104 | * Note: Set padding to RSA_PKCS_V21 for the RSAES-OAEP |
| 105 | * encryption scheme and the RSASSA-PSS signature scheme. |
| 106 | * |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 107 | * \param ctx RSA context to be initialized |
| 108 | * \param padding RSA_PKCS_V15 or RSA_PKCS_V21 |
| 109 | * \param hash_id RSA_PKCS_V21 hash identifier |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 110 | * |
| 111 | * \note The hash_id parameter is actually ignored |
| 112 | * when using RSA_PKCS_V15 padding. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 113 | */ |
| 114 | void rsa_init( rsa_context *ctx, |
| 115 | int padding, |
Paul Bakker | 21eb280 | 2010-08-16 11:10:02 +0000 | [diff] [blame] | 116 | int hash_id); |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 117 | |
| 118 | /** |
| 119 | * \brief Generate an RSA keypair |
| 120 | * |
| 121 | * \param ctx RSA context that will hold the key |
Paul Bakker | 21eb280 | 2010-08-16 11:10:02 +0000 | [diff] [blame] | 122 | * \param f_rng RNG function |
| 123 | * \param p_rng RNG parameter |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 124 | * \param nbits size of the public key in bits |
| 125 | * \param exponent public exponent (e.g., 65537) |
| 126 | * |
| 127 | * \note rsa_init() must be called beforehand to setup |
Paul Bakker | 21eb280 | 2010-08-16 11:10:02 +0000 | [diff] [blame] | 128 | * the RSA context. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 129 | * |
Paul Bakker | 40e4694 | 2009-01-03 21:51:57 +0000 | [diff] [blame] | 130 | * \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 131 | */ |
Paul Bakker | 21eb280 | 2010-08-16 11:10:02 +0000 | [diff] [blame] | 132 | int rsa_gen_key( rsa_context *ctx, |
Paul Bakker | a3d195c | 2011-11-27 21:07:34 +0000 | [diff] [blame] | 133 | int (*f_rng)(void *, unsigned char *, size_t), |
Paul Bakker | 21eb280 | 2010-08-16 11:10:02 +0000 | [diff] [blame] | 134 | void *p_rng, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 135 | unsigned int nbits, int exponent ); |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 136 | |
| 137 | /** |
| 138 | * \brief Check a public RSA key |
| 139 | * |
| 140 | * \param ctx RSA context to be checked |
| 141 | * |
Paul Bakker | 40e4694 | 2009-01-03 21:51:57 +0000 | [diff] [blame] | 142 | * \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 143 | */ |
Paul Bakker | ff60ee6 | 2010-03-16 21:09:09 +0000 | [diff] [blame] | 144 | int rsa_check_pubkey( const rsa_context *ctx ); |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 145 | |
| 146 | /** |
| 147 | * \brief Check a private RSA key |
| 148 | * |
| 149 | * \param ctx RSA context to be checked |
| 150 | * |
Paul Bakker | 40e4694 | 2009-01-03 21:51:57 +0000 | [diff] [blame] | 151 | * \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 152 | */ |
Paul Bakker | ff60ee6 | 2010-03-16 21:09:09 +0000 | [diff] [blame] | 153 | int rsa_check_privkey( const rsa_context *ctx ); |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 154 | |
| 155 | /** |
| 156 | * \brief Do an RSA public key operation |
| 157 | * |
| 158 | * \param ctx RSA context |
| 159 | * \param input input buffer |
| 160 | * \param output output buffer |
| 161 | * |
Paul Bakker | 40e4694 | 2009-01-03 21:51:57 +0000 | [diff] [blame] | 162 | * \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 163 | * |
| 164 | * \note This function does NOT take care of message |
Paul Bakker | 619467a | 2009-03-28 23:26:51 +0000 | [diff] [blame] | 165 | * padding. Also, be sure to set input[0] = 0 or assure that |
| 166 | * input is smaller than N. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 167 | * |
| 168 | * \note The input and output buffers must be large |
| 169 | * enough (eg. 128 bytes if RSA-1024 is used). |
| 170 | */ |
| 171 | int rsa_public( rsa_context *ctx, |
Paul Bakker | ff60ee6 | 2010-03-16 21:09:09 +0000 | [diff] [blame] | 172 | const unsigned char *input, |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 173 | unsigned char *output ); |
| 174 | |
| 175 | /** |
| 176 | * \brief Do an RSA private key operation |
| 177 | * |
| 178 | * \param ctx RSA context |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 179 | * \param f_rng RNG function (Needed for blinding) |
| 180 | * \param p_rng RNG parameter |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 181 | * \param input input buffer |
| 182 | * \param output output buffer |
| 183 | * |
Paul Bakker | 40e4694 | 2009-01-03 21:51:57 +0000 | [diff] [blame] | 184 | * \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 185 | * |
| 186 | * \note The input and output buffers must be large |
| 187 | * enough (eg. 128 bytes if RSA-1024 is used). |
| 188 | */ |
| 189 | int rsa_private( rsa_context *ctx, |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 190 | int (*f_rng)(void *, unsigned char *, size_t), |
| 191 | void *p_rng, |
Paul Bakker | ff60ee6 | 2010-03-16 21:09:09 +0000 | [diff] [blame] | 192 | const unsigned char *input, |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 193 | unsigned char *output ); |
| 194 | |
| 195 | /** |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 196 | * \brief Generic wrapper to perform a PKCS#1 encryption using the |
| 197 | * mode from the context. Add the message padding, then do an |
| 198 | * RSA operation. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 199 | * |
| 200 | * \param ctx RSA context |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 201 | * \param f_rng RNG function (Needed for padding and PKCS#1 v2.1 encoding |
| 202 | * and RSA_PRIVATE) |
Paul Bakker | 21eb280 | 2010-08-16 11:10:02 +0000 | [diff] [blame] | 203 | * \param p_rng RNG parameter |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 204 | * \param mode RSA_PUBLIC or RSA_PRIVATE |
Paul Bakker | 592457c | 2009-04-01 19:01:43 +0000 | [diff] [blame] | 205 | * \param ilen contains the plaintext length |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 206 | * \param input buffer holding the data to be encrypted |
| 207 | * \param output buffer that will hold the ciphertext |
| 208 | * |
Paul Bakker | 40e4694 | 2009-01-03 21:51:57 +0000 | [diff] [blame] | 209 | * \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 210 | * |
| 211 | * \note The output buffer must be as large as the size |
| 212 | * of ctx->N (eg. 128 bytes if RSA-1024 is used). |
| 213 | */ |
| 214 | int rsa_pkcs1_encrypt( rsa_context *ctx, |
Paul Bakker | a3d195c | 2011-11-27 21:07:34 +0000 | [diff] [blame] | 215 | int (*f_rng)(void *, unsigned char *, size_t), |
Paul Bakker | 21eb280 | 2010-08-16 11:10:02 +0000 | [diff] [blame] | 216 | void *p_rng, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 217 | int mode, size_t ilen, |
Paul Bakker | ff60ee6 | 2010-03-16 21:09:09 +0000 | [diff] [blame] | 218 | const unsigned char *input, |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 219 | unsigned char *output ); |
| 220 | |
| 221 | /** |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 222 | * \brief Perform a PKCS#1 v1.5 encryption (RSAES-PKCS1-v1_5-ENCRYPT) |
| 223 | * |
| 224 | * \param ctx RSA context |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 225 | * \param f_rng RNG function (Needed for padding and RSA_PRIVATE) |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 226 | * \param p_rng RNG parameter |
| 227 | * \param mode RSA_PUBLIC or RSA_PRIVATE |
| 228 | * \param ilen contains the plaintext length |
| 229 | * \param input buffer holding the data to be encrypted |
| 230 | * \param output buffer that will hold the ciphertext |
| 231 | * |
| 232 | * \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code |
| 233 | * |
| 234 | * \note The output buffer must be as large as the size |
| 235 | * of ctx->N (eg. 128 bytes if RSA-1024 is used). |
| 236 | */ |
| 237 | int rsa_rsaes_pkcs1_v15_encrypt( rsa_context *ctx, |
| 238 | int (*f_rng)(void *, unsigned char *, size_t), |
| 239 | void *p_rng, |
| 240 | int mode, size_t ilen, |
| 241 | const unsigned char *input, |
| 242 | unsigned char *output ); |
| 243 | |
| 244 | /** |
| 245 | * \brief Perform a PKCS#1 v2.1 OAEP encryption (RSAES-OAEP-ENCRYPT) |
| 246 | * |
| 247 | * \param ctx RSA context |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 248 | * \param f_rng RNG function (Needed for padding and PKCS#1 v2.1 encoding |
| 249 | * and RSA_PRIVATE) |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 250 | * \param p_rng RNG parameter |
| 251 | * \param mode RSA_PUBLIC or RSA_PRIVATE |
Paul Bakker | a43231c | 2013-02-28 17:33:49 +0100 | [diff] [blame] | 252 | * \param label buffer holding the custom label to use |
| 253 | * \param label_len contains the label length |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 254 | * \param ilen contains the plaintext length |
| 255 | * \param input buffer holding the data to be encrypted |
| 256 | * \param output buffer that will hold the ciphertext |
| 257 | * |
| 258 | * \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code |
| 259 | * |
| 260 | * \note The output buffer must be as large as the size |
| 261 | * of ctx->N (eg. 128 bytes if RSA-1024 is used). |
| 262 | */ |
| 263 | int rsa_rsaes_oaep_encrypt( rsa_context *ctx, |
| 264 | int (*f_rng)(void *, unsigned char *, size_t), |
| 265 | void *p_rng, |
Paul Bakker | a43231c | 2013-02-28 17:33:49 +0100 | [diff] [blame] | 266 | int mode, |
| 267 | const unsigned char *label, size_t label_len, |
| 268 | size_t ilen, |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 269 | const unsigned char *input, |
| 270 | unsigned char *output ); |
| 271 | |
| 272 | /** |
| 273 | * \brief Generic wrapper to perform a PKCS#1 decryption using the |
| 274 | * mode from the context. Do an RSA operation, then remove |
| 275 | * the message padding |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 276 | * |
| 277 | * \param ctx RSA context |
Paul Bakker | f451bac | 2013-08-30 15:37:02 +0200 | [diff] [blame^] | 278 | * \param f_rng RNG function (Only needed for RSA_PRIVATE) |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 279 | * \param p_rng RNG parameter |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 280 | * \param mode RSA_PUBLIC or RSA_PRIVATE |
Paul Bakker | 4d8ca70 | 2011-08-09 10:31:05 +0000 | [diff] [blame] | 281 | * \param olen will contain the plaintext length |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 282 | * \param input buffer holding the encrypted data |
| 283 | * \param output buffer that will hold the plaintext |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 284 | * \param output_max_len maximum length of the output buffer |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 285 | * |
Paul Bakker | 40e4694 | 2009-01-03 21:51:57 +0000 | [diff] [blame] | 286 | * \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 287 | * |
| 288 | * \note The output buffer must be as large as the size |
Paul Bakker | 060c568 | 2009-01-12 21:48:39 +0000 | [diff] [blame] | 289 | * of ctx->N (eg. 128 bytes if RSA-1024 is used) otherwise |
| 290 | * an error is thrown. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 291 | */ |
| 292 | int rsa_pkcs1_decrypt( rsa_context *ctx, |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 293 | int (*f_rng)(void *, unsigned char *, size_t), |
| 294 | void *p_rng, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 295 | int mode, size_t *olen, |
Paul Bakker | ff60ee6 | 2010-03-16 21:09:09 +0000 | [diff] [blame] | 296 | const unsigned char *input, |
Paul Bakker | 060c568 | 2009-01-12 21:48:39 +0000 | [diff] [blame] | 297 | unsigned char *output, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 298 | size_t output_max_len ); |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 299 | |
| 300 | /** |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 301 | * \brief Perform a PKCS#1 v1.5 decryption (RSAES-PKCS1-v1_5-DECRYPT) |
| 302 | * |
| 303 | * \param ctx RSA context |
Paul Bakker | f451bac | 2013-08-30 15:37:02 +0200 | [diff] [blame^] | 304 | * \param f_rng RNG function (Only needed for RSA_PRIVATE) |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 305 | * \param p_rng RNG parameter |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 306 | * \param mode RSA_PUBLIC or RSA_PRIVATE |
| 307 | * \param olen will contain the plaintext length |
| 308 | * \param input buffer holding the encrypted data |
| 309 | * \param output buffer that will hold the plaintext |
| 310 | * \param output_max_len maximum length of the output buffer |
| 311 | * |
| 312 | * \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code |
| 313 | * |
| 314 | * \note The output buffer must be as large as the size |
| 315 | * of ctx->N (eg. 128 bytes if RSA-1024 is used) otherwise |
| 316 | * an error is thrown. |
| 317 | */ |
| 318 | int rsa_rsaes_pkcs1_v15_decrypt( rsa_context *ctx, |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 319 | int (*f_rng)(void *, unsigned char *, size_t), |
| 320 | void *p_rng, |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 321 | int mode, size_t *olen, |
| 322 | const unsigned char *input, |
| 323 | unsigned char *output, |
| 324 | size_t output_max_len ); |
| 325 | |
| 326 | /** |
| 327 | * \brief Perform a PKCS#1 v2.1 OAEP decryption (RSAES-OAEP-DECRYPT) |
| 328 | * |
| 329 | * \param ctx RSA context |
Paul Bakker | f451bac | 2013-08-30 15:37:02 +0200 | [diff] [blame^] | 330 | * \param f_rng RNG function (Only needed for RSA_PRIVATE) |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 331 | * \param p_rng RNG parameter |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 332 | * \param mode RSA_PUBLIC or RSA_PRIVATE |
Paul Bakker | a43231c | 2013-02-28 17:33:49 +0100 | [diff] [blame] | 333 | * \param label buffer holding the custom label to use |
| 334 | * \param label_len contains the label length |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 335 | * \param olen will contain the plaintext length |
| 336 | * \param input buffer holding the encrypted data |
| 337 | * \param output buffer that will hold the plaintext |
| 338 | * \param output_max_len maximum length of the output buffer |
| 339 | * |
| 340 | * \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code |
| 341 | * |
| 342 | * \note The output buffer must be as large as the size |
| 343 | * of ctx->N (eg. 128 bytes if RSA-1024 is used) otherwise |
| 344 | * an error is thrown. |
| 345 | */ |
| 346 | int rsa_rsaes_oaep_decrypt( rsa_context *ctx, |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 347 | int (*f_rng)(void *, unsigned char *, size_t), |
| 348 | void *p_rng, |
Paul Bakker | a43231c | 2013-02-28 17:33:49 +0100 | [diff] [blame] | 349 | int mode, |
| 350 | const unsigned char *label, size_t label_len, |
| 351 | size_t *olen, |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 352 | const unsigned char *input, |
| 353 | unsigned char *output, |
| 354 | size_t output_max_len ); |
| 355 | |
| 356 | /** |
| 357 | * \brief Generic wrapper to perform a PKCS#1 signature using the |
| 358 | * mode from the context. Do a private RSA operation to sign |
| 359 | * a message digest |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 360 | * |
| 361 | * \param ctx RSA context |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 362 | * \param f_rng RNG function (Needed for PKCS#1 v2.1 encoding and for |
| 363 | * RSA_PRIVATE) |
Paul Bakker | 9dcc322 | 2011-03-08 14:16:06 +0000 | [diff] [blame] | 364 | * \param p_rng RNG parameter |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 365 | * \param mode RSA_PUBLIC or RSA_PRIVATE |
Paul Bakker | c70b982 | 2013-04-07 22:00:46 +0200 | [diff] [blame] | 366 | * \param md_alg a POLARSSL_MD_* (use POLARSSL_MD_NONE for signing raw data) |
| 367 | * \param hashlen message digest length (for POLARSSL_MD_NONE only) |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 368 | * \param hash buffer holding the message digest |
| 369 | * \param sig buffer that will hold the ciphertext |
| 370 | * |
| 371 | * \return 0 if the signing operation was successful, |
Paul Bakker | 40e4694 | 2009-01-03 21:51:57 +0000 | [diff] [blame] | 372 | * or an POLARSSL_ERR_RSA_XXX error code |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 373 | * |
| 374 | * \note The "sig" buffer must be as large as the size |
| 375 | * of ctx->N (eg. 128 bytes if RSA-1024 is used). |
Paul Bakker | 9dcc322 | 2011-03-08 14:16:06 +0000 | [diff] [blame] | 376 | * |
| 377 | * \note In case of PKCS#1 v2.1 encoding keep in mind that |
| 378 | * the hash_id in the RSA context is the one used for the |
| 379 | * encoding. hash_id in the function call is the type of hash |
| 380 | * that is encoded. According to RFC 3447 it is advised to |
| 381 | * keep both hashes the same. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 382 | */ |
| 383 | int rsa_pkcs1_sign( rsa_context *ctx, |
Paul Bakker | a3d195c | 2011-11-27 21:07:34 +0000 | [diff] [blame] | 384 | int (*f_rng)(void *, unsigned char *, size_t), |
Paul Bakker | 9dcc322 | 2011-03-08 14:16:06 +0000 | [diff] [blame] | 385 | void *p_rng, |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 386 | int mode, |
Paul Bakker | c70b982 | 2013-04-07 22:00:46 +0200 | [diff] [blame] | 387 | md_type_t md_alg, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 388 | unsigned int hashlen, |
Paul Bakker | ff60ee6 | 2010-03-16 21:09:09 +0000 | [diff] [blame] | 389 | const unsigned char *hash, |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 390 | unsigned char *sig ); |
| 391 | |
| 392 | /** |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 393 | * \brief Perform a PKCS#1 v1.5 signature (RSASSA-PKCS1-v1_5-SIGN) |
| 394 | * |
| 395 | * \param ctx RSA context |
Paul Bakker | f451bac | 2013-08-30 15:37:02 +0200 | [diff] [blame^] | 396 | * \param f_rng RNG function (Only needed for RSA_PRIVATE) |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 397 | * \param p_rng RNG parameter |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 398 | * \param mode RSA_PUBLIC or RSA_PRIVATE |
Paul Bakker | c70b982 | 2013-04-07 22:00:46 +0200 | [diff] [blame] | 399 | * \param md_alg a POLARSSL_MD_* (use POLARSSL_MD_NONE for signing raw data) |
| 400 | * \param hashlen message digest length (for POLARSSL_MD_NONE only) |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 401 | * \param hash buffer holding the message digest |
| 402 | * \param sig buffer that will hold the ciphertext |
| 403 | * |
| 404 | * \return 0 if the signing operation was successful, |
| 405 | * or an POLARSSL_ERR_RSA_XXX error code |
| 406 | * |
| 407 | * \note The "sig" buffer must be as large as the size |
| 408 | * of ctx->N (eg. 128 bytes if RSA-1024 is used). |
| 409 | */ |
| 410 | int rsa_rsassa_pkcs1_v15_sign( rsa_context *ctx, |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 411 | int (*f_rng)(void *, unsigned char *, size_t), |
| 412 | void *p_rng, |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 413 | int mode, |
Paul Bakker | c70b982 | 2013-04-07 22:00:46 +0200 | [diff] [blame] | 414 | md_type_t md_alg, |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 415 | unsigned int hashlen, |
| 416 | const unsigned char *hash, |
| 417 | unsigned char *sig ); |
| 418 | |
| 419 | /** |
| 420 | * \brief Perform a PKCS#1 v2.1 PSS signature (RSASSA-PSS-SIGN) |
| 421 | * |
| 422 | * \param ctx RSA context |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 423 | * \param f_rng RNG function (Needed for PKCS#1 v2.1 encoding and for |
| 424 | * RSA_PRIVATE) |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 425 | * \param p_rng RNG parameter |
| 426 | * \param mode RSA_PUBLIC or RSA_PRIVATE |
Paul Bakker | c70b982 | 2013-04-07 22:00:46 +0200 | [diff] [blame] | 427 | * \param md_alg a POLARSSL_MD_* (use POLARSSL_MD_NONE for signing raw data) |
| 428 | * \param hashlen message digest length (for POLARSSL_MD_NONE only) |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 429 | * \param hash buffer holding the message digest |
| 430 | * \param sig buffer that will hold the ciphertext |
| 431 | * |
| 432 | * \return 0 if the signing operation was successful, |
| 433 | * or an POLARSSL_ERR_RSA_XXX error code |
| 434 | * |
| 435 | * \note The "sig" buffer must be as large as the size |
| 436 | * of ctx->N (eg. 128 bytes if RSA-1024 is used). |
| 437 | * |
| 438 | * \note In case of PKCS#1 v2.1 encoding keep in mind that |
| 439 | * the hash_id in the RSA context is the one used for the |
| 440 | * encoding. hash_id in the function call is the type of hash |
| 441 | * that is encoded. According to RFC 3447 it is advised to |
| 442 | * keep both hashes the same. |
| 443 | */ |
| 444 | int rsa_rsassa_pss_sign( rsa_context *ctx, |
| 445 | int (*f_rng)(void *, unsigned char *, size_t), |
| 446 | void *p_rng, |
| 447 | int mode, |
Paul Bakker | c70b982 | 2013-04-07 22:00:46 +0200 | [diff] [blame] | 448 | md_type_t md_alg, |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 449 | unsigned int hashlen, |
| 450 | const unsigned char *hash, |
| 451 | unsigned char *sig ); |
| 452 | |
| 453 | /** |
| 454 | * \brief Generic wrapper to perform a PKCS#1 verification using the |
| 455 | * mode from the context. Do a public RSA operation and check |
| 456 | * the message digest |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 457 | * |
| 458 | * \param ctx points to an RSA public key |
Paul Bakker | f451bac | 2013-08-30 15:37:02 +0200 | [diff] [blame^] | 459 | * \param f_rng RNG function (Only needed for RSA_PRIVATE) |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 460 | * \param p_rng RNG parameter |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 461 | * \param mode RSA_PUBLIC or RSA_PRIVATE |
Paul Bakker | c70b982 | 2013-04-07 22:00:46 +0200 | [diff] [blame] | 462 | * \param md_alg a POLARSSL_MD_* (use POLARSSL_MD_NONE for signing raw data) |
| 463 | * \param hashlen message digest length (for POLARSSL_MD_NONE only) |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 464 | * \param hash buffer holding the message digest |
| 465 | * \param sig buffer holding the ciphertext |
| 466 | * |
| 467 | * \return 0 if the verify operation was successful, |
Paul Bakker | 40e4694 | 2009-01-03 21:51:57 +0000 | [diff] [blame] | 468 | * or an POLARSSL_ERR_RSA_XXX error code |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 469 | * |
| 470 | * \note The "sig" buffer must be as large as the size |
| 471 | * of ctx->N (eg. 128 bytes if RSA-1024 is used). |
Paul Bakker | 9dcc322 | 2011-03-08 14:16:06 +0000 | [diff] [blame] | 472 | * |
| 473 | * \note In case of PKCS#1 v2.1 encoding keep in mind that |
| 474 | * the hash_id in the RSA context is the one used for the |
| 475 | * verification. hash_id in the function call is the type of hash |
| 476 | * that is verified. According to RFC 3447 it is advised to |
| 477 | * keep both hashes the same. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 478 | */ |
| 479 | int rsa_pkcs1_verify( rsa_context *ctx, |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 480 | int (*f_rng)(void *, unsigned char *, size_t), |
| 481 | void *p_rng, |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 482 | int mode, |
Paul Bakker | c70b982 | 2013-04-07 22:00:46 +0200 | [diff] [blame] | 483 | md_type_t md_alg, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 484 | unsigned int hashlen, |
Paul Bakker | ff60ee6 | 2010-03-16 21:09:09 +0000 | [diff] [blame] | 485 | const unsigned char *hash, |
Manuel Pégourié-Gonnard | cc0a9d0 | 2013-08-12 11:34:35 +0200 | [diff] [blame] | 486 | const unsigned char *sig ); |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 487 | |
| 488 | /** |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 489 | * \brief Perform a PKCS#1 v1.5 verification (RSASSA-PKCS1-v1_5-VERIFY) |
| 490 | * |
| 491 | * \param ctx points to an RSA public key |
Paul Bakker | f451bac | 2013-08-30 15:37:02 +0200 | [diff] [blame^] | 492 | * \param f_rng RNG function (Only needed for RSA_PRIVATE) |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 493 | * \param p_rng RNG parameter |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 494 | * \param mode RSA_PUBLIC or RSA_PRIVATE |
Paul Bakker | c70b982 | 2013-04-07 22:00:46 +0200 | [diff] [blame] | 495 | * \param md_alg a POLARSSL_MD_* (use POLARSSL_MD_NONE for signing raw data) |
| 496 | * \param hashlen message digest length (for POLARSSL_MD_NONE only) |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 497 | * \param hash buffer holding the message digest |
| 498 | * \param sig buffer holding the ciphertext |
| 499 | * |
| 500 | * \return 0 if the verify operation was successful, |
| 501 | * or an POLARSSL_ERR_RSA_XXX error code |
| 502 | * |
| 503 | * \note The "sig" buffer must be as large as the size |
| 504 | * of ctx->N (eg. 128 bytes if RSA-1024 is used). |
| 505 | */ |
| 506 | int rsa_rsassa_pkcs1_v15_verify( rsa_context *ctx, |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 507 | int (*f_rng)(void *, unsigned char *, size_t), |
| 508 | void *p_rng, |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 509 | int mode, |
Paul Bakker | c70b982 | 2013-04-07 22:00:46 +0200 | [diff] [blame] | 510 | md_type_t md_alg, |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 511 | unsigned int hashlen, |
| 512 | const unsigned char *hash, |
Manuel Pégourié-Gonnard | cc0a9d0 | 2013-08-12 11:34:35 +0200 | [diff] [blame] | 513 | const unsigned char *sig ); |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 514 | |
| 515 | /** |
| 516 | * \brief Perform a PKCS#1 v2.1 PSS verification (RSASSA-PSS-VERIFY) |
| 517 | * \brief Do a public RSA and check the message digest |
| 518 | * |
| 519 | * \param ctx points to an RSA public key |
Paul Bakker | f451bac | 2013-08-30 15:37:02 +0200 | [diff] [blame^] | 520 | * \param f_rng RNG function (Only needed for RSA_PRIVATE) |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 521 | * \param p_rng RNG parameter |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 522 | * \param mode RSA_PUBLIC or RSA_PRIVATE |
Paul Bakker | c70b982 | 2013-04-07 22:00:46 +0200 | [diff] [blame] | 523 | * \param md_alg a POLARSSL_MD_* (use POLARSSL_MD_NONE for signing raw data) |
| 524 | * \param hashlen message digest length (for POLARSSL_MD_NONE only) |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 525 | * \param hash buffer holding the message digest |
| 526 | * \param sig buffer holding the ciphertext |
| 527 | * |
| 528 | * \return 0 if the verify operation was successful, |
| 529 | * or an POLARSSL_ERR_RSA_XXX error code |
| 530 | * |
| 531 | * \note The "sig" buffer must be as large as the size |
| 532 | * of ctx->N (eg. 128 bytes if RSA-1024 is used). |
| 533 | * |
| 534 | * \note In case of PKCS#1 v2.1 encoding keep in mind that |
| 535 | * the hash_id in the RSA context is the one used for the |
| 536 | * verification. hash_id in the function call is the type of hash |
| 537 | * that is verified. According to RFC 3447 it is advised to |
| 538 | * keep both hashes the same. |
| 539 | */ |
| 540 | int rsa_rsassa_pss_verify( rsa_context *ctx, |
Paul Bakker | 548957d | 2013-08-30 10:30:02 +0200 | [diff] [blame] | 541 | int (*f_rng)(void *, unsigned char *, size_t), |
| 542 | void *p_rng, |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 543 | int mode, |
Paul Bakker | c70b982 | 2013-04-07 22:00:46 +0200 | [diff] [blame] | 544 | md_type_t md_alg, |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 545 | unsigned int hashlen, |
| 546 | const unsigned char *hash, |
Manuel Pégourié-Gonnard | cc0a9d0 | 2013-08-12 11:34:35 +0200 | [diff] [blame] | 547 | const unsigned char *sig ); |
Paul Bakker | b386913 | 2013-02-28 17:21:01 +0100 | [diff] [blame] | 548 | |
| 549 | /** |
Manuel Pégourié-Gonnard | 3053f5b | 2013-08-14 13:39:57 +0200 | [diff] [blame] | 550 | * \brief Copy the components of an RSA context |
| 551 | * |
| 552 | * \param dst Destination context |
| 553 | * \param src Source context |
| 554 | * |
| 555 | * \return O on success, |
| 556 | * POLARSSL_ERR_MPI_MALLOC_FAILED on memory allocation failure |
| 557 | */ |
| 558 | int rsa_copy( rsa_context *dst, const rsa_context *src ); |
| 559 | |
| 560 | /** |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 561 | * \brief Free the components of an RSA key |
Paul Bakker | 13e2dfe | 2009-07-28 07:18:38 +0000 | [diff] [blame] | 562 | * |
| 563 | * \param ctx RSA Context to free |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 564 | */ |
| 565 | void rsa_free( rsa_context *ctx ); |
| 566 | |
| 567 | /** |
| 568 | * \brief Checkup routine |
| 569 | * |
| 570 | * \return 0 if successful, or 1 if the test failed |
| 571 | */ |
| 572 | int rsa_self_test( int verbose ); |
| 573 | |
| 574 | #ifdef __cplusplus |
| 575 | } |
| 576 | #endif |
| 577 | |
Paul Bakker | ed27a04 | 2013-04-18 22:46:23 +0200 | [diff] [blame] | 578 | #endif /* POLARSSL_RSA_C */ |
| 579 | |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 580 | #endif /* rsa.h */ |