tcrypto_api.c - sick - sign and check files using ed25519
 (HTM) git clone git://z3bra.org/sick
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       tcrypto_api.c (535B)
       ---
            1 /*
            2  * Public domain. Author: Ted Unangst <tedu@openbsd.org>
            3  * API compatible reimplementation of functions from nacl
            4  */
            5 #include <sys/types.h>
            6 
            7 #include <string.h>
            8 #include "sha512.h"
            9 
           10 #include "crypto_api.h"
           11 
           12 extern int timingsafe_bcmp(const void *b1, const void *b2, size_t n);
           13 
           14 int
           15 crypto_hash_sha512(unsigned char *out, const unsigned char *in,
           16     unsigned long long inlen)
           17 {
           18         return sha512(in, inlen, out);
           19 }
           20 
           21 int
           22 crypto_verify_32(const unsigned char *x, const unsigned char *y)
           23 {
           24         return timingsafe_bcmp(x, y, 32) ? -1 : 0;
           25 }