sigchk

sign and check files using ed25519
git clone git://z3bra.org/sick
Log | Files | Refs | Submodules | README | LICENSE

commit f94d4e87ddf859286ec5bffb6ff9b1d4fadc4e8b
parent fe15d474478f90ff330ce50b699b034a6f03fdba
Author: z3bra <willyatmailoodotorg>
Date:   Tue May  3 08:26:35 2016

Rename check_magic() to is_signed()

Diffstat:
 sick.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/sick.c b/sick.c @@ -29,11 +29,9 @@ enum { ACTION_DEFAULT = ACTION_CHECK }; - void usage(); - char *base_name(char *path); -int check_magic(const char *file); +int is_signed(const char *file); unsigned char *read_sig(const char *file); int unsign(const char *file); int keygen(const char *alias); @@ -41,7 +39,7 @@ int sign(const char *file, const char *key); int verify(const char *file, const char *key); int check(const char *file, char *keyring); -char *argv0 = NULL; +char *argv0; int verbose = 0; void @@ -59,7 +57,7 @@ base_name(char *path) } int -check_magic(const char *file) +is_signed(const char *file) { int fd = 0, is_magic = -1; struct stat sb; @@ -128,7 +126,7 @@ unsign(const char *file) size_t len = 0; struct stat sb; - if (check_magic(file)) { + if (is_signed(file) != 0) { return -1; } @@ -305,7 +303,7 @@ check(const char *file, char *keyring) struct dirent *dt = NULL; char path[PATH_MAX]; - if (check_magic(file) != 0) + if (is_signed(file) != 0) { return -1; } @@ -387,8 +385,7 @@ main(int argc, char **argv) unsign(*argv); break; case ACTION_SIGN: - /* TODO: only check the pubkey matchng the private */ - if (check_magic(*argv) != 0) { + if (is_signed(*argv) != 0) { sign(*argv, key ? key : DEFAULT_ALIAS ".key"); } else { fprintf(stderr, "%s: Already signed\n", *argv);