PostgreSQL Source Code  git master
sha1_int.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * sha1_int.h
4  * Internal headers for fallback implementation of SHA1
5  *
6  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * IDENTIFICATION
10  * src/common/sha1_int.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 
15 /* $KAME: sha1.h,v 1.4 2000/02/22 14:01:18 itojun Exp $ */
16 
17 /*
18  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
19  * All rights reserved.
20  *
21  * Redistribution and use in source and binary forms, with or without
22  * modification, are permitted provided that the following conditions
23  * are met:
24  * 1. Redistributions of source code must retain the above copyright
25  * notice, this list of conditions and the following disclaimer.
26  * 2. Redistributions in binary form must reproduce the above copyright
27  * notice, this list of conditions and the following disclaimer in the
28  * documentation and/or other materials provided with the distribution.
29  * 3. Neither the name of the project nor the names of its contributors
30  * may be used to endorse or promote products derived from this software
31  * without specific prior written permission.
32  *
33  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
34  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
35  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
36  * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
37  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
38  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
39  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
41  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
42  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
43  * SUCH DAMAGE.
44  */
45 /*
46  * FIPS pub 180-1: Secure Hash Algorithm (SHA-1)
47  * based on: http://www.itl.nist.gov/fipspubs/fip180-1.htm
48  * implemented by Jun-ichiro itojun Itoh <itojun@itojun.org>
49  */
50 
51 #ifndef PG_SHA1_INT_H
52 #define PG_SHA1_INT_H
53 
54 #include "common/sha1.h"
55 
56 typedef struct
57 {
58  union
59  {
60  uint8 b8[20];
61  uint32 b32[5];
62  } h;
63  union
64  {
65  uint8 b8[8];
66  uint64 b64[1];
67  } c;
68  union
69  {
70  uint8 b8[64];
71  uint32 b32[16];
72  } m;
74 } pg_sha1_ctx;
75 
76 /* Interface routines for SHA1 */
77 extern void pg_sha1_init(pg_sha1_ctx *ctx);
78 extern void pg_sha1_update(pg_sha1_ctx *ctx, const uint8 *data, size_t len);
79 extern void pg_sha1_final(pg_sha1_ctx *ctx, uint8 *dest);
80 
81 #endif /* PG_SHA1_INT_H */
uint8_t uint8
Definition: c.h:483
uint64_t uint64
Definition: c.h:486
uint32_t uint32
Definition: c.h:485
const void size_t len
const void * data
char * c
void pg_sha1_update(pg_sha1_ctx *ctx, const uint8 *data, size_t len)
Definition: sha1.c:332
void pg_sha1_init(pg_sha1_ctx *ctx)
Definition: sha1.c:316
void pg_sha1_final(pg_sha1_ctx *ctx, uint8 *dest)
Definition: sha1.c:365
uint8 count
Definition: sha1_int.h:73