aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-06-25 16:25:57 -0400
committerJack Lloyd <[email protected]>2018-06-25 16:25:57 -0400
commit2f2af322a957aebec3d545585054cfc88c9d62eb (patch)
tree01d582422b4564cfa4e6f33e012e76fdb32f7ba3
parentc4d3b64d2ebaa70c737c359a941301783036ca68 (diff)
Fix error in 1024-bit polynomial double
No big problem since we don't even support 1024-bit ciphers atm (though I suppose someone might have used Lion for this)
-rw-r--r--src/lib/utils/poly_dbl/poly_dbl.cpp4
-rw-r--r--src/tests/data/poly_dbl.vec5
2 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/utils/poly_dbl/poly_dbl.cpp b/src/lib/utils/poly_dbl/poly_dbl.cpp
index 62c7695da..65cee9f01 100644
--- a/src/lib/utils/poly_dbl/poly_dbl.cpp
+++ b/src/lib/utils/poly_dbl/poly_dbl.cpp
@@ -75,7 +75,7 @@ void poly_double_n(uint8_t out[], const uint8_t in[], size_t n)
case 64:
return poly_double<8, MinWeightPolynomial::P512>(out, in);
case 128:
- return poly_double<8, MinWeightPolynomial::P1024>(out, in);
+ return poly_double<16, MinWeightPolynomial::P1024>(out, in);
default:
throw Invalid_Argument("Unsupported size for poly_double_n");
}
@@ -96,7 +96,7 @@ void poly_double_n_le(uint8_t out[], const uint8_t in[], size_t n)
case 64:
return poly_double_le<8, MinWeightPolynomial::P512>(out, in);
case 128:
- return poly_double_le<8, MinWeightPolynomial::P1024>(out, in);
+ return poly_double_le<16, MinWeightPolynomial::P1024>(out, in);
default:
throw Invalid_Argument("Unsupported size for poly_double_n_le");
}
diff --git a/src/tests/data/poly_dbl.vec b/src/tests/data/poly_dbl.vec
index fb5326f07..67fc36a94 100644
--- a/src/tests/data/poly_dbl.vec
+++ b/src/tests/data/poly_dbl.vec
@@ -238,3 +238,8 @@ Out = B70F003BEF3BCD3B1DEBA8B3B0B4033F738FC8DD5D8852EA26BA2A3D1C9461CC9A76C8B300
In = E30D8CF9184C855AA05F27B7EE1061DF238052A64452AA6B2FAD9DBC8F86243552F62F0F8F3D0D837292804F2401158787FF7D1AA2EDE287369509184FC674AE
Out = C61B19F230990AB540BE4F6FDC20C3BE4700A54C88A554D65F5B3B791F0C486AA5EC5E1F1E7A1B06E525009E48022B0F0FFEFA3545DBC50E6D2A12309F8CE879
+In = 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+Out = 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+
+In = 8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+Out = 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080043