summaryrefslogtreecommitdiff
path: root/lib/nettle/gost/gostdsa-mask.c
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2020-09-06 08:56:07 +0200
committerDaiki Ueno <ueno@gnu.org>2020-11-04 08:55:00 +0100
commite0928a2edd318ba26279591abe62f8801c814c7a (patch)
tree4a3d080e52dcb99c1ee6f13d7083c7c37582f4ea /lib/nettle/gost/gostdsa-mask.c
parent4511d0cebd3b37d7878139fd9c6e2fda68707169 (diff)
downloadgnutls-e0928a2edd318ba26279591abe62f8801c814c7a.tar.gz
build: hard require nettle 3.6
This allows us to remove several backports, including XTS, CFB8, raw-ChaCha, CMAC64, Curve448, and the GOST curves and hashes. Signed-off-by: Daiki Ueno <ueno@gnu.org>
Diffstat (limited to 'lib/nettle/gost/gostdsa-mask.c')
-rw-r--r--lib/nettle/gost/gostdsa-mask.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/nettle/gost/gostdsa-mask.c b/lib/nettle/gost/gostdsa-mask.c
index 552e5fb9e6..8344e9d6fb 100644
--- a/lib/nettle/gost/gostdsa-mask.c
+++ b/lib/nettle/gost/gostdsa-mask.c
@@ -37,8 +37,15 @@
#include <stdlib.h>
+#include <nettle/ecc-curve.h>
#include "gostdsa2.h"
-#include "ecc/ecc-internal.h"
+
+#define GOST_GC256B_Q "ffffffffffffffffffffffffffffffff" \
+ "6c611070995ad10045841b09b761b893"
+#define GOST_GC512A_Q "ffffffffffffffffffffffffffffffff" \
+ "ffffffffffffffffffffffffffffffff" \
+ "27e69532f48d89116ff22b8d4e056060" \
+ "9b4b38abfad2b85dcacdb1411f10b275"
/* Key comes in form .... M_2 M_1 K_0,
unmask is K_i = K_i-1 * M_i mod Q */
@@ -56,7 +63,14 @@ gostdsa_unmask_key (const struct ecc_curve *ecc,
mpz_init (unmasked);
mpz_init (temp);
mpz_init (temp2);
- mpz_roinit_n (q, ecc->q.m, ecc->q.size);
+
+ if (ecc == nettle_get_gost_gc256b ())
+ mpz_init_set_str (q, GOST_GC256B_Q, 16);
+ else if (ecc == nettle_get_gost_gc512a ())
+ mpz_init_set_str (q, GOST_GC512A_Q, 16);
+ else
+ abort ();
+
mpz_tdiv_r_2exp (unmasked, key, bits);
mpz_tdiv_q_2exp (key, key, bits);
keybits -= bits;