PolarSSL v1.3.7
sha1.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_SHA1_H
28 #define POLARSSL_SHA1_H
29 
30 #if !defined(POLARSSL_CONFIG_FILE)
31 #include "config.h"
32 #else
33 #include POLARSSL_CONFIG_FILE
34 #endif
35 
36 #include <string.h>
37 
38 #if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
39 #include <basetsd.h>
40 typedef UINT32 uint32_t;
41 #else
42 #include <inttypes.h>
43 #endif
44 
45 #define POLARSSL_ERR_SHA1_FILE_IO_ERROR -0x0076
47 #if !defined(POLARSSL_SHA1_ALT)
48 // Regular implementation
49 //
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
58 typedef struct
59 {
60  uint32_t total[2];
61  uint32_t state[5];
62  unsigned char buffer[64];
64  unsigned char ipad[64];
65  unsigned char opad[64];
66 }
68 
74 void sha1_starts( sha1_context *ctx );
75 
83 void sha1_update( sha1_context *ctx, const unsigned char *input, size_t ilen );
84 
91 void sha1_finish( sha1_context *ctx, unsigned char output[20] );
92 
93 /* Internal use */
94 void sha1_process( sha1_context *ctx, const unsigned char data[64] );
95 
96 #ifdef __cplusplus
97 }
98 #endif
99 
100 #else /* POLARSSL_SHA1_ALT */
101 #include "sha1_alt.h"
102 #endif /* POLARSSL_SHA1_ALT */
103 
104 #ifdef __cplusplus
105 extern "C" {
106 #endif
107 
115 void sha1( const unsigned char *input, size_t ilen, unsigned char output[20] );
116 
125 int sha1_file( const char *path, unsigned char output[20] );
126 
134 void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key,
135  size_t keylen );
136 
144 void sha1_hmac_update( sha1_context *ctx, const unsigned char *input,
145  size_t ilen );
146 
153 void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] );
154 
160 void sha1_hmac_reset( sha1_context *ctx );
161 
171 void sha1_hmac( const unsigned char *key, size_t keylen,
172  const unsigned char *input, size_t ilen,
173  unsigned char output[20] );
174 
180 int sha1_self_test( int verbose );
181 
182 #ifdef __cplusplus
183 }
184 #endif
185 
186 #endif /* sha1.h */
void sha1_hmac_finish(sha1_context *ctx, unsigned char output[20])
SHA-1 HMAC final digest.
int sha1_self_test(int verbose)
Checkup routine.
SHA-1 context structure.
Definition: sha1.h:58
void sha1(const unsigned char *input, size_t ilen, unsigned char output[20])
Output = SHA-1( input buffer )
void sha1_finish(sha1_context *ctx, unsigned char output[20])
SHA-1 final digest.
void sha1_hmac(const unsigned char *key, size_t keylen, const unsigned char *input, size_t ilen, unsigned char output[20])
Output = HMAC-SHA-1( hmac key, input buffer )
Configuration options (set of defines)
void sha1_hmac_reset(sha1_context *ctx)
SHA-1 HMAC context reset.
int sha1_file(const char *path, unsigned char output[20])
Output = SHA-1( file contents )
void sha1_hmac_starts(sha1_context *ctx, const unsigned char *key, size_t keylen)
SHA-1 HMAC context setup.
void sha1_starts(sha1_context *ctx)
SHA-1 context setup.
void sha1_update(sha1_context *ctx, const unsigned char *input, size_t ilen)
SHA-1 process buffer.
void sha1_process(sha1_context *ctx, const unsigned char data[64])
void sha1_hmac_update(sha1_context *ctx, const unsigned char *input, size_t ilen)
SHA-1 HMAC process buffer.