comparison src/core/ngx_sha1.h @ 6603:9eefb38f0005

Internal md5 and sha1 implementations are now always used. This reduces the number of moving parts in ABI compatibility checks. Additionally, it also allows to use OpenSSL in FIPS mode while still using md5 for non-security tasks.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 30 Jun 2016 18:57:39 +0300
parents 1064ea81ed3a
children
comparison
equal deleted inserted replaced
6602:bcd442b585f0 6603:9eefb38f0005
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 15
16 #if (NGX_HAVE_SHA1)
17
18 #if (NGX_HAVE_OPENSSL_SHA1_H)
19 #include <openssl/sha.h>
20 #else
21 #include <sha.h>
22 #endif
23
24
25 typedef SHA_CTX ngx_sha1_t;
26
27
28 #define ngx_sha1_init SHA1_Init
29 #define ngx_sha1_update SHA1_Update
30 #define ngx_sha1_final SHA1_Final
31
32
33 #else /* !NGX_HAVE_SHA1 */
34
35
36 typedef struct { 16 typedef struct {
37 uint64_t bytes; 17 uint64_t bytes;
38 uint32_t a, b, c, d, e, f; 18 uint32_t a, b, c, d, e, f;
39 u_char buffer[64]; 19 u_char buffer[64];
40 } ngx_sha1_t; 20 } ngx_sha1_t;
43 void ngx_sha1_init(ngx_sha1_t *ctx); 23 void ngx_sha1_init(ngx_sha1_t *ctx);
44 void ngx_sha1_update(ngx_sha1_t *ctx, const void *data, size_t size); 24 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); 25 void ngx_sha1_final(u_char result[20], ngx_sha1_t *ctx);
46 26
47 27
48 #endif
49
50 #endif /* _NGX_SHA1_H_INCLUDED_ */ 28 #endif /* _NGX_SHA1_H_INCLUDED_ */