Hello community,

here is the log from the commit of package enchive for openSUSE:Factory checked 
in at 2019-12-05 17:34:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/enchive (Old)
 and      /work/SRC/openSUSE:Factory/.enchive.new.4691 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "enchive"

Thu Dec  5 17:34:58 2019 rev:2 rq:754063 version:3.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/enchive/enchive.changes  2019-12-04 
14:21:12.286479847 +0100
+++ /work/SRC/openSUSE:Factory/.enchive.new.4691/enchive.changes        
2019-12-05 17:37:23.493394828 +0100
@@ -1,0 +2,11 @@
+Mon Dec  2 19:51:44 UTC 2019 - Martin Hauke <[email protected]>
+
+- Update to version 3.5
+  * New keygen option: --repeats (-r), times to repeat passphrase
+    prompt
+  * More explicit passphrase prompts
+  * Improved portability
+  * Fix various issues with enchive-mode.el
+  * Minor documentation and bug fixes
+
+-------------------------------------------------------------------

Old:
----
  enchive-3.4.tar.gz

New:
----
  enchive-3.5.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ enchive.spec ++++++
--- /var/tmp/diff_new_pack.pTStWv/_old  2019-12-05 17:37:24.589394433 +0100
+++ /var/tmp/diff_new_pack.pTStWv/_new  2019-12-05 17:37:24.593394431 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           enchive
-Version:        3.4
+Version:        3.5
 Release:        0
 Summary:        Long-term archive encryption tool
 License:        Unlicense
@@ -38,6 +38,7 @@
 %setup -q
 %patch0 -p1
 
+
 %build
 export CFLAGS='%{optflags}'
 make %{?_smp_mflags}

++++++ enchive-3.4.tar.gz -> enchive-3.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/enchive-3.4/Makefile new/enchive-3.5/Makefile
--- old/enchive-3.4/Makefile    2018-01-23 20:43:27.000000000 +0100
+++ new/enchive-3.5/Makefile    2019-12-01 19:23:16.000000000 +0100
@@ -26,7 +26,7 @@
 install: enchive enchive.1
        mkdir -p $(DESTDIR)$(PREFIX)/bin
        mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1
-       cp -f enchive $(DESTDIR)$(PREFIX)/bin
+       install -m 755 enchive $(DESTDIR)$(PREFIX)/bin
        gzip < enchive.1 > $(DESTDIR)$(PREFIX)/share/man/man1/enchive.1.gz
 
 uninstall:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/enchive-3.4/NEWS.md new/enchive-3.5/NEWS.md
--- old/enchive-3.4/NEWS.md     2018-01-23 20:43:27.000000000 +0100
+++ new/enchive-3.5/NEWS.md     2019-12-01 19:23:16.000000000 +0100
@@ -1,5 +1,13 @@
 # Changes
 
+## 3.5
+
+* New keygen option: --repeats (-r), times to repeat passphrase prompt
+* More explicit passphrase prompts
+* Improved portability
+* Fix various issues with enchive-mode.el
+* Minor documentation and bug fixes
+
 ## 3.4
 
 * New `--pinentry` (`-e`) global option. This is an alternative way to
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/enchive-3.4/config.h new/enchive-3.5/config.h
--- old/enchive-3.4/config.h    2018-01-23 20:43:27.000000000 +0100
+++ new/enchive-3.5/config.h    2019-12-01 19:23:16.000000000 +0100
@@ -4,7 +4,7 @@
 /* Compile-time configuration */
 
 #ifndef ENCHIVE_VERSION
-#  define ENCHIVE_VERSION 3.4
+#  define ENCHIVE_VERSION 3.5
 #endif
 
 #ifndef ENCHIVE_FORMAT_VERSION
@@ -24,7 +24,7 @@
 #endif
 
 #ifndef ENCHIVE_OPTION_AGENT
-#  if defined(__unix__) || defined(__APPLE__)
+#  if defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
 #    define ENCHIVE_OPTION_AGENT 1
 #  else
 #    define ENCHIVE_OPTION_AGENT 0
@@ -65,17 +65,20 @@
 /* Integer definitions needed by crypto */
 
 #include <stdint.h>
-
-#define U8C(v)  (UINT8_C(v))
-#define U16C(v) (UINT16_C(v))
-#define U32C(v) (UINT32_C(v))
-
-typedef uint8_t u8;
-typedef uint16_t u16;
-typedef uint32_t u32;
-typedef uint64_t u64;
-
-typedef int32_t s32;
-typedef int64_t limb;
+/* If your compiler lacks a stdint.h, such as when compiling with a
+ * plain ANSI C compiler, you'll need to replace this include with the
+ * appropriate typedefs for the following types:
+ *
+ *   uint8_t
+ *   uint32_t
+ *   uint64_t
+ *   int32_t
+ *   int64_t
+ *
+ * You will also need to define these macros:
+ *
+ *   UINT8_C
+ *   UINT32_C
+ */
 
 #endif /* CONFIG_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/enchive-3.4/enchive-mode.el 
new/enchive-3.5/enchive-mode.el
--- old/enchive-3.4/enchive-mode.el     2018-01-23 20:43:27.000000000 +0100
+++ new/enchive-3.5/enchive-mode.el     2019-12-01 19:23:16.000000000 +0100
@@ -16,24 +16,32 @@
 (defcustom enchive-program-name "enchive"
   "Path to the locally installed enchive binary.")
 
-(defvar enchive-handler-entry (cons "\\.enchive$" #'enchive-file-handler)
+(defvar enchive-handler-entry (cons "\\.enchive\\'" #'enchive-file-handler)
   "Entry for `enchive-mode' in `file-name-handler-alist'.")
 
+(defvar enchive-auto-mode-entry (list "\\.enchive\\'" nil 'enchive)
+  "Entry for `enchive-mode' in `auto-mode-alist'.")
+
 (defun enchive-file-handler (operation &rest args)
   "Handler for `file-name-handler-alist' for automatic encrypt/decrypt."
-  (let ((file-name-handler-alist ()))
-    (cond ((eq operation 'insert-file-contents)
-           (let ((file (car args)))
-             (unless (= 0 (call-process "enchive" file '(t nil) nil
-                                        "--pinentry" "--agent" "extract"))
-               (error "Enchive subprocess failed"))
-             (setf buffer-file-name file)
-             (list file (buffer-size))))
-          ((eq operation 'write-region)
-           (call-process-region (nth 0 args) (nth 1 args)
-                                "enchive" nil nil nil
-                                "archive" "/dev/stdin" (nth 2 args)))
-          ((apply operation args)))))
+  (cond ((eq operation 'insert-file-contents)
+         (let ((file (car args)))
+           (unless (= 0 (call-process enchive-program-name file '(t nil) nil
+                                      "--pinentry" "--agent" "extract"))
+             (error "Enchive subprocess failed"))
+           (setf buffer-file-name file)
+           (list file (buffer-size))))
+        ((eq operation 'write-region)
+         (call-process-region (nth 0 args) (nth 1 args)
+                              enchive-program-name nil nil nil
+                              "archive" "/dev/stdin" (nth 2 args)))
+        ;; Handle any operation we don’t know about.
+        (t (let ((inhibit-file-name-handlers
+                  (cons 'enchive-file-handler
+                        (and (eq inhibit-file-name-operation operation)
+                             inhibit-file-name-handlers)))
+                 (inhibit-file-name-operation operation))
+             (apply operation args)))))
 
 ;;;###autoload
 (define-minor-mode enchive-mode
@@ -41,9 +49,13 @@
   :global t
   (setf file-name-handler-alist
         (delq enchive-handler-entry file-name-handler-alist))
-  (if enchive-mode
-      (setf file-name-handler-alist
-            (cons enchive-handler-entry file-name-handler-alist))))
+  (setf auto-mode-alist
+        (delq enchive-auto-mode-entry auto-mode-alist))
+  (when enchive-mode
+    (setf file-name-handler-alist
+          (cons enchive-handler-entry file-name-handler-alist))
+    (setf auto-mode-alist
+          (cons enchive-auto-mode-entry auto-mode-alist))))
 
 (provide 'enchive-mode)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/enchive-3.4/enchive.1 new/enchive-3.5/enchive.1
--- old/enchive-3.4/enchive.1   2018-01-23 20:43:27.000000000 +0100
+++ new/enchive-3.5/enchive.1   2019-12-01 19:23:16.000000000 +0100
@@ -90,6 +90,12 @@
 Sets the difficulty exponent for deriving the protection key from the 
protection key passphrase.
 Default is 25.
 .TP
+\fB\-r\fR \fIN\fR, \fB\-\-repeats\fR \fIN\fR
+Number of repeated passphrase prompts when deriving a secret key.
+It is convenient to set this to zero when relying primarily on fingerprint 
verification.
+Alternatively, additional repeat prompts may aid in memorization.
+Default is 1.
+.TP
 \fB\-u\fR, \fB\-\-plain\fR
 Do not use a protection key, and instead store the secret key unencrypted on 
the disk.
 Consider using the key agent instead of this option.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/enchive-3.4/src/chacha.c new/enchive-3.5/src/chacha.c
--- old/enchive-3.4/src/chacha.c        2018-01-23 20:43:27.000000000 +0100
+++ new/enchive-3.5/src/chacha.c        2019-12-01 19:23:16.000000000 +0100
@@ -6,15 +6,14 @@
 
 #include "chacha.h"
 
-#define U8V(v)  ((u8)(v)  & U8C(0xFF))
-#define U16V(v) ((u16)(v) & U16C(0xFFFF))
-#define U32V(v) ((u32)(v) & U32C(0xFFFFFFFF))
+#define U8V(v)  ((uint8_t)(v)  & UINT8_C(0xFF))
+#define U32V(v) ((uint32_t)(v) & UINT32_C(0xFFFFFFFF))
 
 #define U8TO32_LITTLE(p) \
-  (((u32)((p)[0])      ) | \
-   ((u32)((p)[1]) <<  8) | \
-   ((u32)((p)[2]) << 16) | \
-   ((u32)((p)[3]) << 24))
+  (((uint32_t)((p)[0])      ) | \
+   ((uint32_t)((p)[1]) <<  8) | \
+   ((uint32_t)((p)[2]) << 16) | \
+   ((uint32_t)((p)[3]) << 24))
 
 #define U32TO8_LITTLE(p, v) \
   do { \
@@ -35,9 +34,10 @@
   x[a] = PLUS(x[a],x[b]); x[d] = ROTATE(XOR(x[d],x[a]), 8); \
   x[c] = PLUS(x[c],x[d]); x[b] = ROTATE(XOR(x[b],x[c]), 7);
 
-static void salsa20_wordtobyte(u8 output[64],const u32 input[16])
+static void
+salsa20_wordtobyte(uint8_t output[64], const uint32_t input[16])
 {
-  u32 x[16];
+  uint32_t x[16];
   int i;
 
   for (i = 0;i < 16;++i) x[i] = input[i];
@@ -58,7 +58,8 @@
 static const char sigma[16] = "expand 32-byte k";
 static const char tau[16] = "expand 16-byte k";
 
-void chacha_keysetup(chacha_ctx *x,const u8 *k,u32 kbits)
+void
+chacha_keysetup(chacha_ctx *x, const uint8_t *k, uint32_t kbits)
 {
   const char *constants;
 
@@ -82,7 +83,8 @@
   x->input[3] = U8TO32_LITTLE(constants + 12);
 }
 
-void chacha_ivsetup(chacha_ctx *x,const u8 *iv)
+void
+chacha_ivsetup(chacha_ctx *x, const uint8_t *iv)
 {
   x->input[12] = 0;
   x->input[13] = 0;
@@ -90,10 +92,11 @@
   x->input[15] = U8TO32_LITTLE(iv + 4);
 }
 
-void chacha_encrypt_bytes(chacha_ctx *x,const u8 *m,u8 *c,u32 bytes)
+void
+chacha_encrypt(chacha_ctx *x, const uint8_t *m, uint8_t *c, uint32_t bytes)
 {
-  u8 output[64];
-  u32 i;
+  uint8_t output[64];
+  uint32_t i;
 
   if (!bytes) return;
   for (;;) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/enchive-3.4/src/chacha.h new/enchive-3.5/src/chacha.h
--- old/enchive-3.4/src/chacha.h        2018-01-23 20:43:27.000000000 +0100
+++ new/enchive-3.5/src/chacha.h        2019-12-01 19:23:16.000000000 +0100
@@ -6,11 +6,11 @@
 #define CHACHA_BLOCKLENGTH 64
 
 typedef struct {
-    u32 input[16];
+    uint32_t input[16];
 } chacha_ctx;
 
-void chacha_keysetup(chacha_ctx *x,const u8 *k,u32 kbits);
-void chacha_ivsetup(chacha_ctx *x,const u8 *iv);
-void chacha_encrypt_bytes(chacha_ctx *x,const u8 *m,u8 *c,u32 bytes);
+void chacha_keysetup(chacha_ctx *, const uint8_t *k, uint32_t kbits);
+void chacha_ivsetup(chacha_ctx *, const uint8_t *iv);
+void chacha_encrypt(chacha_ctx *, const uint8_t *m, uint8_t *c, uint32_t 
bytes);
 
 #endif /* CHACHA_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/enchive-3.4/src/curve25519-donna.c 
new/enchive-3.5/src/curve25519-donna.c
--- old/enchive-3.4/src/curve25519-donna.c      2018-01-23 20:43:27.000000000 
+0100
+++ new/enchive-3.5/src/curve25519-donna.c      2019-12-01 19:23:16.000000000 
+0100
@@ -57,7 +57,9 @@
  * i.e. the limbs are 26, 25, 26, 25, ... bits wide. */
 
 /* Sum two numbers: output += in */
-static void fsum(limb *output, const limb *in) {
+static void
+fsum(int64_t *output, const int64_t *in)
+{
   unsigned i;
   for (i = 0; i < 10; i += 2) {
     output[0+i] = output[0+i] + in[0+i];
@@ -67,7 +69,9 @@
 
 /* Find the difference of two numbers: output = in - output
  * (note the order of the arguments!). */
-static void fdifference(limb *output, const limb *in) {
+static void
+fdifference(int64_t *output, const int64_t *in)
+{
   unsigned i;
   for (i = 0; i < 10; ++i) {
     output[i] = in[i] - output[i];
@@ -75,7 +79,9 @@
 }
 
 /* Multiply a number by a scalar: output = in * scalar */
-static void fscalar_product(limb *output, const limb *in, const limb scalar) {
+static void
+fscalar_product(int64_t *output, const int64_t *in, const int64_t scalar)
+{
   unsigned i;
   for (i = 0; i < 10; ++i) {
     output[i] = in[i] * scalar;
@@ -88,114 +94,118 @@
  * form, the output is not.
  *
  * output[x] <= 14 * the largest product of the input limbs. */
-static void fproduct(limb *output, const limb *in2, const limb *in) {
-  output[0] =       ((limb) ((s32) in2[0])) * ((s32) in[0]);
-  output[1] =       ((limb) ((s32) in2[0])) * ((s32) in[1]) +
-                    ((limb) ((s32) in2[1])) * ((s32) in[0]);
-  output[2] =  2 *  ((limb) ((s32) in2[1])) * ((s32) in[1]) +
-                    ((limb) ((s32) in2[0])) * ((s32) in[2]) +
-                    ((limb) ((s32) in2[2])) * ((s32) in[0]);
-  output[3] =       ((limb) ((s32) in2[1])) * ((s32) in[2]) +
-                    ((limb) ((s32) in2[2])) * ((s32) in[1]) +
-                    ((limb) ((s32) in2[0])) * ((s32) in[3]) +
-                    ((limb) ((s32) in2[3])) * ((s32) in[0]);
-  output[4] =       ((limb) ((s32) in2[2])) * ((s32) in[2]) +
-               2 * (((limb) ((s32) in2[1])) * ((s32) in[3]) +
-                    ((limb) ((s32) in2[3])) * ((s32) in[1])) +
-                    ((limb) ((s32) in2[0])) * ((s32) in[4]) +
-                    ((limb) ((s32) in2[4])) * ((s32) in[0]);
-  output[5] =       ((limb) ((s32) in2[2])) * ((s32) in[3]) +
-                    ((limb) ((s32) in2[3])) * ((s32) in[2]) +
-                    ((limb) ((s32) in2[1])) * ((s32) in[4]) +
-                    ((limb) ((s32) in2[4])) * ((s32) in[1]) +
-                    ((limb) ((s32) in2[0])) * ((s32) in[5]) +
-                    ((limb) ((s32) in2[5])) * ((s32) in[0]);
-  output[6] =  2 * (((limb) ((s32) in2[3])) * ((s32) in[3]) +
-                    ((limb) ((s32) in2[1])) * ((s32) in[5]) +
-                    ((limb) ((s32) in2[5])) * ((s32) in[1])) +
-                    ((limb) ((s32) in2[2])) * ((s32) in[4]) +
-                    ((limb) ((s32) in2[4])) * ((s32) in[2]) +
-                    ((limb) ((s32) in2[0])) * ((s32) in[6]) +
-                    ((limb) ((s32) in2[6])) * ((s32) in[0]);
-  output[7] =       ((limb) ((s32) in2[3])) * ((s32) in[4]) +
-                    ((limb) ((s32) in2[4])) * ((s32) in[3]) +
-                    ((limb) ((s32) in2[2])) * ((s32) in[5]) +
-                    ((limb) ((s32) in2[5])) * ((s32) in[2]) +
-                    ((limb) ((s32) in2[1])) * ((s32) in[6]) +
-                    ((limb) ((s32) in2[6])) * ((s32) in[1]) +
-                    ((limb) ((s32) in2[0])) * ((s32) in[7]) +
-                    ((limb) ((s32) in2[7])) * ((s32) in[0]);
-  output[8] =       ((limb) ((s32) in2[4])) * ((s32) in[4]) +
-               2 * (((limb) ((s32) in2[3])) * ((s32) in[5]) +
-                    ((limb) ((s32) in2[5])) * ((s32) in[3]) +
-                    ((limb) ((s32) in2[1])) * ((s32) in[7]) +
-                    ((limb) ((s32) in2[7])) * ((s32) in[1])) +
-                    ((limb) ((s32) in2[2])) * ((s32) in[6]) +
-                    ((limb) ((s32) in2[6])) * ((s32) in[2]) +
-                    ((limb) ((s32) in2[0])) * ((s32) in[8]) +
-                    ((limb) ((s32) in2[8])) * ((s32) in[0]);
-  output[9] =       ((limb) ((s32) in2[4])) * ((s32) in[5]) +
-                    ((limb) ((s32) in2[5])) * ((s32) in[4]) +
-                    ((limb) ((s32) in2[3])) * ((s32) in[6]) +
-                    ((limb) ((s32) in2[6])) * ((s32) in[3]) +
-                    ((limb) ((s32) in2[2])) * ((s32) in[7]) +
-                    ((limb) ((s32) in2[7])) * ((s32) in[2]) +
-                    ((limb) ((s32) in2[1])) * ((s32) in[8]) +
-                    ((limb) ((s32) in2[8])) * ((s32) in[1]) +
-                    ((limb) ((s32) in2[0])) * ((s32) in[9]) +
-                    ((limb) ((s32) in2[9])) * ((s32) in[0]);
-  output[10] = 2 * (((limb) ((s32) in2[5])) * ((s32) in[5]) +
-                    ((limb) ((s32) in2[3])) * ((s32) in[7]) +
-                    ((limb) ((s32) in2[7])) * ((s32) in[3]) +
-                    ((limb) ((s32) in2[1])) * ((s32) in[9]) +
-                    ((limb) ((s32) in2[9])) * ((s32) in[1])) +
-                    ((limb) ((s32) in2[4])) * ((s32) in[6]) +
-                    ((limb) ((s32) in2[6])) * ((s32) in[4]) +
-                    ((limb) ((s32) in2[2])) * ((s32) in[8]) +
-                    ((limb) ((s32) in2[8])) * ((s32) in[2]);
-  output[11] =      ((limb) ((s32) in2[5])) * ((s32) in[6]) +
-                    ((limb) ((s32) in2[6])) * ((s32) in[5]) +
-                    ((limb) ((s32) in2[4])) * ((s32) in[7]) +
-                    ((limb) ((s32) in2[7])) * ((s32) in[4]) +
-                    ((limb) ((s32) in2[3])) * ((s32) in[8]) +
-                    ((limb) ((s32) in2[8])) * ((s32) in[3]) +
-                    ((limb) ((s32) in2[2])) * ((s32) in[9]) +
-                    ((limb) ((s32) in2[9])) * ((s32) in[2]);
-  output[12] =      ((limb) ((s32) in2[6])) * ((s32) in[6]) +
-               2 * (((limb) ((s32) in2[5])) * ((s32) in[7]) +
-                    ((limb) ((s32) in2[7])) * ((s32) in[5]) +
-                    ((limb) ((s32) in2[3])) * ((s32) in[9]) +
-                    ((limb) ((s32) in2[9])) * ((s32) in[3])) +
-                    ((limb) ((s32) in2[4])) * ((s32) in[8]) +
-                    ((limb) ((s32) in2[8])) * ((s32) in[4]);
-  output[13] =      ((limb) ((s32) in2[6])) * ((s32) in[7]) +
-                    ((limb) ((s32) in2[7])) * ((s32) in[6]) +
-                    ((limb) ((s32) in2[5])) * ((s32) in[8]) +
-                    ((limb) ((s32) in2[8])) * ((s32) in[5]) +
-                    ((limb) ((s32) in2[4])) * ((s32) in[9]) +
-                    ((limb) ((s32) in2[9])) * ((s32) in[4]);
-  output[14] = 2 * (((limb) ((s32) in2[7])) * ((s32) in[7]) +
-                    ((limb) ((s32) in2[5])) * ((s32) in[9]) +
-                    ((limb) ((s32) in2[9])) * ((s32) in[5])) +
-                    ((limb) ((s32) in2[6])) * ((s32) in[8]) +
-                    ((limb) ((s32) in2[8])) * ((s32) in[6]);
-  output[15] =      ((limb) ((s32) in2[7])) * ((s32) in[8]) +
-                    ((limb) ((s32) in2[8])) * ((s32) in[7]) +
-                    ((limb) ((s32) in2[6])) * ((s32) in[9]) +
-                    ((limb) ((s32) in2[9])) * ((s32) in[6]);
-  output[16] =      ((limb) ((s32) in2[8])) * ((s32) in[8]) +
-               2 * (((limb) ((s32) in2[7])) * ((s32) in[9]) +
-                    ((limb) ((s32) in2[9])) * ((s32) in[7]));
-  output[17] =      ((limb) ((s32) in2[8])) * ((s32) in[9]) +
-                    ((limb) ((s32) in2[9])) * ((s32) in[8]);
-  output[18] = 2 *  ((limb) ((s32) in2[9])) * ((s32) in[9]);
+static void
+fproduct(int64_t *output, const int64_t *in2, const int64_t *in)
+{
+  output[0] =       ((int64_t) ((int32_t) in2[0])) * ((int32_t) in[0]);
+  output[1] =       ((int64_t) ((int32_t) in2[0])) * ((int32_t) in[1]) +
+                    ((int64_t) ((int32_t) in2[1])) * ((int32_t) in[0]);
+  output[2] =  2 *  ((int64_t) ((int32_t) in2[1])) * ((int32_t) in[1]) +
+                    ((int64_t) ((int32_t) in2[0])) * ((int32_t) in[2]) +
+                    ((int64_t) ((int32_t) in2[2])) * ((int32_t) in[0]);
+  output[3] =       ((int64_t) ((int32_t) in2[1])) * ((int32_t) in[2]) +
+                    ((int64_t) ((int32_t) in2[2])) * ((int32_t) in[1]) +
+                    ((int64_t) ((int32_t) in2[0])) * ((int32_t) in[3]) +
+                    ((int64_t) ((int32_t) in2[3])) * ((int32_t) in[0]);
+  output[4] =       ((int64_t) ((int32_t) in2[2])) * ((int32_t) in[2]) +
+               2 * (((int64_t) ((int32_t) in2[1])) * ((int32_t) in[3]) +
+                    ((int64_t) ((int32_t) in2[3])) * ((int32_t) in[1])) +
+                    ((int64_t) ((int32_t) in2[0])) * ((int32_t) in[4]) +
+                    ((int64_t) ((int32_t) in2[4])) * ((int32_t) in[0]);
+  output[5] =       ((int64_t) ((int32_t) in2[2])) * ((int32_t) in[3]) +
+                    ((int64_t) ((int32_t) in2[3])) * ((int32_t) in[2]) +
+                    ((int64_t) ((int32_t) in2[1])) * ((int32_t) in[4]) +
+                    ((int64_t) ((int32_t) in2[4])) * ((int32_t) in[1]) +
+                    ((int64_t) ((int32_t) in2[0])) * ((int32_t) in[5]) +
+                    ((int64_t) ((int32_t) in2[5])) * ((int32_t) in[0]);
+  output[6] =  2 * (((int64_t) ((int32_t) in2[3])) * ((int32_t) in[3]) +
+                    ((int64_t) ((int32_t) in2[1])) * ((int32_t) in[5]) +
+                    ((int64_t) ((int32_t) in2[5])) * ((int32_t) in[1])) +
+                    ((int64_t) ((int32_t) in2[2])) * ((int32_t) in[4]) +
+                    ((int64_t) ((int32_t) in2[4])) * ((int32_t) in[2]) +
+                    ((int64_t) ((int32_t) in2[0])) * ((int32_t) in[6]) +
+                    ((int64_t) ((int32_t) in2[6])) * ((int32_t) in[0]);
+  output[7] =       ((int64_t) ((int32_t) in2[3])) * ((int32_t) in[4]) +
+                    ((int64_t) ((int32_t) in2[4])) * ((int32_t) in[3]) +
+                    ((int64_t) ((int32_t) in2[2])) * ((int32_t) in[5]) +
+                    ((int64_t) ((int32_t) in2[5])) * ((int32_t) in[2]) +
+                    ((int64_t) ((int32_t) in2[1])) * ((int32_t) in[6]) +
+                    ((int64_t) ((int32_t) in2[6])) * ((int32_t) in[1]) +
+                    ((int64_t) ((int32_t) in2[0])) * ((int32_t) in[7]) +
+                    ((int64_t) ((int32_t) in2[7])) * ((int32_t) in[0]);
+  output[8] =       ((int64_t) ((int32_t) in2[4])) * ((int32_t) in[4]) +
+               2 * (((int64_t) ((int32_t) in2[3])) * ((int32_t) in[5]) +
+                    ((int64_t) ((int32_t) in2[5])) * ((int32_t) in[3]) +
+                    ((int64_t) ((int32_t) in2[1])) * ((int32_t) in[7]) +
+                    ((int64_t) ((int32_t) in2[7])) * ((int32_t) in[1])) +
+                    ((int64_t) ((int32_t) in2[2])) * ((int32_t) in[6]) +
+                    ((int64_t) ((int32_t) in2[6])) * ((int32_t) in[2]) +
+                    ((int64_t) ((int32_t) in2[0])) * ((int32_t) in[8]) +
+                    ((int64_t) ((int32_t) in2[8])) * ((int32_t) in[0]);
+  output[9] =       ((int64_t) ((int32_t) in2[4])) * ((int32_t) in[5]) +
+                    ((int64_t) ((int32_t) in2[5])) * ((int32_t) in[4]) +
+                    ((int64_t) ((int32_t) in2[3])) * ((int32_t) in[6]) +
+                    ((int64_t) ((int32_t) in2[6])) * ((int32_t) in[3]) +
+                    ((int64_t) ((int32_t) in2[2])) * ((int32_t) in[7]) +
+                    ((int64_t) ((int32_t) in2[7])) * ((int32_t) in[2]) +
+                    ((int64_t) ((int32_t) in2[1])) * ((int32_t) in[8]) +
+                    ((int64_t) ((int32_t) in2[8])) * ((int32_t) in[1]) +
+                    ((int64_t) ((int32_t) in2[0])) * ((int32_t) in[9]) +
+                    ((int64_t) ((int32_t) in2[9])) * ((int32_t) in[0]);
+  output[10] = 2 * (((int64_t) ((int32_t) in2[5])) * ((int32_t) in[5]) +
+                    ((int64_t) ((int32_t) in2[3])) * ((int32_t) in[7]) +
+                    ((int64_t) ((int32_t) in2[7])) * ((int32_t) in[3]) +
+                    ((int64_t) ((int32_t) in2[1])) * ((int32_t) in[9]) +
+                    ((int64_t) ((int32_t) in2[9])) * ((int32_t) in[1])) +
+                    ((int64_t) ((int32_t) in2[4])) * ((int32_t) in[6]) +
+                    ((int64_t) ((int32_t) in2[6])) * ((int32_t) in[4]) +
+                    ((int64_t) ((int32_t) in2[2])) * ((int32_t) in[8]) +
+                    ((int64_t) ((int32_t) in2[8])) * ((int32_t) in[2]);
+  output[11] =      ((int64_t) ((int32_t) in2[5])) * ((int32_t) in[6]) +
+                    ((int64_t) ((int32_t) in2[6])) * ((int32_t) in[5]) +
+                    ((int64_t) ((int32_t) in2[4])) * ((int32_t) in[7]) +
+                    ((int64_t) ((int32_t) in2[7])) * ((int32_t) in[4]) +
+                    ((int64_t) ((int32_t) in2[3])) * ((int32_t) in[8]) +
+                    ((int64_t) ((int32_t) in2[8])) * ((int32_t) in[3]) +
+                    ((int64_t) ((int32_t) in2[2])) * ((int32_t) in[9]) +
+                    ((int64_t) ((int32_t) in2[9])) * ((int32_t) in[2]);
+  output[12] =      ((int64_t) ((int32_t) in2[6])) * ((int32_t) in[6]) +
+               2 * (((int64_t) ((int32_t) in2[5])) * ((int32_t) in[7]) +
+                    ((int64_t) ((int32_t) in2[7])) * ((int32_t) in[5]) +
+                    ((int64_t) ((int32_t) in2[3])) * ((int32_t) in[9]) +
+                    ((int64_t) ((int32_t) in2[9])) * ((int32_t) in[3])) +
+                    ((int64_t) ((int32_t) in2[4])) * ((int32_t) in[8]) +
+                    ((int64_t) ((int32_t) in2[8])) * ((int32_t) in[4]);
+  output[13] =      ((int64_t) ((int32_t) in2[6])) * ((int32_t) in[7]) +
+                    ((int64_t) ((int32_t) in2[7])) * ((int32_t) in[6]) +
+                    ((int64_t) ((int32_t) in2[5])) * ((int32_t) in[8]) +
+                    ((int64_t) ((int32_t) in2[8])) * ((int32_t) in[5]) +
+                    ((int64_t) ((int32_t) in2[4])) * ((int32_t) in[9]) +
+                    ((int64_t) ((int32_t) in2[9])) * ((int32_t) in[4]);
+  output[14] = 2 * (((int64_t) ((int32_t) in2[7])) * ((int32_t) in[7]) +
+                    ((int64_t) ((int32_t) in2[5])) * ((int32_t) in[9]) +
+                    ((int64_t) ((int32_t) in2[9])) * ((int32_t) in[5])) +
+                    ((int64_t) ((int32_t) in2[6])) * ((int32_t) in[8]) +
+                    ((int64_t) ((int32_t) in2[8])) * ((int32_t) in[6]);
+  output[15] =      ((int64_t) ((int32_t) in2[7])) * ((int32_t) in[8]) +
+                    ((int64_t) ((int32_t) in2[8])) * ((int32_t) in[7]) +
+                    ((int64_t) ((int32_t) in2[6])) * ((int32_t) in[9]) +
+                    ((int64_t) ((int32_t) in2[9])) * ((int32_t) in[6]);
+  output[16] =      ((int64_t) ((int32_t) in2[8])) * ((int32_t) in[8]) +
+               2 * (((int64_t) ((int32_t) in2[7])) * ((int32_t) in[9]) +
+                    ((int64_t) ((int32_t) in2[9])) * ((int32_t) in[7]));
+  output[17] =      ((int64_t) ((int32_t) in2[8])) * ((int32_t) in[9]) +
+                    ((int64_t) ((int32_t) in2[9])) * ((int32_t) in[8]);
+  output[18] = 2 *  ((int64_t) ((int32_t) in2[9])) * ((int32_t) in[9]);
 }
 
 /* Reduce a long form to a short form by taking the input mod 2^255 - 19.
  *
  * On entry: |output[i]| < 14*2^54
  * On exit: |output[0..8]| < 280*2^54 */
-static void freduce_degree(limb *output) {
+static void
+freduce_degree(int64_t *output)
+{
   /* Each of these shifts and adds ends up multiplying the value by 19.
    *
    * For output[0..8], the absolute entry value is < 14*2^54 and we add, at
@@ -236,8 +246,8 @@
 /* return v / 2^26, using only shifts and adds.
  *
  * On entry: v can take any value. */
-static limb
-div_by_2_26(const limb v)
+static int64_t
+div_by_2_26(const int64_t v)
 {
   /* High word of v; no shift needed. */
   const uint32_t highword = (uint32_t) (((uint64_t) v) >> 32);
@@ -252,8 +262,8 @@
 /* return v / (2^25), using only shifts and adds.
  *
  * On entry: v can take any value. */
-static limb
-div_by_2_25(const limb v)
+static int64_t
+div_by_2_25(const int64_t v)
 {
   /* High word of v; no shift needed*/
   const uint32_t highword = (uint32_t) (((uint64_t) v) >> 32);
@@ -268,13 +278,15 @@
 /* Reduce all coefficients of the short form input so that |x| < 2^26.
  *
  * On entry: |output[i]| < 280*2^54 */
-static void freduce_coefficients(limb *output) {
+static void
+freduce_coefficients(int64_t *output)
+{
   unsigned i;
 
   output[10] = 0;
 
   for (i = 0; i < 10; i += 2) {
-    limb over = div_by_2_26(output[i]);
+    int64_t over = div_by_2_26(output[i]);
     /* The entry condition (that |output[i]| < 280*2^54) means that over is, at
      * most, 280*2^28 in the first iteration of this loop. This is added to the
      * next limb and we can approximate the resulting bound of that limb by
@@ -302,7 +314,7 @@
   /* Now output[1..9] are reduced, and |output[0]| < 2^26 + 19*281*2^29
    * So |over| will be no more than 2^16. */
   {
-    limb over = div_by_2_26(output[0]);
+    int64_t over = div_by_2_26(output[0]);
     output[0] -= over << 26;
     output[1] += over;
   }
@@ -318,14 +330,15 @@
  * output must be distinct to both inputs. The output is reduced degree
  * (indeed, one need only provide storage for 10 limbs) and |output[i]| < 
2^26. */
 static void
-fmul(limb *output, const limb *in, const limb *in2) {
-  limb t[19];
+fmul(int64_t *output, const int64_t *in, const int64_t *in2)
+{
+  int64_t t[19];
   fproduct(t, in, in2);
   /* |t[i]| < 14*2^54 */
   freduce_degree(t);
   freduce_coefficients(t);
   /* |t[i]| < 2^26 */
-  memcpy(output, t, sizeof(limb) * 10);
+  memcpy(output, t, sizeof(int64_t) * 10);
 }
 
 /* Square a number: output = in**2
@@ -334,62 +347,64 @@
  * form, the output is not.
  *
  * output[x] <= 14 * the largest product of the input limbs. */
-static void fsquare_inner(limb *output, const limb *in) {
-  output[0] =       ((limb) ((s32) in[0])) * ((s32) in[0]);
-  output[1] =  2 *  ((limb) ((s32) in[0])) * ((s32) in[1]);
-  output[2] =  2 * (((limb) ((s32) in[1])) * ((s32) in[1]) +
-                    ((limb) ((s32) in[0])) * ((s32) in[2]));
-  output[3] =  2 * (((limb) ((s32) in[1])) * ((s32) in[2]) +
-                    ((limb) ((s32) in[0])) * ((s32) in[3]));
-  output[4] =       ((limb) ((s32) in[2])) * ((s32) in[2]) +
-               4 *  ((limb) ((s32) in[1])) * ((s32) in[3]) +
-               2 *  ((limb) ((s32) in[0])) * ((s32) in[4]);
-  output[5] =  2 * (((limb) ((s32) in[2])) * ((s32) in[3]) +
-                    ((limb) ((s32) in[1])) * ((s32) in[4]) +
-                    ((limb) ((s32) in[0])) * ((s32) in[5]));
-  output[6] =  2 * (((limb) ((s32) in[3])) * ((s32) in[3]) +
-                    ((limb) ((s32) in[2])) * ((s32) in[4]) +
-                    ((limb) ((s32) in[0])) * ((s32) in[6]) +
-               2 *  ((limb) ((s32) in[1])) * ((s32) in[5]));
-  output[7] =  2 * (((limb) ((s32) in[3])) * ((s32) in[4]) +
-                    ((limb) ((s32) in[2])) * ((s32) in[5]) +
-                    ((limb) ((s32) in[1])) * ((s32) in[6]) +
-                    ((limb) ((s32) in[0])) * ((s32) in[7]));
-  output[8] =       ((limb) ((s32) in[4])) * ((s32) in[4]) +
-               2 * (((limb) ((s32) in[2])) * ((s32) in[6]) +
-                    ((limb) ((s32) in[0])) * ((s32) in[8]) +
-               2 * (((limb) ((s32) in[1])) * ((s32) in[7]) +
-                    ((limb) ((s32) in[3])) * ((s32) in[5])));
-  output[9] =  2 * (((limb) ((s32) in[4])) * ((s32) in[5]) +
-                    ((limb) ((s32) in[3])) * ((s32) in[6]) +
-                    ((limb) ((s32) in[2])) * ((s32) in[7]) +
-                    ((limb) ((s32) in[1])) * ((s32) in[8]) +
-                    ((limb) ((s32) in[0])) * ((s32) in[9]));
-  output[10] = 2 * (((limb) ((s32) in[5])) * ((s32) in[5]) +
-                    ((limb) ((s32) in[4])) * ((s32) in[6]) +
-                    ((limb) ((s32) in[2])) * ((s32) in[8]) +
-               2 * (((limb) ((s32) in[3])) * ((s32) in[7]) +
-                    ((limb) ((s32) in[1])) * ((s32) in[9])));
-  output[11] = 2 * (((limb) ((s32) in[5])) * ((s32) in[6]) +
-                    ((limb) ((s32) in[4])) * ((s32) in[7]) +
-                    ((limb) ((s32) in[3])) * ((s32) in[8]) +
-                    ((limb) ((s32) in[2])) * ((s32) in[9]));
-  output[12] =      ((limb) ((s32) in[6])) * ((s32) in[6]) +
-               2 * (((limb) ((s32) in[4])) * ((s32) in[8]) +
-               2 * (((limb) ((s32) in[5])) * ((s32) in[7]) +
-                    ((limb) ((s32) in[3])) * ((s32) in[9])));
-  output[13] = 2 * (((limb) ((s32) in[6])) * ((s32) in[7]) +
-                    ((limb) ((s32) in[5])) * ((s32) in[8]) +
-                    ((limb) ((s32) in[4])) * ((s32) in[9]));
-  output[14] = 2 * (((limb) ((s32) in[7])) * ((s32) in[7]) +
-                    ((limb) ((s32) in[6])) * ((s32) in[8]) +
-               2 *  ((limb) ((s32) in[5])) * ((s32) in[9]));
-  output[15] = 2 * (((limb) ((s32) in[7])) * ((s32) in[8]) +
-                    ((limb) ((s32) in[6])) * ((s32) in[9]));
-  output[16] =      ((limb) ((s32) in[8])) * ((s32) in[8]) +
-               4 *  ((limb) ((s32) in[7])) * ((s32) in[9]);
-  output[17] = 2 *  ((limb) ((s32) in[8])) * ((s32) in[9]);
-  output[18] = 2 *  ((limb) ((s32) in[9])) * ((s32) in[9]);
+static void
+fsquare_inner(int64_t *output, const int64_t *in)
+{
+  output[0] =       ((int64_t) ((int32_t) in[0])) * ((int32_t) in[0]);
+  output[1] =  2 *  ((int64_t) ((int32_t) in[0])) * ((int32_t) in[1]);
+  output[2] =  2 * (((int64_t) ((int32_t) in[1])) * ((int32_t) in[1]) +
+                    ((int64_t) ((int32_t) in[0])) * ((int32_t) in[2]));
+  output[3] =  2 * (((int64_t) ((int32_t) in[1])) * ((int32_t) in[2]) +
+                    ((int64_t) ((int32_t) in[0])) * ((int32_t) in[3]));
+  output[4] =       ((int64_t) ((int32_t) in[2])) * ((int32_t) in[2]) +
+               4 *  ((int64_t) ((int32_t) in[1])) * ((int32_t) in[3]) +
+               2 *  ((int64_t) ((int32_t) in[0])) * ((int32_t) in[4]);
+  output[5] =  2 * (((int64_t) ((int32_t) in[2])) * ((int32_t) in[3]) +
+                    ((int64_t) ((int32_t) in[1])) * ((int32_t) in[4]) +
+                    ((int64_t) ((int32_t) in[0])) * ((int32_t) in[5]));
+  output[6] =  2 * (((int64_t) ((int32_t) in[3])) * ((int32_t) in[3]) +
+                    ((int64_t) ((int32_t) in[2])) * ((int32_t) in[4]) +
+                    ((int64_t) ((int32_t) in[0])) * ((int32_t) in[6]) +
+               2 *  ((int64_t) ((int32_t) in[1])) * ((int32_t) in[5]));
+  output[7] =  2 * (((int64_t) ((int32_t) in[3])) * ((int32_t) in[4]) +
+                    ((int64_t) ((int32_t) in[2])) * ((int32_t) in[5]) +
+                    ((int64_t) ((int32_t) in[1])) * ((int32_t) in[6]) +
+                    ((int64_t) ((int32_t) in[0])) * ((int32_t) in[7]));
+  output[8] =       ((int64_t) ((int32_t) in[4])) * ((int32_t) in[4]) +
+               2 * (((int64_t) ((int32_t) in[2])) * ((int32_t) in[6]) +
+                    ((int64_t) ((int32_t) in[0])) * ((int32_t) in[8]) +
+               2 * (((int64_t) ((int32_t) in[1])) * ((int32_t) in[7]) +
+                    ((int64_t) ((int32_t) in[3])) * ((int32_t) in[5])));
+  output[9] =  2 * (((int64_t) ((int32_t) in[4])) * ((int32_t) in[5]) +
+                    ((int64_t) ((int32_t) in[3])) * ((int32_t) in[6]) +
+                    ((int64_t) ((int32_t) in[2])) * ((int32_t) in[7]) +
+                    ((int64_t) ((int32_t) in[1])) * ((int32_t) in[8]) +
+                    ((int64_t) ((int32_t) in[0])) * ((int32_t) in[9]));
+  output[10] = 2 * (((int64_t) ((int32_t) in[5])) * ((int32_t) in[5]) +
+                    ((int64_t) ((int32_t) in[4])) * ((int32_t) in[6]) +
+                    ((int64_t) ((int32_t) in[2])) * ((int32_t) in[8]) +
+               2 * (((int64_t) ((int32_t) in[3])) * ((int32_t) in[7]) +
+                    ((int64_t) ((int32_t) in[1])) * ((int32_t) in[9])));
+  output[11] = 2 * (((int64_t) ((int32_t) in[5])) * ((int32_t) in[6]) +
+                    ((int64_t) ((int32_t) in[4])) * ((int32_t) in[7]) +
+                    ((int64_t) ((int32_t) in[3])) * ((int32_t) in[8]) +
+                    ((int64_t) ((int32_t) in[2])) * ((int32_t) in[9]));
+  output[12] =      ((int64_t) ((int32_t) in[6])) * ((int32_t) in[6]) +
+               2 * (((int64_t) ((int32_t) in[4])) * ((int32_t) in[8]) +
+               2 * (((int64_t) ((int32_t) in[5])) * ((int32_t) in[7]) +
+                    ((int64_t) ((int32_t) in[3])) * ((int32_t) in[9])));
+  output[13] = 2 * (((int64_t) ((int32_t) in[6])) * ((int32_t) in[7]) +
+                    ((int64_t) ((int32_t) in[5])) * ((int32_t) in[8]) +
+                    ((int64_t) ((int32_t) in[4])) * ((int32_t) in[9]));
+  output[14] = 2 * (((int64_t) ((int32_t) in[7])) * ((int32_t) in[7]) +
+                    ((int64_t) ((int32_t) in[6])) * ((int32_t) in[8]) +
+               2 *  ((int64_t) ((int32_t) in[5])) * ((int32_t) in[9]));
+  output[15] = 2 * (((int64_t) ((int32_t) in[7])) * ((int32_t) in[8]) +
+                    ((int64_t) ((int32_t) in[6])) * ((int32_t) in[9]));
+  output[16] =      ((int64_t) ((int32_t) in[8])) * ((int32_t) in[8]) +
+               4 *  ((int64_t) ((int32_t) in[7])) * ((int32_t) in[9]);
+  output[17] = 2 *  ((int64_t) ((int32_t) in[8])) * ((int32_t) in[9]);
+  output[18] = 2 *  ((int64_t) ((int32_t) in[9])) * ((int32_t) in[9]);
 }
 
 /* fsquare sets output = in^2.
@@ -400,8 +415,9 @@
  * On exit: The |output| argument is in reduced coefficients form (indeed, one
  * need only provide storage for 10 limbs) and |out[i]| < 2^26. */
 static void
-fsquare(limb *output, const limb *in) {
-  limb t[19];
+fsquare(int64_t *output, const int64_t *in)
+{
+  int64_t t[19];
   fsquare_inner(t, in);
   /* |t[i]| < 14*2^54 because the largest product of two limbs will be <
    * 2^(27+27) and fsquare_inner adds together, at most, 14 of those
@@ -409,17 +425,18 @@
   freduce_degree(t);
   freduce_coefficients(t);
   /* |t[i]| < 2^26 */
-  memcpy(output, t, sizeof(limb) * 10);
+  memcpy(output, t, sizeof(int64_t) * 10);
 }
 
 /* Take a little-endian, 32-byte number and expand it into polynomial form */
 static void
-fexpand(limb *output, const u8 *input) {
+fexpand(int64_t *output, const uint8_t *input)
+{
 #define F(n,start,shift,mask) \
-  output[n] = ((((limb) input[start + 0]) | \
-                ((limb) input[start + 1]) << 8 | \
-                ((limb) input[start + 2]) << 16 | \
-                ((limb) input[start + 3]) << 24) >> shift) & mask;
+  output[n] = ((((int64_t) input[start + 0]) | \
+                ((int64_t) input[start + 1]) << 8 | \
+                ((int64_t) input[start + 2]) << 16 | \
+                ((int64_t) input[start + 3]) << 24) >> shift) & mask;
   F(0, 0, 0, 0x3ffffff);
   F(1, 3, 2, 0x1ffffff);
   F(2, 6, 3, 0x3ffffff);
@@ -438,7 +455,9 @@
 #endif
 
 /* s32_eq returns 0xffffffff iff a == b and zero otherwise. */
-static s32 s32_eq(s32 a, s32 b) {
+static int32_t
+s32_eq(int32_t a, int32_t b)
+{
   a = ~(a ^ b);
   a &= a << 16;
   a &= a << 8;
@@ -450,7 +469,9 @@
 
 /* s32_gte returns 0xffffffff if a >= b and zero otherwise, where a and b are
  * both non-negative. */
-static s32 s32_gte(s32 a, s32 b) {
+static int32_t
+s32_gte(int32_t a, int32_t b)
+{
   a -= b;
   /* a >= 0 iff a >= b. */
   return ~(a >> 31);
@@ -461,13 +482,14 @@
  *
  * On entry: |input_limbs[i]| < 2^26 */
 static void
-fcontract(u8 *output, limb *input_limbs) {
+fcontract(uint8_t *output, int64_t *input_limbs)
+{
   int i;
   int j;
-  s32 input[10];
-  s32 mask;
+  int32_t input[10];
+  int32_t mask;
 
-  /* |input_limbs[i]| < 2^26, so it's valid to convert to an s32. */
+  /* |input_limbs[i]| < 2^26, so it's valid to convert to an int32_t. */
   for (i = 0; i < 10; i++) {
     input[i] = input_limbs[i];
   }
@@ -477,13 +499,13 @@
       if ((i & 1) == 1) {
         /* This calculation is a time-invariant way to make input[i]
          * non-negative by borrowing from the next-larger limb. */
-        const s32 mask = input[i] >> 31;
-        const s32 carry = -((input[i] & mask) >> 25);
+        const int32_t mask = input[i] >> 31;
+        const int32_t carry = -((input[i] & mask) >> 25);
         input[i] = input[i] + (carry << 25);
         input[i+1] = input[i+1] - carry;
       } else {
-        const s32 mask = input[i] >> 31;
-        const s32 carry = -((input[i] & mask) >> 26);
+        const int32_t mask = input[i] >> 31;
+        const int32_t carry = -((input[i] & mask) >> 26);
         input[i] = input[i] + (carry << 26);
         input[i+1] = input[i+1] - carry;
       }
@@ -492,8 +514,8 @@
     /* There's no greater limb for input[9] to borrow from, but we can multiply
      * by 19 and borrow from input[0], which is valid mod 2^255-19. */
     {
-      const s32 mask = input[9] >> 31;
-      const s32 carry = -((input[9] & mask) >> 25);
+      const int32_t mask = input[9] >> 31;
+      const int32_t carry = -((input[9] & mask) >> 25);
       input[9] = input[9] + (carry << 25);
       input[0] = input[0] - (carry * 19);
     }
@@ -516,8 +538,8 @@
      through input[9] were all zero.  In that case, input[1] is now 2^25 - 1,
      and this last borrow-propagation step will leave input[1] non-negative. */
   {
-    const s32 mask = input[0] >> 31;
-    const s32 carry = -((input[0] & mask) >> 26);
+    const int32_t mask = input[0] >> 31;
+    const int32_t carry = -((input[0] & mask) >> 26);
     input[0] = input[0] + (carry << 26);
     input[1] = input[1] - carry;
   }
@@ -527,18 +549,18 @@
   for (j = 0; j < 2; j++) {
     for (i = 0; i < 9; i++) {
       if ((i & 1) == 1) {
-        const s32 carry = input[i] >> 25;
+        const int32_t carry = input[i] >> 25;
         input[i] &= 0x1ffffff;
         input[i+1] += carry;
       } else {
-        const s32 carry = input[i] >> 26;
+        const int32_t carry = input[i] >> 26;
         input[i] &= 0x3ffffff;
         input[i+1] += carry;
       }
     }
 
     {
-      const s32 carry = input[9] >> 25;
+      const int32_t carry = input[9] >> 25;
       input[9] &= 0x1ffffff;
       input[0] += 19*carry;
     }
@@ -614,21 +636,23 @@
  *
  * On entry and exit, the absolute value of the limbs of all inputs and outputs
  * are < 2^26. */
-static void fmonty(limb *x2, limb *z2,  /* output 2Q */
-                   limb *x3, limb *z3,  /* output Q + Q' */
-                   limb *x, limb *z,    /* input Q */
-                   limb *xprime, limb *zprime,  /* input Q' */
-                   const limb *qmqp /* input Q - Q' */) {
-  limb origx[10], origxprime[10], zzz[19], xx[19], zz[19], xxprime[19],
+static void
+fmonty(int64_t *x2, int64_t *z2,  /* output 2Q */
+       int64_t *x3, int64_t *z3,  /* output Q + Q' */
+       int64_t *x, int64_t *z,    /* input Q */
+       int64_t *xprime, int64_t *zprime,  /* input Q' */
+       const int64_t *qmqp /* input Q - Q' */)
+{
+  int64_t origx[10], origxprime[10], zzz[19], xx[19], zz[19], xxprime[19],
         zzprime[19], zzzprime[19], xxxprime[19];
 
-  memcpy(origx, x, 10 * sizeof(limb));
+  memcpy(origx, x, 10 * sizeof(int64_t));
   fsum(x, z);
   /* |x[i]| < 2^27 */
   fdifference(z, origx);  /* does x - z */
   /* |z[i]| < 2^27 */
 
-  memcpy(origxprime, xprime, sizeof(limb) * 10);
+  memcpy(origxprime, xprime, sizeof(int64_t) * 10);
   fsum(xprime, zprime);
   /* |xprime[i]| < 2^27 */
   fdifference(zprime, origxprime);
@@ -645,7 +669,7 @@
   freduce_degree(zzprime);
   freduce_coefficients(zzprime);
   /* |zzprime[i]| < 2^26 */
-  memcpy(origxprime, xxprime, sizeof(limb) * 10);
+  memcpy(origxprime, xxprime, sizeof(int64_t) * 10);
   fsum(xxprime, zzprime);
   /* |xxprime[i]| < 2^27 */
   fdifference(zzprime, origxprime);
@@ -659,8 +683,8 @@
   freduce_degree(zzprime);
   freduce_coefficients(zzprime);
   /* |zzprime[i]| < 2^26 */
-  memcpy(x3, xxxprime, sizeof(limb) * 10);
-  memcpy(z3, zzprime, sizeof(limb) * 10);
+  memcpy(x3, xxxprime, sizeof(int64_t) * 10);
+  memcpy(z3, zzprime, sizeof(int64_t) * 10);
 
   fsquare(xx, x);
   /* |xx[i]| < 2^26 */
@@ -673,7 +697,7 @@
   /* |x2[i]| < 2^26 */
   fdifference(zz, xx);  /* does zz = xx - zz */
   /* |zz[i]| < 2^27 */
-  memset(zzz + 10, 0, sizeof(limb) * 9);
+  memset(zzz + 10, 0, sizeof(int64_t) * 9);
   fscalar_product(zzz, zz, 121665);
   /* |zzz[i]| < 2^(27+17) */
   /* No need to call freduce_degree here:
@@ -699,14 +723,15 @@
  * and all all values in a[0..9],b[0..9] must have magnitude less than
  * INT32_MAX. */
 static void
-swap_conditional(limb a[19], limb b[19], limb iswap) {
+swap_conditional(int64_t a[19], int64_t b[19], int64_t iswap)
+{
   unsigned i;
-  const s32 swap = (s32) -iswap;
+  const int32_t swap = (int32_t) -iswap;
 
   for (i = 0; i < 10; ++i) {
-    const s32 x = swap & ( ((s32)a[i]) ^ ((s32)b[i]) );
-    a[i] = ((s32)a[i]) ^ x;
-    b[i] = ((s32)b[i]) ^ x;
+    const int32_t x = swap & ( ((int32_t)a[i]) ^ ((int32_t)b[i]) );
+    a[i] = ((int32_t)a[i]) ^ x;
+    b[i] = ((int32_t)b[i]) ^ x;
   }
 }
 
@@ -716,20 +741,21 @@
  *   n: a little endian, 32-byte number
  *   q: a point of the curve (short form) */
 static void
-cmult(limb *resultx, limb *resultz, const u8 *n, const limb *q) {
-  limb a[19] = {0}, b[19] = {1}, c[19] = {1}, d[19] = {0};
-  limb *nqpqx = a, *nqpqz = b, *nqx = c, *nqz = d, *t;
-  limb e[19] = {0}, f[19] = {1}, g[19] = {0}, h[19] = {1};
-  limb *nqpqx2 = e, *nqpqz2 = f, *nqx2 = g, *nqz2 = h;
+cmult(int64_t *resultx, int64_t *resultz, const uint8_t *n, const int64_t *q)
+{
+  int64_t a[19] = {0}, b[19] = {1}, c[19] = {1}, d[19] = {0};
+  int64_t *nqpqx = a, *nqpqz = b, *nqx = c, *nqz = d, *t;
+  int64_t e[19] = {0}, f[19] = {1}, g[19] = {0}, h[19] = {1};
+  int64_t *nqpqx2 = e, *nqpqz2 = f, *nqx2 = g, *nqz2 = h;
 
   unsigned i, j;
 
-  memcpy(nqpqx, q, sizeof(limb) * 10);
+  memcpy(nqpqx, q, sizeof(int64_t) * 10);
 
   for (i = 0; i < 32; ++i) {
-    u8 byte = n[31 - i];
+    uint8_t byte = n[31 - i];
     for (j = 0; j < 8; ++j) {
-      const limb bit = byte >> 7;
+      const int64_t bit = byte >> 7;
 
       swap_conditional(nqx, nqpqx, bit);
       swap_conditional(nqz, nqpqz, bit);
@@ -758,22 +784,23 @@
     }
   }
 
-  memcpy(resultx, nqx, sizeof(limb) * 10);
-  memcpy(resultz, nqz, sizeof(limb) * 10);
+  memcpy(resultx, nqx, sizeof(int64_t) * 10);
+  memcpy(resultz, nqz, sizeof(int64_t) * 10);
 }
 
 static void
-crecip(limb *out, const limb *z) {
-  limb z2[10];
-  limb z9[10];
-  limb z11[10];
-  limb z2_5_0[10];
-  limb z2_10_0[10];
-  limb z2_20_0[10];
-  limb z2_50_0[10];
-  limb z2_100_0[10];
-  limb t0[10];
-  limb t1[10];
+crecip(int64_t *out, const int64_t *z)
+{
+  int64_t z2[10];
+  int64_t z9[10];
+  int64_t z11[10];
+  int64_t z2_5_0[10];
+  int64_t z2_10_0[10];
+  int64_t z2_20_0[10];
+  int64_t z2_50_0[10];
+  int64_t z2_100_0[10];
+  int64_t t0[10];
+  int64_t t1[10];
   int i;
 
   /* 2 */ fsquare(z2,z);
@@ -830,8 +857,12 @@
 }
 
 int
-curve25519_donna(u8 *mypublic, const u8 *secret, const u8 *basepoint) {
-  limb bp[10], x[10], z[11], zmone[10];
+curve25519_donna(
+        uint8_t *mypublic,
+        const uint8_t *secret,
+        const uint8_t *basepoint)
+{
+  int64_t bp[10], x[10], z[11], zmone[10];
   uint8_t e[32];
   int i;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/enchive-3.4/src/enchive.c 
new/enchive-3.5/src/enchive.c
--- old/enchive-3.4/src/enchive.c       2018-01-23 20:43:27.000000000 +0100
+++ new/enchive-3.5/src/enchive.c       2019-12-01 19:23:16.000000000 +0100
@@ -10,7 +10,7 @@
 #include "chacha.h"
 #include "optparse.h"
 
-int curve25519_donna(u8 *p, const u8 *s, const u8 *b);
+int curve25519_donna(uint8_t *p, const uint8_t *s, const uint8_t *b);
 
 /* Global options. */
 static char *global_pubkey = 0;
@@ -62,9 +62,10 @@
 {
     unsigned i;
     for (i = 0; i < sizeof(cleanup) / sizeof(*cleanup); i++) {
-        if (file == cleanup[i].file)
+        if (file == cleanup[i].file) {
             cleanup[i].file = 0;
-        return;
+            return;
+        }
     }
     abort();
 }
@@ -173,12 +174,12 @@
 /**
  * Read the protection key from a key agent identified by its IV.
  */
-static int agent_read(u8 *key, const u8 *id);
+static int agent_read(uint8_t *key, const uint8_t *id);
 
 /**
  * Serve the protection key on a key agent identified by its IV.
  */
-static int agent_run(const u8 *key, const u8 *id);
+static int agent_run(const uint8_t *key, const uint8_t *id);
 
 #if ENCHIVE_OPTION_AGENT
 #include <poll.h>
@@ -191,7 +192,7 @@
  * Fill ADDR with a unix domain socket name for the agent.
  */
 static int
-agent_addr(struct sockaddr_un *addr, const u8 *iv)
+agent_addr(struct sockaddr_un *addr, const uint8_t *iv)
 {
     char *dir = getenv("XDG_RUNTIME_DIR");
     if (!dir) {
@@ -212,7 +213,7 @@
 }
 
 static int
-agent_read(u8 *key, const u8 *iv)
+agent_read(uint8_t *key, const uint8_t *iv)
 {
     int success;
     struct sockaddr_un addr;
@@ -231,7 +232,7 @@
 }
 
 static int
-agent_run(const u8 *key, const u8 *iv)
+agent_run(const uint8_t *key, const uint8_t *iv)
 {
     struct pollfd pfd = {-1, POLLIN, 0};
     struct sockaddr_un addr;
@@ -301,7 +302,7 @@
 
 #else
 static int
-agent_read(u8 *key, const u8 *id)
+agent_read(uint8_t *key, const uint8_t *id)
 {
     (void)key;
     (void)id;
@@ -309,7 +310,7 @@
 }
 
 static int
-agent_run(const u8 *key, const u8 *id)
+agent_run(const uint8_t *key, const uint8_t *id)
 {
     (void)key;
     (void)id;
@@ -323,7 +324,7 @@
  */
 static char *storage_directory(char *file);
 
-#if defined(__unix__) || defined(__APPLE__)
+#if defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
 #include <dirent.h>
 #include <unistd.h>
 #include <sys/stat.h>
@@ -433,7 +434,7 @@
         buf[passlen - 1] = 0;
 }
 
-#if defined(__unix__) || defined(__APPLE__)
+#if defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
 #include <fcntl.h>
 #include <unistd.h>
 #include <termios.h>
@@ -606,7 +607,7 @@
  */
 static FILE *secure_creat(const char *file);
 
-#if defined(__unix__) || defined(__APPLE__)
+#if defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
 #include <unistd.h>
 
 static FILE *
@@ -631,10 +632,10 @@
  * All message data will go into the resulting context.
  */
 static void
-hmac_init(SHA256_CTX *ctx, const u8 *key)
+hmac_init(SHA256_CTX *ctx, const uint8_t *key)
 {
     int i;
-    u8 pad[SHA256_BLOCK_SIZE];
+    uint8_t pad[SHA256_BLOCK_SIZE];
     sha256_init(ctx);
     for (i = 0; i < SHA256_BLOCK_SIZE; i++)
         pad[i] = key[i] ^ 0x36U;
@@ -646,10 +647,10 @@
  * The key must be the same as used for initialization.
  */
 static void
-hmac_final(SHA256_CTX *ctx, const u8 *key, u8 *hash)
+hmac_final(SHA256_CTX *ctx, const uint8_t *key, uint8_t *hash)
 {
     int i;
-    u8 pad[SHA256_BLOCK_SIZE];
+    uint8_t pad[SHA256_BLOCK_SIZE];
     sha256_final(ctx, hash);
     sha256_init(ctx);
     for (i = 0; i < SHA256_BLOCK_SIZE; i++)
@@ -664,15 +665,15 @@
  * Optionally provide an 8-byte salt.
  */
 static void
-key_derive(const char *passphrase, u8 *buf, int iexp, const u8 *salt)
+key_derive(const char *passphrase, uint8_t *buf, int iexp, const uint8_t *salt)
 {
-    u8 salt32[SHA256_BLOCK_SIZE] = {0};
+    uint8_t salt32[SHA256_BLOCK_SIZE] = {0};
     SHA256_CTX ctx[1];
     unsigned long i;
     unsigned long memlen = 1UL << iexp;
     unsigned long mask = memlen - 1;
     unsigned long iterations = 1UL << (iexp - 5);
-    u8 *memory, *memptr, *p;
+    uint8_t *memory, *memptr, *p;
 
     memory = malloc(memlen + SHA256_BLOCK_SIZE);
     if (!memory)
@@ -681,7 +682,7 @@
     if (salt)
         memcpy(salt32, salt, 8);
     hmac_init(ctx, salt32);
-    sha256_update(ctx, (u8 *)passphrase, strlen(passphrase));
+    sha256_update(ctx, (uint8_t *)passphrase, strlen(passphrase));
     hmac_final(ctx, salt32, memory);
 
     for (p = memory + SHA256_BLOCK_SIZE;
@@ -715,7 +716,7 @@
  */
 static void secure_entropy(void *buf, size_t len);
 
-#if defined(__unix__) || defined(__APPLE__)
+#if defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
 static void
 secure_entropy(void *buf, size_t len)
 {
@@ -747,7 +748,7 @@
  * Generate a brand new Curve25519 secret key from system entropy.
  */
 static void
-generate_secret(u8 *s)
+generate_secret(uint8_t *s)
 {
     secure_entropy(s, 32);
     s[0] &= 248;
@@ -759,9 +760,9 @@
  * Generate a Curve25519 public key from a secret key.
  */
 static void
-compute_public(u8 *p, const u8 *s)
+compute_public(uint8_t *p, const uint8_t *s)
 {
-    static const u8 b[32] = {9};
+    static const uint8_t b[32] = {9};
     curve25519_donna(p, s, b);
 }
 
@@ -769,7 +770,7 @@
  * Compute a shared secret from our secret key and their public key.
  */
 static void
-compute_shared(u8 *sh, const u8 *s, const u8 *p)
+compute_shared(uint8_t *sh, const uint8_t *s, const uint8_t *p)
 {
     curve25519_donna(sh, s, p);
 }
@@ -778,10 +779,10 @@
  * Encrypt from file to file using key/iv, aborting on any error.
  */
 static void
-symmetric_encrypt(FILE *in, FILE *out, const u8 *key, const u8 *iv)
+symmetric_encrypt(FILE *in, FILE *out, const uint8_t *key, const uint8_t *iv)
 {
-    static u8 buffer[2][CHACHA_BLOCKLENGTH * 1024];
-    u8 mac[SHA256_BLOCK_SIZE];
+    static uint8_t buffer[2][CHACHA_BLOCKLENGTH * 1024];
+    uint8_t mac[SHA256_BLOCK_SIZE];
     SHA256_CTX hmac[1];
     chacha_ctx ctx[1];
 
@@ -797,7 +798,7 @@
             break;
         }
         sha256_update(hmac, buffer[0], z);
-        chacha_encrypt_bytes(ctx, buffer[0], buffer[1], z);
+        chacha_encrypt(ctx, buffer[0], buffer[1], z);
         if (!fwrite(buffer[1], z, 1, out))
             fatal("error writing ciphertext file");
         if (z < sizeof(buffer[0]))
@@ -816,10 +817,10 @@
  * Decrypt from file to file using key/iv, aborting on any error.
  */
 static void
-symmetric_decrypt(FILE *in, FILE *out, const u8 *key, const u8 *iv)
+symmetric_decrypt(FILE *in, FILE *out, const uint8_t *key, const uint8_t *iv)
 {
-    static u8 buffer[2][CHACHA_BLOCKLENGTH * 1024 + SHA256_BLOCK_SIZE];
-    u8 mac[SHA256_BLOCK_SIZE];
+    static uint8_t buffer[2][CHACHA_BLOCKLENGTH * 1024 + SHA256_BLOCK_SIZE];
+    uint8_t mac[SHA256_BLOCK_SIZE];
     SHA256_CTX hmac[1];
     chacha_ctx ctx[1];
 
@@ -836,14 +837,14 @@
     }
 
     for (;;) {
-        u8 *p = buffer[0] + SHA256_BLOCK_SIZE;
+        uint8_t *p = buffer[0] + SHA256_BLOCK_SIZE;
         size_t z = fread(p, 1, sizeof(buffer[0]) - SHA256_BLOCK_SIZE, in);
         if (!z) {
             if (ferror(in))
                 fatal("error reading ciphertext file");
             break;
         }
-        chacha_encrypt_bytes(ctx, buffer[0], buffer[1], z);
+        chacha_encrypt(ctx, buffer[0], buffer[1], z);
         sha256_update(hmac, buffer[1], z);
         if (!fwrite(buffer[1], z, 1, out))
             fatal("error writing plaintext file");
@@ -885,7 +886,7 @@
  * Dump the public key to a file, aborting on error.
  */
 static void
-write_pubkey(char *file, u8 *key)
+write_pubkey(char *file, uint8_t *key)
 {
     FILE *f = fopen(file, "wb");
     if (!f)
@@ -910,19 +911,19 @@
  * Write the secret key to a file, encrypting it if necessary.
  */
 static void
-write_seckey(char *file, const u8 *seckey, int iexp)
+write_seckey(char *file, const uint8_t *seckey, int iexp)
 {
     FILE *secfile;
     chacha_ctx cha[1];
     SHA256_CTX sha[1];
-    u8 buf[8 + 1 + 3 + 20 + 32] = {0}; /* entire file contents */
-    u8 protect[32];
+    uint8_t buf[8 + 1 + 3 + 20 + 32] = {0}; /* entire file contents */
+    uint8_t protect[32];
 
-    u8 *buf_iv           = buf + SECFILE_IV;
-    u8 *buf_iterations   = buf + SECFILE_ITERATIONS;
-    u8 *buf_version      = buf + SECFILE_VERSION;
-    u8 *buf_protect_hash = buf + SECFILE_PROTECT_HASH;
-    u8 *buf_seckey       = buf + SECFILE_SECKEY;
+    uint8_t *buf_iv           = buf + SECFILE_IV;
+    uint8_t *buf_iterations   = buf + SECFILE_ITERATIONS;
+    uint8_t *buf_version      = buf + SECFILE_VERSION;
+    uint8_t *buf_protect_hash = buf + SECFILE_PROTECT_HASH;
+    uint8_t *buf_seckey       = buf + SECFILE_SECKEY;
 
     buf_version[0] = ENCHIVE_FORMAT_VERSION;
 
@@ -930,15 +931,15 @@
         /* Prompt for a passphrase. */
         char pass[2][ENCHIVE_PASSPHRASE_MAX];
         get_passphrase(pass[0], sizeof(pass[0]),
-                       "passphrase (empty for none): ");
+                       "protection passphrase (empty for none): ");
         if (!pass[0][0]) {
             /* Nevermind. */
             iexp = 0;
         }  else {
             get_passphrase(pass[1], sizeof(pass[0]),
-                           "passphrase (repeat): ");
+                           "protection passphrase (repeat): ");
             if (strcmp(pass[0], pass[1]) != 0)
-                fatal("passphrases don't match");
+                fatal("protection passphrases don't match");
 
             /* Generate an IV to double as salt. */
             secure_entropy(buf_iv, 8);
@@ -956,7 +957,7 @@
         /* Encrypt using key derived from passphrase. */
         chacha_keysetup(cha, protect, 256);
         chacha_ivsetup(cha, buf_iv);
-        chacha_encrypt_bytes(cha, seckey, buf_seckey, 32);
+        chacha_encrypt(cha, seckey, buf_seckey, 32);
     } else {
         /* Copy key to output buffer. */
         memcpy(buf_seckey, seckey, 32);
@@ -977,7 +978,7 @@
  * Load the public key from the file.
  */
 static void
-load_pubkey(const char *file, u8 *key)
+load_pubkey(const char *file, uint8_t *key)
 {
     FILE *f = fopen(file, "rb");
     if (!f)
@@ -999,22 +1000,22 @@
  * necessary.
  */
 static void
-load_seckey(const char *file, u8 *seckey)
+load_seckey(const char *file, uint8_t *seckey)
 {
     FILE *secfile;
     chacha_ctx cha[1];
     SHA256_CTX sha[1];
-    u8 buf[8 + 4 + 20 + 32];            /* entire key file contents */
-    u8 protect[32];                     /* protection key */
-    u8 protect_hash[SHA256_BLOCK_SIZE]; /* hash of protection key */
+    uint8_t buf[8 + 4 + 20 + 32];            /* entire key file contents */
+    uint8_t protect[32];                     /* protection key */
+    uint8_t protect_hash[SHA256_BLOCK_SIZE]; /* hash of protection key */
     int iexp;
     int version;
 
-    u8 *buf_iv           = buf + SECFILE_IV;
-    u8 *buf_iterations   = buf + SECFILE_ITERATIONS;
-    u8 *buf_version      = buf + SECFILE_VERSION;
-    u8 *buf_protect_hash = buf + SECFILE_PROTECT_HASH;
-    u8 *buf_seckey       = buf + SECFILE_SECKEY;
+    uint8_t *buf_iv           = buf + SECFILE_IV;
+    uint8_t *buf_iterations   = buf + SECFILE_ITERATIONS;
+    uint8_t *buf_version      = buf + SECFILE_VERSION;
+    uint8_t *buf_protect_hash = buf + SECFILE_PROTECT_HASH;
+    uint8_t *buf_seckey       = buf + SECFILE_SECKEY;
 
     /* Read the entire file into buf. */
     secfile = fopen(file, "rb");
@@ -1063,7 +1064,7 @@
         /* Decrypt the key into the output. */
         chacha_keysetup(cha, protect, 256);
         chacha_ivsetup(cha, buf_iv);
-        chacha_encrypt_bytes(cha, buf_seckey, seckey, 32);
+        chacha_encrypt(cha, buf_seckey, seckey, 32);
     } else {
         /* Key is unencrypted, copy into output. */
         memcpy(seckey, buf_seckey, 32);
@@ -1088,10 +1089,10 @@
  * Print a nice fingerprint of a key.
  */
 static void
-print_fingerprint(const u8 *key)
+print_fingerprint(const uint8_t *key)
 {
     int i;
-    u8 hash[32];
+    uint8_t hash[32];
     SHA256_CTX sha[1];
 
     sha256_init(sha);
@@ -1128,8 +1129,9 @@
 {
     int found = COMMAND_UNKNOWN;
     size_t len = strlen(command);
+    int ncommands = sizeof(command_names) / sizeof(*command_names);
     int i;
-    for (i = 0; i < 5; i++) {
+    for (i = 0; i < ncommands; i++) {
         if (strncmp(command, command_names[i], len) == 0) {
             if (found >= 0)
                 return COMMAND_AMBIGUOUS;
@@ -1149,6 +1151,7 @@
         {"fingerprint", 'i', OPTPARSE_NONE},
         {"iterations",  'k', OPTPARSE_REQUIRED},
         {"plain",       'u', OPTPARSE_NONE},
+        {"repeats",     'r', OPTPARSE_REQUIRED},
         {0, 0, 0}
     };
 
@@ -1156,13 +1159,14 @@
     char *secfile = dupstr(global_seckey);
     int pubfile_exists;
     int secfile_exists;
-    u8 public[32];
-    u8 secret[32];
+    uint8_t public[32];
+    uint8_t secret[32];
     int clobber = 0;
     int derive = 0;
     int edit = 0;
     int protect = 1;
     int fingerprint = 0;
+    int repeats = 1;
     int key_derive_iterations = ENCHIVE_KEY_DERIVE_ITERATIONS;
     int seckey_derive_iterations = ENCHIVE_SECKEY_DERIVE_ITERATIONS;
 
@@ -1207,6 +1211,16 @@
                           arg);
                 key_derive_iterations = n;
             } break;
+            case 'r': {
+                char *p;
+                char *arg = options->optarg;
+                long n;
+                errno = 0;
+                n = strtol(arg, &p, 10);
+                if (errno || *p || n < 0 || n >= 256)
+                    fatal("invalid --repeats (-r) -- %s", arg);
+                repeats = n;
+            } break;
             case 'u':
                 protect = 0;
                 break;
@@ -1241,10 +1255,12 @@
         char pass[2][ENCHIVE_PASSPHRASE_MAX];
         get_passphrase(pass[0], sizeof(pass[0]),
                        "secret key passphrase: ");
-        get_passphrase(pass[1], sizeof(pass[0]),
-                       "secret key passphrase (repeat): ");
-        if (strcmp(pass[0], pass[1]) != 0)
-            fatal("passphrases don't match");
+        while (repeats--) {
+            get_passphrase(pass[1], sizeof(pass[0]),
+                           "secret key passphrase (repeat): ");
+            if (strcmp(pass[0], pass[1]) != 0)
+                fatal("secret key passphrases don't match");
+        }
         key_derive(pass[0], secret, seckey_derive_iterations, 0);
         secret[0] &= 248;
         secret[31] &= 127;
@@ -1274,7 +1290,7 @@
     };
 
     char *pubfile = dupstr(global_pubkey);
-    u8 public[32];
+    uint8_t public[32];
 
     int option;
     while ((option = optparse_long(options, fingerprint, 0)) != -1) {
@@ -1310,11 +1326,11 @@
     int delete = 0;
 
     /* Workspace */
-    u8 public[32];
-    u8 esecret[32];
-    u8 epublic[32];
-    u8 shared[32];
-    u8 iv[SHA256_BLOCK_SIZE];
+    uint8_t public[32];
+    uint8_t esecret[32];
+    uint8_t epublic[32];
+    uint8_t shared[32];
+    uint8_t iv[SHA256_BLOCK_SIZE];
     SHA256_CTX sha[1];
 
     int option;
@@ -1400,11 +1416,11 @@
 
     /* Workspace */
     SHA256_CTX sha[1];
-    u8 secret[32];
-    u8 epublic[32];
-    u8 shared[32];
-    u8 iv[8];
-    u8 check_iv[SHA256_BLOCK_SIZE];
+    uint8_t secret[32];
+    uint8_t epublic[32];
+    uint8_t shared[32];
+    uint8_t iv[8];
+    uint8_t check_iv[SHA256_BLOCK_SIZE];
 
     int option;
     while ((option = optparse_long(options, extract, 0)) != -1) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/enchive-3.4/src/sha256.c new/enchive-3.5/src/sha256.c
--- old/enchive-3.4/src/sha256.c        2018-01-23 20:43:27.000000000 +0100
+++ new/enchive-3.5/src/sha256.c        2019-12-01 19:23:16.000000000 +0100
@@ -29,7 +29,7 @@
 #define SIG1(x) (ROTRIGHT(x,17) ^ ROTRIGHT(x,19) ^ ((x) >> 10))
 
 /**************************** VARIABLES *****************************/
-static const u32 k[64] = {
+static const uint32_t k[64] = {
        
0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,
        
0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,
        
0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,
@@ -41,9 +41,9 @@
 };
 
 /*********************** FUNCTION DEFINITIONS ***********************/
-void sha256_transform(SHA256_CTX *ctx, const u8 data[])
+void sha256_transform(SHA256_CTX *ctx, const uint8_t data[])
 {
-       u32 a, b, c, d, e, f, g, h, i, j, t1, t2, m[64];
+       uint32_t a, b, c, d, e, f, g, h, i, j, t1, t2, m[64];
 
        for (i = 0, j = 0; i < 16; ++i, j += 4)
                m[i] = (data[j] << 24) | (data[j + 1] << 16) | (data[j + 2] << 
8) | (data[j + 3]);
@@ -96,9 +96,9 @@
        ctx->state[7] = 0x5be0cd19;
 }
 
-void sha256_update(SHA256_CTX *ctx, const u8 data[], size_t len)
+void sha256_update(SHA256_CTX *ctx, const uint8_t data[], size_t len)
 {
-       u32 i;
+       uint32_t i;
 
        for (i = 0; i < len; ++i) {
                ctx->data[ctx->datalen] = data[i];
@@ -111,9 +111,9 @@
        }
 }
 
-void sha256_final(SHA256_CTX *ctx, u8 hash[])
+void sha256_final(SHA256_CTX *ctx, uint8_t hash[])
 {
-       u32 i;
+       uint32_t i;
 
        i = ctx->datalen;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/enchive-3.4/src/sha256.h new/enchive-3.5/src/sha256.h
--- old/enchive-3.4/src/sha256.h        2018-01-23 20:43:27.000000000 +0100
+++ new/enchive-3.5/src/sha256.h        2019-12-01 19:23:16.000000000 +0100
@@ -15,15 +15,15 @@
 #define SHA256_BLOCK_SIZE 32
 
 typedef struct {
-       u8 data[64];
-       u32 datalen;
-       u64 bitlen;
-       u32 state[8];
+       uint8_t data[64];
+       uint32_t datalen;
+       uint64_t bitlen;
+       uint32_t state[8];
 } SHA256_CTX;
 
 void sha256_init(SHA256_CTX *ctx);
-void sha256_update(SHA256_CTX *ctx, const u8 data[], size_t len);
-void sha256_final(SHA256_CTX *ctx, u8 hash[]);
+void sha256_update(SHA256_CTX *ctx, const uint8_t data[], size_t len);
+void sha256_final(SHA256_CTX *ctx, uint8_t hash[]);
 
 #endif /* SHA256_H */
 


Reply via email to