summaryrefslogtreecommitdiff
path: root/lang/ruby18-base/patches/patch-dl
blob: a446ae7e648c3f08199b9c597e1a597c6730c800 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
$NetBSD: patch-dl,v 1.2 2010/09/10 03:29:00 taca Exp $

* r18172: suppress warnings.
* r26835: backport fixes in 1.9.

--- ext/openssl/ossl_asn1.c.orig	2010-05-24 23:58:49.000000000 +0000
+++ ext/openssl/ossl_asn1.c
@@ -33,7 +33,7 @@ asn1time_to_time(ASN1_TIME *time)
 	
     switch (time->type) {
     case V_ASN1_UTCTIME:
-	if (sscanf(time->data, "%2d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon,
+	if (sscanf((const char *)time->data, "%2d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon,
     		&tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) {
 	    ossl_raise(rb_eTypeError, "bad UTCTIME format");
 	} 
@@ -44,7 +44,7 @@ asn1time_to_time(ASN1_TIME *time)
 	}
 	break;
     case V_ASN1_GENERALIZEDTIME:
-	if (sscanf(time->data, "%4d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon,
+	if (sscanf((const char *)time->data, "%4d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon,
     		&tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) {
 	    ossl_raise(rb_eTypeError, "bad GENERALIZEDTIME format" );
 	} 
@@ -80,7 +80,7 @@ time_to_time_t(VALUE time)
 VALUE
 asn1str_to_str(ASN1_STRING *str)
 {
-    return rb_str_new(str->data, str->length);
+    return rb_str_new((const char *)str->data, str->length);
 }
 
 /*
@@ -214,7 +214,7 @@ obj_to_asn1bstr(VALUE obj, long unused_b
     StringValue(obj);
     if(!(bstr = ASN1_BIT_STRING_new()))
 	ossl_raise(eASN1Error, NULL);
-    ASN1_BIT_STRING_set(bstr, RSTRING_PTR(obj), RSTRING_LEN(obj));
+    ASN1_BIT_STRING_set(bstr, (unsigned char *)RSTRING_PTR(obj), RSTRING_LEN(obj));
     bstr->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear */
     bstr->flags |= ASN1_STRING_FLAG_BITS_LEFT|(unused_bits&0x07);
 
@@ -307,7 +307,7 @@ static VALUE
 decode_bool(unsigned char* der, int length)
 {
     int val;
-    unsigned char *p;
+    const unsigned char *p;
 
     p = der;
     if((val = d2i_ASN1_BOOLEAN(NULL, &p, length)) < 0)
@@ -320,7 +320,7 @@ static VALUE
 decode_int(unsigned char* der, int length)
 {
     ASN1_INTEGER *ai;
-    unsigned char *p;
+    const unsigned char *p;
     VALUE ret; 
     int status = 0;
 
@@ -360,7 +360,7 @@ static VALUE
 decode_enum(unsigned char* der, int length)
 {
     ASN1_ENUMERATED *ai;
-    unsigned char *p;
+    const unsigned char *p;
     VALUE ret; 
     int status = 0;
 
@@ -379,7 +379,7 @@ static VALUE
 decode_null(unsigned char* der, int length)
 {
     ASN1_NULL *null;
-    unsigned char *p;
+    const unsigned char *p;
 
     p = der;
     if(!(null = d2i_ASN1_NULL(NULL, &p, length)))
@@ -393,7 +393,7 @@ static VALUE
 decode_obj(unsigned char* der, int length)
 {
     ASN1_OBJECT *obj;
-    unsigned char *p;
+    const unsigned char *p;
     VALUE ret;
     int nid;
     BIO *bio;
@@ -422,7 +422,7 @@ static VALUE
 decode_time(unsigned char* der, int length)
 {
     ASN1_TIME *time;
-    unsigned char *p;
+    const unsigned char *p;
     VALUE ret;
     int status = 0;
 
@@ -697,7 +697,7 @@ ossl_asn1data_to_der(VALUE self)
     if((length = ASN1_object_size(1, RSTRING_LEN(value), tag)) <= 0)
 	ossl_raise(eASN1Error, NULL);
     der = rb_str_new(0, length);
-    p = RSTRING_PTR(der);
+    p = (unsigned char *)RSTRING_PTR(der);
     ASN1_put_object(&p, is_cons, RSTRING_LEN(value), tag, tag_class);
     memcpy(p, RSTRING_PTR(value), RSTRING_LEN(value));
     p += RSTRING_LEN(value);
@@ -711,6 +711,7 @@ ossl_asn1_decode0(unsigned char **pp, lo
 		  int once, int yield)
 {
     unsigned char *start, *p;
+    const unsigned char *p0;
     long len, off = *offset;
     int hlen, tag, tc, j;
     VALUE ary, asn1data, value, tag_class;
@@ -719,7 +720,9 @@ ossl_asn1_decode0(unsigned char **pp, lo
     p = *pp;
     while(length > 0){
 	start = p;
-	j = ASN1_get_object(&p, &len, &tag, &tc, length);
+	p0 = p;
+	j = ASN1_get_object(&p0, &len, &tag, &tc, length);
+	p = (unsigned char *)p0;
 	if(j & 0x80) ossl_raise(eASN1Error, NULL);
 	hlen = p - start;
 	if(yield){
@@ -754,7 +757,7 @@ ossl_asn1_decode0(unsigned char **pp, lo
 	    else value = ossl_asn1_decode0(&p, len, &off, depth+1, 0, yield);
 	}
 	else{
-	    value = rb_str_new(p, len);
+	    value = rb_str_new((const char *)p, len);
 	    p += len;
 	    off += len;
 	}
@@ -819,7 +822,7 @@ ossl_asn1_traverse(VALUE self, VALUE obj
 
     obj = ossl_to_der_if_possible(obj);
     tmp = rb_str_new4(StringValue(obj));
-    p = RSTRING_PTR(tmp);
+    p = (unsigned char *)RSTRING_PTR(tmp);
     ossl_asn1_decode0(&p, RSTRING_LEN(tmp), &offset, 0, 0, 1);
 
     return Qnil;
@@ -835,7 +838,7 @@ ossl_asn1_decode(VALUE self, VALUE obj)
 
     obj = ossl_to_der_if_possible(obj);
     tmp = rb_str_new4(StringValue(obj));
-    p = RSTRING_PTR(tmp);
+    p = (unsigned char *)RSTRING_PTR(tmp);
     ary = ossl_asn1_decode0(&p, RSTRING_LEN(tmp), &offset, 0, 1, 0);
     ret = rb_ary_entry(ary, 0);
 
@@ -852,7 +855,7 @@ ossl_asn1_decode_all(VALUE self, VALUE o
 
     obj = ossl_to_der_if_possible(obj);
     tmp = rb_str_new4(StringValue(obj));
-    p = RSTRING_PTR(tmp);
+    p = (unsigned char *)RSTRING_PTR(tmp);
     ret = ossl_asn1_decode0(&p, RSTRING_LEN(tmp), &offset, 0, 0, 0);
 
     return ret;
@@ -947,7 +950,7 @@ ossl_asn1prim_to_der(VALUE self)
     ossl_ASN1_TYPE_free(asn1);
     reallen = p - buf;
     assert(reallen <= len);
-    str = ossl_buf2str(buf, reallen); /* buf will be free in ossl_buf2str */
+    str = ossl_buf2str((char *)buf, reallen); /* buf will be free in ossl_buf2str */
 
     return str;
 }
@@ -969,7 +972,7 @@ ossl_asn1cons_to_der(VALUE self)
     seq_len = ASN1_object_size(1, RSTRING_LEN(value), tag);
     length = ASN1_object_size(1, seq_len, tn);
     str = rb_str_new(0, length);
-    p = RSTRING_PTR(str);
+    p = (unsigned char *)RSTRING_PTR(str);
     if(tc == V_ASN1_UNIVERSAL)
 	ASN1_put_object(&p, 1, RSTRING_LEN(value), tn, tc);
     else{