summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/stack
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/stack')
-rw-r--r--src/lib/libcrypto/stack/Makefile86
-rw-r--r--src/lib/libcrypto/stack/Makefile.ssl88
-rw-r--r--src/lib/libcrypto/stack/safestack.h53
3 files changed, 199 insertions, 28 deletions
diff --git a/src/lib/libcrypto/stack/Makefile b/src/lib/libcrypto/stack/Makefile
new file mode 100644
index 0000000000..711b16832a
--- /dev/null
+++ b/src/lib/libcrypto/stack/Makefile
@@ -0,0 +1,86 @@
1#
2# OpenSSL/crypto/stack/Makefile
3#
4
5DIR= stack
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKEDEPPROG= makedepend
14MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
15MAKEFILE= Makefile
16AR= ar r
17
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=stack.c
26LIBOBJ=stack.o
27
28SRC= $(LIBSRC)
29
30EXHEADER= stack.h safestack.h
31HEADER= $(EXHEADER)
32
33ALL= $(GENERAL) $(SRC) $(HEADER)
34
35top:
36 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
37
38all: lib
39
40lib: $(LIBOBJ)
41 $(AR) $(LIB) $(LIBOBJ)
42 $(RANLIB) $(LIB) || echo Never mind.
43 @touch lib
44
45files:
46 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
47
48links:
49 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
50 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
51 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
52
53install:
54 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
55 do \
56 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
57 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
58 done;
59
60tags:
61 ctags $(SRC)
62
63tests:
64
65lint:
66 lint -DLINT $(INCLUDES) $(SRC)>fluff
67
68depend:
69 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
70
71dclean:
72 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
73 mv -f Makefile.new $(MAKEFILE)
74
75clean:
76 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
77
78# DO NOT DELETE THIS LINE -- make depend depends on it.
79
80stack.o: ../../e_os.h ../../include/openssl/bio.h
81stack.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
82stack.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
83stack.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
84stack.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
85stack.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
86stack.o: ../cryptlib.h stack.c
diff --git a/src/lib/libcrypto/stack/Makefile.ssl b/src/lib/libcrypto/stack/Makefile.ssl
new file mode 100644
index 0000000000..7120fb804a
--- /dev/null
+++ b/src/lib/libcrypto/stack/Makefile.ssl
@@ -0,0 +1,88 @@
1#
2# SSLeay/crypto/stack/Makefile
3#
4
5DIR= stack
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC=stack.c
27LIBOBJ=stack.o
28
29SRC= $(LIBSRC)
30
31EXHEADER= stack.h safestack.h
32HEADER= $(EXHEADER)
33
34ALL= $(GENERAL) $(SRC) $(HEADER)
35
36top:
37 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
38
39all: lib
40
41lib: $(LIBOBJ)
42 $(AR) $(LIB) $(LIBOBJ)
43 $(RANLIB) $(LIB) || echo Never mind.
44 @touch lib
45
46files:
47 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
48
49links:
50 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
51 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
52 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
53 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
54
55install:
56 @for i in $(EXHEADER) ; \
57 do \
58 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
59 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
60 done;
61
62tags:
63 ctags $(SRC)
64
65tests:
66
67lint:
68 lint -DLINT $(INCLUDES) $(SRC)>fluff
69
70depend:
71 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
72
73dclean:
74 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
75 mv -f Makefile.new $(MAKEFILE)
76
77clean:
78 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
79
80# DO NOT DELETE THIS LINE -- make depend depends on it.
81
82stack.o: ../../e_os.h ../../include/openssl/bio.h
83stack.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
84stack.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
85stack.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
86stack.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
87stack.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
88stack.o: ../cryptlib.h stack.c
diff --git a/src/lib/libcrypto/stack/safestack.h b/src/lib/libcrypto/stack/safestack.h
index 6010b7f122..bd1121c279 100644
--- a/src/lib/libcrypto/stack/safestack.h
+++ b/src/lib/libcrypto/stack/safestack.h
@@ -55,9 +55,6 @@
55#ifndef HEADER_SAFESTACK_H 55#ifndef HEADER_SAFESTACK_H
56#define HEADER_SAFESTACK_H 56#define HEADER_SAFESTACK_H
57 57
58typedef void (*openssl_fptr)(void);
59#define openssl_fcast(f) ((openssl_fptr)f)
60
61#include <openssl/stack.h> 58#include <openssl/stack.h>
62 59
63#ifdef DEBUG_SAFESTACK 60#ifdef DEBUG_SAFESTACK
@@ -76,74 +73,74 @@ STACK_OF(type) \
76/* SKM_sk_... stack macros are internal to safestack.h: 73/* SKM_sk_... stack macros are internal to safestack.h:
77 * never use them directly, use sk_<type>_... instead */ 74 * never use them directly, use sk_<type>_... instead */
78#define SKM_sk_new(type, cmp) \ 75#define SKM_sk_new(type, cmp) \
79 ((STACK_OF(type) * (*)(int (*)(const type * const *, const type * const *)))openssl_fcast(sk_new))(cmp) 76 ((STACK_OF(type) * (*)(int (*)(const type * const *, const type * const *)))sk_new)(cmp)
80#define SKM_sk_new_null(type) \ 77#define SKM_sk_new_null(type) \
81 ((STACK_OF(type) * (*)(void))openssl_fcast(sk_new_null))() 78 ((STACK_OF(type) * (*)(void))sk_new_null)()
82#define SKM_sk_free(type, st) \ 79#define SKM_sk_free(type, st) \
83 ((void (*)(STACK_OF(type) *))openssl_fcast(sk_free))(st) 80 ((void (*)(STACK_OF(type) *))sk_free)(st)
84#define SKM_sk_num(type, st) \ 81#define SKM_sk_num(type, st) \
85 ((int (*)(const STACK_OF(type) *))openssl_fcast(sk_num))(st) 82 ((int (*)(const STACK_OF(type) *))sk_num)(st)
86#define SKM_sk_value(type, st,i) \ 83#define SKM_sk_value(type, st,i) \
87 ((type * (*)(const STACK_OF(type) *, int))openssl_fcast(sk_value))(st, i) 84 ((type * (*)(const STACK_OF(type) *, int))sk_value)(st, i)
88#define SKM_sk_set(type, st,i,val) \ 85#define SKM_sk_set(type, st,i,val) \
89 ((type * (*)(STACK_OF(type) *, int, type *))openssl_fcast(sk_set))(st, i, val) 86 ((type * (*)(STACK_OF(type) *, int, type *))sk_set)(st, i, val)
90#define SKM_sk_zero(type, st) \ 87#define SKM_sk_zero(type, st) \
91 ((void (*)(STACK_OF(type) *))openssl_fcast(sk_zero))(st) 88 ((void (*)(STACK_OF(type) *))sk_zero)(st)
92#define SKM_sk_push(type, st,val) \ 89#define SKM_sk_push(type, st,val) \
93 ((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_push))(st, val) 90 ((int (*)(STACK_OF(type) *, type *))sk_push)(st, val)
94#define SKM_sk_unshift(type, st,val) \ 91#define SKM_sk_unshift(type, st,val) \
95 ((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_unshift))(st, val) 92 ((int (*)(STACK_OF(type) *, type *))sk_unshift)(st, val)
96#define SKM_sk_find(type, st,val) \ 93#define SKM_sk_find(type, st,val) \
97 ((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_find))(st, val) 94 ((int (*)(STACK_OF(type) *, type *))sk_find)(st, val)
98#define SKM_sk_delete(type, st,i) \ 95#define SKM_sk_delete(type, st,i) \
99 ((type * (*)(STACK_OF(type) *, int))openssl_fcast(sk_delete))(st, i) 96 ((type * (*)(STACK_OF(type) *, int))sk_delete)(st, i)
100#define SKM_sk_delete_ptr(type, st,ptr) \ 97#define SKM_sk_delete_ptr(type, st,ptr) \
101 ((type * (*)(STACK_OF(type) *, type *))openssl_fcast(sk_delete_ptr))(st, ptr) 98 ((type * (*)(STACK_OF(type) *, type *))sk_delete_ptr)(st, ptr)
102#define SKM_sk_insert(type, st,val,i) \ 99#define SKM_sk_insert(type, st,val,i) \
103 ((int (*)(STACK_OF(type) *, type *, int))openssl_fcast(sk_insert))(st, val, i) 100 ((int (*)(STACK_OF(type) *, type *, int))sk_insert)(st, val, i)
104#define SKM_sk_set_cmp_func(type, st,cmp) \ 101#define SKM_sk_set_cmp_func(type, st,cmp) \
105 ((int (*(*)(STACK_OF(type) *, int (*)(const type * const *, const type * const *))) \ 102 ((int (*(*)(STACK_OF(type) *, int (*)(const type * const *, const type * const *))) \
106 (const type * const *, const type * const *))openssl_fcast(sk_set_cmp_func))\ 103 (const type * const *, const type * const *))sk_set_cmp_func)\
107 (st, cmp) 104 (st, cmp)
108#define SKM_sk_dup(type, st) \ 105#define SKM_sk_dup(type, st) \
109 ((STACK_OF(type) *(*)(STACK_OF(type) *))openssl_fcast(sk_dup))(st) 106 ((STACK_OF(type) *(*)(STACK_OF(type) *))sk_dup)(st)
110#define SKM_sk_pop_free(type, st,free_func) \ 107#define SKM_sk_pop_free(type, st,free_func) \
111 ((void (*)(STACK_OF(type) *, void (*)(type *)))openssl_fcast(sk_pop_free))\ 108 ((void (*)(STACK_OF(type) *, void (*)(type *)))sk_pop_free)\
112 (st, free_func) 109 (st, free_func)
113#define SKM_sk_shift(type, st) \ 110#define SKM_sk_shift(type, st) \
114 ((type * (*)(STACK_OF(type) *))openssl_fcast(sk_shift))(st) 111 ((type * (*)(STACK_OF(type) *))sk_shift)(st)
115#define SKM_sk_pop(type, st) \ 112#define SKM_sk_pop(type, st) \
116 ((type * (*)(STACK_OF(type) *))openssl_fcast(sk_pop))(st) 113 ((type * (*)(STACK_OF(type) *))sk_pop)(st)
117#define SKM_sk_sort(type, st) \ 114#define SKM_sk_sort(type, st) \
118 ((void (*)(STACK_OF(type) *))openssl_fcast(sk_sort))(st) 115 ((void (*)(STACK_OF(type) *))sk_sort)(st)
119#define SKM_sk_is_sorted(type, st) \ 116#define SKM_sk_is_sorted(type, st) \
120 ((int (*)(const STACK_OF(type) *))openssl_fcast(sk_is_sorted))(st) 117 ((int (*)(const STACK_OF(type) *))sk_is_sorted)(st)
121 118
122#define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ 119#define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
123 ((STACK_OF(type) * (*) (STACK_OF(type) **,unsigned char **, long , \ 120 ((STACK_OF(type) * (*) (STACK_OF(type) **,unsigned char **, long , \
124 type *(*)(type **, unsigned char **,long), \ 121 type *(*)(type **, unsigned char **,long), \
125 void (*)(type *), int ,int )) openssl_fcast(d2i_ASN1_SET)) \ 122 void (*)(type *), int ,int )) d2i_ASN1_SET) \
126 (st,pp,length, d2i_func, free_func, ex_tag,ex_class) 123 (st,pp,length, d2i_func, free_func, ex_tag,ex_class)
127#define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \ 124#define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \
128 ((int (*)(STACK_OF(type) *,unsigned char **, \ 125 ((int (*)(STACK_OF(type) *,unsigned char **, \
129 int (*)(type *,unsigned char **), int , int , int)) openssl_fcast(i2d_ASN1_SET)) \ 126 int (*)(type *,unsigned char **), int , int , int)) i2d_ASN1_SET) \
130 (st,pp,i2d_func,ex_tag,ex_class,is_set) 127 (st,pp,i2d_func,ex_tag,ex_class,is_set)
131 128
132#define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \ 129#define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \
133 ((unsigned char *(*)(STACK_OF(type) *, \ 130 ((unsigned char *(*)(STACK_OF(type) *, \
134 int (*)(type *,unsigned char **), unsigned char **,int *)) openssl_fcast(ASN1_seq_pack)) \ 131 int (*)(type *,unsigned char **), unsigned char **,int *)) ASN1_seq_pack) \
135 (st, i2d_func, buf, len) 132 (st, i2d_func, buf, len)
136#define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \ 133#define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \
137 ((STACK_OF(type) * (*)(unsigned char *,int, \ 134 ((STACK_OF(type) * (*)(unsigned char *,int, \
138 type *(*)(type **,unsigned char **, long), \ 135 type *(*)(type **,unsigned char **, long), \
139 void (*)(type *)))openssl_fcast(ASN1_seq_unpack)) \ 136 void (*)(type *)))ASN1_seq_unpack) \
140 (buf,len,d2i_func, free_func) 137 (buf,len,d2i_func, free_func)
141 138
142#define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \ 139#define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \
143 ((STACK_OF(type) * (*)(X509_ALGOR *, \ 140 ((STACK_OF(type) * (*)(X509_ALGOR *, \
144 type *(*)(type **, unsigned char **, long), void (*)(type *), \ 141 type *(*)(type **, unsigned char **, long), void (*)(type *), \
145 const char *, int, \ 142 const char *, int, \
146 ASN1_STRING *, int))openssl_fcast(PKCS12_decrypt_d2i)) \ 143 ASN1_STRING *, int))PKCS12_decrypt_d2i) \
147 (algor,d2i_func,free_func,pass,passlen,oct,seq) 144 (algor,d2i_func,free_func,pass,passlen,oct,seq)
148 145
149#else 146#else