@@ -494,14 +494,16 @@ int wh_DemoClient_CryptoEcc(whClientContext* clientContext)
494494 WC_RNG rng [1 ];
495495 byte sharedOne [32 ];
496496 byte sharedTwo [32 ];
497- const char plainMessage [16 ] = "message example" ;
498- byte message [sizeof (plainMessage )];
497+ /* Pre-computed SHA-256 digest of "message example" */
498+ /* Canned SHA-256 digest to use for sign/verify demo */
499+ byte message [32 ] = {
500+ 0x48 , 0x0E , 0x66 , 0x2E , 0x59 , 0x0A , 0x79 , 0x6E ,
501+ 0xE5 , 0x00 , 0xE1 , 0xA0 , 0xB7 , 0xE1 , 0x2C , 0x4E ,
502+ 0xD0 , 0x39 , 0x1D , 0x67 , 0x56 , 0x2F , 0x6E , 0xE0 ,
503+ 0x48 , 0x9C , 0x00 , 0xB9 , 0xA9 , 0x37 , 0x21 , 0x00
504+ };
499505 byte signature [128 ];
500506
501- /* Set the message to the test string */
502- strncpy ((char * )message , plainMessage , sizeof (message )- 1 );
503- message [sizeof (message )- 1 ] = '\0' ;
504-
505507 /* Initialize the rng to make the ecc keys */
506508 ret = wc_InitRng_ex (rng , NULL , WH_DEV_ID );
507509 if (ret != 0 ) {
@@ -624,15 +626,17 @@ int wh_DemoClient_CryptoEccImport(whClientContext* clientContext)
624626 WC_RNG rng [1 ];
625627 byte sharedOne [32 ];
626628 byte sharedTwo [32 ];
627- const char plainMessage [16 ] = "message example" ;
628- byte message [sizeof (plainMessage )];
629+ /* Pre-computed SHA-256 digest of "message example" */
630+ /* Canned SHA-256 digest to use for sign/verify demo */
631+ byte message [32 ] = {
632+ 0x48 , 0x0E , 0x66 , 0x2E , 0x59 , 0x0A , 0x79 , 0x6E ,
633+ 0xE5 , 0x00 , 0xE1 , 0xA0 , 0xB7 , 0xE1 , 0x2C , 0x4E ,
634+ 0xD0 , 0x39 , 0x1D , 0x67 , 0x56 , 0x2F , 0x6E , 0xE0 ,
635+ 0x48 , 0x9C , 0x00 , 0xB9 , 0xA9 , 0x37 , 0x21 , 0x00
636+ };
629637 byte signature [128 ];
630638 uint8_t keyBuf [256 ];
631639
632- /* Set the message to the test string */
633- strncpy ((char * )message , plainMessage , sizeof (message )- 1 );
634- message [sizeof (message )- 1 ] = '\0' ;
635-
636640 /* Initialize the rng for signature signing */
637641 ret = wc_InitRng_ex (rng , NULL , WH_DEV_ID );
638642 if (ret != 0 ) {
0 commit comments