@@ -819,7 +819,6 @@ static WC_INLINE void bench_append_memory_info(char* buffer, size_t size,
819819#define TEST_STRING "Everyone gets Friday off."
820820#define TEST_STRING_SZ 25
821821
822-
823822/* Bit values for each algorithm that is able to be benchmarked.
824823 * Common grouping of algorithms also.
825824 * Each algorithm has a unique value for its type e.g. cipher.
@@ -2078,7 +2077,8 @@ static const char* bench_result_words2[][6] = {
20782077 static volatile int g_threadCount;
20792078#endif
20802079
2081- #if defined(WOLFSSL_ASYNC_CRYPT) || defined(WOLFSSL_CAAM) || defined(WC_USE_DEVID)
2080+ #if defined(WOLFSSL_ASYNC_CRYPT) || defined(WOLFSSL_CAAM) || defined(WC_USE_DEVID) || \
2081+ defined(WOLFSSL_MICROCHIP_TA100)
20822082 #ifndef NO_HW_BENCH
20832083 #define BENCH_DEVID
20842084 #endif
@@ -9987,8 +9987,12 @@ static void bench_rsa_helper(int useDeviceID,
99879987 1, ×, ntimes, &pending)) {
99889988 #if !defined(WOLFSSL_RSA_VERIFY_INLINE) && \
99899989 !defined(WOLFSSL_RSA_PUBLIC_ONLY)
9990- ret = wc_RsaSSL_Verify(enc[i], idx, out[i],
9990+ #if defined(WOLFSSL_MICROCHIP_TA100)
9991+ ret = wc_RsaSSL_Verify(message, len, enc[i], rsaKeySz/8, rsaKey[i]);
9992+ #else
9993+ ret = wc_RsaSSL_Verify(enc[i], idx, out[i],
99919994 rsaKeySz/8, rsaKey[i]);
9995+ #endif
99929996 #elif defined(USE_CERT_BUFFERS_2048)
99939997 XMEMCPY(enc[i], rsa_2048_sig, sizeof(rsa_2048_sig));
99949998 idx = sizeof(rsa_2048_sig);
@@ -10124,6 +10128,13 @@ void bench_rsa(int useDeviceID)
1012410128#else
1012510129 /* Note: To benchmark public only define WOLFSSL_PUBLIC_MP */
1012610130 rsaKeySz = 0;
10131+ #endif
10132+ #if defined(WOLFSSL_MICROCHIP_TA100)
10133+ /* Create new keys since you cannot import a private key to TA100 */
10134+ ret = wc_MakeRsaKey(rsaKey[i], rsaKeySz, WC_RSA_EXPONENT, &gRng);
10135+ if (ret) {
10136+ goto exit;
10137+ }
1012710138#endif
1012810139 }
1012910140
@@ -12106,6 +12117,9 @@ void bench_ecc(int useDeviceID, int curveId)
1210612117 if ((ret = wc_ecc_init_ex(genKey[i], HEAP_HINT, deviceID)) < 0) {
1210712118 goto exit;
1210812119 }
12120+ #if defined(WOLFSSL_MICROCHIP_TA100)
12121+ genKey[i]->slot = atmel_ecc_alloc(ATMEL_SLOT_ECDHE_ALICE);
12122+ #endif
1210912123 ret = wc_ecc_make_key_ex(&gRng, keySize, genKey[i], curveId);
1211012124 #ifdef WOLFSSL_ASYNC_CRYPT
1211112125 ret = wc_AsyncWait(ret, &genKey[i]->asyncDev, WC_ASYNC_FLAG_NONE);
@@ -12118,6 +12132,9 @@ void bench_ecc(int useDeviceID, int curveId)
1211812132 if ((ret = wc_ecc_init_ex(genKey2[i], HEAP_HINT, deviceID)) < 0) {
1211912133 goto exit;
1212012134 }
12135+ #if defined(WOLFSSL_MICROCHIP_TA100)
12136+ genKey2[i]->slot = atmel_ecc_alloc(ATMEL_SLOT_ECDHE_BOB);
12137+ #endif
1212112138 if ((ret = wc_ecc_make_key_ex(&gRng, keySize, genKey2[i],
1212212139 curveId)) > 0) {
1212312140 goto exit;
@@ -12314,7 +12331,10 @@ void bench_ecc(int useDeviceID, int curveId)
1231412331 WC_FREE_ARRAY(sig, BENCH_MAX_PENDING, HEAP_HINT);
1231512332 WC_FREE_ARRAY(digest, BENCH_MAX_PENDING, HEAP_HINT);
1231612333#endif
12317-
12334+ #if defined(WOLFSSL_MICROCHIP_TA100)
12335+ atmel_ecc_free(ATMEL_SLOT_ECDHE_ALICE);
12336+ atmel_ecc_free(ATMEL_SLOT_ECDHE_BOB);
12337+ #endif
1231812338 (void)useDeviceID;
1231912339 (void)pending;
1232012340 (void)x;
0 commit comments