Skip to content

Commit 679b6f4

Browse files
committed
cipher: rename GetCipherPtr() to ossl_evp_get_cipherbyname()
While GetCipherPtr() function gets a const EVP_CIPHER * from algorithm name, GetCipher() macro that is locally defined in ext/openssl/ossl_cipher.c gets the EVP_CIPHER_CTX from an OpenSSL::Cipher object. They are completely different things. Rename GetCipherPtr() for disambiguation.
1 parent 6a14a59 commit 679b6f4

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

ext/openssl/ossl_cipher.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static const rb_data_type_t ossl_cipher_type = {
4949
* PUBLIC
5050
*/
5151
const EVP_CIPHER *
52-
GetCipherPtr(VALUE obj)
52+
ossl_evp_get_cipherbyname(VALUE obj)
5353
{
5454
if (rb_obj_is_kind_of(obj, cCipher)) {
5555
EVP_CIPHER_CTX *ctx;

ext/openssl/ossl_cipher.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
extern VALUE cCipher;
1414
extern VALUE eCipherError;
1515

16-
const EVP_CIPHER *GetCipherPtr(VALUE);
16+
const EVP_CIPHER *ossl_evp_get_cipherbyname(VALUE);
1717
VALUE ossl_cipher_new(const EVP_CIPHER *);
1818
void Init_ossl_cipher(void);
1919

ext/openssl/ossl_pkcs7.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ ossl_pkcs7_s_encrypt(int argc, VALUE *argv, VALUE klass)
319319
#endif
320320

321321
}
322-
else ciph = GetCipherPtr(cipher); /* NO NEED TO DUP */
322+
else ciph = ossl_evp_get_cipherbyname(cipher);
323323
flg = NIL_P(flags) ? 0 : NUM2INT(flags);
324324
ret = NewPKCS7(cPKCS7);
325325
in = ossl_obj2bio(data);
@@ -525,7 +525,7 @@ ossl_pkcs7_set_cipher(VALUE self, VALUE cipher)
525525
PKCS7 *pkcs7;
526526

527527
GetPKCS7(self, pkcs7);
528-
if (!PKCS7_set_cipher(pkcs7, GetCipherPtr(cipher))) {
528+
if (!PKCS7_set_cipher(pkcs7, ossl_evp_get_cipherbyname(cipher))) {
529529
ossl_raise(ePKCS7Error, NULL);
530530
}
531531

ext/openssl/ossl_pkey_dsa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ ossl_dsa_export(int argc, VALUE *argv, VALUE self)
348348
GetDSA(self, dsa);
349349
rb_scan_args(argc, argv, "02", &cipher, &pass);
350350
if (!NIL_P(cipher)) {
351-
ciph = GetCipherPtr(cipher);
351+
ciph = ossl_evp_get_cipherbyname(cipher);
352352
pass = ossl_pem_passwd_value(pass);
353353
}
354354
if (!(out = BIO_new(BIO_s_mem()))) {

ext/openssl/ossl_pkey_ec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ static VALUE ossl_ec_key_to_string(VALUE self, VALUE ciph, VALUE pass, int forma
446446
private = 1;
447447

448448
if (!NIL_P(ciph)) {
449-
cipher = GetCipherPtr(ciph);
449+
cipher = ossl_evp_get_cipherbyname(ciph);
450450
pass = ossl_pem_passwd_value(pass);
451451
}
452452

ext/openssl/ossl_pkey_rsa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ ossl_rsa_export(int argc, VALUE *argv, VALUE self)
350350
rb_scan_args(argc, argv, "02", &cipher, &pass);
351351

352352
if (!NIL_P(cipher)) {
353-
ciph = GetCipherPtr(cipher);
353+
ciph = ossl_evp_get_cipherbyname(cipher);
354354
pass = ossl_pem_passwd_value(pass);
355355
}
356356
if (!(out = BIO_new(BIO_s_mem()))) {

0 commit comments

Comments
 (0)