Skip to content

Commit c24bae3

Browse files
committed
Remove unused functions and macros
1 parent 8d4d444 commit c24bae3

File tree

9 files changed

+1
-144
lines changed

9 files changed

+1
-144
lines changed

ext/openssl/ossl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ VALUE eOSSLError;
250250
/*
251251
* Convert to DER string
252252
*/
253-
ID ossl_s_to_der;
253+
static ID ossl_s_to_der;
254254

255255
VALUE
256256
ossl_to_der(VALUE obj)

ext/openssl/ossl.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,6 @@ extern VALUE eOSSLError;
5656
}\
5757
} while (0)
5858

59-
#define OSSL_Check_Instance(obj, klass) do {\
60-
if (!rb_obj_is_instance_of((obj), (klass))) {\
61-
ossl_raise(rb_eTypeError, "wrong argument (%"PRIsVALUE")! (Expected instance of %"PRIsVALUE")",\
62-
rb_obj_class(obj), (klass));\
63-
}\
64-
} while (0)
65-
66-
#define OSSL_Check_Same_Class(obj1, obj2) do {\
67-
if (!rb_obj_is_instance_of((obj1), rb_obj_class(obj2))) {\
68-
ossl_raise(rb_eTypeError, "wrong argument type");\
69-
}\
70-
} while (0)
71-
7259
/*
7360
* Type conversions
7461
*/
@@ -85,7 +72,6 @@ extern VALUE eOSSLError;
8572
/*
8673
* Data Conversion
8774
*/
88-
STACK_OF(X509) *ossl_x509_ary2sk0(VALUE);
8975
STACK_OF(X509) *ossl_x509_ary2sk(VALUE);
9076
STACK_OF(X509) *ossl_protect_x509_ary2sk(VALUE,int*);
9177
VALUE ossl_x509_sk2ary(const STACK_OF(X509) *certs);
@@ -129,15 +115,13 @@ int ossl_pem_passwd_cb(char *, int, int, void *);
129115
/*
130116
* ERRor messages
131117
*/
132-
#define OSSL_ErrMsg() ERR_reason_error_string(ERR_get_error())
133118
NORETURN(void ossl_raise(VALUE, const char *, ...));
134119
/* Clear OpenSSL error queue. If dOSSL is set, rb_warn() them. */
135120
void ossl_clear_error(void);
136121

137122
/*
138123
* String to DER String
139124
*/
140-
extern ID ossl_s_to_der;
141125
VALUE ossl_to_der(VALUE);
142126
VALUE ossl_to_der_if_possible(VALUE);
143127

@@ -155,20 +139,9 @@ extern VALUE dOSSL;
155139
} \
156140
} while (0)
157141

158-
#define OSSL_Warning(fmt, ...) do { \
159-
OSSL_Debug((fmt), ##__VA_ARGS__); \
160-
rb_warning((fmt), ##__VA_ARGS__); \
161-
} while (0)
162-
163-
#define OSSL_Warn(fmt, ...) do { \
164-
OSSL_Debug((fmt), ##__VA_ARGS__); \
165-
rb_warn((fmt), ##__VA_ARGS__); \
166-
} while (0)
167142
#else
168143
void ossl_debug(const char *, ...);
169144
#define OSSL_Debug ossl_debug
170-
#define OSSL_Warning rb_warning
171-
#define OSSL_Warn rb_warn
172145
#endif
173146

174147
/*

ext/openssl/ossl_bio.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,6 @@ ossl_obj2bio(VALUE obj)
4444
return bio;
4545
}
4646

47-
BIO *
48-
ossl_protect_obj2bio(VALUE obj, int *status)
49-
{
50-
BIO *ret = NULL;
51-
ret = (BIO*)rb_protect((VALUE (*)(VALUE))ossl_obj2bio, obj, status);
52-
return ret;
53-
}
54-
5547
VALUE
5648
ossl_membio2str(BIO *bio)
5749
{

ext/openssl/ossl_bio.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#define _OSSL_BIO_H_
1212

1313
BIO *ossl_obj2bio(VALUE);
14-
BIO *ossl_protect_obj2bio(VALUE,int*);
1514
VALUE ossl_membio2str(BIO*);
1615

1716
#endif

ext/openssl/ossl_x509.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ extern VALUE cX509Cert;
4141
extern VALUE eX509CertError;
4242

4343
VALUE ossl_x509_new(X509 *);
44-
VALUE ossl_x509_new_from_file(VALUE);
4544
X509 *GetX509CertPtr(VALUE);
4645
X509 *DupX509CertPtr(VALUE);
4746
void Init_ossl_x509cert(void);
@@ -54,7 +53,6 @@ extern VALUE eX509CRLError;
5453

5554
VALUE ossl_x509crl_new(X509_CRL *);
5655
X509_CRL *GetX509CRLPtr(VALUE);
57-
X509_CRL *DupX509CRLPtr(VALUE);
5856
void Init_ossl_x509crl(void);
5957

6058
/*
@@ -84,9 +82,7 @@ void Init_ossl_x509name(void);
8482
extern VALUE cX509Req;
8583
extern VALUE eX509ReqError;
8684

87-
VALUE ossl_x509req_new(X509_REQ *);
8885
X509_REQ *GetX509ReqPtr(VALUE);
89-
X509_REQ *DupX509ReqPtr(VALUE);
9086
void Init_ossl_x509req(void);
9187

9288
/*
@@ -106,11 +102,8 @@ extern VALUE cX509Store;
106102
extern VALUE cX509StoreContext;
107103
extern VALUE eX509StoreError;
108104

109-
VALUE ossl_x509store_new(X509_STORE *);
110105
X509_STORE *GetX509StorePtr(VALUE);
111-
X509_STORE *DupX509StorePtr(VALUE);
112106

113-
X509_STORE_CTX *GetX509StCtxtPtr(VALUE);
114107
void Init_ossl_x509store(void);
115108

116109
/*

ext/openssl/ossl_x509cert.c

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -67,40 +67,6 @@ ossl_x509_new(X509 *x509)
6767
return obj;
6868
}
6969

70-
VALUE
71-
ossl_x509_new_from_file(VALUE filename)
72-
{
73-
X509 *x509;
74-
FILE *fp;
75-
VALUE obj;
76-
77-
rb_check_safe_obj(filename);
78-
obj = NewX509(cX509Cert);
79-
if (!(fp = fopen(StringValueCStr(filename), "r"))) {
80-
ossl_raise(eX509CertError, "%s", strerror(errno));
81-
}
82-
rb_fd_fix_cloexec(fileno(fp));
83-
x509 = PEM_read_X509(fp, NULL, NULL, NULL);
84-
/*
85-
* prepare for DER...
86-
#if !defined(OPENSSL_NO_FP_API)
87-
if (!x509) {
88-
(void)ERR_get_error();
89-
rewind(fp);
90-
91-
x509 = d2i_X509_fp(fp, NULL);
92-
}
93-
#endif
94-
*/
95-
fclose(fp);
96-
if (!x509) {
97-
ossl_raise(eX509CertError, NULL);
98-
}
99-
SetX509(obj, x509);
100-
101-
return obj;
102-
}
103-
10470
X509 *
10571
GetX509CertPtr(VALUE obj)
10672
{

ext/openssl/ossl_x509crl.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,6 @@ GetX509CRLPtr(VALUE obj)
5757
return crl;
5858
}
5959

60-
X509_CRL *
61-
DupX509CRLPtr(VALUE obj)
62-
{
63-
X509_CRL *crl;
64-
65-
GetX509CRL(obj, crl);
66-
X509_CRL_up_ref(crl);
67-
68-
return crl;
69-
}
70-
7160
VALUE
7261
ossl_x509crl_new(X509_CRL *crl)
7362
{

ext/openssl/ossl_x509req.c

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -47,26 +47,6 @@ static const rb_data_type_t ossl_x509req_type = {
4747
/*
4848
* Public functions
4949
*/
50-
VALUE
51-
ossl_x509req_new(X509_REQ *req)
52-
{
53-
X509_REQ *new;
54-
VALUE obj;
55-
56-
obj = NewX509Req(cX509Req);
57-
if (!req) {
58-
new = X509_REQ_new();
59-
} else {
60-
new = X509_REQ_dup(req);
61-
}
62-
if (!new) {
63-
ossl_raise(eX509ReqError, NULL);
64-
}
65-
SetX509Req(obj, new);
66-
67-
return obj;
68-
}
69-
7050
X509_REQ *
7151
GetX509ReqPtr(VALUE obj)
7252
{
@@ -77,19 +57,6 @@ GetX509ReqPtr(VALUE obj)
7757
return req;
7858
}
7959

80-
X509_REQ *
81-
DupX509ReqPtr(VALUE obj)
82-
{
83-
X509_REQ *req, *new;
84-
85-
GetX509Req(obj, req);
86-
if (!(new = X509_REQ_dup(req))) {
87-
ossl_raise(eX509ReqError, NULL);
88-
}
89-
90-
return new;
91-
}
92-
9360
/*
9461
* Private functions
9562
*/

ext/openssl/ossl_x509store.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,6 @@ static const rb_data_type_t ossl_x509store_type = {
122122
/*
123123
* Public functions
124124
*/
125-
VALUE
126-
ossl_x509store_new(X509_STORE *store)
127-
{
128-
VALUE obj;
129-
130-
obj = NewX509Store(cX509Store);
131-
SetX509Store(obj, store);
132-
133-
return obj;
134-
}
135-
136125
X509_STORE *
137126
GetX509StorePtr(VALUE obj)
138127
{
@@ -143,17 +132,6 @@ GetX509StorePtr(VALUE obj)
143132
return store;
144133
}
145134

146-
X509_STORE *
147-
DupX509StorePtr(VALUE obj)
148-
{
149-
X509_STORE *store;
150-
151-
GetX509Store(obj, store);
152-
X509_STORE_up_ref(store);
153-
154-
return store;
155-
}
156-
157135
/*
158136
* Private functions
159137
*/

0 commit comments

Comments
 (0)