Feature #2022 » 0002-Fix-some-various-OpenSSL-compilation-and-runtime-war.patch
| ext/openssl/ossl_asn1.c | ||
|---|---|---|
|
* DER to Ruby converters
|
||
|
*/
|
||
|
static VALUE
|
||
|
decode_bool(unsigned char* der, int length)
|
||
|
decode_bool(OSSL_MORE_CONST unsigned char* der, int length)
|
||
|
{
|
||
|
int bool;
|
||
|
unsigned char *p;
|
||
|
OSSL_MORE_CONST unsigned char *p;
|
||
|
p = der;
|
||
|
if((bool = d2i_ASN1_BOOLEAN(NULL, &p, length)) < 0)
|
||
| ... | ... | |
|
}
|
||
|
static VALUE
|
||
|
decode_int(unsigned char* der, int length)
|
||
|
decode_int(OSSL_MORE_CONST unsigned char* der, int length)
|
||
|
{
|
||
|
ASN1_INTEGER *ai;
|
||
|
unsigned char *p;
|
||
|
OSSL_MORE_CONST unsigned char *p;
|
||
|
VALUE ret;
|
||
|
int status = 0;
|
||
| ... | ... | |
|
}
|
||
|
static VALUE
|
||
|
decode_bstr(unsigned char* der, int length, long *unused_bits)
|
||
|
decode_bstr(OSSL_MORE_CONST unsigned char* der, int length, long *unused_bits)
|
||
|
{
|
||
|
ASN1_BIT_STRING *bstr;
|
||
|
unsigned char *p, *buf;
|
||
|
OSSL_MORE_CONST unsigned char *p;
|
||
|
unsigned char *buf;
|
||
|
long len;
|
||
|
VALUE ret;
|
||
| ... | ... | |
|
}
|
||
|
static VALUE
|
||
|
decode_enum(unsigned char* der, int length)
|
||
|
decode_enum(OSSL_MORE_CONST unsigned char* der, int length)
|
||
|
{
|
||
|
ASN1_ENUMERATED *ai;
|
||
|
unsigned char *p;
|
||
|
OSSL_MORE_CONST unsigned char *p;
|
||
|
VALUE ret;
|
||
|
int status = 0;
|
||
| ... | ... | |
|
}
|
||
|
static VALUE
|
||
|
decode_null(unsigned char* der, int length)
|
||
|
decode_null(OSSL_MORE_CONST unsigned char* der, int length)
|
||
|
{
|
||
|
ASN1_NULL *null;
|
||
|
unsigned char *p;
|
||
|
OSSL_MORE_CONST unsigned char *p;
|
||
|
p = der;
|
||
|
if(!(null = d2i_ASN1_NULL(NULL, &p, length)))
|
||
| ... | ... | |
|
}
|
||
|
static VALUE
|
||
|
decode_obj(unsigned char* der, int length)
|
||
|
decode_obj(OSSL_MORE_CONST unsigned char* der, int length)
|
||
|
{
|
||
|
ASN1_OBJECT *obj;
|
||
|
unsigned char *p;
|
||
|
OSSL_MORE_CONST unsigned char *p;
|
||
|
VALUE ret;
|
||
|
int nid;
|
||
|
BIO *bio;
|
||
| ... | ... | |
|
}
|
||
|
static VALUE
|
||
|
decode_time(unsigned char* der, int length)
|
||
|
decode_time(OSSL_MORE_CONST unsigned char* der, int length)
|
||
|
{
|
||
|
ASN1_TIME *time;
|
||
|
unsigned char *p;
|
||
|
OSSL_MORE_CONST unsigned char *p;
|
||
|
VALUE ret;
|
||
|
int status = 0;
|
||
| ... | ... | |
|
}
|
||
|
static VALUE
|
||
|
ossl_asn1_decode0(unsigned char **pp, long length, long *offset, long depth,
|
||
|
int once, int yield)
|
||
|
ossl_asn1_decode0(OSSL_MORE_CONST unsigned char **pp, long length,
|
||
|
long *offset, long depth, int once, int yield)
|
||
|
{
|
||
|
unsigned char *start, *p;
|
||
|
OSSL_MORE_CONST unsigned char *start, *p;
|
||
|
long len, off = *offset;
|
||
|
int hlen, tag, tc, j;
|
||
|
VALUE ary, asn1data, value, tag_class;
|
||
| ... | ... | |
|
static VALUE
|
||
|
ossl_asn1_traverse(VALUE self, VALUE obj)
|
||
|
{
|
||
|
unsigned char *p;
|
||
|
OSSL_MORE_CONST unsigned char *p;
|
||
|
long offset = 0;
|
||
|
volatile VALUE tmp;
|
||
| ... | ... | |
|
ossl_asn1_decode(VALUE self, VALUE obj)
|
||
|
{
|
||
|
VALUE ret, ary;
|
||
|
unsigned char *p;
|
||
|
OSSL_MORE_CONST unsigned char *p;
|
||
|
long offset = 0;
|
||
|
volatile VALUE tmp;
|
||
| ... | ... | |
|
ossl_asn1_decode_all(VALUE self, VALUE obj)
|
||
|
{
|
||
|
VALUE ret;
|
||
|
unsigned char *p;
|
||
|
OSSL_MORE_CONST unsigned char *p;
|
||
|
long offset = 0;
|
||
|
volatile VALUE tmp;
|
||
| ext/openssl/ossl_cipher.c | ||
|---|---|---|
|
* We deprecated the arguments for this method, but we decided
|
||
|
* keeping this behaviour for backward compatibility.
|
||
|
*/
|
||
|
char *cname = rb_class2name(rb_obj_class(self));
|
||
|
const char *cname = rb_class2name(rb_obj_class(self));
|
||
|
rb_warn("argumtents for %s#encrypt and %s#decrypt were deprecated; "
|
||
|
"use %s#pkcs5_keyivgen to derive key and IV",
|
||
|
cname, cname, cname);
|
||
| ... | ... | |
|
static VALUE
|
||
|
ossl_cipher_update_deprecated(VALUE self, VALUE data)
|
||
|
{
|
||
|
char *cname;
|
||
|
const char *cname;
|
||
|
cname = rb_class2name(rb_obj_class(self));
|
||
|
rb_warning("%s#<< is deprecated; use %s#update instead", cname, cname);
|
||
| ext/openssl/ossl_ssl.c | ||
|---|---|---|
|
}
|
||
|
chain = SSL_get_peer_cert_chain(ssl);
|
||
|
if(!chain) return Qnil;
|
||
|
num = sk_num(chain);
|
||
|
num = sk_x509_num(chain);
|
||
|
ary = rb_ary_new2(num);
|
||
|
for (i = 0; i < num; i++){
|
||
|
cert = (X509*)sk_value(chain, i);
|
||
|
cert = (X509*)sk_x509_value(chain, i);
|
||
|
rb_ary_push(ary, ossl_x509_new(cert));
|
||
|
}
|
||
| ext/openssl/ossl_x509attr.c | ||
|---|---|---|
|
{
|
||
|
VALUE oid, value;
|
||
|
X509_ATTRIBUTE *attr;
|
||
|
unsigned char *p;
|
||
|
OSSL_MORE_CONST unsigned char *p;
|
||
|
GetX509Attr(self, attr);
|
||
|
if(rb_scan_args(argc, argv, "11", &oid, &value) == 1){
|
||
| ... | ... | |
|
ossl_str_adjust(str, p);
|
||
|
}
|
||
|
else{
|
||
|
length = i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set, NULL,
|
||
|
i2d_ASN1_TYPE, V_ASN1_SET, V_ASN1_UNIVERSAL, 0);
|
||
|
length = i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set,
|
||
|
(unsigned char **) NULL, i2d_ASN1_TYPE,
|
||
|
V_ASN1_SET, V_ASN1_UNIVERSAL, 0);
|
||
|
str = rb_str_new(0, length);
|
||
|
p = RSTRING_PTR(str);
|
||
|
i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set, &p,
|
||
| ext/openssl/ossl_x509ext.c | ||
|---|---|---|
|
#ifdef HAVE_X509V3_EXT_NCONF_NID
|
||
|
VALUE rconf;
|
||
|
CONF *conf;
|
||
|
ID i_config;
|
||
|
#else
|
||
|
static LHASH *empty_lhash;
|
||
|
#endif
|
||
| ... | ... | |
|
rb_str_append(valstr, value);
|
||
|
GetX509ExtFactory(self, ctx);
|
||
|
#ifdef HAVE_X509V3_EXT_NCONF_NID
|
||
|
rconf = rb_iv_get(self, "@config");
|
||
|
i_config = rb_intern("@config");
|
||
|
if (rb_ivar_defined(self, i_config))
|
||
|
rconf = rb_ivar_get(self, i_config);
|
||
|
else
|
||
|
rconf = Qnil;
|
||
|
conf = NIL_P(rconf) ? NULL : GetConfigPtr(rconf);
|
||
|
ext = X509V3_EXT_nconf_nid(conf, ctx, nid, RSTRING_PTR(valstr));
|
||
|
#else
|
||
| ... | ... | |
|
ossl_x509ext_initialize(int argc, VALUE *argv, VALUE self)
|
||
|
{
|
||
|
VALUE oid, value, critical;
|
||
|
unsigned char *p;
|
||
|
OSSL_MORE_CONST unsigned char *p;
|
||
|
X509_EXTENSION *ext;
|
||
|
GetX509Ext(self, ext);
|
||