diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-08-23 02:25:08 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2017-05-22 10:03:58 +0900 |
commit | c24bae3993690e0061f4e2f269a22d945021d66d (patch) | |
tree | 607ae7eaca802610f35bab224e0a470062f61df9 | |
parent | 8d4d444917aff23c212e3165132d130cd280b72c (diff) | |
download | ruby-openssl-c24bae3993690e0061f4e2f269a22d945021d66d.tar.gz |
Remove unused functions and macros
-rw-r--r-- | ext/openssl/ossl.c | 2 | ||||
-rw-r--r-- | ext/openssl/ossl.h | 27 | ||||
-rw-r--r-- | ext/openssl/ossl_bio.c | 8 | ||||
-rw-r--r-- | ext/openssl/ossl_bio.h | 1 | ||||
-rw-r--r-- | ext/openssl/ossl_x509.h | 7 | ||||
-rw-r--r-- | ext/openssl/ossl_x509cert.c | 34 | ||||
-rw-r--r-- | ext/openssl/ossl_x509crl.c | 11 | ||||
-rw-r--r-- | ext/openssl/ossl_x509req.c | 33 | ||||
-rw-r--r-- | ext/openssl/ossl_x509store.c | 22 |
9 files changed, 1 insertions, 144 deletions
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c index db487ac9..f2984e6c 100644 --- a/ext/openssl/ossl.c +++ b/ext/openssl/ossl.c @@ -250,7 +250,7 @@ VALUE eOSSLError; /* * Convert to DER string */ -ID ossl_s_to_der; +static ID ossl_s_to_der; VALUE ossl_to_der(VALUE obj) diff --git a/ext/openssl/ossl.h b/ext/openssl/ossl.h index 08bc8b8a..f08889b2 100644 --- a/ext/openssl/ossl.h +++ b/ext/openssl/ossl.h @@ -56,19 +56,6 @@ extern VALUE eOSSLError; }\ } while (0) -#define OSSL_Check_Instance(obj, klass) do {\ - if (!rb_obj_is_instance_of((obj), (klass))) {\ - ossl_raise(rb_eTypeError, "wrong argument (%"PRIsVALUE")! (Expected instance of %"PRIsVALUE")",\ - rb_obj_class(obj), (klass));\ - }\ -} while (0) - -#define OSSL_Check_Same_Class(obj1, obj2) do {\ - if (!rb_obj_is_instance_of((obj1), rb_obj_class(obj2))) {\ - ossl_raise(rb_eTypeError, "wrong argument type");\ - }\ -} while (0) - /* * Type conversions */ @@ -85,7 +72,6 @@ extern VALUE eOSSLError; /* * Data Conversion */ -STACK_OF(X509) *ossl_x509_ary2sk0(VALUE); STACK_OF(X509) *ossl_x509_ary2sk(VALUE); STACK_OF(X509) *ossl_protect_x509_ary2sk(VALUE,int*); VALUE ossl_x509_sk2ary(const STACK_OF(X509) *certs); @@ -129,7 +115,6 @@ int ossl_pem_passwd_cb(char *, int, int, void *); /* * ERRor messages */ -#define OSSL_ErrMsg() ERR_reason_error_string(ERR_get_error()) NORETURN(void ossl_raise(VALUE, const char *, ...)); /* Clear OpenSSL error queue. If dOSSL is set, rb_warn() them. */ void ossl_clear_error(void); @@ -137,7 +122,6 @@ void ossl_clear_error(void); /* * String to DER String */ -extern ID ossl_s_to_der; VALUE ossl_to_der(VALUE); VALUE ossl_to_der_if_possible(VALUE); @@ -155,20 +139,9 @@ extern VALUE dOSSL; } \ } while (0) -#define OSSL_Warning(fmt, ...) do { \ - OSSL_Debug((fmt), ##__VA_ARGS__); \ - rb_warning((fmt), ##__VA_ARGS__); \ -} while (0) - -#define OSSL_Warn(fmt, ...) do { \ - OSSL_Debug((fmt), ##__VA_ARGS__); \ - rb_warn((fmt), ##__VA_ARGS__); \ -} while (0) #else void ossl_debug(const char *, ...); #define OSSL_Debug ossl_debug -#define OSSL_Warning rb_warning -#define OSSL_Warn rb_warn #endif /* diff --git a/ext/openssl/ossl_bio.c b/ext/openssl/ossl_bio.c index 11cd1cd5..5f3f65a5 100644 --- a/ext/openssl/ossl_bio.c +++ b/ext/openssl/ossl_bio.c @@ -44,14 +44,6 @@ ossl_obj2bio(VALUE obj) return bio; } -BIO * -ossl_protect_obj2bio(VALUE obj, int *status) -{ - BIO *ret = NULL; - ret = (BIO*)rb_protect((VALUE (*)(VALUE))ossl_obj2bio, obj, status); - return ret; -} - VALUE ossl_membio2str(BIO *bio) { diff --git a/ext/openssl/ossl_bio.h b/ext/openssl/ossl_bio.h index 534a24a5..1b8020cb 100644 --- a/ext/openssl/ossl_bio.h +++ b/ext/openssl/ossl_bio.h @@ -11,7 +11,6 @@ #define _OSSL_BIO_H_ BIO *ossl_obj2bio(VALUE); -BIO *ossl_protect_obj2bio(VALUE,int*); VALUE ossl_membio2str(BIO*); #endif diff --git a/ext/openssl/ossl_x509.h b/ext/openssl/ossl_x509.h index a60f7c3d..4fadfa6b 100644 --- a/ext/openssl/ossl_x509.h +++ b/ext/openssl/ossl_x509.h @@ -41,7 +41,6 @@ extern VALUE cX509Cert; extern VALUE eX509CertError; VALUE ossl_x509_new(X509 *); -VALUE ossl_x509_new_from_file(VALUE); X509 *GetX509CertPtr(VALUE); X509 *DupX509CertPtr(VALUE); void Init_ossl_x509cert(void); @@ -54,7 +53,6 @@ extern VALUE eX509CRLError; VALUE ossl_x509crl_new(X509_CRL *); X509_CRL *GetX509CRLPtr(VALUE); -X509_CRL *DupX509CRLPtr(VALUE); void Init_ossl_x509crl(void); /* @@ -84,9 +82,7 @@ void Init_ossl_x509name(void); extern VALUE cX509Req; extern VALUE eX509ReqError; -VALUE ossl_x509req_new(X509_REQ *); X509_REQ *GetX509ReqPtr(VALUE); -X509_REQ *DupX509ReqPtr(VALUE); void Init_ossl_x509req(void); /* @@ -106,11 +102,8 @@ extern VALUE cX509Store; extern VALUE cX509StoreContext; extern VALUE eX509StoreError; -VALUE ossl_x509store_new(X509_STORE *); X509_STORE *GetX509StorePtr(VALUE); -X509_STORE *DupX509StorePtr(VALUE); -X509_STORE_CTX *GetX509StCtxtPtr(VALUE); void Init_ossl_x509store(void); /* diff --git a/ext/openssl/ossl_x509cert.c b/ext/openssl/ossl_x509cert.c index 9ecee9c3..53c646cf 100644 --- a/ext/openssl/ossl_x509cert.c +++ b/ext/openssl/ossl_x509cert.c @@ -67,40 +67,6 @@ ossl_x509_new(X509 *x509) return obj; } -VALUE -ossl_x509_new_from_file(VALUE filename) -{ - X509 *x509; - FILE *fp; - VALUE obj; - - rb_check_safe_obj(filename); - obj = NewX509(cX509Cert); - if (!(fp = fopen(StringValueCStr(filename), "r"))) { - ossl_raise(eX509CertError, "%s", strerror(errno)); - } - rb_fd_fix_cloexec(fileno(fp)); - x509 = PEM_read_X509(fp, NULL, NULL, NULL); - /* - * prepare for DER... -#if !defined(OPENSSL_NO_FP_API) - if (!x509) { - (void)ERR_get_error(); - rewind(fp); - - x509 = d2i_X509_fp(fp, NULL); - } -#endif - */ - fclose(fp); - if (!x509) { - ossl_raise(eX509CertError, NULL); - } - SetX509(obj, x509); - - return obj; -} - X509 * GetX509CertPtr(VALUE obj) { diff --git a/ext/openssl/ossl_x509crl.c b/ext/openssl/ossl_x509crl.c index e038dd0b..3f1b76c0 100644 --- a/ext/openssl/ossl_x509crl.c +++ b/ext/openssl/ossl_x509crl.c @@ -57,17 +57,6 @@ GetX509CRLPtr(VALUE obj) return crl; } -X509_CRL * -DupX509CRLPtr(VALUE obj) -{ - X509_CRL *crl; - - GetX509CRL(obj, crl); - X509_CRL_up_ref(crl); - - return crl; -} - VALUE ossl_x509crl_new(X509_CRL *crl) { diff --git a/ext/openssl/ossl_x509req.c b/ext/openssl/ossl_x509req.c index 67b00234..8214fdc5 100644 --- a/ext/openssl/ossl_x509req.c +++ b/ext/openssl/ossl_x509req.c @@ -47,26 +47,6 @@ static const rb_data_type_t ossl_x509req_type = { /* * Public functions */ -VALUE -ossl_x509req_new(X509_REQ *req) -{ - X509_REQ *new; - VALUE obj; - - obj = NewX509Req(cX509Req); - if (!req) { - new = X509_REQ_new(); - } else { - new = X509_REQ_dup(req); - } - if (!new) { - ossl_raise(eX509ReqError, NULL); - } - SetX509Req(obj, new); - - return obj; -} - X509_REQ * GetX509ReqPtr(VALUE obj) { @@ -77,19 +57,6 @@ GetX509ReqPtr(VALUE obj) return req; } -X509_REQ * -DupX509ReqPtr(VALUE obj) -{ - X509_REQ *req, *new; - - GetX509Req(obj, req); - if (!(new = X509_REQ_dup(req))) { - ossl_raise(eX509ReqError, NULL); - } - - return new; -} - /* * Private functions */ diff --git a/ext/openssl/ossl_x509store.c b/ext/openssl/ossl_x509store.c index fc168ad9..46d3552f 100644 --- a/ext/openssl/ossl_x509store.c +++ b/ext/openssl/ossl_x509store.c @@ -122,17 +122,6 @@ static const rb_data_type_t ossl_x509store_type = { /* * Public functions */ -VALUE -ossl_x509store_new(X509_STORE *store) -{ - VALUE obj; - - obj = NewX509Store(cX509Store); - SetX509Store(obj, store); - - return obj; -} - X509_STORE * GetX509StorePtr(VALUE obj) { @@ -143,17 +132,6 @@ GetX509StorePtr(VALUE obj) return store; } -X509_STORE * -DupX509StorePtr(VALUE obj) -{ - X509_STORE *store; - - GetX509Store(obj, store); - X509_STORE_up_ref(store); - - return store; -} - /* * Private functions */ |