Commit 0a44f433 authored by Niels Möller's avatar Niels Möller

* testsuite/Makefile.in (TS_NETTLE_SOURCES): Moved

knuth-lfib-test.c, cbc-test.c, ctr-test.c, hmac-test.c here, from
TS_HOGWEED_SOURCES.
(TS_HOGWEED_SOURCES): Added random-prime-test.c.

* testsuite/random-prime-test.c: New test case.

Rev: nettle/testsuite/.test-rules.make:1.6
Rev: nettle/testsuite/Makefile.in:1.8
Rev: nettle/testsuite/random-prime-test.c:1.1
parent c944a4e3
......@@ -61,6 +61,18 @@ serpent-test$(EXEEXT): serpent-test.$(OBJEXT)
twofish-test$(EXEEXT): twofish-test.$(OBJEXT)
$(LINK) twofish-test.$(OBJEXT) $(TEST_OBJS) -o twofish-test$(EXEEXT)
knuth-lfib-test$(EXEEXT): knuth-lfib-test.$(OBJEXT)
$(LINK) knuth-lfib-test.$(OBJEXT) $(TEST_OBJS) -o knuth-lfib-test$(EXEEXT)
cbc-test$(EXEEXT): cbc-test.$(OBJEXT)
$(LINK) cbc-test.$(OBJEXT) $(TEST_OBJS) -o cbc-test$(EXEEXT)
ctr-test$(EXEEXT): ctr-test.$(OBJEXT)
$(LINK) ctr-test.$(OBJEXT) $(TEST_OBJS) -o ctr-test$(EXEEXT)
hmac-test$(EXEEXT): hmac-test.$(OBJEXT)
$(LINK) hmac-test.$(OBJEXT) $(TEST_OBJS) -o hmac-test$(EXEEXT)
buffer-test$(EXEEXT): buffer-test.$(OBJEXT)
$(LINK) buffer-test.$(OBJEXT) $(TEST_OBJS) -o buffer-test$(EXEEXT)
......@@ -79,21 +91,12 @@ rsa2sexp-test$(EXEEXT): rsa2sexp-test.$(OBJEXT)
sexp2rsa-test$(EXEEXT): sexp2rsa-test.$(OBJEXT)
$(LINK) sexp2rsa-test.$(OBJEXT) $(TEST_OBJS) -o sexp2rsa-test$(EXEEXT)
knuth-lfib-test$(EXEEXT): knuth-lfib-test.$(OBJEXT)
$(LINK) knuth-lfib-test.$(OBJEXT) $(TEST_OBJS) -o knuth-lfib-test$(EXEEXT)
cbc-test$(EXEEXT): cbc-test.$(OBJEXT)
$(LINK) cbc-test.$(OBJEXT) $(TEST_OBJS) -o cbc-test$(EXEEXT)
ctr-test$(EXEEXT): ctr-test.$(OBJEXT)
$(LINK) ctr-test.$(OBJEXT) $(TEST_OBJS) -o ctr-test$(EXEEXT)
hmac-test$(EXEEXT): hmac-test.$(OBJEXT)
$(LINK) hmac-test.$(OBJEXT) $(TEST_OBJS) -o hmac-test$(EXEEXT)
bignum-test$(EXEEXT): bignum-test.$(OBJEXT)
$(LINK) bignum-test.$(OBJEXT) $(TEST_OBJS) -o bignum-test$(EXEEXT)
random-prime-test$(EXEEXT): random-prime-test.$(OBJEXT)
$(LINK) random-prime-test.$(OBJEXT) $(TEST_OBJS) -o random-prime-test$(EXEEXT)
pkcs1-test$(EXEEXT): pkcs1-test.$(OBJEXT)
$(LINK) pkcs1-test.$(OBJEXT) $(TEST_OBJS) -o pkcs1-test$(EXEEXT)
......
......@@ -18,12 +18,13 @@ TS_NETTLE_SOURCES = aes-test.c arcfour-test.c arctwo-test.c \
sha1-test.c sha224-test.c sha256-test.c \
sha384-test.c sha512-test.c \
serpent-test.c twofish-test.c \
knuth-lfib-test.c \
cbc-test.c ctr-test.c hmac-test.c \
buffer-test.c yarrow-test.c
TS_HOGWEED_SOURCES = sexp-test.c sexp-format-test.c \
rsa2sexp-test.c sexp2rsa-test.c \
knuth-lfib-test.c \
cbc-test.c ctr-test.c hmac-test.c bignum-test.c \
bignum-test.c random-prime-test.c \
pkcs1-test.c \
rsa-test.c rsa-encrypt-test.c rsa-keygen-test.c \
dsa-test.c dsa-keygen-test.c
......
#include "testutils.h"
#include "knuth-lfib.h"
int
test_main(void)
{
struct knuth_lfib_ctx lfib;
mpz_t p;
unsigned bits;
knuth_lfib_init(&lfib, 17);
mpz_init(p);
for (bits = 6; bits < 1000; bits = bits + 1 + bits/20)
{
if (verbose)
fprintf(stderr, "bits = %d\n", bits);
nettle_random_prime(p, bits,
&lfib, (nettle_random_func *) knuth_lfib_random );
ASSERT (mpz_probab_prime_p(p, 25));
}
SUCCESS();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment