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