@@ -599,12 +599,14 @@ static int wc_HpkeExtractAndExpand( Hpke* hpke, byte* dh, word32 dh_len,
599599 EAE_PRK_LABEL_STR_LEN , dh , dh_len , eae_prk );
600600
601601 /* expand */
602- if ( ret == 0 )
602+ if ( ret == 0 ) {
603603 ret = wc_HpkeLabeledExpand (hpke , hpke -> kem_suite_id ,
604604 sizeof ( hpke -> kem_suite_id ), eae_prk , hpke -> Nh ,
605605 (byte * )SHARED_SECRET_LABEL_STR , SHARED_SECRET_LABEL_STR_LEN ,
606606 kemContext , kem_context_length , hpke -> Nsecret , sharedSecret );
607+ }
607608
609+ ForceZero (eae_prk , WC_MAX_DIGEST_SIZE );
608610 WC_FREE_VAR_EX (eae_prk , hpke -> heap , DYNAMIC_TYPE_DIGEST );
609611
610612 return ret ;
@@ -693,6 +695,8 @@ static int wc_HpkeKeyScheduleBase(Hpke* hpke, HpkeBaseContext* context,
693695 1 + 2 * hpke -> Nh , hpke -> Nh , context -> exporter_secret );
694696 }
695697
698+ ForceZero (key_schedule_context , 1 + 2 * WC_MAX_DIGEST_SIZE );
699+ ForceZero (secret , WC_MAX_DIGEST_SIZE );
696700 WC_FREE_VAR_EX (key_schedule_context , hpke -> heap ,
697701 DYNAMIC_TYPE_TMP_BUFFER );
698702 WC_FREE_VAR_EX (secret , hpke -> heap , DYNAMIC_TYPE_DIGEST );
0 commit comments