diff options
author | GOTOU Yuuzou <gotoyuzo@notwork.org> | 2003-07-21 19:39:38 +0000 |
---|---|---|
committer | GOTOU Yuuzou <gotoyuzo@notwork.org> | 2003-07-21 19:39:38 +0000 |
commit | 3d0071a8b8370abebc8ff1ed703263939a7e10ef (patch) | |
tree | de85ca79135ab0b64d766700e2b8754c5215a23e | |
parent | c7f1f4441ca27c111fb55a07f40f8c3f8dc217d4 (diff) | |
download | ruby-openssl-history-3d0071a8b8370abebc8ff1ed703263939a7e10ef.tar.gz |
*** empty log message ***
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | extconf.rb | 38 | ||||
-rw-r--r-- | openssl_missing.c | 58 | ||||
-rw-r--r-- | openssl_missing.h | 43 | ||||
-rw-r--r-- | ossl.c | 3 | ||||
-rw-r--r-- | ossl.h | 7 | ||||
-rw-r--r-- | ossl_config.c | 16 | ||||
-rw-r--r-- | ossl_ocsp.c | 2 | ||||
-rw-r--r-- | ossl_ocsp.h | 2 | ||||
-rw-r--r-- | ossl_pkcs7.c | 2 | ||||
-rw-r--r-- | ossl_pkey_rsa.c | 2 | ||||
-rw-r--r-- | ossl_ssl.c | 4 | ||||
-rw-r--r-- | ossl_x509.c | 10 | ||||
-rw-r--r-- | ossl_x509.h | 6 | ||||
-rw-r--r-- | ossl_x509attr.c | 2 | ||||
-rw-r--r-- | ossl_x509crl.c | 4 | ||||
-rw-r--r-- | ossl_x509ext.c | 2 | ||||
-rw-r--r-- | ossl_x509req.c | 6 | ||||
-rw-r--r-- | ossl_x509revoked.c | 2 |
19 files changed, 103 insertions, 109 deletions
@@ -1,3 +1,6 @@ +Tue, 22 Jul 2003 04:37:58 +0900 -- GOTOU Yuuzou <gotoyuzo@notwork.org> + * further OpenSSL 0.9.6 compatibility + Tue, 22 Jul 2003 02:56:54 +0900 -- GOTOU Yuuzou <gotoyuzo@notwork.org> * examples/gen.sh: print OPENSSL_VERSION * exapmles/ossl_x509store.rb: unuse Store#set_flags is <= 0x00907000 @@ -16,17 +16,6 @@ require "mkmf" -def have_defined(macro, header=nil) - checking_for "#{macro}" do - if macro_defined?(macro, cpp_include(header)) - $defs.push(format("-DHAVE_%s", macro.upcase)) - true - else - false - end - end -end - if RUBY_PLATFORM =~ /mswin32/ CRYPTOLIB="libeay32" SSLLIB="ssleay32" @@ -47,7 +36,6 @@ includes ||= "/usr/include" message "=== OpenSSL for Ruby configurator ===\n" - ## # Adds -Wall -DOSSL_DEBUG for compilation and some more targets when GCC is used # To turn it on, use: --with-debug or --enable-debug @@ -80,6 +68,7 @@ dep: include dep EOD } + File.open(File.join($srcdir, "dep"), "w").close end end @@ -113,13 +102,6 @@ have_header("sys/time.h") message "=== Checking for OpenSSL features... ===\n" have_openssl_097(includes) -have_defined("PEM_read_bio_DSAPublicKey", "openssl/pem.h") -have_defined("PEM_write_bio_DSAPublicKey", "openssl/pem.h") -have_defined("DSAPrivateKey_dup", "openssl/dsa.h") -have_defined("DSAPublicKey_dup", "openssl/dsa.h") -have_defined("X509_REVOKED_dup", "openssl/x509.h") -have_defined("PKCS7_SIGNER_INFO_dup", "openssl/pkcs7") -have_defined("PKCS7_RECIP_INFO_dup", "openssl/pkcs7") have_func("HMAC_CTX_copy") have_func("X509_STORE_get_ex_data") have_func("X509_STORE_set_ex_data") @@ -127,31 +109,20 @@ have_func("EVP_MD_CTX_create") have_func("EVP_MD_CTX_cleanup") have_func("EVP_MD_CTX_destroy") have_func("PEM_def_callback") -have_defined("EVP_CIPHER_name", "openssl/evp.h") -have_defined("EVP_MD_name", "openssl/evp.h") have_func("EVP_MD_CTX_init") have_func("HMAC_CTX_init") have_func("HMAC_CTX_cleanup") -have_defined("PKCS7_is_detached", "openssl/pkcs7.h") -have_defined("PKCS7_type_is_encrypted", "openssl/pkcs7.h") have_func("X509_CRL_set_version") have_func("X509_CRL_set_issuer_name") have_func("X509_CRL_sort") have_func("X509_CRL_add0_revoked") -have_struct_member("X509_STORE_CTX", "current_crl", "openssl/x509.h") -have_struct_member("X509_STORE", "flags", "openssl/x509.h") -have_struct_member("X509_STORE", "purpose", "openssl/x509.h") -have_struct_member("X509_STORE", "trust", "openssl/x509.h") -have_struct_member("EVP_CIPHER_CTX", "flags", "openssl/evp.h") +have_func("CONF_get1_default_config_file") have_func("BN_mod_sqr") have_func("BN_mod_add") have_func("BN_mod_sub") have_func("CONF_get1_default_config_file") -have_defined("X509_V_FLAG_CRL_CHECK", "openssl/x509_vfy.h") -have_defined("X509_V_FLAG_CRL_CHECK_ALL", "openssl/x509_vfy.h") -have_defined("X509_PURPOSE_OCSP_HELPER", "openssl/x509v3.h") -have_defined("X509_TRUST_OCSP_SIGN", "openssl/x509.h") -have_defined("X509_TRUST_OCSP_REQUEST", "openssl/x509.h") +have_header("openssl/ocsp.h") +have_struct_member("EVP_CIPHER_CTX", "flags", "openssl/evp.h") message "=== Checking for Ruby features... ===\n" have_func("rb_obj_init_copy", "ruby.h") @@ -159,4 +130,3 @@ have_func("rb_obj_init_copy", "ruby.h") message "=== Checking done. ===\n" create_makefile("openssl") message "Done.\n" - diff --git a/openssl_missing.c b/openssl_missing.c index a23e070..bab51f7 100644 --- a/openssl_missing.c +++ b/openssl_missing.c @@ -66,7 +66,7 @@ EVP_MD_CTX *EVP_MD_CTX_create(void) #if !defined(HAVE_EVP_MD_CTX_CLEANUP) int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) { -#warning FIXME!!! + /* FIXME!!! */ memset(ctx, '\0', sizeof *ctx); return 1; @@ -136,25 +136,25 @@ int X509_CRL_sort(X509_CRL *c) /* sort the data so it will be written in serial * number order */ sk_X509_REVOKED_sort(c->crl->revoked); - for (i=0; i<sk_X509_REVOKED_num(c->crl->revoked); i++) - { + for (i=0; i<sk_X509_REVOKED_num(c->crl->revoked); i++){ r=sk_X509_REVOKED_value(c->crl->revoked,i); r->sequence=i; - } + } return 1; } #endif -#if !defined(X509_CRL_ADD0_REVOKED) -static int OSSL_X509_REVOKED_cmp(const X509_REVOKED * const *a, - const X509_REVOKED * const *b) +#if !defined(HAVE_X509_CRL_ADD0_REVOKED) +static int +OSSL_X509_REVOKED_cmp(const X509_REVOKED * const *a, const X509_REVOKED * const *b) { return(ASN1_STRING_cmp( (ASN1_STRING *)(*a)->serialNumber, (ASN1_STRING *)(*b)->serialNumber)); } -int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev) +int +X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev) { X509_CRL_INFO *inf; inf = crl->crl; @@ -169,12 +169,13 @@ int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev) #endif #if !defined(HAVE_BN_MOD_SQR) -int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) - { - if (!BN_sqr(r, a, ctx)) return 0; +int +BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) +{ + if (!BN_sqr(r, (BIGNUM*)a, ctx)) return 0; /* r->neg == 0, thus we don't need BN_nnmod */ return BN_mod(r, r, m, ctx); - } +} #endif #if !defined(HAVE_BN_MOD_ADD) || !defined(HAVE_BN_MOD_SUB) @@ -241,3 +242,36 @@ char *CONF_get1_default_config_file(void) } #endif +#if !defined(HAVE_PEM_DEF_CALLBACK) +#define OSSL_PASS_MIN_LENGTH 4 +int +PEM_def_callback(char *buf, int num, int w, void *key) +{ + int i,j; + const char *prompt; + if(key){ + i = strlen(key); + i = (i > num) ? num : i; + memcpy(buf, key, i); + return(i); + } + + prompt = EVP_get_pw_prompt(); + if (prompt == NULL) prompt= "Enter PEM pass phrase:"; + for(;;){ + i = EVP_read_pw_string(buf, num, prompt, w); + if(i != 0){ + memset(buf,0,(unsigned int)num); + return(-1); + } + j = strlen(buf); + if(j < OSSL_PASS_MIN_LENGTH){ + fprintf(stderr, + "phrase is too short, needs to be at least %d chars\n", + OSSL_PASS_MIN_LENGTH); + } + else break; + } + return(j); +} +#endif diff --git a/openssl_missing.h b/openssl_missing.h index a45d779..33b15f6 100644 --- a/openssl_missing.h +++ b/openssl_missing.h @@ -19,39 +19,39 @@ extern "C" { * These functions are not included in headers of OPENSSL <= 0.9.6b */ -#if !defined(HAVE_PEM_READ_BIO_DSAPUBLICKEY) +#if !defined(PEM_read_bio_DSAPublicKey) # define PEM_read_bio_DSAPublicKey(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \ (char *(*)())d2i_DSAPublicKey,PEM_STRING_DSA_PUBLIC,bp,(char **)x,cb,u) #endif -#if !defined(HAVE_PEM_WRITE_BIO_DSAPUBLICKEY) +#if !defined(PEM_write_bio_DSAPublicKey) # define PEM_write_bio_DSAPublicKey(bp,x) \ PEM_ASN1_write_bio((int (*)())i2d_DSAPublicKey,\ PEM_STRING_DSA_PUBLIC,\ bp,(char *)x, NULL, NULL, 0, NULL, NULL) #endif -#if !defined(HAVE_DSAPRIVATEKEY_DUP) +#if !defined(DSAPrivateKey_dup) # define DSAPrivateKey_dup(dsa) (DSA *)ASN1_dup((int (*)())i2d_DSAPrivateKey, \ (char *(*)())d2i_DSAPrivateKey,(char *)dsa) #endif -#if !defined(HAVE_DSAPUBLICKEY_DUP) +#if !defined(DSAPublicKey_dup) # define DSAPublicKey_dup(dsa) (DSA *)ASN1_dup((int (*)())i2d_DSAPublicKey, \ (char *(*)())d2i_DSAPublicKey,(char *)dsa) #endif -#if !defined(HAVE_X509_REVOKED_DUP) +#if !defined(X509_REVOKED_dup) # define X509_REVOKED_dup(rev) (X509_REVOKED *)ASN1_dup((int (*)())i2d_X509_REVOKED, \ (char *(*)())d2i_X509_REVOKED, (char *)rev) #endif -#if !defined(HAVE_PKCS7_SIGNER_INFO_DUP) +#if !defined(PKCS7_SIGNER_INFO_dup) # define PKCS7_SIGNER_INFO_dup(si) (PKCS7_SIGNER_INFO *)ASN1_dup((int (*)())i2d_PKCS7_SIGNER_INFO, \ (char *(*)())d2i_PKCS7_SIGNER_INFO, (char *)si) #endif -#if !defined(HAVE_PKCS7_RECIP_INFO_DUP) +#if !defined(PKCS7_RECIP_INFO_dup) # define PKCS7_RECIP_INFO_dup(ri) (PKCS7_RECIP_INFO *)ASN1_dup((int (*)())i2d_PKCS7_RECIP_INFO, \ (char *(*)())d2i_PKCS7_RECIP_INFO, (char *)ri) #endif @@ -63,11 +63,11 @@ EVP_MD_CTX *EVP_MD_CTX_create(void); int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx); void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); -#if !defined(HAVE_EVP_CIPHER_NAME) +#if !defined(EVP_CIPHER_name) # define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) #endif -#if !defined(HAVE_EVP_MD_NAME) +#if !defined(EVP_MD_name) # define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_type(e)) #endif @@ -75,11 +75,11 @@ void EVP_MD_CTX_init(EVP_MD_CTX *ctx); void HMAC_CTX_init(HMAC_CTX *ctx); void HMAC_CTX_cleanup(HMAC_CTX *ctx); -#if !defined(HAVE_PKCS7_IS_DETACHED) +#if !defined(PKCS7_is_detached) # define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7)) #endif -#if !defined(HAVE_PKCS7_TYPE_IS_ENCRYPTED) +#if !defined(PKCS7_type_is_encrypted) # define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted) #endif @@ -92,29 +92,14 @@ int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_ int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx); char *CONF_get1_default_config_file(void); -#if !defined(HAVE_X509_V_FLAG_CRL_CHECK) -# define X509_V_FLAG_CRL_CHECK 0x4 -#endif - -#if !defined(HAVE_X509_V_FLAG_CRL_CHECK_ALL) -# define X509_V_FLAG_CRL_CHECK_ALL 0x8 -#endif - -#if !defined(HAVE_X509_PURPOSE_OCSP_HELPER) -# define X509_PURPOSE_OCSP_HELPER 8 -#endif - -#if !defined(HAVE_X509_TRUST_OCSP_SIGN) -# define X509_TRUST_OCSP_SIGN 6 -#endif - -#if !defined(TRUST_X509_OCSP_REQUEST) -# define X509_TRUST_OCSP_REQUEST 7 +#if !defined(HAVE_PEM_DEF_CALLBACK) +int PEM_def_callback(char *buf, int num, int w, void *key); #endif #if defined(__cplusplus) } #endif + #endif /* _OSSL_OPENSSL_MISSING_H_ */ @@ -292,7 +292,6 @@ OSSL_SK2ARY(x509crl, X509_CRL) /* * our default PEM callback */ -#if defined(HAVE_PEM_DEF_CALLBACK) static VALUE ossl_pem_passwd_cb0(VALUE flag) { @@ -336,7 +335,6 @@ ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd) } return len; } -#endif /* * Verify callback @@ -518,6 +516,7 @@ Init_openssl() */ rb_define_const(mOSSL, "VERSION", rb_str_new2(OSSL_VERSION)); rb_define_const(mOSSL, "OPENSSL_VERSION",rb_str_new2(OPENSSL_VERSION_TEXT)); + rb_define_const(mOSSL, "OPENSSL_VERSION_NUMBER",INT2NUM(OPENSSL_VERSION_NUMBER)); /* * Generic error, @@ -34,7 +34,8 @@ extern "C" { #include <openssl/ssl.h> #include <openssl/hmac.h> #include <openssl/rand.h> -#if (OPENSSL_VERSION_NUMBER >= 0x00907000L) +#if HAVE_OPENSSL_OCSP_H +# define USE_OCSP # include <openssl/ocsp.h> #endif #if defined(NT) || defined(_WIN32) @@ -113,11 +114,7 @@ STACK_OF(X509) *ossl_protect_x509_ary2sk(VALUE,int*); /* * our default PEM callback */ -#if defined(HAVE_PEM_DEF_CALLBACK) int ossl_pem_passwd_cb(char *, int, int, void *); -#else -# define ossl_pem_passwd_cb NULL -#endif /* * ERRor messages diff --git a/ossl_config.c b/ossl_config.c index 5109d3d..5e8cfcd 100644 --- a/ossl_config.c +++ b/ossl_config.c @@ -47,35 +47,29 @@ ossl_config_s_load(int argc, VALUE *argv, VALUE klass) if (rb_scan_args(argc, argv, "01", &path) == 1) { SafeStringValue(path); - filename = RSTRING(path)->ptr; + filename = BUF_strdup(RSTRING(path)->ptr); } else { if (!(filename = CONF_get1_default_config_file())) { ossl_raise(eConfigError, NULL); } } -/* - * FIXME - * Does't work for Windows? -#if defined(NT) || defined(_WIN32) - if (!(conf = NCONF_new(NCONF_WIN32()))){ -#else - if (!(conf = NCONF_new(NCONF_default()))){ -#endif - */ if (!(conf = NCONF_new(NULL))) { + OPENSSL_free(filename); ossl_raise(eConfigError, NULL); } OSSL_Debug("Loading file: %s", filename); if (!NCONF_load(conf, filename, &err_line)) { + OPENSSL_free(filename); if (err_line <= 0) { ossl_raise(eConfigError, "wrong config file (%s)", filename); } else { - ossl_raise(eConfigError, "error on line %ld in config file \"%s\"", \ + ossl_raise(eConfigError, "error on line %ld in config file \"%s\"", err_line, filename); } } + OPENSSL_free(filename); WrapConfig(klass, obj, conf); return obj; diff --git a/ossl_ocsp.c b/ossl_ocsp.c index 6dfb488..ca6f03a 100644 --- a/ossl_ocsp.c +++ b/ossl_ocsp.c @@ -11,7 +11,7 @@ */ #include "ossl.h" -#if (OPENSSL_VERSION_NUMBER >= 0x00907000L) +#ifdef USE_OCSP #define WrapOCSPReq(klass, obj, req) do { \ if(!req) ossl_raise(rb_eRuntimeError, "Request wasn't initialized!"); \ diff --git a/ossl_ocsp.h b/ossl_ocsp.h index 5aa0515..d1d6d7a 100644 --- a/ossl_ocsp.h +++ b/ossl_ocsp.h @@ -12,10 +12,12 @@ #if !defined(_OSSL_OCSP_H_) #define _OSSL_OCSP_H_ +#ifdef USE_OCSP extern VALUE mOCSP; extern VALUE cOPCSReq; extern VALUE cOPCSRes; extern VALUE cOPCSBasicRes; +#endif void Init_ossl_ocsp(void); diff --git a/ossl_pkcs7.c b/ossl_pkcs7.c index d6ac916..a27ecc7 100644 --- a/ossl_pkcs7.c +++ b/ossl_pkcs7.c @@ -299,7 +299,7 @@ ossl_pkcs7_copy(VALUE self, VALUE other) static int ossl_pkcs7_sym2typeid(VALUE sym) { - int i, ret; + int i, ret = Qnil; char *s; static struct { diff --git a/ossl_pkey_rsa.c b/ossl_pkey_rsa.c index d04a22f..e8c74f0 100644 --- a/ossl_pkey_rsa.c +++ b/ossl_pkey_rsa.c @@ -423,6 +423,7 @@ ossl_rsa_to_public_key(VALUE self) return obj; } +#if 0 /* * TODO, FIXME * Find some good way how to specify type @@ -461,7 +462,6 @@ ossl_rsa_sign(VALUE self, VALUE data) return str; } -#if 0 static VALUE ossl_rsa_verify(VALUE self, VALUE sig, VALUE data) { @@ -656,7 +656,7 @@ Init_ossl_ssl() * ossl_ssl_def_const(OP_DONT_INSERT_EMPTY_FRAGMENTS); */ ossl_ssl_def_const(OP_ALL); -#if (OPENSSL_VERSION_NUMBER >= 0x00907000L) +#if SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION ossl_ssl_def_const(OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION); #endif #ifdef SSL_OP_SINGLE_ECDH_USE @@ -664,7 +664,7 @@ Init_ossl_ssl() #endif ossl_ssl_def_const(OP_SINGLE_DH_USE); ossl_ssl_def_const(OP_EPHEMERAL_RSA); -#if (OPENSSL_VERSION_NUMBER >= 0x00907000L) +#if SSL_OP_CIPHER_SERVER_PREFERENCE ossl_ssl_def_const(OP_CIPHER_SERVER_PREFERENCE); #endif ossl_ssl_def_const(OP_TLS_ROLLBACK_BUG); diff --git a/ossl_x509.c b/ossl_x509.c index 5de2b6b..4813ebd 100644 --- a/ossl_x509.c +++ b/ossl_x509.c @@ -62,8 +62,12 @@ Init_ossl_x509() DefX509Const(V_ERR_KEYUSAGE_NO_CERTSIGN); DefX509Const(V_ERR_APPLICATION_VERIFICATION); +#ifdef X509_V_FLAG_CRL_CHECK DefX509Const(V_FLAG_CRL_CHECK); +#endif +#ifdef X509_V_FLAG_CRL_CHECK_ALL DefX509Const(V_FLAG_CRL_CHECK_ALL); +#endif DefX509Const(PURPOSE_SSL_CLIENT); DefX509Const(PURPOSE_SSL_SERVER); @@ -72,13 +76,19 @@ Init_ossl_x509() DefX509Const(PURPOSE_SMIME_ENCRYPT); DefX509Const(PURPOSE_CRL_SIGN); DefX509Const(PURPOSE_ANY); +#ifdef X509_PURPOSE_OCSP_HELPER DefX509Const(PURPOSE_OCSP_HELPER); +#endif DefX509Const(TRUST_COMPAT); DefX509Const(TRUST_SSL_CLIENT); DefX509Const(TRUST_SSL_SERVER); DefX509Const(TRUST_EMAIL); DefX509Const(TRUST_OBJECT_SIGN); +#ifdef X509_TRUST_OCSP_SIGN DefX509Const(TRUST_OCSP_SIGN); +#endif +#ifdef X509_TRUST_OCSP_REQUEST DefX509Const(TRUST_OCSP_REQUEST); +#endif } diff --git a/ossl_x509.h b/ossl_x509.h index f3fcd6a..196ce06 100644 --- a/ossl_x509.h +++ b/ossl_x509.h @@ -25,7 +25,7 @@ extern VALUE cX509Attr; extern VALUE eX509AttrError; VALUE ossl_x509attr_new(X509_ATTRIBUTE *); -X509_ATTRIBUTE *ossl_x509attr_get_X509_ATTRIBUTE(VALUE); +X509_ATTRIBUTE *DupX509AttrPtr(VALUE); void Init_ossl_x509attr(void); /* @@ -80,7 +80,7 @@ extern VALUE cX509Req; extern VALUE eX509ReqError; VALUE ossl_x509req_new(X509_REQ *); -X509_REQ *ossl_x509req_get_X509_REQ(VALUE); +X509_REQ *DupX509ReqPtr(VALUE); void Init_ossl_x509req(void); /* @@ -90,7 +90,7 @@ extern VALUE cX509Rev; extern VALUE eX509RevError; VALUE ossl_x509revoked_new(X509_REVOKED *); -X509_REVOKED *ossl_x509revoked_get_X509_REVOKED(VALUE); +X509_REVOKED *DupX509RevokedPtr(VALUE); void Init_ossl_x509revoked(void); /* diff --git a/ossl_x509attr.c b/ossl_x509attr.c index 22b5e17..6d5df51 100644 --- a/ossl_x509attr.c +++ b/ossl_x509attr.c @@ -56,7 +56,7 @@ ossl_x509attr_new(X509_ATTRIBUTE *attr) } X509_ATTRIBUTE * -ossl_x509attr_get_X509_ATTRIBUTE(VALUE obj) +DupX509AttrPtr(VALUE obj) { X509_ATTRIBUTE *attr, *new; diff --git a/ossl_x509crl.c b/ossl_x509crl.c index 9292eb9..2c1f9e0 100644 --- a/ossl_x509crl.c +++ b/ossl_x509crl.c @@ -310,7 +310,7 @@ ossl_x509crl_set_revoked(VALUE self, VALUE ary) sk_X509_REVOKED_pop_free(crl->crl->revoked, X509_REVOKED_free); crl->crl->revoked = NULL; for (i=0; i<RARRAY(ary)->len; i++) { - rev = ossl_x509revoked_get_X509_REVOKED(RARRAY(ary)->ptr[i]); + rev = DupX509RevokedPtr(RARRAY(ary)->ptr[i]); if (!X509_CRL_add0_revoked(crl, rev)) { /* NO DUP - don't free! */ ossl_raise(eX509CRLError, NULL); } @@ -327,7 +327,7 @@ ossl_x509crl_add_revoked(VALUE self, VALUE revoked) X509_REVOKED *rev; GetX509CRL(self, crl); - rev = ossl_x509revoked_get_X509_REVOKED(revoked); + rev = DupX509RevokedPtr(revoked); if (!X509_CRL_add0_revoked(crl, rev)) { /* NO DUP - don't free! */ ossl_raise(eX509CRLError, NULL); } diff --git a/ossl_x509ext.c b/ossl_x509ext.c index 8b5f75e..4d981ed 100644 --- a/ossl_x509ext.c +++ b/ossl_x509ext.c @@ -146,7 +146,7 @@ ossl_x509extfactory_set_subject_req(VALUE self, VALUE req) X509V3_CTX *ctx; GetX509ExtFactory(self, ctx); - ctx->subject_req = ossl_x509req_get_X509_REQ(req); + ctx->subject_req = DupX509ReqPtr(req); return req; } diff --git a/ossl_x509req.c b/ossl_x509req.c index cda70d7..e7329d1 100644 --- a/ossl_x509req.c +++ b/ossl_x509req.c @@ -56,7 +56,7 @@ ossl_x509req_new(X509_REQ *req) } X509_REQ * -ossl_x509req_get_X509_REQ(VALUE obj) +DupX509ReqPtr(VALUE obj) { X509_REQ *req, *new; @@ -395,7 +395,7 @@ ossl_x509req_set_attributes(VALUE self, VALUE ary) req->req_info->attributes = NULL; for (i=0;i<RARRAY(ary)->len; i++) { item = RARRAY(ary)->ptr[i]; - attr = ossl_x509attr_get_X509_ATTRIBUTE(item); + attr = DupX509AttrPtr(item); if (!X509_REQ_add1_attr(req, attr)) { ossl_raise(eX509ReqError, NULL); } @@ -409,7 +409,7 @@ ossl_x509req_add_attribute(VALUE self, VALUE attr) X509_REQ *req; GetX509Req(self, req); - if (!X509_REQ_add1_attr(req, ossl_x509attr_get_X509_ATTRIBUTE(attr))) { + if (!X509_REQ_add1_attr(req, DupX509AttrPtr(attr))) { ossl_raise(eX509ReqError, NULL); } diff --git a/ossl_x509revoked.c b/ossl_x509revoked.c index e306521..1cd04ea 100644 --- a/ossl_x509revoked.c +++ b/ossl_x509revoked.c @@ -56,7 +56,7 @@ ossl_x509revoked_new(X509_REVOKED *rev) } X509_REVOKED * -ossl_x509revoked_get_X509_REVOKED(VALUE obj) +DupX509RevokedPtr(VALUE obj) { X509_REVOKED *rev, *new; |