[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
This commit is contained in:
parent
be3ba2ee4d
commit
871c61d5d0
Notes:
git
2021-03-16 20:38:45 +09:00
@ -157,9 +157,8 @@ ossl_x509store_alloc(VALUE klass)
|
|||||||
VALUE obj;
|
VALUE obj;
|
||||||
|
|
||||||
obj = NewX509Store(klass);
|
obj = NewX509Store(klass);
|
||||||
if((store = X509_STORE_new()) == NULL){
|
if ((store = X509_STORE_new()) == NULL)
|
||||||
ossl_raise(eX509StoreError, NULL);
|
ossl_raise(eX509StoreError, "X509_STORE_new");
|
||||||
}
|
|
||||||
SetX509Store(obj, store);
|
SetX509Store(obj, store);
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
@ -365,9 +364,8 @@ ossl_x509store_set_default_paths(VALUE self)
|
|||||||
X509_STORE *store;
|
X509_STORE *store;
|
||||||
|
|
||||||
GetX509Store(self, store);
|
GetX509Store(self, store);
|
||||||
if (X509_STORE_set_default_paths(store) != 1){
|
if (X509_STORE_set_default_paths(store) != 1)
|
||||||
ossl_raise(eX509StoreError, NULL);
|
ossl_raise(eX509StoreError, "X509_STORE_set_default_paths");
|
||||||
}
|
|
||||||
|
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
@ -386,9 +384,8 @@ ossl_x509store_add_cert(VALUE self, VALUE arg)
|
|||||||
|
|
||||||
cert = GetX509CertPtr(arg); /* NO NEED TO DUP */
|
cert = GetX509CertPtr(arg); /* NO NEED TO DUP */
|
||||||
GetX509Store(self, store);
|
GetX509Store(self, store);
|
||||||
if (X509_STORE_add_cert(store, cert) != 1){
|
if (X509_STORE_add_cert(store, cert) != 1)
|
||||||
ossl_raise(eX509StoreError, NULL);
|
ossl_raise(eX509StoreError, "X509_STORE_add_cert");
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -407,9 +404,8 @@ ossl_x509store_add_crl(VALUE self, VALUE arg)
|
|||||||
|
|
||||||
crl = GetX509CRLPtr(arg); /* NO NEED TO DUP */
|
crl = GetX509CRLPtr(arg); /* NO NEED TO DUP */
|
||||||
GetX509Store(self, store);
|
GetX509Store(self, store);
|
||||||
if (X509_STORE_add_crl(store, crl) != 1){
|
if (X509_STORE_add_crl(store, crl) != 1)
|
||||||
ossl_raise(eX509StoreError, NULL);
|
ossl_raise(eX509StoreError, "X509_STORE_add_crl");
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -488,9 +484,8 @@ ossl_x509stctx_alloc(VALUE klass)
|
|||||||
VALUE obj;
|
VALUE obj;
|
||||||
|
|
||||||
obj = NewX509StCtx(klass);
|
obj = NewX509StCtx(klass);
|
||||||
if((ctx = X509_STORE_CTX_new()) == NULL){
|
if ((ctx = X509_STORE_CTX_new()) == NULL)
|
||||||
ossl_raise(eX509StoreError, NULL);
|
ossl_raise(eX509StoreError, "X509_STORE_CTX_new");
|
||||||
}
|
|
||||||
SetX509StCtx(obj, ctx);
|
SetX509StCtx(obj, ctx);
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
@ -557,12 +552,12 @@ ossl_x509stctx_verify(VALUE self)
|
|||||||
|
|
||||||
switch (X509_verify_cert(ctx)) {
|
switch (X509_verify_cert(ctx)) {
|
||||||
case 1:
|
case 1:
|
||||||
return Qtrue;
|
return Qtrue;
|
||||||
case 0:
|
case 0:
|
||||||
ossl_clear_error();
|
ossl_clear_error();
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
default:
|
default:
|
||||||
ossl_raise(eX509CertError, NULL);
|
ossl_raise(eX509CertError, "X509_verify_cert");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user