Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDDSA contextLength error #380

Open
lukbettale opened this issue Jan 17, 2025 · 1 comment
Open

EDDSA contextLength error #380

lukbettale opened this issue Jan 17, 2025 · 1 comment
Assignees
Milestone

Comments

@lukbettale
Copy link

When asking for EDDSA SigGen tests with "contextLength": [128] in my registration.json file, the generation fails with the following error:
Error NIST.CVP.ACVTS.Libraries.Generation.Core.Generator`4 System.ArgumentException: min must be less than or equal to max

After investigation, I found that in gen-val/src/generation/src/NIST.CVP.ACVTS.Libraries.Generation/EDDSA/v1_0/SigGen/TestCaseGenerator.cs, the code to sample context lengths at line 40 has been changed to get random values between min+1 and max-1, which raises such exception when there is only one element in the domain.

I suggest to restore to the previous way of sampling values. Here is a patch suggestion:

diff --git a/gen-val/src/generation/src/NIST.CVP.ACVTS.Libraries.Generation/EDDSA/v1_0/SigGen/TestCaseGenerator.cs b/gen-val/src/generation/src/NIST.CVP.ACVTS.Libraries.Generation/EDDSA/v1_0/SigGen/TestCaseGenerator.cs
index 26ae3b4a..b5188f90 100644
--- a/gen-val/src/generation/src/NIST.CVP.ACVTS.Libraries.Generation/EDDSA/v1_0/SigGen/TestCaseGenerator.cs
+++ b/gen-val/src/generation/src/NIST.CVP.ACVTS.Libraries.Generation/EDDSA/v1_0/SigGen/TestCaseGenerator.cs
@@ -36,8 +36,8 @@ namespace NIST.CVP.ACVTS.Libraries.Generation.EDDSA.v1_0.SigGen
                 var min = group.ContextLength.GetDomainMinMax().Minimum;
                 var max = group.ContextLength.GetDomainMinMax().Maximum;

-                // We always add min and max, so get between min+1 and max-1
-                var lengths = group.ContextLength.GetRandomValues(min+1, max-1, NumberOfTestCasesToGenerate - 2).ToList();
+                // We always add min and max
+                var lengths = group.ContextLength.GetRandomValues(min, max, NumberOfTestCasesToGenerate - 2).ToList();
                 lengths.Add(min);
                 lengths.Add(max);
@jbrock24 jbrock24 self-assigned this Jan 27, 2025
@jbrock24
Copy link
Collaborator

Hello @lukbettale, apologies for the issue. This has been resolved and will go out with the next release. We'll reply here once that's available to you. Thanks for your patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants