From f69ec3c75c9f5bfe77c6b38fc9aaaade6e15d848 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 19 Mar 2021 17:59:30 -0400 Subject: Update datatest.cpp --- datatest.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'datatest.cpp') diff --git a/datatest.cpp b/datatest.cpp index 25ee86b8..70bdd546 100644 --- a/datatest.cpp +++ b/datatest.cpp @@ -579,12 +579,6 @@ void TestSymmetricCipher(TestData &v, const NameValuePairs &overrideParameters, (void)decryptor->DefaultKeyLength(); } - // Most block ciphers don't specify BlockPaddingScheme. Kalyna uses it in test vectors. - // 0 is NoPadding, 1 is ZerosPadding, 2 is PkcsPadding, 3 is OneAndZerosPadding, etc - // Note: The machinery is wired such that paddingScheme is effectively latched. An - // old paddingScheme may be unintentionally used in a subsequent test. - int paddingScheme = pairs.GetIntValueWithDefault(Name::BlockPaddingScheme(), 0); - ConstByteArrayParameter iv; if (pairs.GetValue(Name::IV(), iv) && iv.size() != encryptor->IVSize()) SignalTestFailure(); @@ -616,6 +610,13 @@ void TestSymmetricCipher(TestData &v, const NameValuePairs &overrideParameters, } } + // Most block ciphers don't specify BlockPaddingScheme. Kalyna uses it + // in test vectors. 0 is NoPadding, 1 is ZerosPadding, 2 is PkcsPadding, + // 3 is OneAndZerosPadding, etc. Note: The machinery is wired such that + // paddingScheme is effectively latched. An old paddingScheme may be + // unintentionally used in a subsequent test. + int paddingScheme = pairs.GetIntValueWithDefault(Name::BlockPaddingScheme(), 0); + // If a per-test vector parameter was set for a test, like BlockPadding, // BlockSize or Tweak, then it becomes latched in testDataPairs. The old // value is used in subsequent tests, and it could cause a self test @@ -761,12 +762,6 @@ void TestSymmetricCipherWithFileSource(TestData &v, const NameValuePairs &overri (void)decryptor->DefaultKeyLength(); } - // Most block ciphers don't specify BlockPaddingScheme. Kalyna uses it in test vectors. - // 0 is NoPadding, 1 is ZerosPadding, 2 is PkcsPadding, 3 is OneAndZerosPadding, etc - // Note: The machinery is wired such that paddingScheme is effectively latched. An - // old paddingScheme may be unintentionally used in a subsequent test. - int paddingScheme = pairs.GetIntValueWithDefault(Name::BlockPaddingScheme(), 0); - ConstByteArrayParameter iv; if (pairs.GetValue(Name::IV(), iv) && iv.size() != encryptor->IVSize()) SignalTestFailure(); @@ -790,6 +785,13 @@ void TestSymmetricCipherWithFileSource(TestData &v, const NameValuePairs &overri } } + // Most block ciphers don't specify BlockPaddingScheme. Kalyna uses it + // in test vectors. 0 is NoPadding, 1 is ZerosPadding, 2 is PkcsPadding, + // 3 is OneAndZerosPadding, etc. Note: The machinery is wired such that + // paddingScheme is effectively latched. An old paddingScheme may be + // unintentionally used in a subsequent test. + int paddingScheme = pairs.GetIntValueWithDefault(Name::BlockPaddingScheme(), 0); + // If a per-test vector parameter was set for a test, like BlockPadding, // BlockSize or Tweak, then it becomes latched in testDataPairs. The old // value is used in subsequent tests, and it could cause a self test -- cgit v1.2.1