libcoap 4.3.5-develop-19cef11
coap_sha1_internal.h
Go to the documentation of this file.
1/*
2 * coap_sha1_internal.h
3 *
4 * Full Copyright Statement RFC3174
5 *
6 * =======================================================================
7 *
8 * Copyright (C) The Internet Society (2001). All Rights Reserved.
9 *
10 * This document and translations of it may be copied and furnished to
11 * others, and derivative works that comment on or otherwise explain it
12 * or assist in its implementation may be prepared, copied, published
13 * and distributed, in whole or in part, without restriction of any
14 * kind, provided that the above copyright notice and this paragraph are
15 * included on all such copies and derivative works. However, this
16 * document itself may not be modified in any way, such as by removing
17 * the copyright notice or references to the Internet Society or other
18 * Internet organizations, except as needed for the purpose of
19 * developing Internet standards in which case the procedures for
20 * copyrights defined in the Internet Standards process must be
21 * followed, or as required to translate it into languages other than
22 * English.
23 *
24 * The limited permissions granted above are perpetual and will not be
25 * revoked by the Internet Society or its successors or assigns.
26 *
27 * This document and the information contained herein is provided on an
28 * "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
29 * TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
30 * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
31 * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
32 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
33 *
34 * =======================================================================
35 *
36 * Description:
37 * This is the header file for code which implements the Secure
38 * Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
39 * April 17, 1995.
40 *
41 * Many of the variable names in this code, especially the
42 * single character names, were used because those were the names
43 * used in the publication.
44 *
45 * Please read the file sha1.c for more information.
46 *
47 * Taken from https://datatracker.ietf.org/doc/html/rfc3174#section-7.1
48 * Reformatted as appropriate.
49 *
50 */
51
52#ifndef COAP_SHA1_INTERNAL_H_
53#define COAP_SHA1_INTERNAL_H_
54
60#include <stdint.h>
61/*
62 * If you do not have the ISO standard stdint.h header file, then you
63 * must typdef the following:
64 * name meaning
65 * uint32_t unsigned 32 bit integer
66 * uint8_t unsigned 8 bit integer (i.e., unsigned char)
67 * int_least16_t integer of >= 16 bits
68 *
69 */
70
71#ifndef _SHA_enum_
72#define _SHA_enum_
73enum {
75 shaNull, /* Null pointer parameter */
76 shaInputTooLong, /* input data too long */
77 shaStateError /* called Input after Result */
78};
79#endif
80#define SHA1HashSize 20
81
82/*
83 * This structure will hold context information for the SHA-1
84 * hashing operation
85 */
86typedef struct SHA1Context {
87 uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest */
88
89 uint32_t Length_Low; /* Message length in bits */
90 uint32_t Length_High; /* Message length in bits */
91
92 /* Index into message block array */
93 int_least16_t Message_Block_Index;
94 uint8_t Message_Block[64]; /* 512-bit message blocks */
95
96 int Computed; /* Is the digest computed? */
97 int Corrupted; /* Is the message digest corrupted? */
99
100/*
101 * Function Prototypes
102 */
103
106 const uint8_t *,
107 unsigned int);
109 uint8_t Message_Digest[SHA1HashSize]);
110
111#endif /* COAP_SHA1_INTERNAL_H_ */
int SHA1Result(SHA1Context *, uint8_t Message_Digest[SHA1HashSize])
int SHA1Reset(SHA1Context *)
int SHA1Input(SHA1Context *, const uint8_t *, unsigned int)
@ shaInputTooLong
@ shaSuccess
@ shaNull
@ shaStateError
struct SHA1Context SHA1Context
#define SHA1HashSize
uint32_t Length_High
uint32_t Intermediate_Hash[SHA1HashSize/4]
uint8_t Message_Block[64]
uint32_t Length_Low
int_least16_t Message_Block_Index