Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libcrypto: Correct EVP_CIPHER_get_flags argument type #15392

Merged

Conversation

miry
Copy link
Contributor

@miry miry commented Jan 31, 2025

Per OpenSSL documentation 1 and the usage of
LibCrypto#evp_cipher_flags, EVP_CIPHER_get_flags should accept EVP_CIPHER rather than EVP_CIPHER_CTX.

unsigned long EVP_CIPHER_get_flags(const EVP_CIPHER *e);

An example of this usage can be seen in OpenSSL::Cipher#authenticated? 2.

This change does not introduce any functional impact but improves clarity by correctly reflecting the expected argument, reducing the need for developers to cross-check other sources.

Footnotes

  1. https://docs.openssl.org/1.1.1/man3/EVP_EncryptInit/#synopsis

  2. https://github.com/crystal-lang/crystal/blob/2978cd157a7a24a68abcc6d41a12dd7f04afc1f5/src/openssl/cipher.cr#L156C7-L156C21

Per OpenSSL documentation [^1] and the usage of
`LibCrypto#evp_cipher_flags`, `EVP_CIPHER_get_flags` should accept `EVP_CIPHER` rather than `EVP_CIPHER_CTX`.

An example of this usage can be seen in `OpenSSL::Cipher#authenticated?`.

This change does not introduce any functional impact but improves clarity by correctly reflecting the expected argument, reducing the need for developers to cross-check other sources.

[^1]: https://docs.openssl.org/1.1.1/man3/EVP_EncryptInit/#synopsis
@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:crypto labels Jan 31, 2025
@straight-shoota straight-shoota added this to the 1.16.0 milestone Jan 31, 2025
@straight-shoota straight-shoota merged commit 204b6a9 into crystal-lang:master Feb 1, 2025
72 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:crypto
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants