Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Blame | Last modification | View Log | RSS feed

#! /bin/sh /usr/share/dpatch/dpatch-run
## nettle_2.0.dpatch by Magnus Holmgren <holmgren@debian.org>
##
## DP: Adapt to Nettle 2.0

@DPATCH@
diff -ur lsh-2.0.4/src/crypto.c /var/cache/users/magnus/svn-buildpackage/lsh-utils/lsh-utils-2.0.4-dfsg/src/crypto.c
--- lsh-2.0.4/src/crypto.c      2005-11-26 18:13:55.000000000 +0100
+++ lsh-utils-2.0.4-dfsg/src/crypto.c   2009-08-04 23:57:22.000000000 +0200
@@ -71,7 +71,7 @@
   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 @@
 
   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 @@
 
   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 @@
 
   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 @@
 
   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 @@
 
   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 @@
 
   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 @@
 
   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 @@
 
   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 @@
 
   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 @@
 
   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 @@
 
   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 @@
 
   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 @@
 
   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);
 }
 
diff -ur lsh-2.0.4/src/lsh-make-seed.c /var/cache/users/magnus/svn-buildpackage/lsh-utils/lsh-utils-2.0.4-dfsg/src/lsh-make-seed.c
--- lsh-2.0.4/src/lsh-make-seed.c       2006-01-23 18:51:06.000000000 +0100
+++ lsh-utils-2.0.4-dfsg/src/lsh-make-seed.c    2009-08-05 00:24:58.000000000 +0200
@@ -1219,6 +1219,7 @@
 
   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 @@
        }
     }
   
-  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)
     {
diff -ur lsh-2.0.4/src/unix_random.c /var/cache/users/magnus/svn-buildpackage/lsh-utils/lsh-utils-2.0.4-dfsg/src/unix_random.c
--- lsh-2.0.4/src/unix_random.c 2006-01-23 18:47:10.000000000 +0100
+++ lsh-utils-2.0.4-dfsg/src/unix_random.c      2009-08-05 00:28:31.000000000 +0200
@@ -81,6 +81,7 @@
               int fd)
 {
   const struct exception *e;
+  uint8_t seed[YARROW256_SEED_FILE_SIZE];
   
   if (lseek(fd, 0, SEEK_SET) < 0)
     {
@@ -88,7 +89,8 @@
       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 +183,19 @@
     {
       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);
     }
 }