1 /* Copyright (C) 2001-2019 Artifex Software, Inc.
2    All Rights Reserved.
3 
4    This software is provided AS-IS with no warranty, either express or
5    implied.
6 
7    This software is distributed under license and may not be copied,
8    modified or distributed except as expressly authorized under the terms
9    of the license contained in the file LICENSE in this distribution.
10 
11    Refer to licensing information at http://www.artifex.com or contact
12    Artifex Software, Inc.,  1305 Grant Avenue - Suite 200, Novato,
13    CA 94945, U.S.A., +1(415)492-9861, for further information.
14 */
15 
16 
17 /* Definitions for SHA256Encode filter */
18 /* Requires scommon.h; strimpl.h if any templates are referenced */
19 
20 #ifndef ssha2_INCLUDED
21 #  define ssha2_INCLUDED
22 
23 #include "sha2.h"
24 #include "scommon.h"
25 
26 /*
27  * The SHA256Encode filter accepts an arbitrary amount of input data,
28  * and then, when closed, emits the 32-byte SHA-256 digest.
29  */
30 typedef struct stream_SHA256E_state_s {
31     stream_state_common;
32     SHA256_CTX sha256;
33 } stream_SHA256E_state;
34 
35 #define private_st_SHA256E_state()	/* in ssha2.c */\
36   gs_private_st_simple(st_SHA256E_state, stream_SHA256E_state,\
37     "SHA256Encode state")
38 extern const stream_template s_SHA256E_template;
39 
40 stream *s_SHA256E_make_stream(gs_memory_t *mem, byte *digest, int digest_size);
41 
42 #endif /* ssha2_INCLUDED */
43