@@ -311,44 +311,44 @@ static int whTest_CryptoRsa(whClientContext* ctx, int devId, WC_RNG* rng)
311311static int whTest_CryptoEcc (whClientContext * ctx , int devId , WC_RNG * rng )
312312{
313313 int ret = WH_ERROR_OK ;
314- ecc_key bonnieKey [1 ];
315- ecc_key clydeKey [1 ];
314+ ecc_key bobKey [1 ];
315+ ecc_key aliceKey [1 ];
316316#define TEST_ECC_KEYSIZE 32
317317#define TEST_ECC_CURVE_ID ECC_SECP256R1
318318 uint8_t shared_ab [TEST_ECC_KEYSIZE ] = {0 };
319319 uint8_t shared_ba [TEST_ECC_KEYSIZE ] = {0 };
320320 uint8_t hash [TEST_ECC_KEYSIZE ] = {0 };
321321 uint8_t sig [ECC_MAX_SIG_SIZE ] = {0 };
322- whKeyId keyIdPrivate = WH_KEYID_ERASED ;
323- whKeyId checkKeyId = WH_KEYID_ERASED ;
322+ whKeyId keyIdPrivate = WH_KEYID_ERASED ;
323+ whKeyId checkKeyId = WH_KEYID_ERASED ;
324324 whNvmFlags flags = WH_NVM_FLAGS_USAGE_SIGN | WH_NVM_FLAGS_USAGE_VERIFY |
325325 WH_NVM_FLAGS_USAGE_DERIVE ;
326326 uint8_t labelPrivate [WH_NVM_LABEL_LEN ] = "ECC Private Key" ;
327327
328328 /* Test Case 1: Using ephemeral key (normal wolfCrypt flow) */
329- ret = wc_ecc_init_ex (bonnieKey , NULL , devId );
329+ ret = wc_ecc_init_ex (bobKey , NULL , devId );
330330 if (ret != 0 ) {
331331 WH_ERROR_PRINT ("Failed to wc_ecc_init_ex %d\n" , ret );
332332 } else {
333- ret = wc_ecc_init_ex (clydeKey , NULL , devId );
333+ ret = wc_ecc_init_ex (aliceKey , NULL , devId );
334334 if (ret != 0 ) {
335335 WH_ERROR_PRINT ("Failed to wc_ecc_init_ex %d\n" , ret );
336336 } else {
337- ret = wc_ecc_make_key (rng , TEST_ECC_KEYSIZE , bonnieKey );
337+ ret = wc_ecc_make_key (rng , TEST_ECC_KEYSIZE , bobKey );
338338 if (ret != 0 ) {
339339 WH_ERROR_PRINT ("Failed to wc_ecc_make_key %d\n" , ret );
340340 } else {
341- ret = wc_ecc_make_key (rng , TEST_ECC_KEYSIZE , clydeKey );
341+ ret = wc_ecc_make_key (rng , TEST_ECC_KEYSIZE , aliceKey );
342342 if (ret != 0 ) {
343343 WH_ERROR_PRINT ("Failed to wc_ecc_make_key %d\n" , ret );
344344 } else {
345345 word32 secLen = TEST_ECC_KEYSIZE ;
346- ret = wc_ecc_shared_secret (bonnieKey , clydeKey ,
346+ ret = wc_ecc_shared_secret (bobKey , aliceKey ,
347347 (byte * )shared_ab , & secLen );
348348 if (ret != 0 ) {
349349 WH_ERROR_PRINT ("Failed to compute secret %d\n" , ret );
350350 } else {
351- ret = wc_ecc_shared_secret (clydeKey , bonnieKey ,
351+ ret = wc_ecc_shared_secret (aliceKey , bobKey ,
352352 (byte * )shared_ba , & secLen );
353353 if (ret != 0 ) {
354354 WH_ERROR_PRINT ("Failed to compute secret %d\n" ,
@@ -370,15 +370,15 @@ static int whTest_CryptoEcc(whClientContext* ctx, int devId, WC_RNG* rng)
370370 word32 sigLen = sizeof (sig );
371371 ret = wc_ecc_sign_hash ((void * )hash , sizeof (hash ),
372372 (void * )sig , & sigLen , rng ,
373- bonnieKey );
373+ bobKey );
374374 if (ret != 0 ) {
375375 WH_ERROR_PRINT ("Failed to wc_ecc_sign_hash %d\n" ,
376376 ret );
377377 } else {
378378 int res = 0 ;
379379 ret = wc_ecc_verify_hash ((void * )sig , sigLen ,
380380 (void * )hash , sizeof (hash ),
381- & res , bonnieKey );
381+ & res , bobKey );
382382 if (ret != 0 ) {
383383 WH_ERROR_PRINT ("Failed to wc_ecc_verify_hash"
384384 " %d\n" ,
@@ -399,9 +399,9 @@ static int whTest_CryptoEcc(whClientContext* ctx, int devId, WC_RNG* rng)
399399 }
400400 }
401401 }
402- wc_ecc_free (clydeKey );
402+ wc_ecc_free (aliceKey );
403403 }
404- wc_ecc_free (bonnieKey );
404+ wc_ecc_free (bobKey );
405405 }
406406
407407 /* Test Case 2: Using client export key */
@@ -410,27 +410,27 @@ static int whTest_CryptoEcc(whClientContext* ctx, int devId, WC_RNG* rng)
410410 memset (shared_ba , 0 , sizeof (shared_ba ));
411411 memset (sig , 0 , sizeof (sig ));
412412
413- ret = wc_ecc_init_ex (bonnieKey , NULL , WH_DEV_ID );
413+ ret = wc_ecc_init_ex (bobKey , NULL , WH_DEV_ID );
414414 if (ret != 0 ) {
415415 WH_ERROR_PRINT ("Failed to wc_ecc_init_ex for export key %d\n" , ret );
416416 }
417417 else {
418- ret = wc_ecc_init_ex (clydeKey , NULL , WH_DEV_ID );
418+ ret = wc_ecc_init_ex (aliceKey , NULL , WH_DEV_ID );
419419 if (ret != 0 ) {
420420 WH_ERROR_PRINT ("Failed to wc_ecc_init_ex for export key %d\n" ,
421421 ret );
422422 }
423423 else {
424424 /* Server creates keys and exports them to client */
425425 ret = wh_Client_EccMakeExportKey (ctx , TEST_ECC_KEYSIZE ,
426- TEST_ECC_CURVE_ID , bonnieKey );
426+ TEST_ECC_CURVE_ID , bobKey );
427427 if (ret != 0 ) {
428428 WH_ERROR_PRINT ("Failed to wh_Client_EccMakeExportKey %d\n" ,
429429 ret );
430430 }
431431 if (ret == 0 ) {
432432 ret = wh_Client_EccMakeExportKey (
433- ctx , TEST_ECC_KEYSIZE , TEST_ECC_CURVE_ID , clydeKey );
433+ ctx , TEST_ECC_KEYSIZE , TEST_ECC_CURVE_ID , aliceKey );
434434 if (ret != 0 ) {
435435 WH_ERROR_PRINT (
436436 "Failed to wh_Client_EccMakeExportKey %d\n" , ret );
@@ -439,7 +439,7 @@ static int whTest_CryptoEcc(whClientContext* ctx, int devId, WC_RNG* rng)
439439 /* Test ECDH with exported keys */
440440 if (ret == 0 ) {
441441 word32 secLen = TEST_ECC_KEYSIZE ;
442- ret = wc_ecc_shared_secret (bonnieKey , clydeKey ,
442+ ret = wc_ecc_shared_secret (bobKey , aliceKey ,
443443 (byte * )shared_ab , & secLen );
444444 if (ret != 0 ) {
445445 WH_ERROR_PRINT (
@@ -448,7 +448,7 @@ static int whTest_CryptoEcc(whClientContext* ctx, int devId, WC_RNG* rng)
448448 }
449449 if (ret == 0 ) {
450450 word32 secLen = TEST_ECC_KEYSIZE ;
451- ret = wc_ecc_shared_secret (clydeKey , bonnieKey ,
451+ ret = wc_ecc_shared_secret (aliceKey , bobKey ,
452452 (byte * )shared_ba , & secLen );
453453 if (ret != 0 ) {
454454 WH_ERROR_PRINT (
@@ -469,7 +469,7 @@ static int whTest_CryptoEcc(whClientContext* ctx, int devId, WC_RNG* rng)
469469 memcpy (hash , shared_ba , sizeof (hash ));
470470 word32 sigLen = sizeof (sig );
471471 ret = wc_ecc_sign_hash ((void * )hash , sizeof (hash ),
472- (void * )sig , & sigLen , rng , bonnieKey );
472+ (void * )sig , & sigLen , rng , bobKey );
473473 if (ret != 0 ) {
474474 WH_ERROR_PRINT ("Failed to sign with export key %d\n" ,
475475 ret );
@@ -478,7 +478,7 @@ static int whTest_CryptoEcc(whClientContext* ctx, int devId, WC_RNG* rng)
478478 int res = 0 ;
479479 ret =
480480 wc_ecc_verify_hash ((void * )sig , sigLen , (void * )hash ,
481- sizeof (hash ), & res , bonnieKey );
481+ sizeof (hash ), & res , bobKey );
482482 if (ret != 0 ) {
483483 WH_ERROR_PRINT (
484484 "Failed to verify with export key %d\n" , ret );
@@ -493,9 +493,9 @@ static int whTest_CryptoEcc(whClientContext* ctx, int devId, WC_RNG* rng)
493493 }
494494 }
495495 }
496- wc_ecc_free (clydeKey );
496+ wc_ecc_free (aliceKey );
497497 }
498- wc_ecc_free (bonnieKey );
498+ wc_ecc_free (bobKey );
499499 }
500500 }
501501
@@ -517,19 +517,19 @@ static int whTest_CryptoEcc(whClientContext* ctx, int devId, WC_RNG* rng)
517517 }
518518 if (ret == 0 ) {
519519 /* Init the cached key struct and associate with server key ID */
520- ret = wc_ecc_init_ex (bonnieKey , NULL , WH_DEV_ID );
520+ ret = wc_ecc_init_ex (bobKey , NULL , WH_DEV_ID );
521521 if (ret != 0 ) {
522522 WH_ERROR_PRINT ("Failed to wc_ecc_init_ex for cache key %d\n" ,
523523 ret );
524524 }
525525 else {
526- ret = wh_Client_EccSetKeyId (bonnieKey , keyIdPrivate );
526+ ret = wh_Client_EccSetKeyId (bobKey , keyIdPrivate );
527527 if (ret != 0 ) {
528528 WH_ERROR_PRINT ("Failed to wh_Client_EccSetKeyId %d\n" , ret );
529529 }
530530 /* Verify key ID was set correctly */
531531 if (ret == 0 ) {
532- ret = wh_Client_EccGetKeyId (bonnieKey , & checkKeyId );
532+ ret = wh_Client_EccGetKeyId (bobKey , & checkKeyId );
533533 if (ret != 0 ) {
534534 WH_ERROR_PRINT ("Failed to wh_Client_EccGetKeyId %d\n" ,
535535 ret );
@@ -544,21 +544,21 @@ static int whTest_CryptoEcc(whClientContext* ctx, int devId, WC_RNG* rng)
544544 /* Set curve parameters (required since key data isn't exported)
545545 */
546546 if (ret == 0 ) {
547- ret = wc_ecc_set_curve (bonnieKey , TEST_ECC_KEYSIZE ,
547+ ret = wc_ecc_set_curve (bobKey , TEST_ECC_KEYSIZE ,
548548 TEST_ECC_CURVE_ID );
549549 if (ret != 0 ) {
550550 WH_ERROR_PRINT ("Failed to wc_ecc_set_curve %d\n" , ret );
551551 }
552552 }
553553 /* Create ephemeral peer key for ECDH test */
554554 if (ret == 0 ) {
555- ret = wc_ecc_init_ex (clydeKey , NULL , WH_DEV_ID );
555+ ret = wc_ecc_init_ex (aliceKey , NULL , WH_DEV_ID );
556556 if (ret != 0 ) {
557557 WH_ERROR_PRINT (
558558 "Failed to wc_ecc_init_ex for peer key %d\n" , ret );
559559 }
560560 else {
561- ret = wc_ecc_make_key (rng , TEST_ECC_KEYSIZE , clydeKey );
561+ ret = wc_ecc_make_key (rng , TEST_ECC_KEYSIZE , aliceKey );
562562 if (ret != 0 ) {
563563 WH_ERROR_PRINT (
564564 "Failed to wc_ecc_make_key for peer %d\n" , ret );
@@ -567,7 +567,7 @@ static int whTest_CryptoEcc(whClientContext* ctx, int devId, WC_RNG* rng)
567567 if (ret == 0 ) {
568568 word32 secLen = TEST_ECC_KEYSIZE ;
569569 ret = wc_ecc_shared_secret (
570- bonnieKey , clydeKey , (byte * )shared_ab , & secLen );
570+ bobKey , aliceKey , (byte * )shared_ab , & secLen );
571571 if (ret != 0 ) {
572572 WH_ERROR_PRINT (
573573 "Failed to compute cache key secret %d\n" ,
@@ -577,7 +577,7 @@ static int whTest_CryptoEcc(whClientContext* ctx, int devId, WC_RNG* rng)
577577 if (ret == 0 ) {
578578 word32 secLen = TEST_ECC_KEYSIZE ;
579579 ret = wc_ecc_shared_secret (
580- clydeKey , bonnieKey , (byte * )shared_ba , & secLen );
580+ aliceKey , bobKey , (byte * )shared_ba , & secLen );
581581 if (ret != 0 ) {
582582 WH_ERROR_PRINT (
583583 "Failed to compute peer secret %d\n" , ret );
@@ -594,15 +594,15 @@ static int whTest_CryptoEcc(whClientContext* ctx, int devId, WC_RNG* rng)
594594 WH_TEST_PRINT ("ECC cache key ECDH SUCCESS\n" );
595595 }
596596 }
597- wc_ecc_free (clydeKey );
597+ wc_ecc_free (aliceKey );
598598 }
599599 }
600600 /* Test ECDSA sign/verify with cached key */
601601 if (ret == 0 ) {
602602 memcpy (hash , shared_ba , sizeof (hash ));
603603 word32 sigLen = sizeof (sig );
604604 ret = wc_ecc_sign_hash ((void * )hash , sizeof (hash ),
605- (void * )sig , & sigLen , rng , bonnieKey );
605+ (void * )sig , & sigLen , rng , bobKey );
606606 if (ret != 0 ) {
607607 WH_ERROR_PRINT ("Failed to sign with cache key %d\n" ,
608608 ret );
@@ -611,7 +611,7 @@ static int whTest_CryptoEcc(whClientContext* ctx, int devId, WC_RNG* rng)
611611 int res = 0 ;
612612 ret =
613613 wc_ecc_verify_hash ((void * )sig , sigLen , (void * )hash ,
614- sizeof (hash ), & res , bonnieKey );
614+ sizeof (hash ), & res , bobKey );
615615 if (ret != 0 ) {
616616 WH_ERROR_PRINT (
617617 "Failed to verify with cache key %d\n" , ret );
@@ -626,7 +626,7 @@ static int whTest_CryptoEcc(whClientContext* ctx, int devId, WC_RNG* rng)
626626 }
627627 }
628628 }
629- wc_ecc_free (bonnieKey );
629+ wc_ecc_free (bobKey );
630630 }
631631 }
632632 /* Evict server key regardless of test success */
0 commit comments