diff 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
line wrap: on
line diff
--- a/src/core/ngx_sha1.h
+++ b/src/core/ngx_sha1.h
@@ -13,6 +13,8 @@
 #include <ngx_core.h>
 
 
+#if (NGX_HAVE_SHA1)
+
 #if (NGX_HAVE_OPENSSL_SHA1_H)
 #include <openssl/sha.h>
 #else
@@ -28,4 +30,21 @@ typedef SHA_CTX  ngx_sha1_t;
 #define ngx_sha1_final   SHA1_Final
 
 
+#else /* !NGX_HAVE_SHA1 */
+
+
+typedef struct {
+    uint64_t  bytes;
+    uint32_t  a, b, c, d, e, f;
+    u_char    buffer[64];
+} ngx_sha1_t;
+
+
+void ngx_sha1_init(ngx_sha1_t *ctx);
+void ngx_sha1_update(ngx_sha1_t *ctx, const void *data, size_t size);
+void ngx_sha1_final(u_char result[20], ngx_sha1_t *ctx);
+
+
+#endif
+
 #endif /* _NGX_SHA1_H_INCLUDED_ */