public int Generate(byte[] output, byte[] additionalInput, bool predictionResistant) { lock (this) { lazyInitDRBG(); if (predictionResistant) { // FSM_STATE:5.7, "DRBG RESEED HEALTH CHECK", "The module is performing DRBG Reseed Health Check self-test" // FSM_TRANS:5.7, "CONDITIONAL TEST", "DRBG RESEED HEALTH CHECKS", "Invoke DRBG Reseed Health Check" SelfTestExecutor.Validate(algorithm, drbg.CreateReseedSelfTest(algorithm)); // reseed health test // FSM_TRANS:5.8, "DRBG RESEED HEALTH CHECKS", "CONDITIONAL TEST", "DRBG Reseed Health Check successful" } // check if a reseed is required... if (drbg.Generate(output, additionalInput, predictionResistant) < 0) { // FSM_STATE:5.7, "DRBG RESEED HEALTH CHECK", "The module is performing DRBG Reseed Health Check self-test" // FSM_TRANS:5.7, "CONDITIONAL TEST", "DRBG RESEED HEALTH CHECKS", "Invoke DRBG Reseed Health Check" SelfTestExecutor.Validate(algorithm, drbg.CreateReseedSelfTest(algorithm)); // reseed health test // FSM_TRANS:5.8, "DRBG RESEED HEALTH CHECKS", "CONDITIONAL TEST", "DRBG Reseed Health Check successful" drbg.Reseed(null); return(drbg.Generate(output, additionalInput, predictionResistant)); } return(output.Length); } }
public override void NextBytes(byte[] bytes) { lock (drbg) { // check if a reseed is required... if (drbg.Generate(bytes, null, predictionResistant) < 0) { drbg.Reseed(null); drbg.Generate(bytes, null, predictionResistant); } } }
public void Reseed(byte[] additionalInput) { CryptoStatus.IsReady(); lock (this) { block = new byte[0]; nextBlock = new byte[0]; drbg.Reseed(additionalInput); } }