Fix indentation in twophase.c
[pgsql.git] / src / common / sha2_int.h
blob954e5d78dcc5c28a05119642840e5d823b4d48db
1 /*-------------------------------------------------------------------------
3 * sha2_int.h
4 * Internal headers for fallback implementation of SHA{224,256,384,512}
6 * Portions Copyright (c) 2016-2023, PostgreSQL Global Development Group
8 * IDENTIFICATION
9 * src/common/sha2_int.h
11 *-------------------------------------------------------------------------
14 /* $OpenBSD: sha2.h,v 1.2 2004/04/28 23:11:57 millert Exp $ */
17 * FILE: sha2.h
18 * AUTHOR: Aaron D. Gifford <me@aarongifford.com>
20 * Copyright (c) 2000-2001, Aaron D. Gifford
21 * All rights reserved.
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the above copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. Neither the name of the copyright holder nor the names of contributors
32 * may be used to endorse or promote products derived from this software
33 * without specific prior written permission.
35 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND
36 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
38 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE
39 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
40 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
41 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
42 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
43 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
44 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
45 * SUCH DAMAGE.
47 * $From: sha2.h,v 1.1 2001/11/08 00:02:01 adg Exp adg $
50 #ifndef PG_SHA2_INT_H
51 #define PG_SHA2_INT_H
53 #include "common/sha2.h"
55 typedef struct pg_sha256_ctx
57 uint32 state[8];
58 uint64 bitcount;
59 uint8 buffer[PG_SHA256_BLOCK_LENGTH];
60 } pg_sha256_ctx;
61 typedef struct pg_sha512_ctx
63 uint64 state[8];
64 uint64 bitcount[2];
65 uint8 buffer[PG_SHA512_BLOCK_LENGTH];
66 } pg_sha512_ctx;
67 typedef struct pg_sha256_ctx pg_sha224_ctx;
68 typedef struct pg_sha512_ctx pg_sha384_ctx;
70 /* Interface routines for SHA224/256/384/512 */
71 extern void pg_sha224_init(pg_sha224_ctx *ctx);
72 extern void pg_sha224_update(pg_sha224_ctx *ctx, const uint8 *input0,
73 size_t len);
74 extern void pg_sha224_final(pg_sha224_ctx *ctx, uint8 *dest);
76 extern void pg_sha256_init(pg_sha256_ctx *ctx);
77 extern void pg_sha256_update(pg_sha256_ctx *ctx, const uint8 *input0,
78 size_t len);
79 extern void pg_sha256_final(pg_sha256_ctx *ctx, uint8 *dest);
81 extern void pg_sha384_init(pg_sha384_ctx *ctx);
82 extern void pg_sha384_update(pg_sha384_ctx *ctx,
83 const uint8 *, size_t len);
84 extern void pg_sha384_final(pg_sha384_ctx *ctx, uint8 *dest);
86 extern void pg_sha512_init(pg_sha512_ctx *ctx);
87 extern void pg_sha512_update(pg_sha512_ctx *ctx, const uint8 *input0,
88 size_t len);
89 extern void pg_sha512_final(pg_sha512_ctx *ctx, uint8 *dest);
91 #endif /* PG_SHA2_INT_H */