Annotation of src/usr.bin/signify/crypto_api.c, Revision 1.1
1.1 ! tedu 1: /* $OpenBSD$ */
! 2: /*
! 3: * Public domain. Author: Ted Unangst <tedu@openbsd.org>
! 4: * API compatible reimplementation of functions from nacl
! 5: */
! 6: #include <sys/types.h>
! 7:
! 8: #include <string.h>
! 9: #include <sha2.h>
! 10:
! 11: #include "crypto_api.h"
! 12:
! 13: int
! 14: crypto_hash_sha512(unsigned char *out, const unsigned char *in,
! 15: unsigned long long inlen)
! 16: {
! 17: SHA2_CTX ctx;
! 18:
! 19: SHA512Init(&ctx);
! 20: SHA512Update(&ctx, in, inlen);
! 21: SHA512Final(out, &ctx);
! 22: return 0;
! 23: }
! 24:
! 25: int
! 26: crypto_verify_32(const unsigned char *x, const unsigned char *y)
! 27: {
! 28: return timingsafe_bcmp(x, y, 32) ? -1 : 0;
! 29: }