@@ -59469,29 +59469,26 @@ static wc_test_ret_t ecc_onlycb_test(myCryptoDevCtx *ctx)
5946959469{
5947059470 wc_test_ret_t ret = 0;
5947159471#if defined(HAVE_ECC)
59472-
5947359472#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
5947459473 ecc_key* key = (ecc_key *)XMALLOC(sizeof *key,
5947559474 HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
5947659475 ecc_key* pub = (ecc_key *)XMALLOC(sizeof *pub,
5947759476 HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
5947859477 byte* out = (byte*)XMALLOC(sizeof(byte),
5947959478 HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
59480- #ifdef OPENSSL_EXTRA
59481- byte* check = (byte*)XMALLOC(sizeof(byte)*(256), HEAP_HINT,
59482- DYNAMIC_TYPE_TMP_BUFFER);
59483-
59479+ #if !defined(WOLFCRYPT_ONLY) && defined(OPENSSL_EXTRA)
59480+ byte* check = (byte*)XMALLOC(256, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
5948459481 #endif
5948559482#else
5948659483 ecc_key key[1];
59484+ #ifdef HAVE_ECC_DHE
5948759485 ecc_key pub[1];
59488- byte out[256];
59489- #ifdef OPENSSL_EXTRA
59490- unsigned char check[256];
59486+ #endif
59487+ #if !defined(WOLFCRYPT_ONLY) && defined( OPENSSL_EXTRA)
59488+ byte check[256];
5949159489 #endif
5949259490#endif
59493-
59494- #ifdef OPENSSL_EXTRA
59491+ #if !defined(WOLFCRYPT_ONLY) && defined(OPENSSL_EXTRA)
5949559492 WOLFSSL_EVP_PKEY* privKey = NULL;
5949659493 WOLFSSL_EVP_PKEY* pubKey = NULL;
5949759494 #ifdef USE_CERT_BUFFERS_256
@@ -59530,17 +59527,22 @@ static wc_test_ret_t ecc_onlycb_test(myCryptoDevCtx *ctx)
5953059527 0x94,0x1d,0x7a,0x66,0xf8,0xd1,0x1d,0xcf,0xb0,0x48,
5953159528 0xef,0x8c,0x94,0x6f,0xdd,0x62,
5953259529 };
59533- #endif
59534-
59530+ #endif
59531+ #ifdef HAVE_ECC_DHE
5953559532 WC_RNG rng;
59533+ #endif
5953659534 EncryptedInfo encInfo;
5953759535 int keyFormat = 0;
59536+ #ifdef USE_CERT_BUFFERS_256
5953859537 word32 keyIdx = 0;
59539-
59538+ #endif
59539+ #if defined(HAVE_ECC_SIGN) && defined(HAVE_ECC_VERIFY)
5954059540 byte in[] = "Everyone gets Friday off. ecc p";
5954159541 word32 inLen = (word32)XSTRLEN((char*)in);
59542+ byte out[256];
5954259543 word32 outLen;
5954359544 int verify;
59545+ #endif
5954459546
5954559547#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
5954659548 if (key == NULL || pub == NULL) {
@@ -59551,7 +59553,8 @@ static wc_test_ret_t ecc_onlycb_test(myCryptoDevCtx *ctx)
5955159553 if (ret != 0)
5955259554 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_onlycb);
5955359555
59554- /* wc_CryptoCb_MakeEccKey cb test, , no actual testing */
59556+ /* wc_CryptoCb_MakeEccKey cb test, no actual testing */
59557+ #ifdef HAVE_ECC_DHE
5955559558 ctx->exampleVar = 99;
5955659559 ret = wc_ecc_make_key(&rng, ECC_KEYGEN_SIZE, key);
5955759560 if (ret != 0)
@@ -59563,7 +59566,7 @@ static wc_test_ret_t ecc_onlycb_test(myCryptoDevCtx *ctx)
5956359566 } else
5956459567 /* reset return code */
5956559568 ret = 0;
59566-
59569+ #endif
5956759570#ifdef USE_CERT_BUFFERS_256
5956859571 if (ret == 0) {
5956959572 /* load ECC private key and perform private transform */
@@ -59572,6 +59575,9 @@ static wc_test_ret_t ecc_onlycb_test(myCryptoDevCtx *ctx)
5957259575 }
5957359576 if (ret != 0)
5957459577 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_onlycb);
59578+ #endif
59579+
59580+ #ifdef HAVE_ECC_SIGN
5957559581 /* wc_CryptoCb_EccSign cb test, no actual testing */
5957659582 ctx->exampleVar = 99;
5957759583 if (ret == 0) {
@@ -59589,6 +59595,7 @@ static wc_test_ret_t ecc_onlycb_test(myCryptoDevCtx *ctx)
5958959595 else
5959059596 ret = 0;
5959159597
59598+ #ifdef HAVE_ECC_VERIFY
5959259599 /* wc_CryptoCb_EccVerify cb test, no actual testing */
5959359600 ctx->exampleVar = 99;
5959459601 if (ret == 0) {
@@ -59606,7 +59613,10 @@ static wc_test_ret_t ecc_onlycb_test(myCryptoDevCtx *ctx)
5960659613 }
5960759614 else
5960859615 ret = 0;
59616+ #endif /* HAVE_ECC_VERIFY */
59617+ #endif /* HAVE_ECC_SIGN */
5960959618
59619+ #ifdef HAVE_ECC_DHE
5961059620 /* wc_CryptoCb_Ecdh cb test, no actual testing */
5961159621
5961259622 /* make public key for shared secret */
@@ -59628,9 +59638,9 @@ static wc_test_ret_t ecc_onlycb_test(myCryptoDevCtx *ctx)
5962859638 else
5962959639 ret = 0;
5963059640
59641+ #endif /* HAVE_ECC_DHE */
5963159642
59632- #ifdef OPENSSL_EXTRA
59633-
59643+ #if !defined(WOLFCRYPT_ONLY) && defined(OPENSSL_EXTRA)
5963459644 (void)pkey;
5963559645 cp = ecc_clikey_der_256;
5963659646 privKey = d2i_PrivateKey(WC_EVP_PKEY_EC, NULL, &cp,
@@ -59691,7 +59701,6 @@ static wc_test_ret_t ecc_onlycb_test(myCryptoDevCtx *ctx)
5969159701 }
5969259702
5969359703 /* verify */
59694-
5969559704 wolfSSL_EVP_MD_CTX_init(&mdCtx);
5969659705
5969759706 if (ret == WOLFSSL_SUCCESS) {
@@ -59727,24 +59736,11 @@ static wc_test_ret_t ecc_onlycb_test(myCryptoDevCtx *ctx)
5972759736 ERROR_OUT(WC_TEST_RET_ENC_NC, exit_onlycb);
5972859737 } else
5972959738 ret = 0;
59730- #endif
59731- #else
59732- (void)verify;
59733- (void)outLen;
59734- (void)inLen;
59735- (void)out;
59736- (void)pub;
59737- #ifdef OPENSSL_EXTRA
59738- (void)privKey;
59739- (void)pubKey;
59740- (void)mdCtx;
59741- (void)check;
59742- (void)checkSz;
59743- (void)p;
59744- #endif
59745- #endif
59739+ #endif /* !WOLFCRYPT_ONLY && OPENSSL_EXTRA */
59740+
5974659741 (void)keyFormat;
5974759742 (void)encInfo;
59743+ (void)ctx;
5974859744
5974959745exit_onlycb:
5975059746#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
@@ -59754,14 +59750,14 @@ static wc_test_ret_t ecc_onlycb_test(myCryptoDevCtx *ctx)
5975459750 }
5975559751 XFREE(pub, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
5975659752 XFREE(out, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
59757- #ifdef OPENSSL_EXTRA
59753+ #if !defined(WOLFCRYPT_ONLY) && defined( OPENSSL_EXTRA)
5975859754 if (check) {
5975959755 FREE(check, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
5976059756 }
5976159757 #endif
5976259758#else
5976359759 wc_ecc_free(key);
59764- #ifdef OPENSSL_EXTRA
59760+ #if !defined(WOLFCRYPT_ONLY) && defined( OPENSSL_EXTRA)
5976559761 if (privKey)
5976659762 wolfSSL_EVP_PKEY_free(privKey);
5976759763 if (pubKey)
@@ -59896,6 +59892,7 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
5989659892 #endif /* !NO_RSA */
5989759893 #ifdef HAVE_ECC
5989859894 if (info->pk.type == WC_PK_TYPE_EC_KEYGEN) {
59895+ #ifdef HAVE_ECC_DHE
5989959896 /* set devId to invalid, so software is used */
5990059897 info->pk.eckg.key->devId = INVALID_DEVID;
5990159898 #if defined(WOLF_CRYPTO_CB_ONLY_ECC)
@@ -59912,8 +59909,10 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
5991259909
5991359910 /* reset devId */
5991459911 info->pk.eckg.key->devId = devIdArg;
59912+ #endif
5991559913 }
5991659914 else if (info->pk.type == WC_PK_TYPE_ECDSA_SIGN) {
59915+ #ifdef HAVE_ECC_SIGN
5991759916 /* set devId to invalid, so software is used */
5991859917 info->pk.eccsign.key->devId = INVALID_DEVID;
5991959918 #if defined(WOLF_CRYPTO_CB_ONLY_ECC)
@@ -59932,8 +59931,10 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
5993259931
5993359932 /* reset devId */
5993459933 info->pk.eccsign.key->devId = devIdArg;
59934+ #endif
5993559935 }
5993659936 else if (info->pk.type == WC_PK_TYPE_ECDSA_VERIFY) {
59937+ #ifdef HAVE_ECC_VERIFY
5993759938 /* set devId to invalid, so software is used */
5993859939 info->pk.eccverify.key->devId = INVALID_DEVID;
5993959940 #if defined(WOLF_CRYPTO_CB_ONLY_ECC)
@@ -59952,8 +59953,10 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
5995259953
5995359954 /* reset devId */
5995459955 info->pk.eccverify.key->devId = devIdArg;
59956+ #endif
5995559957 }
5995659958 else if (info->pk.type == WC_PK_TYPE_ECDH) {
59959+ #ifdef HAVE_ECC_DHE
5995759960 /* set devId to invalid, so software is used */
5995859961 info->pk.ecdh.private_key->devId = INVALID_DEVID;
5995959962 #if defined(WOLF_CRYPTO_CB_ONLY_ECC)
@@ -59971,6 +59974,7 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
5997159974
5997259975 /* reset devId */
5997359976 info->pk.ecdh.private_key->devId = devIdArg;
59977+ #endif
5997459978 }
5997559979 #endif /* HAVE_ECC */
5997659980 #ifdef HAVE_CURVE25519
0 commit comments