commit 877bf7ca5529c15deba0714df94d534e1e25e430
parent eba08d1ff6618f1b3277dea6990a0afde7a0bc11
Author: sin <sin@2f30.org>
Date: Sun, 19 May 2019 19:56:56 +0300
Initialize sodium before generating random bytes
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dup-init.c b/dup-init.c
@@ -108,6 +108,9 @@ main(int argc, char *argv[])
usage();
};
+ if (sodium_init() < 0)
+ errx(1, "sodium_init: failed");
+
if (strcasecmp(param.ealgo, "none") == 0) {
param.seed = 0;
} else if (strcasecmp(param.ealgo, "XChaCha20-Poly1305") == 0) {
@@ -116,9 +119,6 @@ main(int argc, char *argv[])
param.seed = randombytes_uniform(0xffffffff);
}
- if (sodium_init() < 0)
- errx(1, "sodium_init: failed");
-
if (snprintf(spath, sizeof(spath), "%s/%s",
repo, ARCHIVEPATH) >= sizeof(spath))
errx(1, "snprintf: %s: path too long", spath);