Skip to content

Commit

Permalink
Update Ruby 3.1 patch; Remove GetConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Sep 13, 2024
1 parent 03cc01a commit b2b83e5
Showing 1 changed file with 42 additions and 10 deletions.
52 changes: 42 additions & 10 deletions tests/ci/integration/ruby_patch/ruby_3_1/aws-lc-ruby-temp.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
From 74a05634822493182094618aa502be8bca00fbda Mon Sep 17 00:00:00 2001
From: Justin Smith <justsmth@amazon.com>
Date: Fri, 13 Sep 2024 07:59:49 -0400
Subject: [PATCH] Patch out GetConfig

---
ext/openssl/ossl_config.c | 8 ++++++++
ext/openssl/ossl_config.h | 3 +++
ext/openssl/ossl_ocsp.c | 16 ++++++++++------
ext/openssl/ossl_pkcs7.c | 8 ++++++++
ext/openssl/ossl_pkcs7.h | 2 ++
ext/openssl/ossl_pkey.c | 32 ++++++++++++++++----------------
ext/openssl/ossl_pkey_ec.c | 4 ++--
ext/openssl/ossl_x509.c | 4 ++--
ext/openssl/ossl_x509ext.c | 2 +-
9 files changed, 52 insertions(+), 27 deletions(-)

diff --git a/ext/openssl/ossl_config.c b/ext/openssl/ossl_config.c
index 0bac027..7d499a0 100644
--- a/ext/openssl/ossl_config.c
Expand Down Expand Up @@ -130,7 +147,7 @@ index 3e1b094..f85efcc 100644
void Init_ossl_pkcs7(void);

diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c
index 4aa4489..be5769c 100644
index 4aa4489..c7790aa 100644
--- a/ext/openssl/ossl_pkey.c
+++ b/ext/openssl/ossl_pkey.c
@@ -710,23 +710,23 @@ ossl_pkey_export_traditional(int argc, VALUE *argv, VALUE self, int to_der)
Expand All @@ -144,7 +161,14 @@ index 4aa4489..be5769c 100644
-#else
- char pem_str[80];
- const char *aname;
-
+// #if OPENSSL_VERSION_NUMBER >= 0x10100000
+// if (!PEM_write_bio_PrivateKey_traditional(bio, pkey, enc, NULL, 0,
+// ossl_pem_passwd_cb,
+// (void *)pass)) {
+// #else
+// char pem_str[80];
+// const char *aname;

- EVP_PKEY_asn1_get0_info(NULL, NULL, NULL, NULL, &aname, pkey->ameth);
- snprintf(pem_str, sizeof(pem_str), "%s PRIVATE KEY", aname);
- if (!PEM_ASN1_write_bio((i2d_of_void *)i2d_PrivateKey, pem_str, bio,
Expand All @@ -154,14 +178,6 @@ index 4aa4489..be5769c 100644
- BIO_free(bio);
- ossl_raise(ePKeyError, "PEM_write_bio_PrivateKey_traditional");
- }
+// #if OPENSSL_VERSION_NUMBER >= 0x10100000
+// if (!PEM_write_bio_PrivateKey_traditional(bio, pkey, enc, NULL, 0,
+// ossl_pem_passwd_cb,
+// (void *)pass)) {
+// #else
+// char pem_str[80];
+// const char *aname;
+
+// EVP_PKEY_asn1_get0_info(NULL, NULL, NULL, NULL, &aname, pkey->ameth);
+// snprintf(pem_str, sizeof(pem_str), "%s PRIVATE KEY", aname);
+// if (!PEM_ASN1_write_bio((i2d_of_void *)i2d_PrivateKey, pem_str, bio,
Expand Down Expand Up @@ -211,3 +227,19 @@ index f847070..53b6270 100644
DefX509Const(TRUST_TSA);

DefX509Default(CERT_AREA, cert_area);
diff --git a/ext/openssl/ossl_x509ext.c b/ext/openssl/ossl_x509ext.c
index e54102c..b6658e7 100644
--- a/ext/openssl/ossl_x509ext.c
+++ b/ext/openssl/ossl_x509ext.c
@@ -226,7 +226,7 @@ ossl_x509extfactory_create_ext(int argc, VALUE *argv, VALUE self)
GetX509ExtFactory(self, ctx);
obj = NewX509Ext(cX509Ext);
rconf = rb_iv_get(self, "@config");
- conf = NIL_P(rconf) ? NULL : GetConfig(rconf);
+ conf = NULL;
X509V3_set_nconf(ctx, conf);
ext = X509V3_EXT_nconf_nid(conf, ctx, nid, RSTRING_PTR(valstr));
X509V3_set_ctx_nodb(ctx);
--
2.39.3 (Apple Git-145)

0 comments on commit b2b83e5

Please sign in to comment.