Commit 6a3c5a6a authored by Magnus Holmgren's avatar Magnus Holmgren Committed by Niels Möller

Adapt to nettle-2.0.

parent ee6f02ce
2013-03-30 Niels Mller <nisse@lysator.liu.se>
From Magnus Holmgren's debian patches. Adapt to nettle-2.0.
* src/lsh-make-seed.c (main): Updated to new yarrow interface,
sith no seed_file data inside the context.
* src/unix_random.c (write_seed_file): Likewise.
(update_seed_file): Update yarrow state before writing the new
seed file.
* src/crypto.c: Updated casts for new nettle_crypt_func no longer
being a pointer.
* src/Makefile.am (LDADD): Added -lhogweed.
* src/testsuite/Makefile.am (LDADD): Likewise.
* src/nettle: Deleted subdirectory.
From Magnus Holmgren's debian patches.
......
......@@ -113,7 +113,7 @@ lsh_krb_checkpw_LDADD=@KRB_LIBS@
lsh_execuv_LDADD=
LDADD = liblsh.a spki/libspki.a -lnettle @LIBARGP@
LDADD = liblsh.a spki/libspki.a -lnettle -lhogweed @LIBARGP@
# To avoid having to link lshg with nettle, link with dummy.o.
......
......@@ -71,7 +71,7 @@ do_crypt_arcfour(struct crypto_instance *s,
assert(!(length % 8));
lsh_string_crypt(dst, di, src, si, length,
(nettle_crypt_func) arcfour_crypt, &self->ctx);
(nettle_crypt_func*) arcfour_crypt, &self->ctx);
}
static struct crypto_instance *
......@@ -114,7 +114,7 @@ do_aes_cbc_encrypt(struct crypto_instance *s,
lsh_string_cbc_encrypt(dst, di, src, si, length,
AES_BLOCK_SIZE, self->ctx.iv,
(nettle_crypt_func) aes_encrypt,
(nettle_crypt_func*) aes_encrypt,
&self->ctx.ctx);
}
......@@ -128,7 +128,7 @@ do_aes_cbc_decrypt(struct crypto_instance *s,
lsh_string_cbc_decrypt(dst, di, src, si, length,
AES_BLOCK_SIZE, self->ctx.iv,
(nettle_crypt_func) aes_decrypt,
(nettle_crypt_func*) aes_decrypt,
&self->ctx.ctx);
}
......@@ -185,7 +185,7 @@ do_aes_ctr_crypt(struct crypto_instance *s,
lsh_string_ctr_crypt(dst, di, src, si, length,
AES_BLOCK_SIZE, self->ctx.ctr,
(nettle_crypt_func) aes_encrypt,
(nettle_crypt_func*) aes_encrypt,
&self->ctx.ctx);
}
......@@ -227,7 +227,7 @@ do_des3_encrypt(struct crypto_instance *s,
lsh_string_cbc_encrypt(dst, di, src, si, length,
DES3_BLOCK_SIZE, self->ctx.iv,
(nettle_crypt_func) des3_encrypt,
(nettle_crypt_func*) des3_encrypt,
&self->ctx.ctx);
}
......@@ -241,7 +241,7 @@ do_des3_decrypt(struct crypto_instance *s,
lsh_string_cbc_decrypt(dst, di, src, si, length,
DES3_BLOCK_SIZE, self->ctx.iv,
(nettle_crypt_func) des3_decrypt,
(nettle_crypt_func*) des3_decrypt,
&self->ctx.ctx);
}
......@@ -303,7 +303,7 @@ do_cast128_encrypt(struct crypto_instance *s,
lsh_string_cbc_encrypt(dst, di, src, si, length,
CAST128_BLOCK_SIZE, self->ctx.iv,
(nettle_crypt_func) cast128_encrypt,
(nettle_crypt_func*) cast128_encrypt,
&self->ctx.ctx);
}
......@@ -317,7 +317,7 @@ do_cast128_decrypt(struct crypto_instance *s,
lsh_string_cbc_decrypt(dst, di, src, si, length,
CAST128_BLOCK_SIZE, self->ctx.iv,
(nettle_crypt_func) cast128_decrypt,
(nettle_crypt_func*) cast128_decrypt,
&self->ctx.ctx);
}
......@@ -363,7 +363,7 @@ do_twofish_encrypt(struct crypto_instance *s,
lsh_string_cbc_encrypt(dst, di, src, si, length,
TWOFISH_BLOCK_SIZE, self->ctx.iv,
(nettle_crypt_func) twofish_encrypt,
(nettle_crypt_func*) twofish_encrypt,
&self->ctx.ctx);
}
......@@ -377,7 +377,7 @@ do_twofish_decrypt(struct crypto_instance *s,
lsh_string_cbc_decrypt(dst, di, src, si, length,
TWOFISH_BLOCK_SIZE, self->ctx.iv,
(nettle_crypt_func) twofish_decrypt,
(nettle_crypt_func*) twofish_decrypt,
&self->ctx.ctx);
}
......@@ -422,7 +422,7 @@ do_blowfish_encrypt(struct crypto_instance *s,
lsh_string_cbc_encrypt(dst, di, src, si, length,
BLOWFISH_BLOCK_SIZE, self->ctx.iv,
(nettle_crypt_func) blowfish_encrypt,
(nettle_crypt_func*) blowfish_encrypt,
&self->ctx.ctx);
}
......@@ -436,7 +436,7 @@ do_blowfish_decrypt(struct crypto_instance *s,
lsh_string_cbc_decrypt(dst, di, src, si, length,
BLOWFISH_BLOCK_SIZE, self->ctx.iv,
(nettle_crypt_func) blowfish_decrypt,
(nettle_crypt_func*) blowfish_decrypt,
&self->ctx.ctx);
}
......@@ -488,7 +488,7 @@ do_serpent_encrypt(struct crypto_instance *s,
lsh_string_cbc_encrypt(dst, di, src, si, length,
SERPENT_BLOCK_SIZE, self->ctx.iv,
(nettle_crypt_func) serpent_encrypt,
(nettle_crypt_func*) serpent_encrypt,
&self->ctx.ctx);
}
......@@ -502,7 +502,7 @@ do_serpent_decrypt(struct crypto_instance *s,
lsh_string_cbc_decrypt(dst, di, src, si, length,
SERPENT_BLOCK_SIZE, self->ctx.iv,
(nettle_crypt_func) serpent_decrypt,
(nettle_crypt_func*) serpent_decrypt,
&self->ctx.ctx);
}
......
......@@ -1219,6 +1219,7 @@ main(int argc, char **argv)
struct yarrow256_ctx yarrow;
struct yarrow_source sources[NSOURCES];
uint8_t seed[YARROW256_SEED_FILE_SIZE];
argp_parse(&main_argp, argc, argv, 0, NULL, options);
......@@ -1371,7 +1372,8 @@ main(int argc, char **argv)
}
}
e = write_raw(fd, sizeof(yarrow.seed_file), yarrow.seed_file);
yarrow256_random(&yarrow, sizeof(seed), seed);
e = write_raw(fd, sizeof(seed), seed);
if (e)
{
......
2013-03-30 Niels Mller <nisse@lysator.liu.se>
* testsuite/Makefile.am (LDADD): Added -lhogweed.
* tools/Makefile.am (LDADD): Likewise.
2005-11-25 Niels Mller <nisse@lysator.liu.se>
* configure.ac: Use -Wno-pointer-sign when compiling with gcc-4.x.
......@@ -7,7 +12,7 @@
* testsuite/Makefile.am (CLEANFILES): Delete test.canonical.
* testsuite/delegate-test: Don't use cmp -, use a temporary file
instead.
instead.
* testsuite/reduce-test: Likewise.
2004-11-16 Niels Mller <nisse@lysator.liu.se>
......
......@@ -9,7 +9,7 @@ TS_ALL = $(TS_PROGS) $(TS_SH)
noinst_PROGRAMS = $(TS_PROGS)
LDADD = testutils.o ../libspki.a -lnettle
LDADD = testutils.o ../libspki.a -lnettle -lhogweed
include .dist_cdsa
......
......@@ -6,7 +6,7 @@ noinst_PROGRAMS = spki-check-signature spki-make-signature \
# that affects all programs.
LDADD = misc.o getopt.o getopt1.o \
../libspki.a -lnettle
../libspki.a -lnettle -lhogweed
spki_make_signature_SOURCES = spki-make-signature.c sign.c
spki_delegate_SOURCES = spki-delegate.c sign.c
......
......@@ -34,7 +34,7 @@ noinst_PROGRAMS = $(TS_PROGS) mini-inetd tcpconnect
# Workaround to get automake to keep dependencies for testutils.o
EXTRA_PROGRAMS = testutils
LDADD = testutils.o ../liblsh.a ../spki/libspki.a -lnettle \
LDADD = testutils.o ../liblsh.a ../spki/libspki.a -lnettle -lhogweed \
$(DOTDOT_LIBARGP)
mini_inetd_LDADD =
tcpconnect_LDADD =
......
......@@ -81,6 +81,7 @@ write_seed_file(struct yarrow256_ctx *ctx,
int fd)
{
const struct exception *e;
uint8_t seed[YARROW256_SEED_FILE_SIZE];
if (lseek(fd, 0, SEEK_SET) < 0)
{
......@@ -88,7 +89,8 @@ write_seed_file(struct yarrow256_ctx *ctx,
return 0;
}
e = write_raw(fd, YARROW256_SEED_FILE_SIZE, ctx->seed_file);
yarrow256_random(ctx, sizeof(seed), seed);
e = write_raw(fd, sizeof(seed), seed);
if (e)
{
......@@ -183,17 +185,19 @@ update_seed_file(struct unix_random *self)
{
struct lsh_string *s = read_seed_file(self->seed_file_fd);
write_seed_file(&self->yarrow, self->seed_file_fd);
KILL_RESOURCE(lock);
/* Mix in the old seed file, it might have picked up
* some randomness. */
if (s)
{
self->yarrow.sources[RANDOM_SOURCE_NEW_SEED].next = YARROW_FAST;
yarrow256_update(&self->yarrow, RANDOM_SOURCE_NEW_SEED,
0, STRING_LD(s));
lsh_string_free(s);
yarrow256_fast_reseed(&self->yarrow);
}
write_seed_file(&self->yarrow, self->seed_file_fd);
KILL_RESOURCE(lock);
}
}
......
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