@@ -8414,6 +8414,7 @@ static int dilithium_sign_with_seed_mu(dilithium_key* key,
84148414 dilithium_vec_encode_gamma1 (z , params -> l , params -> gamma1_bits , ze );
84158415 }
84168416
8417+ ForceZero (priv_rand_seed , sizeof (priv_rand_seed ));
84178418 XFREE (y , key -> heap , DYNAMIC_TYPE_DILITHIUM );
84188419 return ret ;
84198420#else
@@ -8955,6 +8956,7 @@ static int dilithium_sign_with_seed_mu(dilithium_key* key,
89558956 while ((ret == 0 ) && (!valid ));
89568957 }
89578958
8959+ ForceZero (priv_rand_seed , sizeof (priv_rand_seed ));
89588960 XFREE (y , key -> heap , DYNAMIC_TYPE_DILITHIUM );
89598961 return ret ;
89608962#endif
@@ -9008,6 +9010,7 @@ static int dilithium_sign_ctx_msg_with_seed(dilithium_key* key,
90089010 ret = dilithium_sign_with_seed_mu (key , seedMu , sig , sigLen );
90099011 }
90109012
9013+ ForceZero (seedMu , sizeof (seedMu ));
90119014 return ret ;
90129015}
90139016
@@ -9057,6 +9060,7 @@ static int dilithium_sign_msg_with_seed(dilithium_key* key, const byte* seed,
90579060 ret = dilithium_sign_with_seed_mu (key , seedMu , sig , sigLen );
90589061 }
90599062
9063+ ForceZero (seedMu , sizeof (seedMu ));
90609064 return ret ;
90619065}
90629066#endif /* WOLFSSL_DILITHIUM_NO_CTX */
@@ -9122,6 +9126,7 @@ static int dilithium_sign_ctx_msg(dilithium_key* key, WC_RNG* rng,
91229126 ret = dilithium_sign_with_seed_mu (key , seedMu , sig , sigLen );
91239127 }
91249128
9129+ ForceZero (seedMu , sizeof (seedMu ));
91259130 return ret ;
91269131}
91279132
@@ -9184,6 +9189,7 @@ static int dilithium_sign_msg(dilithium_key* key, WC_RNG* rng,
91849189 ret = dilithium_sign_with_seed_mu (key , seedMu , sig , sigLen );
91859190 }
91869191
9192+ ForceZero (seedMu , sizeof (seedMu ));
91879193 return ret ;
91889194}
91899195#endif /* WOLFSSL_DILITHIUM_NO_CTX */
@@ -9257,6 +9263,7 @@ static int dilithium_sign_ctx_hash_with_seed(dilithium_key* key,
92579263 ret = dilithium_sign_with_seed_mu (key , seedMu , sig , sigLen );
92589264 }
92599265
9266+ ForceZero (seedMu , sizeof (seedMu ));
92609267 return ret ;
92619268}
92629269
0 commit comments