?revision_form?Rev ?revision_input??revision_submit??revision_endform?
Rev 33 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
Author: Magnus Holmgren <holmgren@debian.org>
Description: Adapt to Nettle 2.0
--- a/src/crypto.c
+++ b/src/crypto.c
@@ -71,7 +71,7 @@ do_crypt_arcfour(struct crypto_instance
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_instanc
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_instanc
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
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 *
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 *
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_instanc
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_instanc
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_instanc
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_instanc
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_instan
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_instan
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_instanc
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_instanc
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);
}
--- a/src/lsh-make-seed.c
+++ b/src/lsh-make-seed.c
@@ -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)
{
--- a/src/unix_random.c
+++ b/src/unix_random.c
@@ -81,6 +81,7 @@ write_seed_file(struct yarrow256_ctx *ct
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 *ct
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 *sel
{
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);
}
}
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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.
--- a/src/spki/testsuite/Makefile.am
+++ b/src/spki/testsuite/Makefile.am
@@ -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
--- a/src/spki/tools/Makefile.am
+++ b/src/spki/tools/Makefile.am
@@ -6,7 +6,7 @@ noinst_PROGRAMS = spki-check-signature s
# 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
--- a/src/testsuite/Makefile.am
+++ b/src/testsuite/Makefile.am
@@ -34,7 +34,7 @@ noinst_PROGRAMS = $(TS_PROGS)
# 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)
include .dist_rapid7