Core: ngx_explicit_memzero().
Maxim Dounin
3 years ago
2012 | 2012 | } |
2013 | 2013 | |
2014 | 2014 | |
2015 | void | |
2016 | ngx_explicit_memzero(void *buf, size_t n) | |
2017 | { | |
2018 | ngx_memzero(buf, n); | |
2019 | ngx_memory_barrier(); | |
2020 | } | |
2021 | ||
2022 | ||
2015 | 2023 | #if (NGX_MEMCPY_LIMIT) |
2016 | 2024 | |
2017 | 2025 | void * |
86 | 86 | */ |
87 | 87 | #define ngx_memzero(buf, n) (void) memset(buf, 0, n) |
88 | 88 | #define ngx_memset(buf, c, n) (void) memset(buf, c, n) |
89 | ||
90 | void ngx_explicit_memzero(void *buf, size_t n); | |
89 | 91 | |
90 | 92 | |
91 | 93 | #if (NGX_MEMCPY_LIMIT) |
1050 | 1050 | ngx_close_file_n " \"%s\" failed", file->data); |
1051 | 1051 | } |
1052 | 1052 | |
1053 | ngx_memzero(buf, NGX_SSL_PASSWORD_BUFFER_SIZE); | |
1053 | ngx_explicit_memzero(buf, NGX_SSL_PASSWORD_BUFFER_SIZE); | |
1054 | 1054 | |
1055 | 1055 | return passwords; |
1056 | 1056 | } |
1067 | 1067 | pwd = passwords->elts; |
1068 | 1068 | |
1069 | 1069 | for (i = 0; i < passwords->nelts; i++) { |
1070 | ngx_memzero(pwd[i].data, pwd[i].len); | |
1070 | ngx_explicit_memzero(pwd[i].data, pwd[i].len); | |
1071 | 1071 | } |
1072 | 1072 | } |
1073 | 1073 |