forked from wolfSSL/wolfssl
align return code, coding style (tab-> space, line with 80 char), curve_idx validity
This commit is contained in:
@ -529,7 +529,8 @@ WOLFSSL_LOCAL int GetSet(const byte* input, word32* inOutIdx, int* len,
|
||||
|
||||
|
||||
/* winodws header clash for WinCE using GetVersion */
|
||||
WOLFSSL_LOCAL int GetMyVersion(const byte* input, word32* inOutIdx, int* version)
|
||||
WOLFSSL_LOCAL int GetMyVersion(const byte* input, word32* inOutIdx,
|
||||
int* version)
|
||||
{
|
||||
word32 idx = *inOutIdx;
|
||||
|
||||
@ -939,12 +940,12 @@ static int DecryptKey(const char* password, int passwordSz, byte* salt,
|
||||
#endif
|
||||
|
||||
if (version == PKCS5v2)
|
||||
ret = wc_PBKDF2(key, (byte*)password, passwordSz, salt, saltSz, iterations,
|
||||
derivedLen, typeH);
|
||||
ret = wc_PBKDF2(key, (byte*)password, passwordSz,
|
||||
salt, saltSz, iterations, derivedLen, typeH);
|
||||
#ifndef NO_SHA
|
||||
else if (version == PKCS5)
|
||||
ret = wc_PBKDF1(key, (byte*)password, passwordSz, salt, saltSz, iterations,
|
||||
derivedLen, typeH);
|
||||
ret = wc_PBKDF1(key, (byte*)password, passwordSz,
|
||||
salt, saltSz, iterations, derivedLen, typeH);
|
||||
#endif
|
||||
else if (version == PKCS12) {
|
||||
int i, idx = 0;
|
||||
@ -6272,14 +6273,16 @@ int wc_SignCert(int requestSz, int sType, byte* buffer, word32 buffSz,
|
||||
}
|
||||
|
||||
|
||||
int wc_MakeSelfCert(Cert* cert, byte* buffer, word32 buffSz, RsaKey* key, RNG* rng)
|
||||
int wc_MakeSelfCert(Cert* cert, byte* buffer, word32 buffSz,
|
||||
RsaKey* key, RNG* rng)
|
||||
{
|
||||
int ret = wc_MakeCert(cert, buffer, buffSz, key, NULL, rng);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return wc_SignCert(cert->bodySz, cert->sigType, buffer, buffSz, key, NULL,rng);
|
||||
return wc_SignCert(cert->bodySz, cert->sigType,
|
||||
buffer, buffSz, key, NULL, rng);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1442,25 +1442,30 @@ void ecc_del_point(ecc_point* p)
|
||||
*/
|
||||
int ecc_copy_point(ecc_point* p, ecc_point *r)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* prevents null arguments */
|
||||
if (p == NULL || r == NULL)
|
||||
return 0;
|
||||
return ECC_BAD_ARG_E;
|
||||
|
||||
if (mp_copy(p->x, r->x) != MP_OKAY)
|
||||
return 0;
|
||||
if (mp_copy(p->y, r->y) != MP_OKAY)
|
||||
return 0;
|
||||
if (mp_copy(p->z, r->z) != MP_OKAY)
|
||||
return 0;
|
||||
ret = mp_copy(p->x, r->x);
|
||||
if (ret != MP_OKAY)
|
||||
return ret;
|
||||
ret = mp_copy(p->y, r->y);
|
||||
if (ret != MP_OKAY)
|
||||
return ret;
|
||||
ret = mp_copy(p->z, r->z);
|
||||
if (ret != MP_OKAY)
|
||||
return ret;
|
||||
|
||||
return 1;
|
||||
return MP_OKAY;
|
||||
}
|
||||
|
||||
/** Compare the value of a point with an other one
|
||||
a The point to compare
|
||||
b The othe point to compare
|
||||
|
||||
return 0 if equal, 1 if not, -1 in case of error
|
||||
return MP_EQ if equal, MP_LT/MP_GT if not, < 0 in case of error
|
||||
*/
|
||||
int ecc_cmp_point(ecc_point* a, ecc_point *b)
|
||||
{
|
||||
@ -1468,28 +1473,19 @@ int ecc_cmp_point(ecc_point* a, ecc_point *b)
|
||||
|
||||
/* prevents null arguments */
|
||||
if (a == NULL || b == NULL)
|
||||
return -1;
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
ret = mp_cmp(a->x, b->x);
|
||||
if (ret != MP_EQ) {
|
||||
if (ret != MP_LT && ret != MP_GT)
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
if (ret != MP_EQ)
|
||||
return ret;
|
||||
ret = mp_cmp(a->y, b->y);
|
||||
if (ret != MP_EQ) {
|
||||
if (ret != MP_LT && ret != MP_GT)
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
if (ret != MP_EQ)
|
||||
return ret;
|
||||
ret = mp_cmp(a->z, b->z);
|
||||
if (ret != MP_EQ) {
|
||||
if (ret != MP_LT && ret != MP_GT)
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
if (ret != MP_EQ)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
return MP_EQ;
|
||||
}
|
||||
|
||||
/** Returns whether an ECC idx is valid or not
|
||||
@ -1588,7 +1584,8 @@ int wc_ecc_shared_secret(ecc_key* private_key, ecc_key* public_key, byte* out,
|
||||
outlen [in/out] The max size and resulting size of the shared secret
|
||||
return MP_OKAY if successful
|
||||
*/
|
||||
int wc_ecc_shared_secret_ssh(ecc_key* private_key, ecc_point* point, byte* out, word32 *outlen)
|
||||
int wc_ecc_shared_secret_ssh(ecc_key* private_key, ecc_point* point,
|
||||
byte* out, word32 *outlen)
|
||||
{
|
||||
word32 x = 0;
|
||||
ecc_point* result;
|
||||
@ -1630,7 +1627,8 @@ int wc_ecc_shared_secret_ssh(ecc_key* private_key, ecc_point* point, byte* out,
|
||||
|
||||
if (err == MP_OKAY) {
|
||||
XMEMSET(out, 0, x);
|
||||
err = mp_to_unsigned_bin(result->x,out + (x - mp_unsigned_bin_size(result->x)));
|
||||
err = mp_to_unsigned_bin(result->x,out +
|
||||
(x - mp_unsigned_bin_size(result->x)));
|
||||
*outlen = x;
|
||||
}
|
||||
|
||||
@ -1823,7 +1821,7 @@ int wc_ecc_init(ecc_key* key)
|
||||
alt_fp_init(key->pubkey.z);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
return MP_OKAY;
|
||||
}
|
||||
|
||||
|
||||
@ -1843,7 +1841,8 @@ int wc_ecc_sign_hash(const byte* in, word32 inlen, byte* out, word32 *outlen,
|
||||
mp_int s;
|
||||
int err;
|
||||
|
||||
if (in == NULL || out == NULL || outlen == NULL || key == NULL || rng == NULL)
|
||||
if (in == NULL || out == NULL || outlen == NULL ||
|
||||
key == NULL || rng == NULL)
|
||||
return ECC_BAD_ARG_E;
|
||||
|
||||
if ((err = mp_init_multi(&r, &s, NULL, NULL, NULL, NULL)) != MP_OKAY) {
|
||||
@ -1916,7 +1915,7 @@ int wc_ecc_sign_hash_ex(const byte* in, word32 inlen, RNG* rng,
|
||||
if (err == MP_OKAY) {
|
||||
int loop_check = 0;
|
||||
ecc_key pubkey;
|
||||
wc_ecc_init(&pubkey);
|
||||
if (wc_ecc_init(&pubkey) == MP_OKAY) {
|
||||
for (;;) {
|
||||
if (++loop_check > 64) {
|
||||
err = RNG_FAILURE_E;
|
||||
@ -1958,6 +1957,7 @@ int wc_ecc_sign_hash_ex(const byte* in, word32 inlen, RNG* rng,
|
||||
}
|
||||
wc_ecc_free(&pubkey);
|
||||
}
|
||||
}
|
||||
|
||||
mp_clear(&p);
|
||||
mp_clear(&e);
|
||||
@ -2335,7 +2335,8 @@ int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
|
||||
|
||||
/* check for zero */
|
||||
if (err == MP_OKAY) {
|
||||
if (mp_iszero(r) || mp_iszero(s) || mp_cmp(r, &p) != MP_LT || mp_cmp(s, &p) != MP_LT)
|
||||
if (mp_iszero(r) || mp_iszero(s) || mp_cmp(r, &p) != MP_LT ||
|
||||
mp_cmp(s, &p) != MP_LT)
|
||||
err = MP_ZERO_E;
|
||||
}
|
||||
/* read hash */
|
||||
@ -2434,12 +2435,14 @@ int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
|
||||
}
|
||||
|
||||
/* import point from der */
|
||||
int wc_ecc_import_point_der(byte* in, word32 inLen, const int curve_idx, ecc_point* point)
|
||||
int wc_ecc_import_point_der(byte* in, word32 inLen, const int curve_idx,
|
||||
ecc_point* point)
|
||||
{
|
||||
int err = 0;
|
||||
int compressed = 0;
|
||||
|
||||
if (in == NULL || point == NULL || (ecc_is_valid_idx(curve_idx) == 0))
|
||||
if (in == NULL || point == NULL || (curve_idx < 0) ||
|
||||
(ecc_is_valid_idx(curve_idx) == 0))
|
||||
return ECC_BAD_ARG_E;
|
||||
|
||||
/* must be odd */
|
||||
@ -2539,7 +2542,8 @@ int wc_ecc_import_point_der(byte* in, word32 inLen, const int curve_idx, ecc_poi
|
||||
#endif
|
||||
|
||||
if (err == MP_OKAY && compressed == 0)
|
||||
err = mp_read_unsigned_bin(point->y, (byte*)in+1+((inLen-1)>>1), (inLen-1)>>1);
|
||||
err = mp_read_unsigned_bin(point->y,
|
||||
(byte*)in+1+((inLen-1)>>1), (inLen-1)>>1);
|
||||
if (err == MP_OKAY)
|
||||
mp_set(point->z, 1);
|
||||
|
||||
@ -2553,7 +2557,8 @@ int wc_ecc_import_point_der(byte* in, word32 inLen, const int curve_idx, ecc_poi
|
||||
}
|
||||
|
||||
/* export point to der */
|
||||
int wc_ecc_export_point_der(const int curve_idx, ecc_point* point, byte* out, word32* outLen)
|
||||
int wc_ecc_export_point_der(const int curve_idx, ecc_point* point, byte* out,
|
||||
word32* outLen)
|
||||
{
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
byte* buf;
|
||||
@ -2563,7 +2568,7 @@ int wc_ecc_export_point_der(const int curve_idx, ecc_point* point, byte* out, wo
|
||||
word32 numlen;
|
||||
int ret = MP_OKAY;
|
||||
|
||||
if (curve_idx < 0)
|
||||
if ((curve_idx < 0) || (ecc_is_valid_idx(curve_idx) == 0))
|
||||
return ECC_BAD_ARG_E;
|
||||
|
||||
/* return length needed only */
|
||||
@ -2595,16 +2600,16 @@ int wc_ecc_export_point_der(const int curve_idx, ecc_point* point, byte* out, wo
|
||||
do {
|
||||
/* pad and store x */
|
||||
XMEMSET(buf, 0, ECC_BUFSIZE);
|
||||
ret = mp_to_unsigned_bin(point->x,
|
||||
buf + (numlen - mp_unsigned_bin_size(point->x)));
|
||||
ret = mp_to_unsigned_bin(point->x, buf +
|
||||
(numlen - mp_unsigned_bin_size(point->x)));
|
||||
if (ret != MP_OKAY)
|
||||
break;
|
||||
XMEMCPY(out+1, buf, numlen);
|
||||
|
||||
/* pad and store y */
|
||||
XMEMSET(buf, 0, ECC_BUFSIZE);
|
||||
ret = mp_to_unsigned_bin(point->y,
|
||||
buf + (numlen - mp_unsigned_bin_size(point->y)));
|
||||
ret = mp_to_unsigned_bin(point->y, buf +
|
||||
(numlen - mp_unsigned_bin_size(point->y)));
|
||||
if (ret != MP_OKAY)
|
||||
break;
|
||||
XMEMCPY(out+1+numlen, buf, numlen);
|
||||
@ -2690,7 +2695,8 @@ int wc_ecc_export_x963(ecc_key* key, byte* out, word32* outLen)
|
||||
|
||||
/* export public ECC key in ANSI X9.63 format, extended with
|
||||
* compression option */
|
||||
int wc_ecc_export_x963_ex(ecc_key* key, byte* out, word32* outLen, int compressed)
|
||||
int wc_ecc_export_x963_ex(ecc_key* key, byte* out, word32* outLen,
|
||||
int compressed)
|
||||
{
|
||||
if (compressed == 0)
|
||||
return wc_ecc_export_x963(key, out, outLen);
|
||||
@ -3235,8 +3241,8 @@ int wc_ecc_size(ecc_key* key)
|
||||
}
|
||||
|
||||
|
||||
/* worst case estimate, check actual return from wc_ecc_sign_hash for actual value
|
||||
of signature size in octets */
|
||||
/* worst case estimate, check actual return from wc_ecc_sign_hash for actual
|
||||
value of signature size in octets */
|
||||
int wc_ecc_sig_size(ecc_key* key)
|
||||
{
|
||||
int sz = wc_ecc_size(key);
|
||||
|
@ -1888,7 +1888,8 @@ int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y,
|
||||
}
|
||||
|
||||
for (x = 0; x < (winsize - 1); x++) {
|
||||
if ((err = mp_sqr (&M[(mp_digit)(1 << (winsize - 1))], &M[(mp_digit)(1 << (winsize - 1))])) != MP_OKAY) {
|
||||
if ((err = mp_sqr (&M[(mp_digit)(1 << (winsize - 1))],
|
||||
&M[(mp_digit)(1 << (winsize - 1))])) != MP_OKAY) {
|
||||
goto LBL_RES;
|
||||
}
|
||||
if ((err = redux (&M[(mp_digit)(1 << (winsize - 1))], P, mp)) != MP_OKAY) {
|
||||
@ -3192,7 +3193,8 @@ int mp_montgomery_calc_normalization (mp_int * a, mp_int * b)
|
||||
bits = mp_count_bits (b) % DIGIT_BIT;
|
||||
|
||||
if (b->used > 1) {
|
||||
if ((res = mp_2expt (a, (b->used - 1) * DIGIT_BIT + bits - 1)) != MP_OKAY) {
|
||||
if ((res = mp_2expt (a, (b->used - 1) * DIGIT_BIT + bits - 1))
|
||||
!= MP_OKAY) {
|
||||
return res;
|
||||
}
|
||||
} else {
|
||||
@ -3624,7 +3626,8 @@ s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
||||
/* can we use the fast multiplier? */
|
||||
#ifdef BN_FAST_S_MP_MUL_HIGH_DIGS_C
|
||||
if (((a->used + b->used + 1) < MP_WARRAY)
|
||||
&& MIN (a->used, b->used) < (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) {
|
||||
&& MIN (a->used, b->used) <
|
||||
(1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) {
|
||||
return fast_s_mp_mul_high_digs (a, b, c, digs);
|
||||
}
|
||||
#endif
|
||||
@ -3818,7 +3821,8 @@ int mp_sqrmod (mp_int * a, mp_int * b, mp_int * c)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(HAVE_ECC) || !defined(NO_PWDBASED) || defined(WOLFSSL_SNIFFER) || defined(WOLFSSL_HAVE_WOLFSCEP) || defined(WOLFSSL_KEY_GEN)
|
||||
#if defined(HAVE_ECC) || !defined(NO_PWDBASED) || defined(WOLFSSL_SNIFFER) || \
|
||||
defined(WOLFSSL_HAVE_WOLFSCEP) || defined(WOLFSSL_KEY_GEN)
|
||||
|
||||
/* single digit addition */
|
||||
int mp_add_d (mp_int* a, mp_digit b, mp_int* c)
|
||||
@ -4120,7 +4124,7 @@ int mp_mod_d (mp_int * a, mp_digit b, mp_digit * c)
|
||||
return mp_div_d(a, b, NULL, c);
|
||||
}
|
||||
|
||||
#endif /* defined(WOLFSSL_KEY_GEN) || defined(HAVE_COMP_KEY) || defined(HAVE_ECC) */
|
||||
#endif /* defined(WOLFSSL_KEY_GEN)||defined(HAVE_COMP_KEY)||defined(HAVE_ECC) */
|
||||
|
||||
#ifdef WOLFSSL_KEY_GEN
|
||||
|
||||
@ -4472,7 +4476,8 @@ LBL_U:mp_clear (&v);
|
||||
#ifdef HAVE_ECC
|
||||
|
||||
/* chars used in radix conversions */
|
||||
const char *mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";
|
||||
const char *mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\
|
||||
abcdefghijklmnopqrstuvwxyz+/";
|
||||
|
||||
/* read a string [ASCII] in a given radix */
|
||||
int mp_read_radix (mp_int * a, const char *str, int radix)
|
||||
|
@ -966,8 +966,8 @@ int fp_mulmod(fp_int *a, fp_int *b, fp_int *c, fp_int *d)
|
||||
#ifdef TFM_TIMING_RESISTANT
|
||||
|
||||
/* timing resistant montgomery ladder based exptmod
|
||||
|
||||
Based on work by Marc Joye, Sung-Ming Yen, "The Montgomery Powering Ladder", Cryptographic Hardware and Embedded Systems, CHES 2002
|
||||
Based on work by Marc Joye, Sung-Ming Yen, "The Montgomery Powering Ladder",
|
||||
Cryptographic Hardware and Embedded Systems, CHES 2002
|
||||
*/
|
||||
static int _fp_exptmod(fp_int * G, fp_int * X, fp_int * P, fp_int * Y)
|
||||
{
|
||||
@ -1085,7 +1085,8 @@ static int _fp_exptmod(fp_int * G, fp_int * X, fp_int * P, fp_int * Y)
|
||||
}
|
||||
fp_mulmod (&M[1], &res, P, &M[1]);
|
||||
|
||||
/* compute the value at M[1<<(winsize-1)] by squaring M[1] (winsize-1) times */
|
||||
/* compute the value at M[1<<(winsize-1)] by
|
||||
* squaring M[1] (winsize-1) times */
|
||||
fp_copy (&M[1], &M[1 << (winsize - 1)]);
|
||||
for (x = 0; x < (winsize - 1); x++) {
|
||||
fp_sqr (&M[1 << (winsize - 1)], &M[1 << (winsize - 1)]);
|
||||
@ -1737,7 +1738,8 @@ void fp_read_unsigned_bin(fp_int *a, unsigned char *b, int c)
|
||||
|
||||
/* If we know the endianness of this architecture, and we're using
|
||||
32-bit fp_digits, we can optimize this */
|
||||
#if (defined(LITTLE_ENDIAN_ORDER) || defined(BIG_ENDIAN_ORDER)) && defined(FP_32BIT)
|
||||
#if (defined(LITTLE_ENDIAN_ORDER) || defined(BIG_ENDIAN_ORDER)) && \
|
||||
defined(FP_32BIT)
|
||||
/* But not for both simultaneously */
|
||||
#if defined(LITTLE_ENDIAN_ORDER) && defined(BIG_ENDIAN_ORDER)
|
||||
#error Both LITTLE_ENDIAN_ORDER and BIG_ENDIAN_ORDER defined.
|
||||
@ -2003,7 +2005,8 @@ void mp_clear (mp_int * a)
|
||||
}
|
||||
|
||||
/* handle up to 6 inits */
|
||||
int mp_init_multi(mp_int* a, mp_int* b, mp_int* c, mp_int* d, mp_int* e, mp_int* f)
|
||||
int mp_init_multi(mp_int* a, mp_int* b, mp_int* c, mp_int* d,
|
||||
mp_int* e, mp_int* f)
|
||||
{
|
||||
if (a)
|
||||
fp_init(a);
|
||||
@ -2597,7 +2600,8 @@ int mp_add_d(fp_int *a, fp_digit b, fp_int *c)
|
||||
#ifdef HAVE_ECC
|
||||
|
||||
/* chars used in radix conversions */
|
||||
static const char *fp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";
|
||||
static const char *fp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\
|
||||
abcdefghijklmnopqrstuvwxyz+/";
|
||||
|
||||
static int fp_read_radix(fp_int *a, const char *str, int radix)
|
||||
{
|
||||
|
@ -59,7 +59,8 @@ WOLFSSL_API int wolfSSL_BN_is_bit_set(const WOLFSSL_BIGNUM*, int n);
|
||||
WOLFSSL_API int wolfSSL_BN_hex2bn(WOLFSSL_BIGNUM**, const char* str);
|
||||
|
||||
WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_BN_dup(const WOLFSSL_BIGNUM*);
|
||||
WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_BN_copy(WOLFSSL_BIGNUM*, const WOLFSSL_BIGNUM*);
|
||||
WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_BN_copy(WOLFSSL_BIGNUM*,
|
||||
const WOLFSSL_BIGNUM*);
|
||||
|
||||
WOLFSSL_API int wolfSSL_BN_dec2bn(WOLFSSL_BIGNUM**, const char* str);
|
||||
WOLFSSL_API char* wolfSSL_BN_bn2dec(const WOLFSSL_BIGNUM*);
|
||||
@ -69,12 +70,13 @@ WOLFSSL_API int wolfSSL_BN_add_word(WOLFSSL_BIGNUM*, WOLFSSL_BN_ULONG);
|
||||
WOLFSSL_API int wolfSSL_BN_set_bit(WOLFSSL_BIGNUM*, int);
|
||||
WOLFSSL_API int wolfSSL_BN_set_word(WOLFSSL_BIGNUM*, WOLFSSL_BN_ULONG);
|
||||
|
||||
|
||||
/* 2/6 */
|
||||
WOLFSSL_API int wolfSSL_BN_add(WOLFSSL_BIGNUM*, WOLFSSL_BIGNUM*, WOLFSSL_BIGNUM*);
|
||||
WOLFSSL_API int wolfSSL_BN_add(WOLFSSL_BIGNUM*, WOLFSSL_BIGNUM*,
|
||||
WOLFSSL_BIGNUM*);
|
||||
WOLFSSL_API char *wolfSSL_BN_bn2hex(const WOLFSSL_BIGNUM*);
|
||||
WOLFSSL_API int wolfSSL_BN_is_prime_ex(const WOLFSSL_BIGNUM*, int, WOLFSSL_BN_CTX*, WOLFSSL_BN_GENCB*);
|
||||
WOLFSSL_API WOLFSSL_BN_ULONG wolfSSL_BN_mod_word(const WOLFSSL_BIGNUM*, WOLFSSL_BN_ULONG);
|
||||
WOLFSSL_API int wolfSSL_BN_is_prime_ex(const WOLFSSL_BIGNUM*, int,
|
||||
WOLFSSL_BN_CTX*, WOLFSSL_BN_GENCB*);
|
||||
WOLFSSL_API WOLFSSL_BN_ULONG wolfSSL_BN_mod_word(const WOLFSSL_BIGNUM*,
|
||||
WOLFSSL_BN_ULONG);
|
||||
WOLFSSL_API int wolfSSL_BN_print_fp(FILE*, const WOLFSSL_BIGNUM*);
|
||||
WOLFSSL_API int wolfSSL_BN_rshift(WOLFSSL_BIGNUM*, const WOLFSSL_BIGNUM*, int);
|
||||
WOLFSSL_API WOLFSSL_BIGNUM *wolfSSL_BN_CTX_get(WOLFSSL_BN_CTX *ctx);
|
||||
|
@ -4,18 +4,13 @@
|
||||
#ifndef WOLFSSL_DH_H_
|
||||
#define WOLFSSL_DH_H_
|
||||
|
||||
|
||||
#include <wolfssl/openssl/ssl.h>
|
||||
#include <wolfssl/openssl/bn.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct WOLFSSL_DH {
|
||||
WOLFSSL_BIGNUM* p;
|
||||
WOLFSSL_BIGNUM* g;
|
||||
|
@ -4,17 +4,13 @@
|
||||
#ifndef WOLFSSL_DSA_H_
|
||||
#define WOLFSSL_DSA_H_
|
||||
|
||||
|
||||
#include <wolfssl/openssl/ssl.h>
|
||||
#include <wolfssl/openssl/bn.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
struct WOLFSSL_DSA {
|
||||
WOLFSSL_BIGNUM* p;
|
||||
WOLFSSL_BIGNUM* q;
|
||||
@ -36,9 +32,12 @@ WOLFSSL_API int wolfSSL_DSA_generate_parameters_ex(WOLFSSL_DSA*, int bits,
|
||||
unsigned long* hRet, void* cb);
|
||||
|
||||
WOLFSSL_API int wolfSSL_DSA_LoadDer(WOLFSSL_DSA*, const unsigned char*, int sz);
|
||||
WOLFSSL_API int wolfSSL_DSA_do_sign(const unsigned char* d, unsigned char* sigRet,
|
||||
WOLFSSL_DSA* dsa);
|
||||
WOLFSSL_API int wolfSSL_DSA_do_verify(const unsigned char* d, unsigned char* sig,
|
||||
|
||||
WOLFSSL_API int wolfSSL_DSA_do_sign(const unsigned char* d,
|
||||
unsigned char* sigRet, WOLFSSL_DSA* dsa);
|
||||
|
||||
WOLFSSL_API int wolfSSL_DSA_do_verify(const unsigned char* d,
|
||||
unsigned char* sig,
|
||||
WOLFSSL_DSA* dsa, int *dsacheck);
|
||||
|
||||
#define DSA_new wolfSSL_DSA_new
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <wolfssl/openssl/ssl.h>
|
||||
#include <wolfssl/openssl/bn.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -37,8 +36,8 @@ struct WOLFSSL_EC_POINT {
|
||||
};
|
||||
|
||||
struct WOLFSSL_EC_GROUP {
|
||||
int curve_idx; /* index of curve, used by WolfSSL as a curve reference */
|
||||
int curve_nid; /* NID of curve, used by OpenSSL/OpenSSH as a curve reference */
|
||||
int curve_idx; /* index of curve, used by WolfSSL as reference */
|
||||
int curve_nid; /* NID of curve, used by OpenSSL/OpenSSH as reference */
|
||||
};
|
||||
|
||||
struct WOLFSSL_EC_KEY {
|
||||
@ -51,42 +50,82 @@ struct WOLFSSL_EC_KEY {
|
||||
char exSet; /* external set from internal ? */
|
||||
};
|
||||
|
||||
WOLFSSL_API int wolfSSL_ECPoint_i2d(const WOLFSSL_EC_GROUP *curve, const WOLFSSL_EC_POINT *p, unsigned char *out, unsigned int *len);
|
||||
WOLFSSL_API int wolfSSL_ECPoint_d2i(unsigned char *in, unsigned int len, const WOLFSSL_EC_GROUP *curve, WOLFSSL_EC_POINT *p);
|
||||
WOLFSSL_API int wolfSSL_EC_KEY_LoadDer(WOLFSSL_EC_KEY* key, const unsigned char* der, int derSz);
|
||||
|
||||
WOLFSSL_API void wolfSSL_EC_KEY_free(WOLFSSL_EC_KEY *key);
|
||||
WOLFSSL_API WOLFSSL_EC_POINT *wolfSSL_EC_KEY_get0_public_key(const WOLFSSL_EC_KEY *key);
|
||||
WOLFSSL_API const WOLFSSL_EC_GROUP *wolfSSL_EC_KEY_get0_group(const WOLFSSL_EC_KEY *key);
|
||||
WOLFSSL_API int wolfSSL_EC_KEY_set_private_key(WOLFSSL_EC_KEY *key, const WOLFSSL_BIGNUM *priv_key);
|
||||
WOLFSSL_API WOLFSSL_BIGNUM *wolfSSL_EC_KEY_get0_private_key(const WOLFSSL_EC_KEY *key);
|
||||
WOLFSSL_API WOLFSSL_EC_KEY *wolfSSL_EC_KEY_new_by_curve_name(int nid);
|
||||
WOLFSSL_API WOLFSSL_EC_KEY *wolfSSL_EC_KEY_new(void);
|
||||
WOLFSSL_API int wolfSSL_EC_KEY_set_group(WOLFSSL_EC_KEY *key, WOLFSSL_EC_GROUP *group);
|
||||
WOLFSSL_API int wolfSSL_EC_KEY_generate_key(WOLFSSL_EC_KEY *key);
|
||||
WOLFSSL_API void wolfSSL_EC_KEY_set_asn1_flag(WOLFSSL_EC_KEY *key, int asn1_flag);
|
||||
WOLFSSL_API int wolfSSL_EC_KEY_set_public_key(WOLFSSL_EC_KEY *key, const WOLFSSL_EC_POINT *pub);
|
||||
|
||||
|
||||
WOLFSSL_API void wolfSSL_EC_GROUP_set_asn1_flag(WOLFSSL_EC_GROUP *group, int flag);
|
||||
WOLFSSL_API WOLFSSL_EC_GROUP *wolfSSL_EC_GROUP_new_by_curve_name(int nid);
|
||||
WOLFSSL_API int wolfSSL_EC_GROUP_cmp(const WOLFSSL_EC_GROUP *a, const WOLFSSL_EC_GROUP *b, WOLFSSL_BN_CTX *ctx);
|
||||
WOLFSSL_API int wolfSSL_EC_GROUP_get_curve_name(const WOLFSSL_EC_GROUP *group);
|
||||
WOLFSSL_API int wolfSSL_EC_GROUP_get_degree(const WOLFSSL_EC_GROUP *group);
|
||||
WOLFSSL_API int wolfSSL_EC_GROUP_get_order(const WOLFSSL_EC_GROUP *group, WOLFSSL_BIGNUM *order, WOLFSSL_BN_CTX *ctx);
|
||||
WOLFSSL_API void wolfSSL_EC_GROUP_free(WOLFSSL_EC_GROUP *group);
|
||||
|
||||
WOLFSSL_API void wolfssl_EC_POINT_dump(const char *msg, const WOLFSSL_EC_POINT *p);
|
||||
WOLFSSL_API WOLFSSL_EC_POINT *wolfSSL_EC_POINT_new(const WOLFSSL_EC_GROUP *group);
|
||||
WOLFSSL_API int wolfSSL_EC_POINT_get_affine_coordinates_GFp(const WOLFSSL_EC_GROUP *group, const WOLFSSL_EC_POINT *p,
|
||||
WOLFSSL_BIGNUM *x, WOLFSSL_BIGNUM *y, WOLFSSL_BN_CTX *ctx);
|
||||
WOLFSSL_API int wolfSSL_EC_POINT_mul(const WOLFSSL_EC_GROUP *group, WOLFSSL_EC_POINT *r, const WOLFSSL_BIGNUM *n,
|
||||
const WOLFSSL_EC_POINT *q, const WOLFSSL_BIGNUM *m, WOLFSSL_BN_CTX *ctx);
|
||||
WOLFSSL_API void wolfSSL_EC_POINT_clear_free(WOLFSSL_EC_POINT *point);
|
||||
WOLFSSL_API int wolfSSL_EC_POINT_cmp(const WOLFSSL_EC_GROUP *group, const WOLFSSL_EC_POINT *a,
|
||||
const WOLFSSL_EC_POINT *b, WOLFSSL_BN_CTX *ctx);
|
||||
WOLFSSL_API void wolfSSL_EC_POINT_free(WOLFSSL_EC_POINT *point);
|
||||
WOLFSSL_API int wolfSSL_EC_POINT_is_at_infinity(const WOLFSSL_EC_GROUP *group, const WOLFSSL_EC_POINT *a);
|
||||
WOLFSSL_API
|
||||
int wolfSSL_ECPoint_i2d(const WOLFSSL_EC_GROUP *curve,
|
||||
const WOLFSSL_EC_POINT *p,
|
||||
unsigned char *out, unsigned int *len);
|
||||
WOLFSSL_API
|
||||
int wolfSSL_ECPoint_d2i(unsigned char *in, unsigned int len,
|
||||
const WOLFSSL_EC_GROUP *curve, WOLFSSL_EC_POINT *p);
|
||||
WOLFSSL_API
|
||||
int wolfSSL_EC_KEY_LoadDer(WOLFSSL_EC_KEY* key,
|
||||
const unsigned char* der, int derSz);
|
||||
WOLFSSL_API
|
||||
void wolfSSL_EC_KEY_free(WOLFSSL_EC_KEY *key);
|
||||
WOLFSSL_API
|
||||
WOLFSSL_EC_POINT *wolfSSL_EC_KEY_get0_public_key(const WOLFSSL_EC_KEY *key);
|
||||
WOLFSSL_API
|
||||
const WOLFSSL_EC_GROUP *wolfSSL_EC_KEY_get0_group(const WOLFSSL_EC_KEY *key);
|
||||
WOLFSSL_API
|
||||
int wolfSSL_EC_KEY_set_private_key(WOLFSSL_EC_KEY *key,
|
||||
const WOLFSSL_BIGNUM *priv_key);
|
||||
WOLFSSL_API
|
||||
WOLFSSL_BIGNUM *wolfSSL_EC_KEY_get0_private_key(const WOLFSSL_EC_KEY *key);
|
||||
WOLFSSL_API
|
||||
WOLFSSL_EC_KEY *wolfSSL_EC_KEY_new_by_curve_name(int nid);
|
||||
WOLFSSL_API
|
||||
WOLFSSL_EC_KEY *wolfSSL_EC_KEY_new(void);
|
||||
WOLFSSL_API
|
||||
int wolfSSL_EC_KEY_set_group(WOLFSSL_EC_KEY *key, WOLFSSL_EC_GROUP *group);
|
||||
WOLFSSL_API
|
||||
int wolfSSL_EC_KEY_generate_key(WOLFSSL_EC_KEY *key);
|
||||
WOLFSSL_API
|
||||
void wolfSSL_EC_KEY_set_asn1_flag(WOLFSSL_EC_KEY *key, int asn1_flag);
|
||||
WOLFSSL_API
|
||||
int wolfSSL_EC_KEY_set_public_key(WOLFSSL_EC_KEY *key,
|
||||
const WOLFSSL_EC_POINT *pub);
|
||||
WOLFSSL_API
|
||||
void wolfSSL_EC_GROUP_set_asn1_flag(WOLFSSL_EC_GROUP *group, int flag);
|
||||
WOLFSSL_API
|
||||
WOLFSSL_EC_GROUP *wolfSSL_EC_GROUP_new_by_curve_name(int nid);
|
||||
WOLFSSL_API
|
||||
int wolfSSL_EC_GROUP_cmp(const WOLFSSL_EC_GROUP *a, const WOLFSSL_EC_GROUP *b,
|
||||
WOLFSSL_BN_CTX *ctx);
|
||||
WOLFSSL_API
|
||||
int wolfSSL_EC_GROUP_get_curve_name(const WOLFSSL_EC_GROUP *group);
|
||||
WOLFSSL_API
|
||||
int wolfSSL_EC_GROUP_get_degree(const WOLFSSL_EC_GROUP *group);
|
||||
WOLFSSL_API
|
||||
int wolfSSL_EC_GROUP_get_order(const WOLFSSL_EC_GROUP *group,
|
||||
WOLFSSL_BIGNUM *order, WOLFSSL_BN_CTX *ctx);
|
||||
WOLFSSL_API
|
||||
void wolfSSL_EC_GROUP_free(WOLFSSL_EC_GROUP *group);
|
||||
WOLFSSL_API
|
||||
void wolfssl_EC_POINT_dump(const char *msg, const WOLFSSL_EC_POINT *p);
|
||||
WOLFSSL_API
|
||||
WOLFSSL_EC_POINT *wolfSSL_EC_POINT_new(const WOLFSSL_EC_GROUP *group);
|
||||
WOLFSSL_API
|
||||
int wolfSSL_EC_POINT_get_affine_coordinates_GFp(const WOLFSSL_EC_GROUP *group,
|
||||
const WOLFSSL_EC_POINT *p,
|
||||
WOLFSSL_BIGNUM *x,
|
||||
WOLFSSL_BIGNUM *y,
|
||||
WOLFSSL_BN_CTX *ctx);
|
||||
WOLFSSL_API
|
||||
int wolfSSL_EC_POINT_mul(const WOLFSSL_EC_GROUP *group, WOLFSSL_EC_POINT *r,
|
||||
const WOLFSSL_BIGNUM *n,
|
||||
const WOLFSSL_EC_POINT *q, const WOLFSSL_BIGNUM *m,
|
||||
WOLFSSL_BN_CTX *ctx);
|
||||
WOLFSSL_API
|
||||
void wolfSSL_EC_POINT_clear_free(WOLFSSL_EC_POINT *point);
|
||||
WOLFSSL_API
|
||||
int wolfSSL_EC_POINT_cmp(const WOLFSSL_EC_GROUP *group,
|
||||
const WOLFSSL_EC_POINT *a, const WOLFSSL_EC_POINT *b,
|
||||
WOLFSSL_BN_CTX *ctx);
|
||||
WOLFSSL_API
|
||||
void wolfSSL_EC_POINT_free(WOLFSSL_EC_POINT *point);
|
||||
WOLFSSL_API
|
||||
int wolfSSL_EC_POINT_is_at_infinity(const WOLFSSL_EC_GROUP *group,
|
||||
const WOLFSSL_EC_POINT *a);
|
||||
|
||||
#define EC_KEY_free wolfSSL_EC_KEY_free
|
||||
#define EC_KEY_get0_public_key wolfSSL_EC_KEY_get0_public_key
|
||||
@ -109,7 +148,8 @@ WOLFSSL_API int wolfSSL_EC_POINT_is_at_infinity(const WOLFSSL_EC_GROUP *group, c
|
||||
#define EC_GROUP_free wolfSSL_EC_GROUP_free
|
||||
|
||||
#define EC_POINT_new wolfSSL_EC_POINT_new
|
||||
#define EC_POINT_get_affine_coordinates_GFp wolfSSL_EC_POINT_get_affine_coordinates_GFp
|
||||
#define EC_POINT_get_affine_coordinates_GFp \
|
||||
wolfSSL_EC_POINT_get_affine_coordinates_GFp
|
||||
#define EC_POINT_mul wolfSSL_EC_POINT_mul
|
||||
#define EC_POINT_clear_free wolfSSL_EC_POINT_clear_free
|
||||
#define EC_POINT_cmp wolfSSL_EC_POINT_cmp
|
||||
|
@ -11,8 +11,13 @@ extern C {
|
||||
#endif
|
||||
|
||||
|
||||
WOLFSSL_API int wolfSSL_ECDH_compute_key(void *out, size_t outlen, const WOLFSSL_EC_POINT *pub_key,
|
||||
WOLFSSL_EC_KEY *ecdh, void *(*KDF) (const void *in, size_t inlen, void *out, size_t *outlen));
|
||||
WOLFSSL_API int wolfSSL_ECDH_compute_key(void *out, size_t outlen,
|
||||
const WOLFSSL_EC_POINT *pub_key,
|
||||
WOLFSSL_EC_KEY *ecdh,
|
||||
void *(*KDF) (const void *in,
|
||||
size_t inlen,
|
||||
void *out,
|
||||
size_t *outlen));
|
||||
|
||||
#define ECDH_compute_key wolfSSL_ECDH_compute_key
|
||||
|
||||
|
@ -14,17 +14,17 @@ extern "C" {
|
||||
struct WOLFSSL_ECDSA_SIG {
|
||||
WOLFSSL_BIGNUM *r;
|
||||
WOLFSSL_BIGNUM *s;
|
||||
#if 0
|
||||
void* internal; /* our EC DSA */
|
||||
char inSet; /* internal set from external ? */
|
||||
char exSet; /* external set from internal ? */
|
||||
#endif
|
||||
};
|
||||
|
||||
WOLFSSL_API void wolfSSL_ECDSA_SIG_free(WOLFSSL_ECDSA_SIG *sig);
|
||||
WOLFSSL_API WOLFSSL_ECDSA_SIG *wolfSSL_ECDSA_SIG_new(void);
|
||||
WOLFSSL_API WOLFSSL_ECDSA_SIG *wolfSSL_ECDSA_do_sign(const unsigned char *dgst, int dgst_len, WOLFSSL_EC_KEY *eckey);
|
||||
WOLFSSL_API int wolfSSL_ECDSA_do_verify(const unsigned char *dgst, int dgst_len, const WOLFSSL_ECDSA_SIG *sig, WOLFSSL_EC_KEY *eckey);
|
||||
WOLFSSL_API WOLFSSL_ECDSA_SIG *wolfSSL_ECDSA_do_sign(const unsigned char *dgst,
|
||||
int dgst_len,
|
||||
WOLFSSL_EC_KEY *eckey);
|
||||
WOLFSSL_API int wolfSSL_ECDSA_do_verify(const unsigned char *dgst,
|
||||
int dgst_len,
|
||||
const WOLFSSL_ECDSA_SIG *sig,
|
||||
WOLFSSL_EC_KEY *eckey);
|
||||
|
||||
#define ECDSA_SIG_free wolfSSL_ECDSA_SIG_free
|
||||
#define ECDSA_SIG_new wolfSSL_ECDSA_SIG_new
|
||||
|
@ -521,7 +521,7 @@ WOLFSSL_TEST_API void InitDecodedCert(DecodedCert*, byte*, word32, void*);
|
||||
WOLFSSL_TEST_API void FreeDecodedCert(DecodedCert*);
|
||||
WOLFSSL_TEST_API int ParseCert(DecodedCert*, int type, int verify, void* cm);
|
||||
|
||||
WOLFSSL_LOCAL int ParseCertRelative(DecodedCert*, int type, int verify,void* cm);
|
||||
WOLFSSL_LOCAL int ParseCertRelative(DecodedCert*,int type,int verify,void* cm);
|
||||
WOLFSSL_LOCAL int DecodeToKey(DecodedCert*, int verify);
|
||||
|
||||
WOLFSSL_LOCAL Signer* MakeSigner(void*);
|
||||
@ -530,7 +530,7 @@ WOLFSSL_LOCAL void FreeSignerTable(Signer**, int, void*);
|
||||
|
||||
|
||||
WOLFSSL_LOCAL int ToTraditional(byte* buffer, word32 length);
|
||||
WOLFSSL_LOCAL int ToTraditionalEnc(byte* buffer, word32 length,const char*, int);
|
||||
WOLFSSL_LOCAL int ToTraditionalEnc(byte* buffer, word32 length,const char*,int);
|
||||
|
||||
WOLFSSL_LOCAL int ValidateDate(const byte* date, byte format, int dateType);
|
||||
|
||||
@ -550,10 +550,10 @@ WOLFSSL_LOCAL int GetAlgoId(const byte* input, word32* inOutIdx, word32* oid,
|
||||
WOLFSSL_LOCAL word32 SetLength(word32 length, byte* output);
|
||||
WOLFSSL_LOCAL word32 SetSequence(word32 len, byte* output);
|
||||
WOLFSSL_LOCAL word32 SetOctetString(word32 len, byte* output);
|
||||
WOLFSSL_LOCAL word32 SetImplicit(byte tag, byte number, word32 len,byte* output);
|
||||
WOLFSSL_LOCAL word32 SetImplicit(byte tag,byte number,word32 len,byte* output);
|
||||
WOLFSSL_LOCAL word32 SetExplicit(byte number, word32 len, byte* output);
|
||||
WOLFSSL_LOCAL word32 SetSet(word32 len, byte* output);
|
||||
WOLFSSL_LOCAL word32 SetAlgoID(int algoOID, byte* output, int type, int curveSz);
|
||||
WOLFSSL_LOCAL word32 SetAlgoID(int algoOID,byte* output,int type,int curveSz);
|
||||
WOLFSSL_LOCAL int SetMyVersion(word32 version, byte* output, int header);
|
||||
WOLFSSL_LOCAL int SetSerialNumber(const byte* sn, word32 snSz, byte* output);
|
||||
WOLFSSL_LOCAL int GetNameHash(const byte* source, word32* idx, byte* hash,
|
||||
@ -582,7 +582,7 @@ enum cert_enums {
|
||||
#ifndef NO_FILESYSTEM
|
||||
/* forward from wolfSSL */
|
||||
WOLFSSL_API
|
||||
int wolfSSL_PemCertToDer(const char* fileName, unsigned char* derBuf, int derSz);
|
||||
int wolfSSL_PemCertToDer(const char* fileName,unsigned char* derBuf,int derSz);
|
||||
#define WOLFSSL_PEMCERT_TODER_DEFINED
|
||||
#endif
|
||||
#endif
|
||||
|
@ -150,8 +150,8 @@ WOLFSSL_API void wc_InitCert(Cert*);
|
||||
WOLFSSL_API int wc_MakeCert(Cert*, byte* derBuffer, word32 derSz, RsaKey*,
|
||||
ecc_key*, RNG*);
|
||||
#ifdef WOLFSSL_CERT_REQ
|
||||
WOLFSSL_API int wc_MakeCertReq(Cert*, byte* derBuffer, word32 derSz, RsaKey*,
|
||||
ecc_key*);
|
||||
WOLFSSL_API int wc_MakeCertReq(Cert*, byte* derBuffer, word32 derSz,
|
||||
RsaKey*, ecc_key*);
|
||||
#endif
|
||||
WOLFSSL_API int wc_SignCert(int requestSz, int sigType, byte* derBuffer,
|
||||
word32 derSz, RsaKey*, ecc_key*, RNG*);
|
||||
@ -188,8 +188,8 @@ WOLFSSL_API int wc_SetDatesBuffer(Cert*, const byte*, int);
|
||||
#endif
|
||||
|
||||
/* DER encode signature */
|
||||
WOLFSSL_API word32 wc_EncodeSignature(byte* out, const byte* digest, word32 digSz,
|
||||
int hashOID);
|
||||
WOLFSSL_API word32 wc_EncodeSignature(byte* out, const byte* digest,
|
||||
word32 digSz, int hashOID);
|
||||
WOLFSSL_API int wc_GetCTC_HashOID(int type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -54,19 +54,16 @@ typedef struct DsaKey {
|
||||
int type; /* public or private */
|
||||
} DsaKey;
|
||||
|
||||
|
||||
WOLFSSL_API void wc_InitDsaKey(DsaKey* key);
|
||||
WOLFSSL_API void wc_FreeDsaKey(DsaKey* key);
|
||||
|
||||
WOLFSSL_API int wc_DsaSign(const byte* digest, byte* out, DsaKey* key, RNG* rng);
|
||||
WOLFSSL_API int wc_DsaVerify(const byte* digest, const byte* sig, DsaKey* key,
|
||||
int* answer);
|
||||
|
||||
WOLFSSL_API int wc_DsaPublicKeyDecode(const byte* input, word32* inOutIdx, DsaKey*,
|
||||
word32);
|
||||
WOLFSSL_API int wc_DsaPrivateKeyDecode(const byte* input, word32* inOutIdx, DsaKey*,
|
||||
word32);
|
||||
|
||||
WOLFSSL_API int wc_DsaSign(const byte* digest, byte* out,
|
||||
DsaKey* key, RNG* rng);
|
||||
WOLFSSL_API int wc_DsaVerify(const byte* digest, const byte* sig,
|
||||
DsaKey* key, int* answer);
|
||||
WOLFSSL_API int wc_DsaPublicKeyDecode(const byte* input, word32* inOutIdx,
|
||||
DsaKey*, word32);
|
||||
WOLFSSL_API int wc_DsaPrivateKeyDecode(const byte* input, word32* inOutIdx,
|
||||
DsaKey*, word32);
|
||||
WOLFSSL_API int wc_DsaKeyToDer(DsaKey* key, byte* output, word32 inLen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -141,7 +141,8 @@ WOLFSSL_API
|
||||
int wc_ecc_shared_secret(ecc_key* private_key, ecc_key* public_key, byte* out,
|
||||
word32* outlen);
|
||||
WOLFSSL_API
|
||||
int wc_ecc_shared_secret_ssh(ecc_key* private_key, ecc_point* point, byte* out, word32 *outlen);
|
||||
int wc_ecc_shared_secret_ssh(ecc_key* private_key, ecc_point* point,
|
||||
byte* out, word32 *outlen);
|
||||
WOLFSSL_API
|
||||
int wc_ecc_sign_hash(const byte* in, word32 inlen, byte* out, word32 *outlen,
|
||||
RNG* rng, ecc_key* key);
|
||||
@ -195,8 +196,11 @@ WOLFSSL_API
|
||||
int wc_ecc_export_private_only(ecc_key* key, byte* out, word32* outLen);
|
||||
|
||||
WOLFSSL_API
|
||||
int wc_ecc_export_point_der(const int curve_idx, ecc_point* point, byte* out, word32* outLen);
|
||||
int wc_ecc_import_point_der(byte* in, word32 inLen, const int curve_idx, ecc_point* point);
|
||||
int wc_ecc_export_point_der(const int curve_idx, ecc_point* point,
|
||||
byte* out, word32* outLen);
|
||||
WOLFSSL_API
|
||||
int wc_ecc_import_point_der(byte* in, word32 inLen, const int curve_idx,
|
||||
ecc_point* point);
|
||||
|
||||
/* size helper */
|
||||
WOLFSSL_API
|
||||
|
Reference in New Issue
Block a user