Skip to content

Commit

Permalink
AES-XPN Fixes NRE within deferred crypto resolver
Browse files Browse the repository at this point in the history
- Sometimes IV and Salt are provided from different "parties" depending on the registration, the deferred resolver did not take this into account
- #12
  • Loading branch information
Kritner committed Oct 15, 2020
1 parent a067c07 commit 1901a5f
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using NIST.CVP.Common.Oracle.ParameterTypes;
using NIST.CVP.Common.Oracle.ResultTypes;
using NIST.CVP.Generation.Core.Async;
using NIST.CVP.Math;

namespace NIST.CVP.Generation.AES_XPN.v1_0
{
Expand All @@ -18,17 +19,25 @@ public DeferredEncryptResolver(IOracle oracle)

public async Task<AeadResult> CompleteDeferredCryptoAsync(TestGroup testGroup, TestCase serverTestCase, TestCase iutTestCase)
{
var iv = serverTestCase.IV.GetDeepCopy();
BitString iv = null;
if (testGroup.IvGeneration.Equals("internal", StringComparison.OrdinalIgnoreCase))
{
iv = iutTestCase.IV.GetDeepCopy();
iv = iutTestCase.IV?.GetDeepCopy();
}
else
{
iv = serverTestCase.IV?.GetDeepCopy();
}

var salt = serverTestCase.Salt;
BitString salt = null;
if (testGroup.SaltGen.Equals("internal", StringComparison.OrdinalIgnoreCase))
{
salt = iutTestCase.Salt.GetDeepCopy();
}
else
{
salt = serverTestCase.Salt.GetDeepCopy();
}

var param = new AeadParameters
{
Expand Down

0 comments on commit 1901a5f

Please sign in to comment.