private void KdfFeedbackNoCounterTest()
        {
            string    file    = "KDFFeedbackNoCounter_gen.rsp";
            ArrayList vectors = CavpReader.ReadVectorFile(file);

            foreach (Vector vector in vectors)
            {
                IMac prf = CavpReader.CreatePrf(vector);
                KdfFeedbackBytesGenerator gen = new KdfFeedbackBytesGenerator(prf);

                int    count                = vector.ValueAsInt("COUNT");
                int    l                    = vector.ValueAsInt("L");
                byte[] ki                   = vector.ValueAsBytes("KI");
                byte[] iv                   = vector.ValueAsBytes("IV");
                byte[] fixedInputData       = vector.ValueAsBytes("FixedInputData");
                KdfFeedbackParameters param = KdfFeedbackParameters.CreateWithoutCounter(ki, iv, fixedInputData);
                gen.Init(param);

                byte[] koGenerated = new byte[l / 8];
                gen.GenerateBytes(koGenerated, 0, koGenerated.Length);

                byte[] koVectors = vector.ValueAsBytes("KO");
                CompareKO(file, vector, count, koGenerated, koVectors);
            }
        }
        public override void PerformTest()
        {
            string    file    = "KDFCTR_gen.rsp";
            ArrayList vectors = CavpReader.ReadVectorFile(file);

            ProcessVectors(file, vectors);
        }
        private void ProcessVectors(string name, ArrayList vectors)
        {
            foreach (Vector vector in vectors)
            {
                IMac prf = CavpReader.CreatePrf(vector);
                KdfCounterBytesGenerator gen = new KdfCounterBytesGenerator(prf);
                int r = -1;
                {
                    string rlen = vector.HeaderAsString("RLEN");
                    if (rlen == null)
                    {
                        Assert.Fail("No RLEN");
                    }
                    r = Int32.Parse(rlen.Split('_')[0]);
                }
                int    count = vector.ValueAsInt("COUNT");
                int    l     = vector.ValueAsInt("L");
                byte[] ki    = vector.ValueAsBytes("KI");
                if (vector.HeaderAsString("CTRLOCATION") == "BEFORE_FIXED")
                {
                    byte[] fixedInputData      = vector.ValueAsBytes("FixedInputData");
                    KdfCounterParameters param = new KdfCounterParameters(ki, null, fixedInputData, r);
                    gen.Init(param);
                }
                else if (vector.HeaderAsString("CTRLOCATION") == "AFTER_FIXED")
                {
                    byte[] fixedInputData      = vector.ValueAsBytes("FixedInputData");
                    KdfCounterParameters param = new KdfCounterParameters(ki, fixedInputData, null, r);
                    gen.Init(param);
                }
                else if (vector.HeaderAsString("CTRLOCATION") == "MIDDLE_FIXED")
                {
                    byte[] DataBeforeCtrData   = vector.ValueAsBytes("DataBeforeCtrData");
                    byte[] DataAfterCtrData    = vector.ValueAsBytes("DataAfterCtrData");
                    KdfCounterParameters param = new KdfCounterParameters(ki, DataBeforeCtrData, DataAfterCtrData, r);
                    gen.Init(param);
                }
                else
                {
                    throw new InvalidOperationException("Unknown CTRLOCATION: " + vector.HeaderAsString("CTRLOCATION"));
                }

                byte[] koGenerated = new byte[l / 8];
                gen.GenerateBytes(koGenerated, 0, koGenerated.Length);

                byte[] koVectors = vector.ValueAsBytes("KO");
                CompareKO(name, vector, count, koGenerated, koVectors);
            }
        }
        private void KdfFeedbackCounterTest()
        {
            string    file    = "KDFFeedbackCounter_gen.rsp";
            ArrayList vectors = CavpReader.ReadVectorFile(file);

            foreach (Vector vector in vectors)
            {
                if (vector.HeaderAsString("CTRLOCATION") != "AFTER_ITER")
                {
                    continue;
                }

                IMac prf = CavpReader.CreatePrf(vector);
                KdfFeedbackBytesGenerator gen = new KdfFeedbackBytesGenerator(prf);
                int r = -1;
                {
                    string rlen = vector.HeaderAsString("RLEN");
                    if (rlen == null)
                    {
                        Fail("No RLEN");
                    }
                    r = Int32.Parse(rlen.Split('_')[0]);
                }
                int    count                = vector.ValueAsInt("COUNT");
                int    l                    = vector.ValueAsInt("L");
                byte[] ki                   = vector.ValueAsBytes("KI");
                byte[] iv                   = vector.ValueAsBytes("IV");
                byte[] fixedInputData       = vector.ValueAsBytes("FixedInputData");
                KdfFeedbackParameters param = KdfFeedbackParameters.CreateWithCounter(ki, iv, fixedInputData, r);
                gen.Init(param);

                byte[] koGenerated = new byte[l / 8];
                gen.GenerateBytes(koGenerated, 0, koGenerated.Length);

                byte[] koVectors = vector.ValueAsBytes("KO");
                CompareKO(file, vector, count, koGenerated, koVectors);
            }
        }