summaryrefslogtreecommitdiff
path: root/ext/openssl
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2020-08-09 00:04:56 +0900
committerKazuki Yamaguchi <k@rhe.jp>2021-03-16 19:16:11 +0900
commit871c61d5d068f85595c04b8d118da1f489bc2d42 (patch)
treef8d594b6bdff2cdbca9b15099d350ae755f062b2 /ext/openssl
parentbe3ba2ee4d4104a36a6dc2a15f16522454db33ae (diff)
[ruby/openssl] x509store: avoid ossl_raise() calls with NULL message
Use the OpenSSL function name that caused the error to generate a better error message. https://github.com/ruby/openssl/commit/b31809ba3d
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4275
Diffstat (limited to 'ext/openssl')
-rw-r--r--ext/openssl/ossl_x509store.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/ext/openssl/ossl_x509store.c b/ext/openssl/ossl_x509store.c
index 596814887cf..6554d6378d6 100644
--- a/ext/openssl/ossl_x509store.c
+++ b/ext/openssl/ossl_x509store.c
@@ -157,9 +157,8 @@ ossl_x509store_alloc(VALUE klass)
VALUE obj;
obj = NewX509Store(klass);
- if((store = X509_STORE_new()) == NULL){
- ossl_raise(eX509StoreError, NULL);
- }
+ if ((store = X509_STORE_new()) == NULL)
+ ossl_raise(eX509StoreError, "X509_STORE_new");
SetX509Store(obj, store);
return obj;
@@ -365,9 +364,8 @@ ossl_x509store_set_default_paths(VALUE self)
X509_STORE *store;
GetX509Store(self, store);
- if (X509_STORE_set_default_paths(store) != 1){
- ossl_raise(eX509StoreError, NULL);
- }
+ if (X509_STORE_set_default_paths(store) != 1)
+ ossl_raise(eX509StoreError, "X509_STORE_set_default_paths");
return Qnil;
}
@@ -386,9 +384,8 @@ ossl_x509store_add_cert(VALUE self, VALUE arg)
cert = GetX509CertPtr(arg); /* NO NEED TO DUP */
GetX509Store(self, store);
- if (X509_STORE_add_cert(store, cert) != 1){
- ossl_raise(eX509StoreError, NULL);
- }
+ if (X509_STORE_add_cert(store, cert) != 1)
+ ossl_raise(eX509StoreError, "X509_STORE_add_cert");
return self;
}
@@ -407,9 +404,8 @@ ossl_x509store_add_crl(VALUE self, VALUE arg)
crl = GetX509CRLPtr(arg); /* NO NEED TO DUP */
GetX509Store(self, store);
- if (X509_STORE_add_crl(store, crl) != 1){
- ossl_raise(eX509StoreError, NULL);
- }
+ if (X509_STORE_add_crl(store, crl) != 1)
+ ossl_raise(eX509StoreError, "X509_STORE_add_crl");
return self;
}
@@ -488,9 +484,8 @@ ossl_x509stctx_alloc(VALUE klass)
VALUE obj;
obj = NewX509StCtx(klass);
- if((ctx = X509_STORE_CTX_new()) == NULL){
- ossl_raise(eX509StoreError, NULL);
- }
+ if ((ctx = X509_STORE_CTX_new()) == NULL)
+ ossl_raise(eX509StoreError, "X509_STORE_CTX_new");
SetX509StCtx(obj, ctx);
return obj;
@@ -557,12 +552,12 @@ ossl_x509stctx_verify(VALUE self)
switch (X509_verify_cert(ctx)) {
case 1:
- return Qtrue;
+ return Qtrue;
case 0:
- ossl_clear_error();
- return Qfalse;
+ ossl_clear_error();
+ return Qfalse;
default:
- ossl_raise(eX509CertError, NULL);
+ ossl_raise(eX509CertError, "X509_verify_cert");
}
}