@@ -796,12 +796,8 @@ static int wc_HpkeEncap(Hpke* hpke, void* ephemeralKey, void* receiverKey,
796796 hpke -> Npk * 2 , sharedSecret );
797797 }
798798
799- if (dh != NULL ) {
800- ForceZero (dh , hpke -> Ndh );
801- }
802- if (kemContext != NULL ) {
803- ForceZero (kemContext , hpke -> Npk * 2 );
804- }
799+ ForceZero (dh , hpke -> Ndh );
800+ ForceZero (kemContext , hpke -> Npk * 2 );
805801 WC_FREE_VAR_EX (dh , hpke -> heap , DYNAMIC_TYPE_TMP_BUFFER );
806802 WC_FREE_VAR_EX (kemContext , hpke -> heap , DYNAMIC_TYPE_TMP_BUFFER );
807803
@@ -833,9 +829,7 @@ static int wc_HpkeSetupBaseSender(Hpke* hpke, HpkeBaseContext* context,
833829 infoSz );
834830 }
835831
836- if (sharedSecret != NULL ) {
837- ForceZero (sharedSecret , hpke -> Nsecret );
838- }
832+ ForceZero (sharedSecret , hpke -> Nsecret );
839833 WC_FREE_VAR_EX (sharedSecret , hpke -> heap , DYNAMIC_TYPE_TMP_BUFFER );
840834
841835 return ret ;
@@ -923,9 +917,7 @@ int wc_HpkeSealBase(Hpke* hpke, void* ephemeralKey, void* receiverKey,
923917
924918 PRIVATE_KEY_LOCK ();
925919
926- if (context != NULL ) {
927- ForceZero (context , sizeof (HpkeBaseContext ));
928- }
920+ ForceZero (context , sizeof (HpkeBaseContext ));
929921 WC_FREE_VAR_EX (context , hpke -> heap , DYNAMIC_TYPE_TMP_BUFFER );
930922
931923 return ret ;
@@ -1044,9 +1036,7 @@ static int wc_HpkeDecap(Hpke* hpke, void* receiverKey, const byte* pubKey,
10441036 hpke -> Npk * 2 , sharedSecret );
10451037 }
10461038
1047- if (dh != NULL ) {
1048- ForceZero (dh , hpke -> Ndh );
1049- }
1039+ ForceZero (dh , hpke -> Ndh );
10501040 WC_FREE_VAR_EX (dh , hpke -> heap , DYNAMIC_TYPE_TMP_BUFFER );
10511041 WC_FREE_VAR_EX (kemContext , hpke -> heap , DYNAMIC_TYPE_TMP_BUFFER );
10521042
@@ -1073,9 +1063,7 @@ static int wc_HpkeSetupBaseReceiver(Hpke* hpke, HpkeBaseContext* context,
10731063 infoSz );
10741064 }
10751065
1076- if (sharedSecret != NULL ) {
1077- ForceZero (sharedSecret , hpke -> Nsecret );
1078- }
1066+ ForceZero (sharedSecret , hpke -> Nsecret );
10791067 WC_FREE_VAR_EX (sharedSecret , hpke -> heap , DYNAMIC_TYPE_TMP_BUFFER );
10801068
10811069 return ret ;
@@ -1162,9 +1150,7 @@ int wc_HpkeOpenBase(Hpke* hpke, void* receiverKey, const byte* pubKey,
11621150
11631151 PRIVATE_KEY_LOCK ();
11641152
1165- if (context != NULL ) {
1166- ForceZero (context , sizeof (HpkeBaseContext ));
1167- }
1153+ ForceZero (context , sizeof (HpkeBaseContext ));
11681154 WC_FREE_VAR_EX (context , hpke -> heap , DYNAMIC_TYPE_TMP_BUFFER );
11691155
11701156 return ret ;
0 commit comments