@@ -376,6 +376,9 @@ void mld_poly_uniform(mld_poly *a, const uint8_t seed[MLDSA_SEEDBYTES + 2])
376376 ctr = mld_rej_uniform (a -> coeffs , MLDSA_N , ctr , buf , buflen );
377377 }
378378 mld_xof128_release (& state );
379+
380+ /* FIPS 204. Section 3.6.3 Destruction of intermediate values. */
381+ mld_zeroize (buf , sizeof (buf ));
379382}
380383
381384void mld_poly_uniform_4x (mld_poly * vec0 , mld_poly * vec1 , mld_poly * vec2 ,
@@ -431,6 +434,9 @@ void mld_poly_uniform_4x(mld_poly *vec0, mld_poly *vec1, mld_poly *vec2,
431434 ctr [3 ] = mld_rej_uniform (vec3 -> coeffs , MLDSA_N , ctr [3 ], buf [3 ], buflen );
432435 }
433436 mld_xof128_x4_release (& state );
437+
438+ /* FIPS 204. Section 3.6.3 Destruction of intermediate values. */
439+ mld_zeroize (buf , sizeof (buf ));
434440}
435441
436442/*************************************************
@@ -628,6 +634,10 @@ void mld_poly_uniform_eta_4x(mld_poly *r0, mld_poly *r1, mld_poly *r2,
628634 }
629635
630636 mld_xof256_x4_release (& state );
637+
638+ /* FIPS 204. Section 3.6.3 Destruction of intermediate values. */
639+ mld_zeroize (buf , sizeof (buf ));
640+ mld_zeroize (extseed , sizeof (extseed ));
631641}
632642
633643
@@ -651,6 +661,10 @@ void mld_poly_uniform_gamma1(mld_poly *a, const uint8_t seed[MLDSA_CRHBYTES],
651661 mld_polyz_unpack (a , buf );
652662
653663 mld_xof256_release (& state );
664+
665+ /* FIPS 204. Section 3.6.3 Destruction of intermediate values. */
666+ mld_zeroize (buf , sizeof (buf ));
667+ mld_zeroize (extseed , sizeof (extseed ));
654668}
655669
656670void mld_poly_uniform_gamma1_4x (mld_poly * r0 , mld_poly * r1 , mld_poly * r2 ,
@@ -690,6 +704,10 @@ void mld_poly_uniform_gamma1_4x(mld_poly *r0, mld_poly *r1, mld_poly *r2,
690704 mld_polyz_unpack (r2 , buf [2 ]);
691705 mld_polyz_unpack (r3 , buf [3 ]);
692706 mld_xof256_x4_release (& state );
707+
708+ /* FIPS 204. Section 3.6.3 Destruction of intermediate values. */
709+ mld_zeroize (buf , sizeof (buf ));
710+ mld_zeroize (extseed , sizeof (extseed ));
693711}
694712
695713
@@ -764,6 +782,10 @@ void mld_poly_challenge(mld_poly *c, const uint8_t seed[MLDSA_CTILDEBYTES])
764782 signs >>= 1 ;
765783 }
766784
785+ /* FIPS 204. Section 3.6.3 Destruction of intermediate values. */
786+ mld_zeroize (buf , sizeof (buf ));
787+ mld_zeroize (& signs , sizeof (signs ));
788+
767789 mld_assert_bound (c -> coeffs , MLDSA_N , -1 , 2 );
768790}
769791
0 commit comments