Remove building with NOCRYPTO option
[minix.git] / crypto / external / bsd / openssl / lib / libcrypto / libc-sha512.c
blob5d6909d4d07d6f51a9a30e036bab209163896e7f
1 /*
2 * Special version of sha512.c that uses the libc SHA512 implementation
3 * of libc.
4 */
6 /* crypto/sha/sha512.c */
7 /* ====================================================================
8 * Copyright (c) 2004 The OpenSSL Project. All rights reserved
9 * according to the OpenSSL license [found in ../../LICENSE].
10 * ====================================================================
12 #include <openssl/opensslconf.h>
14 #include <stdlib.h>
15 #include <string.h>
17 #include <openssl/crypto.h>
18 #include <openssl/sha.h>
19 #include <openssl/opensslv.h>
21 #include "cryptlib.h"
23 const char SHA512_version[]="SHA-512" OPENSSL_VERSION_PTEXT;
25 unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md)
27 SHA512_CTX c;
28 static unsigned char m[SHA384_DIGEST_LENGTH];
30 if (md == NULL) md=m;
31 SHA384_Init(&c);
32 SHA384_Update(&c,d,n);
33 SHA384_Final(md,&c);
34 OPENSSL_cleanse(&c,sizeof(c));
35 return(md);
38 unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md)
40 SHA512_CTX c;
41 static unsigned char m[SHA512_DIGEST_LENGTH];
43 if (md == NULL) md=m;
44 SHA512_Init(&c);
45 SHA512_Update(&c,d,n);
46 SHA512_Final(md,&c);
47 OPENSSL_cleanse(&c,sizeof(c));
48 return(md);