Hello. I saw new master branch received "gost" support.
Please add "--enable-gost" and "--disable-gost" flag.
I've noticed this flag is already a part of ".gitlab-ci.yml".
I will attach patch to this mail.
>From my point of view - I don't trust any russian government innovation,
especially because of their crypto-licensing politics and unknown genesis
of s-boxes. But I am sure that this flag will be used by many people: for
example openwrt, ddwrt developers don't like additional code.
By default I've disabled this flag. If you think it is important - please
enable it by default.
Thank you.
diff --git a/Makefile.in b/Makefile.in
index d4fcb813..3b06338b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -62,6 +62,10 @@ dvi installcheck uninstallcheck:
all-here: $(TARGETS) $(DOCTARGETS)
+GOST_nettle_SOURCES = @IF_GOST@ \
+ gost28147.c gosthash94.c gosthash94-meta.c \
+ hmac-gosthash94.c pbkdf2-hmac-gosthash94.c
+
nettle_SOURCES = aes-decrypt-internal.c aes-decrypt.c \
aes-encrypt-internal.c aes-encrypt.c aes-encrypt-table.c \
aes-invert-internal.c aes-set-key-internal.c \
@@ -104,8 +108,7 @@ nettle_SOURCES = aes-decrypt-internal.c aes-decrypt.c \
gcm-camellia256.c gcm-camellia256-meta.c \
cmac.c cmac64.c cmac-aes128.c cmac-aes256.c cmac-des3.c \
cmac-aes128-meta.c cmac-aes256-meta.c \
- gost28147.c gosthash94.c gosthash94-meta.c \
- hmac.c hmac-gosthash94.c hmac-md5.c hmac-ripemd160.c \
+ hmac.c hmac-md5.c hmac-ripemd160.c \
hmac-sha1.c hmac-sha224.c hmac-sha256.c hmac-sha384.c \
hmac-sha512.c \
hmac-md5-meta.c hmac-ripemd160-meta.c hmac-sha1-meta.c \
@@ -118,7 +121,7 @@ nettle_SOURCES = aes-decrypt-internal.c aes-decrypt.c \
nettle-lookup-hash.c \
nettle-meta-aeads.c nettle-meta-armors.c \
nettle-meta-ciphers.c nettle-meta-hashes.c nettle-meta-macs.c \
- pbkdf2.c pbkdf2-hmac-gosthash94.c pbkdf2-hmac-sha1.c \
+ pbkdf2.c pbkdf2-hmac-sha1.c \
pbkdf2-hmac-sha256.c \
poly1305-aes.c poly1305-internal.c \
realloc.c \
@@ -144,7 +147,13 @@ nettle_SOURCES = aes-decrypt-internal.c aes-decrypt.c \
version.c \
write-be32.c write-le32.c write-le64.c \
yarrow256.c yarrow_key_event.c \
- xts.c xts-aes128.c xts-aes256.c
+ xts.c xts-aes128.c xts-aes256.c \
+ $(GOST_nettle_SOURCES)
+
+GOST_hogweed_SOURCES = @IF_GOST@ \
+ ecc-gost-gc256b.c ecc-gost-gc512a.c \
+ ecc-gostdsa-sign.c gostdsa-sign.c \
+ ecc-gostdsa-verify.c gostdsa-verify.c
hogweed_SOURCES = sexp.c sexp-format.c \
sexp-transport.c sexp-transport-format.c \
@@ -180,7 +189,6 @@ hogweed_SOURCES = sexp.c sexp-format.c \
ecc-mod.c ecc-mod-inv.c \
ecc-mod-arith.c ecc-pp1-redc.c ecc-pm1-redc.c \
ecc-curve25519.c ecc-curve448.c \
- ecc-gost-gc256b.c ecc-gost-gc512a.c \
ecc-secp192r1.c ecc-secp224r1.c ecc-secp256r1.c \
ecc-secp384r1.c ecc-secp521r1.c \
ecc-size.c ecc-j-to-a.c ecc-a-to-j.c \
@@ -193,8 +201,6 @@ hogweed_SOURCES = sexp.c sexp-format.c \
ecc-point.c ecc-scalar.c ecc-point-mul.c ecc-point-mul-g.c \
ecc-ecdsa-sign.c ecdsa-sign.c \
ecc-ecdsa-verify.c ecdsa-verify.c ecdsa-keygen.c \
- ecc-gostdsa-sign.c gostdsa-sign.c \
- ecc-gostdsa-verify.c gostdsa-verify.c \
curve25519-mul-g.c curve25519-mul.c curve25519-eh-to-x.c \
curve448-mul-g.c curve448-mul.c curve448-eh-to-x.c \
eddsa-compress.c eddsa-decompress.c eddsa-expand.c \
@@ -202,16 +208,19 @@ hogweed_SOURCES = sexp.c sexp-format.c \
ed25519-sha512.c ed25519-sha512-pubkey.c \
ed25519-sha512-sign.c ed25519-sha512-verify.c \
ed448-shake256.c ed448-shake256-pubkey.c \
- ed448-shake256-sign.c ed448-shake256-verify.c
+ ed448-shake256-sign.c ed448-shake256-verify.c \
+ $(GOST_hogweed_SOURCES)
OPT_SOURCES = fat-x86_64.c fat-arm.c mini-gmp.c
+GOST_HEADERS = @IF_GOST@ gostdsa.h gosthash94.h
+
HEADERS = aes.h arcfour.h arctwo.h asn1.h blowfish.h \
base16.h base64.h bignum.h buffer.h camellia.h cast128.h \
cbc.h ccm.h cfb.h chacha.h chacha-poly1305.h ctr.h \
curve25519.h curve448.h des.h dsa.h dsa-compat.h eax.h \
ecc-curve.h ecc.h ecdsa.h eddsa.h \
- gcm.h gostdsa.h gosthash94.h hmac.h \
+ gcm.h hmac.h \
knuth-lfib.h hkdf.h \
macros.h \
cmac.h siv-cmac.h \
@@ -223,7 +232,8 @@ HEADERS = aes.h arcfour.h arctwo.h asn1.h blowfish.h \
pgp.h pkcs1.h pss.h pss-mgf1.h realloc.h ripemd160.h rsa.h \
salsa20.h sexp.h \
serpent.h sha.h sha1.h sha2.h sha3.h twofish.h \
- umac.h yarrow.h xts.h poly1305.h
+ umac.h yarrow.h xts.h poly1305.h \
+ $(GOST_HEADERS)
INSTALL_HEADERS = $(HEADERS) version.h @IF_MINI_GMP@ mini-gmp.h
@@ -232,6 +242,8 @@ SOURCES = $(nettle_SOURCES) $(hogweed_SOURCES) \
$(OPT_SOURCES) \
aesdata.c desdata.c twofishdata.c shadata.c gcmdata.c eccdata.c
+GOST_DISTFILES = @IF_GOST@ gost28147-internal.h
+
# NOTE: This list must include all source files, with no duplicates,
# independently of which source files are included in the build.
DISTFILES = $(SOURCES) $(HEADERS) getopt.h getopt_int.h \
@@ -246,7 +258,7 @@ DISTFILES = $(SOURCES) $(HEADERS) getopt.h getopt_int.h \
nettle.pc.in hogweed.pc.in \
$(des_headers) descore.README desdata.stamp \
aes-internal.h block-internal.h camellia-internal.h \
- gost28147-internal.h serpent-internal.h \
+ serpent-internal.h \
cast128_sboxes.h desinfo.h desCode.h \
ripemd160-internal.h sha2-internal.h \
memxor-internal.h nettle-internal.h nettle-write.h \
@@ -255,7 +267,8 @@ DISTFILES = $(SOURCES) $(HEADERS) getopt.h getopt_int.h \
rsa-internal.h pkcs1-internal.h dsa-internal.h eddsa-internal.h \
gmp-glue.h ecc-internal.h fat-setup.h \
mini-gmp.h asm.m4 \
- nettle.texinfo nettle.info nettle.html nettle.pdf sha-example.c
+ nettle.texinfo nettle.info nettle.html nettle.pdf sha-example.c \
+ $(GOST_DISTFILES)
# Rules building static libraries
nettle_OBJS = $(nettle_SOURCES:.c=.$(OBJEXT)) \
@@ -401,7 +414,7 @@ ecc-gost-gc512a.h: eccdata.stamp
./eccdata$(EXEEXT_FOR_BUILD) gost_gc512a 43 6 $(NUMB_BITS) > $@T && mv $@T $@
eccdata.stamp: eccdata.c
- $(MAKE) eccdata$(EXEEXT_FOR_BUILD)
+ $(COMPILE) $< -o eccdata$(EXEEXT_FOR_BUILD)
echo stamp > eccdata.stamp
ecc-curve25519.$(OBJEXT): ecc-curve25519.h
@@ -658,10 +671,11 @@ distcheck: dist
exit 1; }
$(rm_distcheck)
+GOST_CLEAN = @IF_GOST@ ecc-gost-gc256b.h ecc-gost-gc512a.h
+
clean-here:
-rm -f $(TARGETS) *.$(OBJEXT) *.$(OBJEXT).d *.s *.so *.dll *.a \
ecc-curve25519.h ecc-curve448.h \
- ecc-gost-gc256b.h ecc-gost-gc512a.h \
ecc-secp192r1.h ecc-secp224r1.h ecc-secp256r1.h \
ecc-secp384r1.h ecc-secp521r1.h \
aesdata$(EXEEXT_FOR_BUILD) \
@@ -669,7 +683,8 @@ clean-here:
twofishdata$(EXEEXT_FOR_BUILD) \
shadata$(EXEEXT_FOR_BUILD) \
gcmdata$(EXEEXT_FOR_BUILD) \
- eccdata$(EXEEXT_FOR_BUILD) eccdata.stamp
+ eccdata$(EXEEXT_FOR_BUILD) eccdata.stamp \
+ $(GOST_CLEAN)
-rm -rf .lib libnettle.stamp libhogweed.stamp
distclean-here: clean-here
diff --git a/configure.ac b/configure.ac
index ba3ab7c6..a3235dd0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,6 +93,10 @@ AC_ARG_ENABLE(mini-gmp,
AC_HELP_STRING([--enable-mini-gmp], [Enable mini-gmp, used instead of libgmp.]),,
[enable_mini_gmp=no])
+AC_ARG_ENABLE(gost,
+ AC_HELP_STRING([--enable-gost], [Enable gost. (default=no)]),,
+ [enable_gost=no])
+
if test "x$enable_mini_gmp" = xyes ; then
NETTLE_USE_MINI_GMP=1
HOGWEED_EXTRA_SYMBOLS="mpz_*;gmp_*;mpn_*;mp_*;"
@@ -888,7 +892,16 @@ if test "x$enable_mini_gmp" = "xyes" ; then
else
IF_MINI_GMP='#'
fi
-
+
+AH_TEMPLATE([WITH_GOST], [Defined if gost is enabled])
+
+if test "x$enable_gost" = "xyes" ; then
+ AC_DEFINE(WITH_GOST)
+ IF_GOST=''
+else
+ IF_GOST='#'
+fi
+
AC_SUBST(IF_HOGWEED)
AC_SUBST(IF_STATIC)
AC_SUBST(IF_SHARED)
@@ -897,6 +910,7 @@ AC_SUBST(IF_DLOPEN_TEST)
AC_SUBST(IF_DOCUMENTATION)
AC_SUBST(IF_DLL)
AC_SUBST(IF_MINI_GMP)
+AC_SUBST(IF_GOST)
OPENSSL_LIBFLAGS=''
@@ -980,5 +994,6 @@ AC_MSG_NOTICE([summary of build options:
Shared libraries: ${enable_shared}
Public key crypto: ${enable_public_key}
Using mini-gmp: ${enable_mini_gmp}
+ Gost: ${enable_gost}
Documentation: ${enable_documentation}
])
diff --git a/ecc-curve.h b/ecc-curve.h
index 8f050404..27330846 100644
--- a/ecc-curve.h
+++ b/ecc-curve.h
@@ -43,8 +43,10 @@ extern "C" {
/* The contents of this struct is internal. */
struct ecc_curve;
+#if WITH_GOST
const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_gost_gc256b(void);
const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_gost_gc512a(void);
+#endif
const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_secp_192r1(void);
const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_secp_224r1(void);
const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_secp_256r1(void);
diff --git a/ecc-hash.c b/ecc-hash.c
index 07877110..0d8fc737 100644
--- a/ecc-hash.c
+++ b/ecc-hash.c
@@ -63,6 +63,7 @@ ecc_hash (const struct ecc_modulo *m,
mpn_rshift (hp, hp, m->size + 1, 8*length - m->bit_size);
}
+#if WITH_GOST
void
gost_hash (const struct ecc_modulo *m,
mp_limb_t *hp,
@@ -73,3 +74,4 @@ gost_hash (const struct ecc_modulo *m,
mpn_set_base256_le (hp, m->size + 1, digest, length);
}
+#endif
diff --git a/ecc-internal.h b/ecc-internal.h
index 9e24e0ce..7d86a7e4 100644
--- a/ecc-internal.h
+++ b/ecc-internal.h
@@ -53,7 +53,9 @@
#define ecc_mod _nettle_ecc_mod
#define ecc_mod_inv _nettle_ecc_mod_inv
#define ecc_hash _nettle_ecc_hash
+#if WITH_GOST
#define gost_hash _nettle_gost_hash
+#endif
#define ecc_a_to_j _nettle_ecc_a_to_j
#define ecc_j_to_a _nettle_ecc_j_to_a
#define ecc_eh_to_a _nettle_ecc_eh_to_a
@@ -92,9 +94,11 @@ extern const struct ecc_curve _nettle_secp_521r1;
extern const struct ecc_curve _nettle_curve25519;
extern const struct ecc_curve _nettle_curve448;
+#if WITH_GOST
/* GOST curves, visible with underscore prefix for now */
extern const struct ecc_curve _nettle_gost_gc256b;
extern const struct ecc_curve _nettle_gost_gc512a;
+#endif
#define ECC_MAX_SIZE ((521 + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS)
@@ -266,10 +270,12 @@ ecc_hash (const struct ecc_modulo *m,
mp_limb_t *hp,
size_t length, const uint8_t *digest);
+#if WITH_GOST
void
gost_hash (const struct ecc_modulo *m,
mp_limb_t *hp,
size_t length, const uint8_t *digest);
+#endif
/* Converts a point P in affine coordinates into a point R in jacobian
coordinates. */
@@ -439,7 +445,9 @@ curve448_eh_to_x (mp_limb_t *xp, const mp_limb_t *p,
#endif
#define ECC_MUL_M_ITCH(size) (11*(size))
#define ECC_ECDSA_SIGN_ITCH(size) (12*(size))
+#if WITH_GOST
#define ECC_GOSTDSA_SIGN_ITCH(size) (12*(size))
+#endif
#define ECC_MOD_RANDOM_ITCH(size) (size)
#define ECC_HASH_ITCH(size) (1+(size))
diff --git a/eccdata.c b/eccdata.c
index 1b4cb0b5..544486fd 100644
--- a/eccdata.c
+++ b/eccdata.c
@@ -35,6 +35,10 @@
/* Development of Nettle's ECC support was funded by the .SE Internet Fund. */
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -674,6 +678,8 @@ ecc_curve_init (struct ecc_curve *ecc, const char *curve)
"47d0e827cb1595e1470eb88580d5716c"
"4cf22832ea2f0ff0df38ab61ca32112f");
}
+
+#if WITH_GOST
else if (!strcmp (curve, "gost_gc256b"))
{
ecc_curve_init_str (ecc, ECC_TYPE_WEIERSTRASS,
@@ -744,6 +750,8 @@ ecc_curve_init (struct ecc_curve *ecc, const char *curve)
"3bee95e29eecc5d5ad2beba941abcbf9f1cad478df0fecf614f63aeebef77850da7efdb93de8f3df80bc25eac09239c14175f5c29704ce9a3e383f1b3ec0e929");
}
+#endif
+
else if (!strcmp (curve, "curve448"))
{
/* curve448, y^2 = x^3 + 156326 x^2 + x (mod p), with p = 2^{448} - 2^{224} - 1.
@@ -842,7 +850,7 @@ ecc_curve_clear (struct ecc_curve *ecc)
ecc_clear (&ecc->g);
if (ecc->table)
{
- size_t i;
+ mp_size_t i;
for (i = 0; i < ecc->table_size; i++)
ecc_clear (&ecc->table[i]);
free (ecc->table);
diff --git a/examples/ecc-benchmark.c b/examples/ecc-benchmark.c
index a529cf16..951fe7f8 100644
--- a/examples/ecc-benchmark.c
+++ b/examples/ecc-benchmark.c
@@ -314,8 +314,10 @@ const struct ecc_curve * const curves[] = {
&_nettle_secp_384r1,
&_nettle_curve448,
&_nettle_secp_521r1,
+#if WITH_GOST
&_nettle_gost_gc256b,
&_nettle_gost_gc512a,
+#endif
};
#define numberof(x) (sizeof (x) / sizeof ((x)[0]))
diff --git a/examples/hogweed-benchmark.c b/examples/hogweed-benchmark.c
index 3d008021..a6443fd1 100644
--- a/examples/hogweed-benchmark.c
+++ b/examples/hogweed-benchmark.c
@@ -48,7 +48,9 @@
#include "dsa.h"
#include "rsa.h"
#include "eddsa.h"
+#if WITH_GOST
#include "gostdsa.h"
+#endif
#include "curve25519.h"
#include "curve448.h"
@@ -592,6 +594,7 @@ bench_eddsa_clear (void *p)
free (p);
}
+#if WITH_GOST
static void *
bench_gostdsa_init (unsigned size)
{
@@ -692,6 +695,7 @@ bench_gostdsa_clear (void *p)
free (ctx);
}
+#endif
#if WITH_OPENSSL
struct openssl_rsa_ctx
@@ -940,8 +944,10 @@ struct alg alg_list[] = {
{ "eddsa", 448, bench_eddsa_init, bench_eddsa_sign, bench_eddsa_verify, bench_eddsa_clear },
{ "curve", 255, bench_curve_init, bench_curve_mul_g, bench_curve_mul, bench_curve_clear},
{ "curve", 448, bench_curve_init, bench_curve_mul_g, bench_curve_mul, bench_curve_clear },
+#if WITH_GOST
{ "gostdsa", 256, bench_gostdsa_init, bench_gostdsa_sign, bench_gostdsa_verify, bench_gostdsa_clear },
{ "gostdsa", 512, bench_gostdsa_init, bench_gostdsa_sign, bench_gostdsa_verify, bench_gostdsa_clear },
+#endif
};
#define numberof(x) (sizeof (x) / sizeof ((x)[0]))
diff --git a/examples/nettle-benchmark.c b/examples/nettle-benchmark.c
index 5d0e649e..0d22e040 100644
--- a/examples/nettle-benchmark.c
+++ b/examples/nettle-benchmark.c
@@ -896,6 +896,12 @@ bench_sha3_permute(void)
# define OPENSSL(x)
#endif
+#if WITH_GOST
+# define GOST(x) x,
+#else
+# define GOST(x)
+#endif
+
int
main(int argc, char **argv)
{
@@ -917,8 +923,8 @@ main(int argc, char **argv)
&nettle_sha512_224, &nettle_sha512_256,
&nettle_sha3_224, &nettle_sha3_256,
&nettle_sha3_384, &nettle_sha3_512,
- &nettle_ripemd160, &nettle_gosthash94,
- &nettle_gosthash94cp,
+ &nettle_ripemd160, GOST(&nettle_gosthash94)
+ GOST(&nettle_gosthash94cp)
NULL
};
diff --git a/hmac.h b/hmac.h
index d9ee3400..c1ad1975 100644
--- a/hmac.h
+++ b/hmac.h
@@ -36,7 +36,9 @@
#include "nettle-meta.h"
+#if WITH_GOST
#include "gosthash94.h"
+#endif
#include "md5.h"
#include "ripemd160.h"
#include "sha1.h"
@@ -69,12 +71,14 @@ extern "C" {
#define hmac_sha512_set_key nettle_hmac_sha512_set_key
#define hmac_sha512_update nettle_hmac_sha512_update
#define hmac_sha512_digest nettle_hmac_sha512_digest
+#if WITH_GOST
#define hmac_gosthash94_set_key nettle_hmac_gosthash94_set_key
#define hmac_gosthash94_update nettle_hmac_gosthash94_update
#define hmac_gosthash94_digest nettle_hmac_gosthash94_digest
#define hmac_gosthash94cp_set_key nettle_hmac_gosthash94cp_set_key
#define hmac_gosthash94cp_update nettle_hmac_gosthash94cp_update
#define hmac_gosthash94cp_digest nettle_hmac_gosthash94cp_digest
+#endif
void
hmac_set_key(void *outer, void *inner, void *state,
@@ -210,6 +214,7 @@ void
hmac_sha384_digest(struct hmac_sha512_ctx *ctx,
size_t length, uint8_t *digest);
+#if WITH_GOST
/* hmac-gosthash94 */
struct hmac_gosthash94_ctx HMAC_CTX(struct gosthash94_ctx);
@@ -238,6 +243,7 @@ hmac_gosthash94cp_update(struct hmac_gosthash94cp_ctx *ctx,
void
hmac_gosthash94cp_digest(struct hmac_gosthash94cp_ctx *ctx,
size_t length, uint8_t *digest);
+#endif
#ifdef __cplusplus
diff --git a/mini-gmp.c b/mini-gmp.c
index d4d257c4..a865d0ce 100644
--- a/mini-gmp.c
+++ b/mini-gmp.c
@@ -270,7 +270,7 @@ gmp_default_alloc (size_t size)
}
static void *
-gmp_default_realloc (void *old, size_t old_size, size_t new_size)
+gmp_default_realloc (void *old, size_t old_size UNUSED, size_t new_size)
{
void * p;
@@ -283,7 +283,7 @@ gmp_default_realloc (void *old, size_t old_size, size_t new_size)
}
static void
-gmp_default_free (void *p, size_t size)
+gmp_default_free (void *p, size_t size UNUSED)
{
free (p);
}
diff --git a/nettle-meta-hashes.c b/nettle-meta-hashes.c
index 27b576cd..ba2a4f66 100644
--- a/nettle-meta-hashes.c
+++ b/nettle-meta-hashes.c
@@ -38,8 +38,10 @@
#include "nettle-meta.h"
const struct nettle_hash * const _nettle_hashes[] = {
+#if WITH_GOST
&nettle_gosthash94,
&nettle_gosthash94cp,
+#endif
&nettle_md2,
&nettle_md4,
&nettle_md5,
diff --git a/nettle-meta.h b/nettle-meta.h
index 5d86615f..d3a49105 100644
--- a/nettle-meta.h
+++ b/nettle-meta.h
@@ -129,8 +129,10 @@ nettle_lookup_hash (const char *name);
extern const struct nettle_hash nettle_md2;
extern const struct nettle_hash nettle_md4;
extern const struct nettle_hash nettle_md5;
+#if WITH_GOST
extern const struct nettle_hash nettle_gosthash94;
extern const struct nettle_hash nettle_gosthash94cp;
+#endif
extern const struct nettle_hash nettle_ripemd160;
extern const struct nettle_hash nettle_sha1;
extern const struct nettle_hash nettle_sha224;
diff --git a/pbkdf2.h b/pbkdf2.h
index a36dfdba..65525132 100644
--- a/pbkdf2.h
+++ b/pbkdf2.h
@@ -45,7 +45,9 @@ extern "C"
#define pbkdf2 nettle_pbkdf2
#define pbkdf2_hmac_sha1 nettle_pbkdf2_hmac_sha1
#define pbkdf2_hmac_sha256 nettle_pbkdf2_hmac_sha256
+#if WITH_GOST
#define pbkdf2_hmac_gosthash94cp nettle_pbkdf2_hmac_gosthash94cp
+#endif
void
pbkdf2 (void *mac_ctx,
@@ -79,11 +81,13 @@ pbkdf2_hmac_sha256 (size_t key_length, const uint8_t *key,
size_t salt_length, const uint8_t *salt,
size_t length, uint8_t *dst);
+#if WITH_GOST
void
pbkdf2_hmac_gosthash94cp (size_t key_length, const uint8_t *key,
unsigned iterations,
size_t salt_length, const uint8_t *salt,
size_t length, uint8_t *dst);
+#endif
#ifdef __cplusplus
}
diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in
index 813467a5..7791fe69 100644
--- a/testsuite/Makefile.in
+++ b/testsuite/Makefile.in
@@ -10,6 +10,8 @@ include ../config.make
PRE_CPPFLAGS = -I.. -I$(top_srcdir)
PRE_LDFLAGS = -L..
+GOST_TS_NETTLE_SOURCES = @IF_GOST@ gosthash94-test.c
+
TS_NETTLE_SOURCES = aes-test.c arcfour-test.c arctwo-test.c \
blowfish-test.c cast128-test.c \
base16-test.c base64-test.c \
@@ -17,7 +19,7 @@ TS_NETTLE_SOURCES = aes-test.c arcfour-test.c arctwo-test.c \
cnd-memcpy-test.c \
des-test.c des3-test.c \
md2-test.c md4-test.c md5-test.c md5-compat-test.c \
- memeql-test.c memxor-test.c gosthash94-test.c \
+ memeql-test.c memxor-test.c \
ripemd160-test.c hkdf-test.c \
salsa20-test.c \
sha1-test.c sha224-test.c sha256-test.c \
@@ -33,7 +35,12 @@ TS_NETTLE_SOURCES = aes-test.c arcfour-test.c arctwo-test.c \
hmac-test.c umac-test.c \
meta-hash-test.c meta-cipher-test.c\
meta-aead-test.c meta-armor-test.c meta-mac-test.c \
- buffer-test.c yarrow-test.c xts-test.c pbkdf2-test.c
+ buffer-test.c yarrow-test.c xts-test.c pbkdf2-test.c \
+ $(GOST_TS_NETTLE_SOURCES)
+
+GOST_TS_HOGWEED_SOURCES = @IF_GOST@ \
+ gostdsa-sign-test.c gostdsa-verify-test.c \
+ gostdsa-keygen-test.c
TS_HOGWEED_SOURCES = sexp-test.c sexp-format-test.c \
rsa2sexp-test.c sexp2rsa-test.c \
@@ -54,8 +61,7 @@ TS_HOGWEED_SOURCES = sexp-test.c sexp-format-test.c \
ecdsa-keygen-test.c ecdh-test.c \
eddsa-compress-test.c eddsa-sign-test.c \
eddsa-verify-test.c ed25519-test.c ed448-test.c \
- gostdsa-sign-test.c gostdsa-verify-test.c \
- gostdsa-keygen-test.c
+ $(GOST_TS_HOGWEED_SOURCES)
TS_SOURCES = $(TS_NETTLE_SOURCES) $(TS_HOGWEED_SOURCES)
CXX_SOURCES = cxx-test.cxx
diff --git a/testsuite/hmac-test.c b/testsuite/hmac-test.c
index de1b6bfe..a0130747 100644
--- a/testsuite/hmac-test.c
+++ b/testsuite/hmac-test.c
@@ -853,6 +853,7 @@ test_main(void)
/* Test case AUTH512-3 from same document seems broken. */
+#if WITH_GOST
HMAC_TEST(gosthash94,
SHEX("000102030405060708090a0b0c0d0e0f"
"101112131415161718191a1b1c1d1e1f"),
@@ -866,4 +867,5 @@ test_main(void)
SHEX("0126bdb87800af214341456563780100"),
SHEX("bad70b61c41095bc47e1141cfaed4272"
"6a5ceebd62ce75dbbb9ad76cda9f72f7"));
+#endif
}
diff --git a/testsuite/meta-hash-test.c b/testsuite/meta-hash-test.c
index 7d863a7c..ec4035a1 100644
--- a/testsuite/meta-hash-test.c
+++ b/testsuite/meta-hash-test.c
@@ -5,8 +5,10 @@
#include "sha3.h"
const char* hashes[] = {
+#if WITH_GOST
"gosthash94",
"gosthash94cp",
+#endif
"md2",
"md4",
"md5",
diff --git a/testsuite/pbkdf2-test.c b/testsuite/pbkdf2-test.c
index e64a20d0..a17ae187 100644
--- a/testsuite/pbkdf2-test.c
+++ b/testsuite/pbkdf2-test.c
@@ -28,7 +28,9 @@ test_main (void)
struct hmac_sha1_ctx sha1ctx;
struct hmac_sha256_ctx sha256ctx;
struct hmac_sha512_ctx sha512ctx;
+#if WITH_GOST
struct hmac_gosthash94cp_ctx gosthash94cpctx;
+#endif
/* Test vectors for PBKDF2 from RFC 6070. */
@@ -111,6 +113,7 @@ test_main (void)
PBKDF2_HMAC_TEST(pbkdf2_hmac_sha256, LDATA("passwd"), 1, LDATA("salt"),
SHEX("55ac046e56e3089fec1691c22544b605"));
+#if WITH_GOST
/* From TC26 document, MR 26.2.001-2012 */
hmac_gosthash94cp_set_key (&gosthash94cpctx, LDATA("password"));
@@ -134,4 +137,5 @@ test_main (void)
PBKDF2_HMAC_TEST (pbkdf2_hmac_gosthash94cp, LDATA("password"), 1, LDATA("salt"),
SHEX("7314e7c04fb2e662c543674253f68bd0b73445d07f241bed872882da21662d58"));
+#endif
}
diff --git a/testsuite/testutils.c b/testsuite/testutils.c
index 187da0ef..37cd6039 100644
--- a/testsuite/testutils.c
+++ b/testsuite/testutils.c
@@ -1676,8 +1676,10 @@ const struct ecc_curve * const ecc_curves[] = {
&_nettle_secp_521r1,
&_nettle_curve25519,
&_nettle_curve448,
+#if WITH_GOST
&_nettle_gost_gc256b,
&_nettle_gost_gc512a,
+#endif
NULL
};
_______________________________________________
nettle-bugs mailing list
[email protected]
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs