2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #ifndef __OSSL_SHA_H__
11 #define __OSSL_SHA_H__
14 * This is always included last which permits the namespace hacks below
17 #define SHA256_CTX OSSL_SHA256_CTX
18 #define SHA512_CTX OSSL_SHA512_CTX
20 /* From include/openssl/sha.h */
21 # define SHA_LONG unsigned int
23 # define SHA_LBLOCK 16
24 # define SHA_CBLOCK (SHA_LBLOCK*4)/* SHA treats input data as a
25 * contiguous array of 32 bit wide
26 * big-endian values. */
28 typedef struct SHAstate_st {
29 SHA_LONG h0, h1, h2, h3, h4;
31 SHA_LONG data[SHA_LBLOCK];
35 # define SHA256_CBLOCK (SHA_LBLOCK*4)/* SHA-256 treats input data as a
36 * contiguous array of 32 bit wide
37 * big-endian values. */
39 typedef struct SHA256state_st {
42 SHA_LONG data[SHA_LBLOCK];
43 unsigned int num, md_len;
47 * SHA-512 treats input data as a
48 * contiguous array of 64 bit
49 * wide big-endian values.
51 # define SHA512_CBLOCK (SHA_LBLOCK*8)
53 # define SHA_LONG64 unsigned long long
54 # define U64(C) C##ULL
56 typedef struct SHA512state_st {
60 SHA_LONG64 d[SHA_LBLOCK];
61 unsigned char p[SHA512_CBLOCK];
63 unsigned int num, md_len;
66 #endif /* !__OSSL_SHA_H__ */