membphis commented on code in PR #11305:
URL: https://github.com/apache/apisix/pull/11305#discussion_r1621941038
##########
apisix/ssl.lua:
##########
@@ -153,6 +159,9 @@ local function aes_decrypt_pkey(origin, field)
for _, aes_128_cbc_with_iv in ipairs(aes_128_cbc_with_iv_tbl) do
local decrypted = aes_128_cbc_with_iv:decrypt(decoded_key)
if decrypted then
Review Comment:
I prefer this style, clean the error if fail to call `decrypt`.
```lua
local decrypted = aes_128_cbc_with_iv:decrypt(decoded_key)
if not decrypted then
-- clean the error in OpenSSL
if C.ERR_peek_error() then
C.ERR_clear_error()
end
else
return decrypted
end
... ...
```
The new style is safer
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]