Skip to content

Fix argument type for EVP_CIPHER_get_flags#15392

Merged
straight-shoota merged 1 commit intocrystal-lang:masterfrom
miry:lib-crypto-get-flags-synopsis
Feb 1, 2025
Merged

Fix argument type for EVP_CIPHER_get_flags#15392
straight-shoota merged 1 commit intocrystal-lang:masterfrom
miry:lib-crypto-get-flags-synopsis

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
@miry miry deleted the lib-crypto-get-flags-synopsis branch February 2, 2025 17:43
@straight-shoota straight-shoota changed the title libcrypto: Correct EVP_CIPHER_get_flags argument type Fix argument type for EVP_CIPHER_get_flags Mar 25, 2025
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