PolarSSL v1.3.4
sha1.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_SHA1_H
28 #define POLARSSL_SHA1_H
29 
30 #include "config.h"
31 
32 #include <string.h>
33 
34 #if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
35 #include <basetsd.h>
36 typedef UINT32 uint32_t;
37 #else
38 #include <inttypes.h>
39 #endif
40 
41 #define POLARSSL_ERR_SHA1_FILE_IO_ERROR -0x0076
43 #if !defined(POLARSSL_SHA1_ALT)
44 // Regular implementation
45 //
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
54 typedef struct
55 {
56  uint32_t total[2];
57  uint32_t state[5];
58  unsigned char buffer[64];
60  unsigned char ipad[64];
61  unsigned char opad[64];
62 }
64 
70 void sha1_starts( sha1_context *ctx );
71 
79 void sha1_update( sha1_context *ctx, const unsigned char *input, size_t ilen );
80 
87 void sha1_finish( sha1_context *ctx, unsigned char output[20] );
88 
89 /* Internal use */
90 void sha1_process( sha1_context *ctx, const unsigned char data[64] );
91 
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #else /* POLARSSL_SHA1_ALT */
97 #include "sha1_alt.h"
98 #endif /* POLARSSL_SHA1_ALT */
99 
100 #ifdef __cplusplus
101 extern "C" {
102 #endif
103 
111 void sha1( const unsigned char *input, size_t ilen, unsigned char output[20] );
112 
121 int sha1_file( const char *path, unsigned char output[20] );
122 
130 void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key, size_t keylen );
131 
139 void sha1_hmac_update( sha1_context *ctx, const unsigned char *input, size_t ilen );
140 
147 void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] );
148 
154 void sha1_hmac_reset( sha1_context *ctx );
155 
165 void sha1_hmac( const unsigned char *key, size_t keylen,
166  const unsigned char *input, size_t ilen,
167  unsigned char output[20] );
168 
174 int sha1_self_test( int verbose );
175 
176 #ifdef __cplusplus
177 }
178 #endif
179 
180 #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:54
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.