forked from wolfSSL/wolfssl
for Windows build, clean up warnings and a couple variable declarations
This commit is contained in:
14
src/ssl.c
14
src/ssl.c
@ -13911,8 +13911,6 @@ int wolfSSL_EC_GROUP_get_degree(const WOLFSSL_EC_GROUP *group)
|
|||||||
return SSL_FAILURE;
|
return SSL_FAILURE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SSL_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return code compliant with OpenSSL :
|
/* return code compliant with OpenSSL :
|
||||||
@ -14087,11 +14085,11 @@ 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 *n, const WOLFSSL_EC_POINT *q,
|
||||||
const WOLFSSL_BIGNUM *m, WOLFSSL_BN_CTX *ctx)
|
const WOLFSSL_BIGNUM *m, WOLFSSL_BN_CTX *ctx)
|
||||||
{
|
{
|
||||||
|
mp_int prime;
|
||||||
|
|
||||||
(void)ctx;
|
(void)ctx;
|
||||||
(void)n;
|
(void)n;
|
||||||
|
|
||||||
mp_int prime;
|
|
||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_EC_POINT_mul");
|
WOLFSSL_ENTER("wolfSSL_EC_POINT_mul");
|
||||||
|
|
||||||
if (group == NULL || r == NULL || r->internal == NULL ||
|
if (group == NULL || r == NULL || r->internal == NULL ||
|
||||||
@ -14153,8 +14151,9 @@ int wolfSSL_EC_POINT_cmp(const WOLFSSL_EC_GROUP *group,
|
|||||||
const WOLFSSL_EC_POINT *a, const WOLFSSL_EC_POINT *b,
|
const WOLFSSL_EC_POINT *a, const WOLFSSL_EC_POINT *b,
|
||||||
WOLFSSL_BN_CTX *ctx)
|
WOLFSSL_BN_CTX *ctx)
|
||||||
{
|
{
|
||||||
(void)ctx;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
(void)ctx;
|
||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_EC_POINT_cmp");
|
WOLFSSL_ENTER("wolfSSL_EC_POINT_cmp");
|
||||||
|
|
||||||
@ -14411,10 +14410,11 @@ int wolfSSL_ECDH_compute_key(void *out, size_t outlen,
|
|||||||
void *(*KDF) (const void *in, size_t inlen,
|
void *(*KDF) (const void *in, size_t inlen,
|
||||||
void *out, size_t *outlen))
|
void *out, size_t *outlen))
|
||||||
{
|
{
|
||||||
(void)KDF;
|
|
||||||
word32 len;
|
word32 len;
|
||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_ECDH_compute_key");
|
(void)KDF;
|
||||||
|
|
||||||
|
WOLFSSL_ENTER("wolfSSL_ECDH_compute_key");
|
||||||
|
|
||||||
if (out == NULL || pub_key == NULL || pub_key->internal == NULL ||
|
if (out == NULL || pub_key == NULL || pub_key->internal == NULL ||
|
||||||
ecdh == NULL || ecdh->internal == NULL) {
|
ecdh == NULL || ecdh->internal == NULL) {
|
||||||
|
58
wolfcrypt/src/ecc.c
Normal file → Executable file
58
wolfcrypt/src/ecc.c
Normal file → Executable file
@ -2597,26 +2597,25 @@ int wc_ecc_export_point_der(const int curve_idx, ecc_point* point, byte* out,
|
|||||||
return MEMORY_E;
|
return MEMORY_E;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
do {
|
/* pad and store x */
|
||||||
/* pad and store x */
|
XMEMSET(buf, 0, ECC_BUFSIZE);
|
||||||
XMEMSET(buf, 0, ECC_BUFSIZE);
|
ret = mp_to_unsigned_bin(point->x, buf +
|
||||||
ret = mp_to_unsigned_bin(point->x, buf +
|
|
||||||
(numlen - mp_unsigned_bin_size(point->x)));
|
(numlen - mp_unsigned_bin_size(point->x)));
|
||||||
if (ret != MP_OKAY)
|
if (ret != MP_OKAY)
|
||||||
break;
|
goto done;
|
||||||
XMEMCPY(out+1, buf, numlen);
|
XMEMCPY(out+1, buf, numlen);
|
||||||
|
|
||||||
/* pad and store y */
|
/* pad and store y */
|
||||||
XMEMSET(buf, 0, ECC_BUFSIZE);
|
XMEMSET(buf, 0, ECC_BUFSIZE);
|
||||||
ret = mp_to_unsigned_bin(point->y, buf +
|
ret = mp_to_unsigned_bin(point->y, buf +
|
||||||
(numlen - mp_unsigned_bin_size(point->y)));
|
(numlen - mp_unsigned_bin_size(point->y)));
|
||||||
if (ret != MP_OKAY)
|
if (ret != MP_OKAY)
|
||||||
break;
|
goto done;
|
||||||
XMEMCPY(out+1+numlen, buf, numlen);
|
XMEMCPY(out+1+numlen, buf, numlen);
|
||||||
|
|
||||||
*outLen = 1 + 2*numlen;
|
*outLen = 1 + 2*numlen;
|
||||||
} while (0);
|
|
||||||
|
|
||||||
|
done:
|
||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
#endif
|
#endif
|
||||||
@ -2665,26 +2664,25 @@ int wc_ecc_export_x963(ecc_key* key, byte* out, word32* outLen)
|
|||||||
return MEMORY_E;
|
return MEMORY_E;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
do {
|
/* pad and store x */
|
||||||
/* pad and store x */
|
XMEMSET(buf, 0, ECC_BUFSIZE);
|
||||||
XMEMSET(buf, 0, ECC_BUFSIZE);
|
ret = mp_to_unsigned_bin(key->pubkey.x,
|
||||||
ret = mp_to_unsigned_bin(key->pubkey.x,
|
|
||||||
buf + (numlen - mp_unsigned_bin_size(key->pubkey.x)));
|
buf + (numlen - mp_unsigned_bin_size(key->pubkey.x)));
|
||||||
if (ret != MP_OKAY)
|
if (ret != MP_OKAY)
|
||||||
break;
|
goto done;
|
||||||
XMEMCPY(out+1, buf, numlen);
|
XMEMCPY(out+1, buf, numlen);
|
||||||
|
|
||||||
/* pad and store y */
|
/* pad and store y */
|
||||||
XMEMSET(buf, 0, ECC_BUFSIZE);
|
XMEMSET(buf, 0, ECC_BUFSIZE);
|
||||||
ret = mp_to_unsigned_bin(key->pubkey.y,
|
ret = mp_to_unsigned_bin(key->pubkey.y,
|
||||||
buf + (numlen - mp_unsigned_bin_size(key->pubkey.y)));
|
buf + (numlen - mp_unsigned_bin_size(key->pubkey.y)));
|
||||||
if (ret != MP_OKAY)
|
if (ret != MP_OKAY)
|
||||||
break;
|
goto done;
|
||||||
XMEMCPY(out+1+numlen, buf, numlen);
|
XMEMCPY(out+1+numlen, buf, numlen);
|
||||||
|
|
||||||
*outLen = 1 + 2*numlen;
|
*outLen = 1 + 2*numlen;
|
||||||
} while (0);
|
|
||||||
|
|
||||||
|
done:
|
||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user