예제 #1
0
        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 VariantInternalKatTest CreateReseedSelfTest(Algorithm algorithm)
 {
     return(drbg.CreateReseedSelfTest(algorithm));
 }