Commit 1fd83ac
committed
crypto: evict getCiphers/getHashes cache on setFips/setEngine
getCiphers() and getHashes() used cachedResult() which memoizes once
and never clears. setFips() changes which algorithms OpenSSL exposes
(FIPS-approved only vs. all), and setEngine() can register additional
ciphers/hashes from a loaded engine, but neither invalidated the cache.
Replace the two cachedResult() calls with manual cache variables
(_ciphersCache, _hashesCache) that mirror the existing _hashCache
pattern. Add evictCipherHashCache() and call it from both setFips()
and setEngine() after they mutate OpenSSL state.
getCurves is intentionally left using cachedResult — curves are not
affected by FIPS mode or engine loading.
Fixes: #629821 parent 27abe9c commit 1fd83ac
2 files changed
Lines changed: 24 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
| |||
263 | 264 | | |
264 | 265 | | |
265 | 266 | | |
| 267 | + | |
266 | 268 | | |
267 | 269 | | |
268 | 270 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
128 | | - | |
129 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
130 | 148 | | |
131 | 149 | | |
132 | 150 | | |
| |||
143 | 161 | | |
144 | 162 | | |
145 | 163 | | |
| 164 | + | |
146 | 165 | | |
147 | 166 | | |
148 | 167 | | |
| |||
855 | 874 | | |
856 | 875 | | |
857 | 876 | | |
| 877 | + | |
858 | 878 | | |
859 | 879 | | |
860 | 880 | | |
| |||
0 commit comments