* Fixes for building ECC without ASN.

* Fix to expose `wc_ecc_import_private_key_ex` and its ability to import a private key even when `NO_ASN` is defined.
* Remove execute bit on CSharp files.
This commit is contained in:
David Garske 2020-04-03 10:55:31 -07:00
parent 9a1687d00e
commit 1831193c20
11 changed files with 15 additions and 9 deletions

View File

@ -7319,7 +7319,6 @@ int wc_ecc_export_private_raw(ecc_key* key, byte* qx, word32* qxLen,
#endif /* HAVE_ECC_KEY_EXPORT */
#ifndef NO_ASN
#ifdef HAVE_ECC_KEY_IMPORT
/* import private key, public part optional if (pub) passed as NULL */
int wc_ecc_import_private_key_ex(const byte* priv, word32 privSz,
@ -7327,7 +7326,6 @@ int wc_ecc_import_private_key_ex(const byte* priv, word32 privSz,
int curve_id)
{
int ret;
word32 idx = 0;
#if defined(WOLFSSL_CRYPTOCELL) && !defined(WOLFSSL_ATECC508A)
const CRYS_ECPKI_Domain_t* pDomain;
CRYS_ECPKI_BUILD_TempData_t tempBuff;
@ -7337,10 +7335,15 @@ int wc_ecc_import_private_key_ex(const byte* priv, word32 privSz,
/* public optional, NULL if only importing private */
if (pub != NULL) {
#ifndef NO_ASN
word32 idx = 0;
ret = wc_ecc_import_x963_ex(pub, pubSz, key, curve_id);
if (ret < 0)
ret = wc_EccPublicKeyDecode(pub, &idx, key, pubSz);
key->type = ECC_PRIVATEKEY;
#else
ret = NOT_COMPILED_IN;
#endif
}
else {
/* make sure required variables are reset */
@ -7422,6 +7425,7 @@ int wc_ecc_import_private_key(const byte* priv, word32 privSz, const byte* pub,
}
#endif /* HAVE_ECC_KEY_IMPORT */
#ifndef NO_ASN
/**
Convert ECC R,S to signature
r R component of signature

View File

@ -252,7 +252,7 @@ int wc_SignatureVerify(
{
int ret;
word32 hash_len, hash_enc_len;
#ifdef WOLFSSL_SMALL_STACK
#if defined(WOLFSSL_SMALL_STACK) || defined(NO_ASN)
byte *hash_data;
#else
byte hash_data[MAX_DER_DIGEST_SZ];
@ -286,7 +286,7 @@ int wc_SignatureVerify(
}
#endif
#ifdef WOLFSSL_SMALL_STACK
#if defined(WOLFSSL_SMALL_STACK) || defined(NO_ASN)
/* Allocate temporary buffer for hash data */
hash_data = (byte*)XMALLOC(hash_enc_len, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (hash_data == NULL) {
@ -328,7 +328,7 @@ int wc_SignatureVerify(
}
}
#ifdef WOLFSSL_SMALL_STACK
#if defined(WOLFSSL_SMALL_STACK) || defined(NO_ASN)
XFREE(hash_data, NULL, DYNAMIC_TYPE_TMP_BUFFER);
#endif
@ -462,7 +462,7 @@ int wc_SignatureGenerate_ex(
{
int ret;
word32 hash_len, hash_enc_len;
#ifdef WOLFSSL_SMALL_STACK
#if defined(WOLFSSL_SMALL_STACK) || defined(NO_ASN)
byte *hash_data;
#else
byte hash_data[MAX_DER_DIGEST_SZ];
@ -496,7 +496,7 @@ int wc_SignatureGenerate_ex(
}
#endif
#ifdef WOLFSSL_SMALL_STACK
#if defined(WOLFSSL_SMALL_STACK) || defined(NO_ASN)
/* Allocate temporary buffer for hash data */
hash_data = (byte*)XMALLOC(hash_enc_len, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (hash_data == NULL) {
@ -549,7 +549,7 @@ int wc_SignatureGenerate_ex(
}
#endif /* WOLFSSL_CRYPTOCELL */
#ifdef WOLFSSL_SMALL_STACK
#if defined(WOLFSSL_SMALL_STACK) || defined(NO_ASN)
XFREE(hash_data, NULL, DYNAMIC_TYPE_TMP_BUFFER);
#endif

View File

@ -10293,12 +10293,14 @@ byte GetEntropy(ENTROPY_CMD cmd, byte* out)
static const char* dsaKey = CERT_ROOT "dsa2048.der";
#endif
#endif /* !USE_CERT_BUFFER_* */
#if !defined(USE_CERT_BUFFERS_256) && !defined(NO_ASN)
#if !defined(USE_CERT_BUFFERS_256)
#ifdef HAVE_ECC
/* cert files to be used in rsa cert gen test, check if RSA enabled */
#ifdef HAVE_ECC_KEY_IMPORT
static const char* eccKeyDerFile = CERT_ROOT "ecc-key.der";
#endif
#endif
#if !defined(USE_CERT_BUFFERS_256) && !defined(NO_ASN)
#ifdef WOLFSSL_CERT_GEN
#ifndef NO_RSA
/* eccKeyPubFile is used in a test that requires RSA. */

View File

View File

View File

0
wrapper/CSharp/wolfSSL-TLS-ServerThreaded/App.config Executable file → Normal file
View File

View File

0
wrapper/CSharp/wolfSSL_CSharp/wolfSSL.cs Executable file → Normal file
View File