Some of the ENGINE file names were changed for 8.3 filename uniqueness
[openssl.git] / perl / OpenSSL.xs
1 /*
2 **  OpenSSL.xs
3 */
4
5 #include "openssl.h"
6
7 SV *
8 new_ref(type, obj, mort)
9   char *type;
10   char *obj;
11 {
12     SV *ret;
13
14     if (mort)
15         ret = sv_newmortal();
16     else
17         ret = newSViv(0);
18 #ifdef DEBUG
19     printf(">new_ref %d\n",type);
20 #endif
21     sv_setref_pv(ret, type, (void *)obj);
22     return(ret);
23 }
24
25 int 
26 ex_new(obj, data, ad, idx, argl, argp)
27   char *obj;
28   SV *data;
29   CRYPTO_EX_DATA *ad;
30   int idx;
31   long argl;
32   char *argp;
33 {
34     SV *sv;
35
36 #ifdef DEBUG
37     printf("ex_new %08X %s\n",obj,argp); 
38 #endif
39     sv = sv_newmortal();
40     sv_setref_pv(sv, argp, (void *)obj);
41 #ifdef DEBUG
42     printf("%d>new_ref '%s'\n", sv, argp);
43 #endif
44     CRYPTO_set_ex_data(ad, idx, (char *)sv);
45     return(1);
46 }
47
48 void 
49 ex_cleanup(obj, data, ad, idx, argl, argp)
50   char *obj;
51   SV *data;
52   CRYPTO_EX_DATA *ad;
53   int idx;
54   long argl;
55   char *argp;
56 {
57     pr_name("ex_cleanup");
58 #ifdef DEBUG
59     printf("ex_cleanup %08X %s\n", obj, argp);
60 #endif
61     if (data != NULL)
62         SvREFCNT_dec((SV *)data);
63 }
64
65 MODULE = OpenSSL  PACKAGE = OpenSSL
66
67 PROTOTYPES: ENABLE
68
69 BOOT:
70     boot_bio();
71     boot_cipher();
72     boot_digest();
73     boot_err();
74     boot_ssl();
75
76         /*                                                              */
77         /* The next macro is the completely correct way to call a C     */
78         /* function that uses perl calling conventions but is not       */
79         /* registered with perl.                                        */
80         /*                                                              */
81         /* The second macro seems to work for this context.  (We just   */
82         /* need a mark for the called function since we don't have      */
83         /* any local variables and what-not.)                           */
84         /*                                                              */
85         /* Unfortunately, we need to do this because these boot_*       */
86         /* functions are auto-generated by xsubpp and are normally      */
87         /* called from DyncLoader, but we're pulling them in here.      */
88         /*                                                              */
89 #define FULL_callBootFunc(func) { \
90             dSP; \
91             ENTER; \
92             SAVETMPS; \
93             PUSHMARK(SP); \
94                 func(); \
95             FREETMPS; \
96             LEAVE; \
97         }
98 #define callBootFunc(func) { \
99             PUSHMARK(SP); \
100                 func(); \
101         }
102     callBootFunc(boot_OpenSSL__BN);
103     callBootFunc(boot_OpenSSL__BIO);
104     callBootFunc(boot_OpenSSL__Cipher);
105     callBootFunc(boot_OpenSSL__MD);
106     callBootFunc(boot_OpenSSL__ERR);
107     callBootFunc(boot_OpenSSL__SSL);
108     callBootFunc(boot_OpenSSL__X509);
109