@@ -598,12 +598,14 @@ static int wc_HpkeExtractAndExpand( Hpke* hpke, byte* dh, word32 dh_len,
598598 EAE_PRK_LABEL_STR_LEN , dh , dh_len , eae_prk );
599599
600600 /* expand */
601- if ( ret == 0 )
601+ if ( ret == 0 ) {
602602 ret = wc_HpkeLabeledExpand (hpke , hpke -> kem_suite_id ,
603603 sizeof ( hpke -> kem_suite_id ), eae_prk , hpke -> Nh ,
604604 (byte * )SHARED_SECRET_LABEL_STR , SHARED_SECRET_LABEL_STR_LEN ,
605605 kemContext , kem_context_length , hpke -> Nsecret , sharedSecret );
606+ }
606607
608+ ForceZero (eae_prk , WC_MAX_DIGEST_SIZE );
607609 WC_FREE_VAR_EX (eae_prk , hpke -> heap , DYNAMIC_TYPE_DIGEST );
608610
609611 return ret ;
@@ -692,6 +694,8 @@ static int wc_HpkeKeyScheduleBase(Hpke* hpke, HpkeBaseContext* context,
692694 1 + 2 * hpke -> Nh , hpke -> Nh , context -> exporter_secret );
693695 }
694696
697+ ForceZero (key_schedule_context , 1 + 2 * WC_MAX_DIGEST_SIZE );
698+ ForceZero (secret , WC_MAX_DIGEST_SIZE );
695699 WC_FREE_VAR_EX (key_schedule_context , hpke -> heap ,
696700 DYNAMIC_TYPE_TMP_BUFFER );
697701 WC_FREE_VAR_EX (secret , hpke -> heap , DYNAMIC_TYPE_DIGEST );
0 commit comments