wolfSSL 3.11.1 for TLS1.3 beta

Fork of wolfSSL by wolf SSL

Committer:
wolfSSL
Date:
Thu Apr 28 00:57:21 2016 +0000
Revision:
4:1b0d80432c79
wolfSSL 3.9.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wolfSSL 4:1b0d80432c79 1 /* ecc.h
wolfSSL 4:1b0d80432c79 2 *
wolfSSL 4:1b0d80432c79 3 * Copyright (C) 2006-2016 wolfSSL Inc.
wolfSSL 4:1b0d80432c79 4 *
wolfSSL 4:1b0d80432c79 5 * This file is part of wolfSSL.
wolfSSL 4:1b0d80432c79 6 *
wolfSSL 4:1b0d80432c79 7 * wolfSSL is free software; you can redistribute it and/or modify
wolfSSL 4:1b0d80432c79 8 * it under the terms of the GNU General Public License as published by
wolfSSL 4:1b0d80432c79 9 * the Free Software Foundation; either version 2 of the License, or
wolfSSL 4:1b0d80432c79 10 * (at your option) any later version.
wolfSSL 4:1b0d80432c79 11 *
wolfSSL 4:1b0d80432c79 12 * wolfSSL is distributed in the hope that it will be useful,
wolfSSL 4:1b0d80432c79 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
wolfSSL 4:1b0d80432c79 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
wolfSSL 4:1b0d80432c79 15 * GNU General Public License for more details.
wolfSSL 4:1b0d80432c79 16 *
wolfSSL 4:1b0d80432c79 17 * You should have received a copy of the GNU General Public License
wolfSSL 4:1b0d80432c79 18 * along with this program; if not, write to the Free Software
wolfSSL 4:1b0d80432c79 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
wolfSSL 4:1b0d80432c79 20 */
wolfSSL 4:1b0d80432c79 21
wolfSSL 4:1b0d80432c79 22
wolfSSL 4:1b0d80432c79 23 #ifndef WOLF_CRYPT_ECC_H
wolfSSL 4:1b0d80432c79 24 #define WOLF_CRYPT_ECC_H
wolfSSL 4:1b0d80432c79 25
wolfSSL 4:1b0d80432c79 26 #include <wolfssl/wolfcrypt/types.h>
wolfSSL 4:1b0d80432c79 27
wolfSSL 4:1b0d80432c79 28 #ifdef HAVE_ECC
wolfSSL 4:1b0d80432c79 29
wolfSSL 4:1b0d80432c79 30 #include <wolfssl/wolfcrypt/integer.h>
wolfSSL 4:1b0d80432c79 31 #include <wolfssl/wolfcrypt/random.h>
wolfSSL 4:1b0d80432c79 32
wolfSSL 4:1b0d80432c79 33 #ifdef __cplusplus
wolfSSL 4:1b0d80432c79 34 extern "C" {
wolfSSL 4:1b0d80432c79 35 #endif
wolfSSL 4:1b0d80432c79 36
wolfSSL 4:1b0d80432c79 37 enum {
wolfSSL 4:1b0d80432c79 38 ECC_PUBLICKEY = 1,
wolfSSL 4:1b0d80432c79 39 ECC_PRIVATEKEY = 2,
wolfSSL 4:1b0d80432c79 40 ECC_MAXNAME = 16, /* MAX CURVE NAME LENGTH */
wolfSSL 4:1b0d80432c79 41 SIG_HEADER_SZ = 6, /* ECC signature header size */
wolfSSL 4:1b0d80432c79 42 ECC_BUFSIZE = 256, /* for exported keys temp buffer */
wolfSSL 4:1b0d80432c79 43 ECC_MINSIZE = 20, /* MIN Private Key size */
wolfSSL 4:1b0d80432c79 44 ECC_MAXSIZE = 66, /* MAX Private Key size */
wolfSSL 4:1b0d80432c79 45 ECC_MAXSIZE_GEN = 74, /* MAX Buffer size required when generating ECC keys*/
wolfSSL 4:1b0d80432c79 46 ECC_MAX_PAD_SZ = 4 /* ECC maximum padding size */
wolfSSL 4:1b0d80432c79 47 };
wolfSSL 4:1b0d80432c79 48
wolfSSL 4:1b0d80432c79 49
wolfSSL 4:1b0d80432c79 50 /* ECC set type defined a NIST GF(p) curve */
wolfSSL 4:1b0d80432c79 51 typedef struct {
wolfSSL 4:1b0d80432c79 52 int size; /* The size of the curve in octets */
wolfSSL 4:1b0d80432c79 53 int nid; /* id of this curve */
wolfSSL 4:1b0d80432c79 54 const char* name; /* name of this curve */
wolfSSL 4:1b0d80432c79 55 const char* prime; /* prime that defines the field, curve is in (hex) */
wolfSSL 4:1b0d80432c79 56 const char* Af; /* fields A param (hex) */
wolfSSL 4:1b0d80432c79 57 const char* Bf; /* fields B param (hex) */
wolfSSL 4:1b0d80432c79 58 const char* order; /* order of the curve (hex) */
wolfSSL 4:1b0d80432c79 59 const char* Gx; /* x coordinate of the base point on curve (hex) */
wolfSSL 4:1b0d80432c79 60 const char* Gy; /* y coordinate of the base point on curve (hex) */
wolfSSL 4:1b0d80432c79 61 } ecc_set_type;
wolfSSL 4:1b0d80432c79 62
wolfSSL 4:1b0d80432c79 63
wolfSSL 4:1b0d80432c79 64 #ifdef ALT_ECC_SIZE
wolfSSL 4:1b0d80432c79 65
wolfSSL 4:1b0d80432c79 66 /* Note on ALT_ECC_SIZE:
wolfSSL 4:1b0d80432c79 67 * The fast math code uses an array of a fixed size to store the big integers.
wolfSSL 4:1b0d80432c79 68 * By default, the array is big enough for RSA keys. There is a size,
wolfSSL 4:1b0d80432c79 69 * FP_MAX_BITS which can be used to make the array smaller when one wants ECC
wolfSSL 4:1b0d80432c79 70 * but not RSA. Some people want fast math sized for both RSA and ECC, where
wolfSSL 4:1b0d80432c79 71 * ECC won't use as much as RSA. The flag ALT_ECC_SIZE switches in an alternate
wolfSSL 4:1b0d80432c79 72 * ecc_point structure that uses an alternate fp_int that has a shorter array
wolfSSL 4:1b0d80432c79 73 * of fp_digits.
wolfSSL 4:1b0d80432c79 74 *
wolfSSL 4:1b0d80432c79 75 * Now, without ALT_ECC_SIZE, the ecc_point has three single item arrays of
wolfSSL 4:1b0d80432c79 76 * mp_ints for the components of the point. With ALT_ECC_SIZE, the components
wolfSSL 4:1b0d80432c79 77 * of the point are pointers that are set to each of a three item array of
wolfSSL 4:1b0d80432c79 78 * alt_fp_ints. While an mp_int will have 4096 bits of digit inside the
wolfSSL 4:1b0d80432c79 79 * structure, the alt_fp_int will only have 528 bits. A size value was added
wolfSSL 4:1b0d80432c79 80 * in the ALT case, as well, and is set by mp_init() and alt_fp_init(). The
wolfSSL 4:1b0d80432c79 81 * functions fp_zero() and fp_copy() use the size parameter. An int needs to
wolfSSL 4:1b0d80432c79 82 * be initialized before using it instead of just fp_zeroing it, the init will
wolfSSL 4:1b0d80432c79 83 * call zero. FP_MAX_BITS_ECC defaults to 528, but can be set to change the
wolfSSL 4:1b0d80432c79 84 * number of bits used in the alternate FP_INT.
wolfSSL 4:1b0d80432c79 85 *
wolfSSL 4:1b0d80432c79 86 * Do not enable ALT_ECC_SIZE and disable fast math in the configuration.
wolfSSL 4:1b0d80432c79 87 */
wolfSSL 4:1b0d80432c79 88
wolfSSL 4:1b0d80432c79 89 #ifndef USE_FAST_MATH
wolfSSL 4:1b0d80432c79 90 #error USE_FAST_MATH must be defined to use ALT_ECC_SIZE
wolfSSL 4:1b0d80432c79 91 #endif
wolfSSL 4:1b0d80432c79 92
wolfSSL 4:1b0d80432c79 93 #ifndef FP_MAX_BITS_ECC
wolfSSL 4:1b0d80432c79 94 #define FP_MAX_BITS_ECC 528
wolfSSL 4:1b0d80432c79 95 #endif
wolfSSL 4:1b0d80432c79 96 #define FP_MAX_SIZE_ECC (FP_MAX_BITS_ECC+(8*DIGIT_BIT))
wolfSSL 4:1b0d80432c79 97 #if FP_MAX_BITS_ECC % CHAR_BIT
wolfSSL 4:1b0d80432c79 98 #error FP_MAX_BITS_ECC must be a multiple of CHAR_BIT
wolfSSL 4:1b0d80432c79 99 #endif
wolfSSL 4:1b0d80432c79 100 #define FP_SIZE_ECC (FP_MAX_SIZE_ECC/DIGIT_BIT)
wolfSSL 4:1b0d80432c79 101
wolfSSL 4:1b0d80432c79 102 /* This needs to match the size of the fp_int struct, except the
wolfSSL 4:1b0d80432c79 103 * fp_digit array will be shorter. */
wolfSSL 4:1b0d80432c79 104 typedef struct alt_fp_int {
wolfSSL 4:1b0d80432c79 105 int used, sign, size;
wolfSSL 4:1b0d80432c79 106 fp_digit dp[FP_SIZE_ECC];
wolfSSL 4:1b0d80432c79 107 } alt_fp_int;
wolfSSL 4:1b0d80432c79 108 #endif
wolfSSL 4:1b0d80432c79 109
wolfSSL 4:1b0d80432c79 110 /* A point on an ECC curve, stored in Jacbobian format such that (x,y,z) =>
wolfSSL 4:1b0d80432c79 111 (x/z^2, y/z^3, 1) when interpreted as affine */
wolfSSL 4:1b0d80432c79 112 typedef struct {
wolfSSL 4:1b0d80432c79 113 #ifndef ALT_ECC_SIZE
wolfSSL 4:1b0d80432c79 114 mp_int x[1]; /* The x coordinate */
wolfSSL 4:1b0d80432c79 115 mp_int y[1]; /* The y coordinate */
wolfSSL 4:1b0d80432c79 116 mp_int z[1]; /* The z coordinate */
wolfSSL 4:1b0d80432c79 117 #else
wolfSSL 4:1b0d80432c79 118 mp_int* x; /* The x coordinate */
wolfSSL 4:1b0d80432c79 119 mp_int* y; /* The y coordinate */
wolfSSL 4:1b0d80432c79 120 mp_int* z; /* The z coordinate */
wolfSSL 4:1b0d80432c79 121 alt_fp_int xyz[3];
wolfSSL 4:1b0d80432c79 122 #endif
wolfSSL 4:1b0d80432c79 123 } ecc_point;
wolfSSL 4:1b0d80432c79 124
wolfSSL 4:1b0d80432c79 125
wolfSSL 4:1b0d80432c79 126 /* An ECC Key */
wolfSSL 4:1b0d80432c79 127 typedef struct {
wolfSSL 4:1b0d80432c79 128 int type; /* Public or Private */
wolfSSL 4:1b0d80432c79 129 int idx; /* Index into the ecc_sets[] for the parameters of
wolfSSL 4:1b0d80432c79 130 this curve if -1, this key is using user supplied
wolfSSL 4:1b0d80432c79 131 curve in dp */
wolfSSL 4:1b0d80432c79 132 const ecc_set_type* dp; /* domain parameters, either points to NIST
wolfSSL 4:1b0d80432c79 133 curves (idx >= 0) or user supplied */
wolfSSL 4:1b0d80432c79 134 ecc_point pubkey; /* public key */
wolfSSL 4:1b0d80432c79 135 mp_int k; /* private key */
wolfSSL 4:1b0d80432c79 136 } ecc_key;
wolfSSL 4:1b0d80432c79 137
wolfSSL 4:1b0d80432c79 138
wolfSSL 4:1b0d80432c79 139 /* ECC predefined curve sets */
wolfSSL 4:1b0d80432c79 140 extern const ecc_set_type ecc_sets[];
wolfSSL 4:1b0d80432c79 141
wolfSSL 4:1b0d80432c79 142
wolfSSL 4:1b0d80432c79 143 WOLFSSL_API
wolfSSL 4:1b0d80432c79 144 int wc_ecc_make_key(WC_RNG* rng, int keysize, ecc_key* key);
wolfSSL 4:1b0d80432c79 145 WOLFSSL_API
wolfSSL 4:1b0d80432c79 146 int wc_ecc_check_key(ecc_key* key);
wolfSSL 4:1b0d80432c79 147
wolfSSL 4:1b0d80432c79 148 #ifdef HAVE_ECC_DHE
wolfSSL 4:1b0d80432c79 149 WOLFSSL_API
wolfSSL 4:1b0d80432c79 150 int wc_ecc_shared_secret(ecc_key* private_key, ecc_key* public_key, byte* out,
wolfSSL 4:1b0d80432c79 151 word32* outlen);
wolfSSL 4:1b0d80432c79 152 WOLFSSL_API
wolfSSL 4:1b0d80432c79 153 int wc_ecc_shared_secret_ssh(ecc_key* private_key, ecc_point* point,
wolfSSL 4:1b0d80432c79 154 byte* out, word32 *outlen);
wolfSSL 4:1b0d80432c79 155 #endif /* HAVE_ECC_DHE */
wolfSSL 4:1b0d80432c79 156
wolfSSL 4:1b0d80432c79 157 #ifdef HAVE_ECC_SIGN
wolfSSL 4:1b0d80432c79 158 WOLFSSL_API
wolfSSL 4:1b0d80432c79 159 int wc_ecc_sign_hash(const byte* in, word32 inlen, byte* out, word32 *outlen,
wolfSSL 4:1b0d80432c79 160 WC_RNG* rng, ecc_key* key);
wolfSSL 4:1b0d80432c79 161 WOLFSSL_API
wolfSSL 4:1b0d80432c79 162 int wc_ecc_sign_hash_ex(const byte* in, word32 inlen, WC_RNG* rng,
wolfSSL 4:1b0d80432c79 163 ecc_key* key, mp_int *r, mp_int *s);
wolfSSL 4:1b0d80432c79 164 #endif /* HAVE_ECC_SIGN */
wolfSSL 4:1b0d80432c79 165
wolfSSL 4:1b0d80432c79 166 #ifdef HAVE_ECC_VERIFY
wolfSSL 4:1b0d80432c79 167 WOLFSSL_API
wolfSSL 4:1b0d80432c79 168 int wc_ecc_verify_hash(const byte* sig, word32 siglen, const byte* hash,
wolfSSL 4:1b0d80432c79 169 word32 hashlen, int* stat, ecc_key* key);
wolfSSL 4:1b0d80432c79 170 WOLFSSL_API
wolfSSL 4:1b0d80432c79 171 int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
wolfSSL 4:1b0d80432c79 172 word32 hashlen, int* stat, ecc_key* key);
wolfSSL 4:1b0d80432c79 173 #endif /* HAVE_ECC_VERIFY */
wolfSSL 4:1b0d80432c79 174
wolfSSL 4:1b0d80432c79 175 WOLFSSL_API
wolfSSL 4:1b0d80432c79 176 int wc_ecc_init(ecc_key* key);
wolfSSL 4:1b0d80432c79 177 WOLFSSL_API
wolfSSL 4:1b0d80432c79 178 void wc_ecc_free(ecc_key* key);
wolfSSL 4:1b0d80432c79 179 WOLFSSL_API
wolfSSL 4:1b0d80432c79 180 void wc_ecc_fp_free(void);
wolfSSL 4:1b0d80432c79 181
wolfSSL 4:1b0d80432c79 182 WOLFSSL_API
wolfSSL 4:1b0d80432c79 183 ecc_point* wc_ecc_new_point(void);
wolfSSL 4:1b0d80432c79 184 WOLFSSL_API
wolfSSL 4:1b0d80432c79 185 void wc_ecc_del_point(ecc_point* p);
wolfSSL 4:1b0d80432c79 186 WOLFSSL_API
wolfSSL 4:1b0d80432c79 187 int wc_ecc_copy_point(ecc_point* p, ecc_point *r);
wolfSSL 4:1b0d80432c79 188 WOLFSSL_API
wolfSSL 4:1b0d80432c79 189 int wc_ecc_cmp_point(ecc_point* a, ecc_point *b);
wolfSSL 4:1b0d80432c79 190 WOLFSSL_API
wolfSSL 4:1b0d80432c79 191 int wc_ecc_point_is_at_infinity(ecc_point *p);
wolfSSL 4:1b0d80432c79 192 WOLFSSL_API
wolfSSL 4:1b0d80432c79 193 int wc_ecc_is_valid_idx(int n);
wolfSSL 4:1b0d80432c79 194 WOLFSSL_API
wolfSSL 4:1b0d80432c79 195 int wc_ecc_mulmod(mp_int* k, ecc_point *G, ecc_point *R,
wolfSSL 4:1b0d80432c79 196 mp_int* modulus, int map);
wolfSSL 4:1b0d80432c79 197
wolfSSL 4:1b0d80432c79 198 #ifdef HAVE_ECC_KEY_EXPORT
wolfSSL 4:1b0d80432c79 199 /* ASN key helpers */
wolfSSL 4:1b0d80432c79 200 WOLFSSL_API
wolfSSL 4:1b0d80432c79 201 int wc_ecc_export_x963(ecc_key*, byte* out, word32* outLen);
wolfSSL 4:1b0d80432c79 202 WOLFSSL_API
wolfSSL 4:1b0d80432c79 203 int wc_ecc_export_x963_ex(ecc_key*, byte* out, word32* outLen, int compressed);
wolfSSL 4:1b0d80432c79 204 /* extended functionality with compressed option */
wolfSSL 4:1b0d80432c79 205 #endif /* HAVE_ECC_KEY_EXPORT */
wolfSSL 4:1b0d80432c79 206
wolfSSL 4:1b0d80432c79 207 #ifdef HAVE_ECC_KEY_IMPORT
wolfSSL 4:1b0d80432c79 208 WOLFSSL_API
wolfSSL 4:1b0d80432c79 209 int wc_ecc_import_x963(const byte* in, word32 inLen, ecc_key* key);
wolfSSL 4:1b0d80432c79 210 WOLFSSL_API
wolfSSL 4:1b0d80432c79 211 int wc_ecc_import_private_key(const byte* priv, word32 privSz, const byte* pub,
wolfSSL 4:1b0d80432c79 212 word32 pubSz, ecc_key* key);
wolfSSL 4:1b0d80432c79 213 WOLFSSL_API
wolfSSL 4:1b0d80432c79 214 int wc_ecc_rs_to_sig(const char* r, const char* s, byte* out, word32* outlen);
wolfSSL 4:1b0d80432c79 215 WOLFSSL_API
wolfSSL 4:1b0d80432c79 216 int wc_ecc_import_raw(ecc_key* key, const char* qx, const char* qy,
wolfSSL 4:1b0d80432c79 217 const char* d, const char* curveName);
wolfSSL 4:1b0d80432c79 218 #endif /* HAVE_ECC_KEY_IMPORT */
wolfSSL 4:1b0d80432c79 219
wolfSSL 4:1b0d80432c79 220 #ifdef HAVE_ECC_KEY_EXPORT
wolfSSL 4:1b0d80432c79 221 WOLFSSL_API
wolfSSL 4:1b0d80432c79 222 int wc_ecc_export_private_only(ecc_key* key, byte* out, word32* outLen);
wolfSSL 4:1b0d80432c79 223
wolfSSL 4:1b0d80432c79 224 WOLFSSL_API
wolfSSL 4:1b0d80432c79 225 int wc_ecc_export_point_der(const int curve_idx, ecc_point* point,
wolfSSL 4:1b0d80432c79 226 byte* out, word32* outLen);
wolfSSL 4:1b0d80432c79 227 #endif /* HAVE_ECC_KEY_EXPORT */
wolfSSL 4:1b0d80432c79 228
wolfSSL 4:1b0d80432c79 229 #ifdef HAVE_ECC_KEY_IMPORT
wolfSSL 4:1b0d80432c79 230 WOLFSSL_API
wolfSSL 4:1b0d80432c79 231 int wc_ecc_import_point_der(byte* in, word32 inLen, const int curve_idx,
wolfSSL 4:1b0d80432c79 232 ecc_point* point);
wolfSSL 4:1b0d80432c79 233 #endif /* HAVE_ECC_KEY_IMPORT */
wolfSSL 4:1b0d80432c79 234
wolfSSL 4:1b0d80432c79 235 /* size helper */
wolfSSL 4:1b0d80432c79 236 WOLFSSL_API
wolfSSL 4:1b0d80432c79 237 int wc_ecc_size(ecc_key* key);
wolfSSL 4:1b0d80432c79 238 WOLFSSL_API
wolfSSL 4:1b0d80432c79 239 int wc_ecc_sig_size(ecc_key* key);
wolfSSL 4:1b0d80432c79 240
wolfSSL 4:1b0d80432c79 241
wolfSSL 4:1b0d80432c79 242 #ifdef HAVE_ECC_ENCRYPT
wolfSSL 4:1b0d80432c79 243 /* ecc encrypt */
wolfSSL 4:1b0d80432c79 244
wolfSSL 4:1b0d80432c79 245 enum ecEncAlgo {
wolfSSL 4:1b0d80432c79 246 ecAES_128_CBC = 1, /* default */
wolfSSL 4:1b0d80432c79 247 ecAES_256_CBC = 2
wolfSSL 4:1b0d80432c79 248 };
wolfSSL 4:1b0d80432c79 249
wolfSSL 4:1b0d80432c79 250 enum ecKdfAlgo {
wolfSSL 4:1b0d80432c79 251 ecHKDF_SHA256 = 1, /* default */
wolfSSL 4:1b0d80432c79 252 ecHKDF_SHA1 = 2
wolfSSL 4:1b0d80432c79 253 };
wolfSSL 4:1b0d80432c79 254
wolfSSL 4:1b0d80432c79 255 enum ecMacAlgo {
wolfSSL 4:1b0d80432c79 256 ecHMAC_SHA256 = 1, /* default */
wolfSSL 4:1b0d80432c79 257 ecHMAC_SHA1 = 2
wolfSSL 4:1b0d80432c79 258 };
wolfSSL 4:1b0d80432c79 259
wolfSSL 4:1b0d80432c79 260 enum {
wolfSSL 4:1b0d80432c79 261 KEY_SIZE_128 = 16,
wolfSSL 4:1b0d80432c79 262 KEY_SIZE_256 = 32,
wolfSSL 4:1b0d80432c79 263 IV_SIZE_64 = 8,
wolfSSL 4:1b0d80432c79 264 IV_SIZE_128 = 16,
wolfSSL 4:1b0d80432c79 265 EXCHANGE_SALT_SZ = 16,
wolfSSL 4:1b0d80432c79 266 EXCHANGE_INFO_SZ = 23
wolfSSL 4:1b0d80432c79 267 };
wolfSSL 4:1b0d80432c79 268
wolfSSL 4:1b0d80432c79 269 enum ecFlags {
wolfSSL 4:1b0d80432c79 270 REQ_RESP_CLIENT = 1,
wolfSSL 4:1b0d80432c79 271 REQ_RESP_SERVER = 2
wolfSSL 4:1b0d80432c79 272 };
wolfSSL 4:1b0d80432c79 273
wolfSSL 4:1b0d80432c79 274
wolfSSL 4:1b0d80432c79 275 typedef struct ecEncCtx ecEncCtx;
wolfSSL 4:1b0d80432c79 276
wolfSSL 4:1b0d80432c79 277 WOLFSSL_API
wolfSSL 4:1b0d80432c79 278 ecEncCtx* wc_ecc_ctx_new(int flags, WC_RNG* rng);
wolfSSL 4:1b0d80432c79 279 WOLFSSL_API
wolfSSL 4:1b0d80432c79 280 void wc_ecc_ctx_free(ecEncCtx*);
wolfSSL 4:1b0d80432c79 281 WOLFSSL_API
wolfSSL 4:1b0d80432c79 282 int wc_ecc_ctx_reset(ecEncCtx*, WC_RNG*); /* reset for use again w/o alloc/free */
wolfSSL 4:1b0d80432c79 283
wolfSSL 4:1b0d80432c79 284 WOLFSSL_API
wolfSSL 4:1b0d80432c79 285 const byte* wc_ecc_ctx_get_own_salt(ecEncCtx*);
wolfSSL 4:1b0d80432c79 286 WOLFSSL_API
wolfSSL 4:1b0d80432c79 287 int wc_ecc_ctx_set_peer_salt(ecEncCtx*, const byte* salt);
wolfSSL 4:1b0d80432c79 288 WOLFSSL_API
wolfSSL 4:1b0d80432c79 289 int wc_ecc_ctx_set_info(ecEncCtx*, const byte* info, int sz);
wolfSSL 4:1b0d80432c79 290
wolfSSL 4:1b0d80432c79 291 WOLFSSL_API
wolfSSL 4:1b0d80432c79 292 int wc_ecc_encrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
wolfSSL 4:1b0d80432c79 293 word32 msgSz, byte* out, word32* outSz, ecEncCtx* ctx);
wolfSSL 4:1b0d80432c79 294 WOLFSSL_API
wolfSSL 4:1b0d80432c79 295 int wc_ecc_decrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
wolfSSL 4:1b0d80432c79 296 word32 msgSz, byte* out, word32* outSz, ecEncCtx* ctx);
wolfSSL 4:1b0d80432c79 297
wolfSSL 4:1b0d80432c79 298 #endif /* HAVE_ECC_ENCRYPT */
wolfSSL 4:1b0d80432c79 299
wolfSSL 4:1b0d80432c79 300 #ifdef __cplusplus
wolfSSL 4:1b0d80432c79 301 } /* extern "C" */
wolfSSL 4:1b0d80432c79 302 #endif
wolfSSL 4:1b0d80432c79 303
wolfSSL 4:1b0d80432c79 304 #endif /* HAVE_ECC */
wolfSSL 4:1b0d80432c79 305 #endif /* WOLF_CRYPT_ECC_H */
wolfSSL 4:1b0d80432c79 306