annotate src/core/ngx_sha1.h @ 5418:6961d52ebc49 stable-1.4

Core: fix misallocation at ngx_crypt_apr1 (ticket #412). Found by using auth_basic.t from mdounin nginx-tests under valgrind. ==10470== Invalid write of size 1 ==10470== at 0x43603D: ngx_crypt_to64 (ngx_crypt.c:168) ==10470== by 0x43648E: ngx_crypt (ngx_crypt.c:153) ==10470== by 0x489D8B: ngx_http_auth_basic_crypt_handler (ngx_http_auth_basic_module.c:297) ==10470== by 0x48A24A: ngx_http_auth_basic_handler (ngx_http_auth_basic_module.c:240) ==10470== by 0x44EAB9: ngx_http_core_access_phase (ngx_http_core_module.c:1121) ==10470== by 0x44A822: ngx_http_core_run_phases (ngx_http_core_module.c:895) ==10470== by 0x44A932: ngx_http_handler (ngx_http_core_module.c:878) ==10470== by 0x455EEF: ngx_http_process_request (ngx_http_request.c:1852) ==10470== by 0x456527: ngx_http_process_request_headers (ngx_http_request.c:1283) ==10470== by 0x456A91: ngx_http_process_request_line (ngx_http_request.c:964) ==10470== by 0x457097: ngx_http_wait_request_handler (ngx_http_request.c:486) ==10470== by 0x4411EE: ngx_epoll_process_events (ngx_epoll_module.c:691) ==10470== Address 0x5866fab is 0 bytes after a block of size 27 alloc'd ==10470== at 0x4A074CD: malloc (vg_replace_malloc.c:236) ==10470== by 0x43B251: ngx_alloc (ngx_alloc.c:22) ==10470== by 0x421B0D: ngx_malloc (ngx_palloc.c:119) ==10470== by 0x421B65: ngx_pnalloc (ngx_palloc.c:147) ==10470== by 0x436368: ngx_crypt (ngx_crypt.c:140) ==10470== by 0x489D8B: ngx_http_auth_basic_crypt_handler (ngx_http_auth_basic_module.c:297) ==10470== by 0x48A24A: ngx_http_auth_basic_handler (ngx_http_auth_basic_module.c:240) ==10470== by 0x44EAB9: ngx_http_core_access_phase (ngx_http_core_module.c:1121) ==10470== by 0x44A822: ngx_http_core_run_phases (ngx_http_core_module.c:895) ==10470== by 0x44A932: ngx_http_handler (ngx_http_core_module.c:878) ==10470== by 0x455EEF: ngx_http_process_request (ngx_http_request.c:1852) ==10470== by 0x456527: ngx_http_process_request_headers (ngx_http_request.c:1283) ==10470==
author Markus Linnala <Markus.Linnala@cybercom.com>
date Fri, 20 Sep 2013 17:57:21 +0300
parents d620f497c50f
children 1064ea81ed3a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1573
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2 /*
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
3 * Copyright (C) Igor Sysoev
4412
d620f497c50f Copyright updated.
Maxim Konovalov <maxim@nginx.com>
parents: 1598
diff changeset
4 * Copyright (C) Nginx, Inc.
1573
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
5 */
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
6
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
7
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
8 #ifndef _NGX_SHA1_H_INCLUDED_
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
9 #define _NGX_SHA1_H_INCLUDED_
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
10
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
11
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
12 #include <ngx_config.h>
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
13 #include <ngx_core.h>
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
14
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
15
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
16 #if (NGX_HAVE_OPENSSL_SHA1_H)
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
17 #include <openssl/sha.h>
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
18 #else
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
19 #include <sha.h>
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
20 #endif
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
21
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
22
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
23 typedef SHA_CTX ngx_sha1_t;
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
24
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
25
1598
27d4ed42e49d style fix
Igor Sysoev <igor@sysoev.ru>
parents: 1573
diff changeset
26 #define ngx_sha1_init SHA1_Init
27d4ed42e49d style fix
Igor Sysoev <igor@sysoev.ru>
parents: 1573
diff changeset
27 #define ngx_sha1_update SHA1_Update
27d4ed42e49d style fix
Igor Sysoev <igor@sysoev.ru>
parents: 1573
diff changeset
28 #define ngx_sha1_final SHA1_Final
1573
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
29
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
30
8f911d6d0d70 ngx_sha1.h
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
31 #endif /* _NGX_SHA1_H_INCLUDED_ */