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
12 #ifndef __OSSL_SHA_H__
13 #define __OSSL_SHA_H__
16 * This is always included last which permits the namespace hacks below
19 #define SHA256_CTX OSSL_SHA256_CTX
20 #define SHA512_CTX OSSL_SHA512_CTX
22 /* From include/openssl/sha.h */
23 # define SHA_LONG unsigned int
25 # define SHA_LBLOCK 16
26 # define SHA_CBLOCK (SHA_LBLOCK*4)/* SHA treats input data as a
27 * contiguous array of 32 bit wide
28 * big-endian values. */
30 typedef struct SHAstate_st {
31 SHA_LONG h0, h1, h2, h3, h4;
33 SHA_LONG data[SHA_LBLOCK];
37 # define SHA256_CBLOCK (SHA_LBLOCK*4)/* SHA-256 treats input data as a
38 * contiguous array of 32 bit wide
39 * big-endian values. */
41 typedef struct SHA256state_st {
44 SHA_LONG data[SHA_LBLOCK];
45 unsigned int num, md_len;
49 * SHA-512 treats input data as a
50 * contiguous array of 64 bit
51 * wide big-endian values.
53 # define SHA512_CBLOCK (SHA_LBLOCK*8)
55 # define SHA_LONG64 unsigned long long
56 # define U64(C) C##ULL
58 typedef struct SHA512state_st {
62 SHA_LONG64 d[SHA_LBLOCK];
63 unsigned char p[SHA512_CBLOCK];
65 unsigned int num, md_len;
68 #endif /* !__OSSL_SHA_H__ */