commit fe9f87887380dd21504bc482b245398ae9be0d1a
parent 7da9e6101622a5682c04733dcf7f3ff849bcb9bf
Author: sin <sin@2f30.org>
Date: Sun, 12 May 2019 10:18:57 +0100
Rename {load,save}key to {read,write}key
Diffstat:
9 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/dup-check.c b/dup-check.c
@@ -50,8 +50,8 @@ initkey(char *keyfile)
fd = open(keyfile, O_RDONLY);
if (fd < 0)
err(1, "open: %s", keyfile);
- if (loadkey(fd, param.key, sizeof(param.key)) < 0)
- errx(1, "loadkey: failed");
+ if (readkey(fd, param.key, sizeof(param.key)) < 0)
+ errx(1, "readkey: failed");
param.keyloaded = 1;
if (close(fd) < 0)
err(1, "close: %s", keyfile);
diff --git a/dup-gc.c b/dup-gc.c
@@ -48,8 +48,8 @@ initkey(char *keyfile)
fd = open(keyfile, O_RDONLY);
if (fd < 0)
err(1, "open: %s", keyfile);
- if (loadkey(fd, param.key, sizeof(param.key)) < 0)
- errx(1, "loadkey: failed");
+ if (readkey(fd, param.key, sizeof(param.key)) < 0)
+ errx(1, "readkey: failed");
param.keyloaded = 1;
if (close(fd) < 0)
err(1, "close: %s", keyfile);
diff --git a/dup-init.c b/dup-init.c
@@ -49,8 +49,8 @@ initkey(char *keyfile)
fd = open(keyfile, O_RDONLY);
if (fd < 0)
err(1, "open: %s", keyfile);
- if (loadkey(fd, param.key, sizeof(param.key)) < 0)
- errx(1, "loadkey: failed");
+ if (readkey(fd, param.key, sizeof(param.key)) < 0)
+ errx(1, "readkey: failed");
param.keyloaded = 1;
if (close(fd) < 0)
err(1, "close: %s", keyfile);
diff --git a/dup-keygen.c b/dup-keygen.c
@@ -45,8 +45,8 @@ main(int argc, char *argv[])
err(1, "open: %s", argv[0]);
if (keygen(key, sizeof(key)) < 0)
errx(1, "keygen: failed");
- if (savekey(fd, key, sizeof(key)) < 0)
- errx(1, "savekey: failed");
+ if (writekey(fd, key, sizeof(key)) < 0)
+ errx(1, "writekey: failed");
fsync(fd);
if (close(fd) < 0)
err(1, "close: %s", argv[0]);
diff --git a/dup-pack.c b/dup-pack.c
@@ -49,8 +49,8 @@ initkey(char *keyfile)
fd = open(keyfile, O_RDONLY);
if (fd < 0)
err(1, "open: %s", keyfile);
- if (loadkey(fd, param.key, sizeof(param.key)) < 0)
- errx(1, "loadkey: failed");
+ if (readkey(fd, param.key, sizeof(param.key)) < 0)
+ errx(1, "readkey: failed");
param.keyloaded = 1;
if (close(fd) < 0)
err(1, "close: %s", keyfile);
diff --git a/dup-rm.c b/dup-rm.c
@@ -48,8 +48,8 @@ initkey(char *keyfile)
fd = open(keyfile, O_RDONLY);
if (fd < 0)
err(1, "open: %s", keyfile);
- if (loadkey(fd, param.key, sizeof(param.key)) < 0)
- errx(1, "loadkey: failed");
+ if (readkey(fd, param.key, sizeof(param.key)) < 0)
+ errx(1, "readkey: failed");
param.keyloaded = 1;
if (close(fd) < 0)
err(1, "close: %s", keyfile);
diff --git a/dup-unpack.c b/dup-unpack.c
@@ -49,8 +49,8 @@ initkey(char *keyfile)
fd = open(keyfile, O_RDONLY);
if (fd < 0)
err(1, "open: %s", keyfile);
- if (loadkey(fd, param.key, sizeof(param.key)) < 0)
- errx(1, "loadkey: failed");
+ if (readkey(fd, param.key, sizeof(param.key)) < 0)
+ errx(1, "readkey: failed");
param.keyloaded = 1;
if (close(fd) < 0)
err(1, "close: %s", keyfile);
diff --git a/key.c b/key.c
@@ -19,7 +19,7 @@ keygen(unsigned char *key, size_t n)
}
int
-savekey(int fd, unsigned char *key, size_t n)
+writekey(int fd, unsigned char *key, size_t n)
{
assert(KEYSIZE == crypto_aead_xchacha20poly1305_ietf_KEYBYTES);
if (n != KEYSIZE)
@@ -30,7 +30,7 @@ savekey(int fd, unsigned char *key, size_t n)
}
int
-loadkey(int fd, unsigned char *key, size_t n)
+readkey(int fd, unsigned char *key, size_t n)
{
assert(KEYSIZE == crypto_aead_xchacha20poly1305_ietf_KEYBYTES);
if (n != KEYSIZE)
diff --git a/key.h b/key.h
@@ -1,3 +1,3 @@
extern int keygen(unsigned char *, size_t);
-extern int savekey(int fd, unsigned char *, size_t);
-extern int loadkey(int fd, unsigned char *, size_t);
+extern int writekey(int fd, unsigned char *, size_t);
+extern int readkey(int fd, unsigned char *, size_t);