Skip to content

Commit b3d3d2c

Browse files
committed
feat: stop using ePKCS7Error, make all error values static
1 parent fa8efa3 commit b3d3d2c

File tree

5 files changed

+13
-16
lines changed

5 files changed

+13
-16
lines changed

ext/openssl/ossl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ extern VALUE dOSSL;
186186
#include "ossl_bn.h"
187187
#include "ossl_cipher.h"
188188
#include "ossl_config.h"
189+
#include "ossl_cms.h"
189190
#include "ossl_digest.h"
190191
#include "ossl_engine.h"
191192
#include "ossl_hmac.h"
@@ -194,7 +195,6 @@ extern VALUE dOSSL;
194195
#include "ossl_ocsp.h"
195196
#include "ossl_pkcs12.h"
196197
#include "ossl_pkcs7.h"
197-
#include "ossl_cms.h"
198198
#include "ossl_pkey.h"
199199
#include "ossl_provider.h"
200200
#include "ossl_rand.h"

ext/openssl/ossl_cms.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,14 @@
5454
#define ossl_cmsci_set_err_string(o,v) rb_iv_set((o), "@error_string", (v))
5555
#define ossl_cmsci_get_err_string(o) rb_iv_get((o), "@error_string")
5656

57-
VALUE cCMS;
58-
VALUE cCMSContentInfo;
59-
VALUE cCMSSignerInfo;
60-
VALUE cCMSRecipient;
61-
VALUE eCMSError;
57+
static VALUE cCMS;
58+
static VALUE cCMSContentInfo;
59+
static VALUE cCMSSignerInfo;
60+
#if 0
61+
/* not yet implemented. */
62+
static VALUE cCMSRecipient;
63+
#endif
64+
static VALUE eCMSError;
6265

6366

6467
static void
@@ -104,7 +107,7 @@ ossl_cmsci_to_pem(VALUE self)
104107
}
105108
if (!PEM_write_bio_CMS(out, cmsci)) {
106109
BIO_free(out);
107-
ossl_raise(ePKCS7Error, NULL);
110+
ossl_raise(eCMSError, NULL);
108111
}
109112
str = ossl_membio2str(out);
110113

@@ -423,7 +426,7 @@ ossl_cms_s_sign(int argc, VALUE *argv, VALUE klass)
423426
if(!(cms_cinfo = CMS_sign(x509, pkey, x509s, in, flg))){
424427
BIO_free(in);
425428
sk_X509_pop_free(x509s, X509_free);
426-
ossl_raise(ePKCS7Error, NULL);
429+
ossl_raise(eCMSError, NULL);
427430
}
428431
SetCMSContentInfo(ret, cms_cinfo);
429432
ossl_cmsci_set_data(ret, data);
@@ -470,6 +473,7 @@ Init_ossl_cms(void)
470473
rb_define_method(cCMSSignerInfo,"serial", ossl_cmssi_get_serial,0);
471474

472475
#if 0
476+
/* not yet implemented. */
473477
rb_define_singleton_method(cCMS, "read_smime", ossl_cms_s_read_smime, 1);
474478
rb_define_singleton_method(cCMS, "write_smime", ossl_cms_s_write_smime, -1);
475479
rb_define_singleton_method(cCMS, "encrypt", ossl_cms_s_encrypt, -1);

ext/openssl/ossl_cms.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010
#if !defined(_OSSL_CMS_H_)
1111
#define _OSSL_CMS_H_
1212

13-
extern VALUE cCMS;
14-
extern VALUE cCMSContentInfo;
15-
extern VALUE cCMSSigner;
16-
extern VALUE cCMSRecipient;
17-
extern VALUE eCMSError;
18-
1913
void Init_ossl_cms(void);
2014

2115
#endif /* _OSSL_CMS_H_ */

ext/openssl/ossl_pkcs7.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
static VALUE cPKCS7;
6868
static VALUE cPKCS7Signer;
6969
static VALUE cPKCS7Recipient;
70-
VALUE ePKCS7Error;
70+
static VALUE ePKCS7Error;
7171

7272
static void
7373
ossl_pkcs7_free(void *ptr)

ext/openssl/ossl_pkcs7.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#if !defined(_OSSL_PKCS7_H_)
1111
#define _OSSL_PKCS7_H_
1212

13-
extern VALUE ePKCS7Error;
1413
VALUE ossl_pkcs7_new(PKCS7 *p7);
1514
void Init_ossl_pkcs7(void);
1615

0 commit comments

Comments
 (0)