URI: 
       tWrite master salt outside writepass() - safe - password protected secret keeper
  HTML git clone git://git.z3bra.org/safe.git
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 788fd208467d17a169a655453b20510ba6245cfb
   DIR parent 5629cc83838f9cf85f53828e1f45cd6244abab58
  HTML Author: Willy Goiffon <dev@z3bra.org>
       Date:   Wed,  5 Jun 2019 18:10:43 +0200
       
       Write master salt outside writepass()
       
       Diffstat:
         M safe.c                              |       2 +-
       
       1 file changed, 1 insertion(+), 1 deletion(-)
       ---
   DIR diff --git a/safe.c b/safe.c
       t@@ -280,7 +280,6 @@ writepass(struct safe *s, uint8_t *m, size_t mlen, int fd)
                if (crypto_secretstream_xchacha20poly1305_push(&st, c, &clen, m, mlen, NULL, 0, crypto_secretstream_xchacha20poly1305_TAG_FINAL))
                        return -1;
        
       -        xwrite(fd, s->salt, sizeof(s->salt));
                xwrite(fd, h, sizeof(h));
                xwrite(fd, c, clen);
        
       t@@ -396,6 +395,7 @@ main(int argc, char *argv[])
                } else {
                        randombytes_buf(s.salt, sizeof(s.salt));
                        deriv((char *)passphrase, &s);
       +                xwrite(fd, s.salt, sizeof(s.salt));
                        writepass(&s, passphrase, pplen, fd);
                        close(fd);
                }