tcheck() verifies the signature of the message - sick - sign and check files using ed25519
 (HTM) git clone git://z3bra.org/sick
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 7ecf401609eb89626e79c80bd037e529e5f33511
 (DIR) parent f25a0ec2408627875aea874ec4384e1cc0ad0d2e
 (HTM) Author: z3bra <willyatmailoodotorg>
       Date:   Sun, 15 May 2016 19:37:43 +0200
       
       check() verifies the signature of the message
       
       Diffstat:
         M sick.c                              |      28 ++++++++++++++++++++++++++++
       
       1 file changed, 28 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/sick.c b/sick.c
       t@@ -23,6 +23,7 @@ static size_t extractmsg(unsigned char *msg[], char *buf);
        static size_t extractsig(unsigned char *sig[], char *buf);
        static int createkeypair(const char *);
        static int sign(FILE *fp, FILE *key);
       +static int check(FILE *fp, FILE *key);
        
        static int verbose = 0;
        char *argv0;
       t@@ -203,6 +204,33 @@ sign(FILE *fp, FILE *key)
                return 0;
        }
        
       +static int
       +check(FILE *fp, FILE *key)
       +{
       +        int ret = 0;
       +        size_t len;
       +        char *buf = NULL;
       +        unsigned char *sig, *msg, pub[32];
       +
       +        if (fread(pub, 1, 32, key) < 32)
       +                return -1;
       +
       +        len = bufferize(&buf, fp);
       +        if (len == 0)
       +                return -1;
       +
       +        if (extractsig(&sig, buf)) {
       +                len = extractmsg(&msg, buf);
       +                ret = ed25519_verify(sig, msg, len, pub);
       +                free(msg);
       +        }
       +
       +        free(buf);
       +        free(sig);
       +
       +        return !ret;
       +}
       +
        int
        main(int argc, char *argv[])
        {