Skip to content

Commit 6c0ef87

Browse files
committed
asn1: reorder declarations
Move variable declarations for OpenSSL::ASN1 classes to the top of the file. asn1time_to_time() will need eASN1Error in the next patch.
1 parent 1426c6d commit 6c0ef87

File tree

1 file changed

+46
-46
lines changed

1 file changed

+46
-46
lines changed

ext/openssl/ossl_asn1.c

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,48 @@
99
*/
1010
#include "ossl.h"
1111

12-
static VALUE ossl_asn1_decode0(unsigned char **pp, long length, long *offset,
13-
int depth, int yield, long *num_read);
14-
static VALUE ossl_asn1_initialize(int argc, VALUE *argv, VALUE self);
12+
/********/
13+
/*
14+
* ASN1 module
15+
*/
16+
#define ossl_asn1_get_value(o) rb_attr_get((o),sivVALUE)
17+
#define ossl_asn1_get_tag(o) rb_attr_get((o),sivTAG)
18+
#define ossl_asn1_get_tagging(o) rb_attr_get((o),sivTAGGING)
19+
#define ossl_asn1_get_tag_class(o) rb_attr_get((o),sivTAG_CLASS)
20+
#define ossl_asn1_get_indefinite_length(o) rb_attr_get((o),sivINDEFINITE_LENGTH)
21+
22+
#define ossl_asn1_set_value(o,v) rb_ivar_set((o),sivVALUE,(v))
23+
#define ossl_asn1_set_tag(o,v) rb_ivar_set((o),sivTAG,(v))
24+
#define ossl_asn1_set_tagging(o,v) rb_ivar_set((o),sivTAGGING,(v))
25+
#define ossl_asn1_set_tag_class(o,v) rb_ivar_set((o),sivTAG_CLASS,(v))
26+
#define ossl_asn1_set_indefinite_length(o,v) rb_ivar_set((o),sivINDEFINITE_LENGTH,(v))
27+
28+
VALUE mASN1;
29+
static VALUE eASN1Error;
30+
31+
VALUE cASN1Data;
32+
static VALUE cASN1Primitive;
33+
static VALUE cASN1Constructive;
34+
35+
static VALUE cASN1EndOfContent;
36+
static VALUE cASN1Boolean; /* BOOLEAN */
37+
static VALUE cASN1Integer, cASN1Enumerated; /* INTEGER */
38+
static VALUE cASN1BitString; /* BIT STRING */
39+
static VALUE cASN1OctetString, cASN1UTF8String; /* STRINGs */
40+
static VALUE cASN1NumericString, cASN1PrintableString;
41+
static VALUE cASN1T61String, cASN1VideotexString;
42+
static VALUE cASN1IA5String, cASN1GraphicString;
43+
static VALUE cASN1ISO64String, cASN1GeneralString;
44+
static VALUE cASN1UniversalString, cASN1BMPString;
45+
static VALUE cASN1Null; /* NULL */
46+
static VALUE cASN1ObjectId; /* OBJECT IDENTIFIER */
47+
static VALUE cASN1UTCTime, cASN1GeneralizedTime; /* TIME */
48+
static VALUE cASN1Sequence, cASN1Set; /* CONSTRUCTIVE */
49+
50+
static VALUE sym_IMPLICIT, sym_EXPLICIT;
51+
static VALUE sym_UNIVERSAL, sym_APPLICATION, sym_CONTEXT_SPECIFIC, sym_PRIVATE;
52+
static ID sivVALUE, sivTAG, sivTAG_CLASS, sivTAGGING, sivINDEFINITE_LENGTH, sivUNUSED_BITS;
53+
static ID id_each;
1554

1655
/*
1756
* DATE conversion
@@ -190,49 +229,6 @@ ossl_asn1obj_to_string_long_name(const ASN1_OBJECT *obj)
190229
return ossl_asn1obj_to_string_oid(obj);
191230
}
192231

193-
/********/
194-
/*
195-
* ASN1 module
196-
*/
197-
#define ossl_asn1_get_value(o) rb_attr_get((o),sivVALUE)
198-
#define ossl_asn1_get_tag(o) rb_attr_get((o),sivTAG)
199-
#define ossl_asn1_get_tagging(o) rb_attr_get((o),sivTAGGING)
200-
#define ossl_asn1_get_tag_class(o) rb_attr_get((o),sivTAG_CLASS)
201-
#define ossl_asn1_get_indefinite_length(o) rb_attr_get((o),sivINDEFINITE_LENGTH)
202-
203-
#define ossl_asn1_set_value(o,v) rb_ivar_set((o),sivVALUE,(v))
204-
#define ossl_asn1_set_tag(o,v) rb_ivar_set((o),sivTAG,(v))
205-
#define ossl_asn1_set_tagging(o,v) rb_ivar_set((o),sivTAGGING,(v))
206-
#define ossl_asn1_set_tag_class(o,v) rb_ivar_set((o),sivTAG_CLASS,(v))
207-
#define ossl_asn1_set_indefinite_length(o,v) rb_ivar_set((o),sivINDEFINITE_LENGTH,(v))
208-
209-
VALUE mASN1;
210-
static VALUE eASN1Error;
211-
212-
VALUE cASN1Data;
213-
static VALUE cASN1Primitive;
214-
static VALUE cASN1Constructive;
215-
216-
static VALUE cASN1EndOfContent;
217-
static VALUE cASN1Boolean; /* BOOLEAN */
218-
static VALUE cASN1Integer, cASN1Enumerated; /* INTEGER */
219-
static VALUE cASN1BitString; /* BIT STRING */
220-
static VALUE cASN1OctetString, cASN1UTF8String; /* STRINGs */
221-
static VALUE cASN1NumericString, cASN1PrintableString;
222-
static VALUE cASN1T61String, cASN1VideotexString;
223-
static VALUE cASN1IA5String, cASN1GraphicString;
224-
static VALUE cASN1ISO64String, cASN1GeneralString;
225-
static VALUE cASN1UniversalString, cASN1BMPString;
226-
static VALUE cASN1Null; /* NULL */
227-
static VALUE cASN1ObjectId; /* OBJECT IDENTIFIER */
228-
static VALUE cASN1UTCTime, cASN1GeneralizedTime; /* TIME */
229-
static VALUE cASN1Sequence, cASN1Set; /* CONSTRUCTIVE */
230-
231-
static VALUE sym_IMPLICIT, sym_EXPLICIT;
232-
static VALUE sym_UNIVERSAL, sym_APPLICATION, sym_CONTEXT_SPECIFIC, sym_PRIVATE;
233-
static ID sivVALUE, sivTAG, sivTAG_CLASS, sivTAGGING, sivINDEFINITE_LENGTH, sivUNUSED_BITS;
234-
static ID id_each;
235-
236232
/*
237233
* Ruby to ASN1 converters
238234
*/
@@ -777,6 +773,10 @@ ossl_asn1data_to_der(VALUE self)
777773
}
778774
}
779775

776+
static VALUE ossl_asn1_initialize(int argc, VALUE *argv, VALUE self);
777+
static VALUE ossl_asn1_decode0(unsigned char **pp, long length, long *offset,
778+
int depth, int yield, long *num_read);
779+
780780
static VALUE
781781
int_ossl_asn1_decode0_prim(unsigned char **pp, long length, long hlen, int tag,
782782
VALUE tc, long *num_read)

0 commit comments

Comments
 (0)