Mercurial > hg > nginx
comparison src/core/ngx_sha1.h @ 6586:1064ea81ed3a
An internal SHA1 implementation.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 09 Jun 2016 16:55:38 +0300 |
parents | d620f497c50f |
children | 9eefb38f0005 |
comparison
equal
deleted
inserted
replaced
6585:e511e3d581bb | 6586:1064ea81ed3a |
---|---|
10 | 10 |
11 | 11 |
12 #include <ngx_config.h> | 12 #include <ngx_config.h> |
13 #include <ngx_core.h> | 13 #include <ngx_core.h> |
14 | 14 |
15 | |
16 #if (NGX_HAVE_SHA1) | |
15 | 17 |
16 #if (NGX_HAVE_OPENSSL_SHA1_H) | 18 #if (NGX_HAVE_OPENSSL_SHA1_H) |
17 #include <openssl/sha.h> | 19 #include <openssl/sha.h> |
18 #else | 20 #else |
19 #include <sha.h> | 21 #include <sha.h> |
26 #define ngx_sha1_init SHA1_Init | 28 #define ngx_sha1_init SHA1_Init |
27 #define ngx_sha1_update SHA1_Update | 29 #define ngx_sha1_update SHA1_Update |
28 #define ngx_sha1_final SHA1_Final | 30 #define ngx_sha1_final SHA1_Final |
29 | 31 |
30 | 32 |
33 #else /* !NGX_HAVE_SHA1 */ | |
34 | |
35 | |
36 typedef struct { | |
37 uint64_t bytes; | |
38 uint32_t a, b, c, d, e, f; | |
39 u_char buffer[64]; | |
40 } ngx_sha1_t; | |
41 | |
42 | |
43 void ngx_sha1_init(ngx_sha1_t *ctx); | |
44 void ngx_sha1_update(ngx_sha1_t *ctx, const void *data, size_t size); | |
45 void ngx_sha1_final(u_char result[20], ngx_sha1_t *ctx); | |
46 | |
47 | |
48 #endif | |
49 | |
31 #endif /* _NGX_SHA1_H_INCLUDED_ */ | 50 #endif /* _NGX_SHA1_H_INCLUDED_ */ |