Mercurial > hg > nginx
annotate src/core/ngx_md5.h @ 6133:af7eba90645d
Win32: shared memory base addresses and remapping.
Two mechanisms are implemented to make it possible to store pointers
in shared memory on Windows, in particular on Windows Vista and later
versions with ASLR:
- The ngx_shm_remap() function added to allow remapping of a shared memory
zone to the address originally used for it in the master process. While
important, it doesn't solve the problem by itself as in many cases it's
not possible to use the address because of conflicts with other
allocations.
- We now create mappings at the same address in all processes by starting
mappings at predefined addresses normally unused by newborn processes.
These two mechanisms combined allow to use shared memory on Windows
almost without problems, including reloads.
Based on the patch by Sergey Brester:
http://mailman.nginx.org/pipermail/nginx-devel/2015-April/006836.html
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 27 Apr 2015 18:25:42 +0300 |
parents | d620f497c50f |
children | 9eefb38f0005 |
rev | line source |
---|---|
1572 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4412 | 4 * Copyright (C) Nginx, Inc. |
1572 | 5 */ |
6 | |
7 | |
8 #ifndef _NGX_MD5_H_INCLUDED_ | |
9 #define _NGX_MD5_H_INCLUDED_ | |
10 | |
11 | |
12 #include <ngx_config.h> | |
13 #include <ngx_core.h> | |
14 | |
15 | |
3895
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
16 #if (NGX_HAVE_MD5) |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
17 |
1572 | 18 #if (NGX_HAVE_OPENSSL_MD5_H) |
19 #include <openssl/md5.h> | |
20 #else | |
21 #include <md5.h> | |
22 #endif | |
23 | |
24 | |
25 typedef MD5_CTX ngx_md5_t; | |
26 | |
27 | |
28 #if (NGX_OPENSSL_MD5) | |
29 | |
1598 | 30 #define ngx_md5_init MD5_Init |
31 #define ngx_md5_update MD5_Update | |
32 #define ngx_md5_final MD5_Final | |
1572 | 33 |
34 #else | |
35 | |
1598 | 36 #define ngx_md5_init MD5Init |
37 #define ngx_md5_update MD5Update | |
38 #define ngx_md5_final MD5Final | |
1572 | 39 |
40 #endif | |
41 | |
42 | |
3895
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
43 #else /* !NGX_HAVE_MD5 */ |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
44 |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
45 |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
46 typedef struct { |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
47 uint64_t bytes; |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
48 uint32_t a, b, c, d; |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
49 u_char buffer[64]; |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
50 } ngx_md5_t; |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
51 |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
52 |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
53 void ngx_md5_init(ngx_md5_t *ctx); |
3927
38e6f45c5e3d
make built-in ngx_md5_update() interface consistent with other implemenations
Igor Sysoev <igor@sysoev.ru>
parents:
3895
diff
changeset
|
54 void ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size); |
3895
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
55 void ngx_md5_final(u_char result[16], ngx_md5_t *ctx); |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
56 |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
57 |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
58 #endif |
b659514a3948
an internal MD5 implemenation
Igor Sysoev <igor@sysoev.ru>
parents:
1598
diff
changeset
|
59 |
1572 | 60 #endif /* _NGX_MD5_H_INCLUDED_ */ |