Second round of fixing the OpenSSL perl/ stuff. It now at least compiled fine
[openssl.git] / perl / openssl_x509.xs
1
2 #include "openssl.h"
3
4 MODULE =  OpenSSL::X509 PACKAGE = OpenSSL::X509 PREFIX = p5_X509_
5
6 PROTOTYPES: ENABLE
7 VERSIONCHECK: DISABLE
8
9 void
10 p5_X509_new(void )
11         PREINIT:
12                 X509 *x509;
13                 SV *arg;
14         PPCODE:
15                 pr_name("p5_X509_new");
16                 EXTEND(sp,1);
17                 PUSHs(sv_newmortal());
18                 x509=X509_new();
19                 sv_setref_pv(ST(0),"OpenSSL::X509",(void *)x509);
20
21 char *
22 p5_X509_get_subject_name(x509)
23         X509 *x509;
24         PREINIT:
25                 char *p;
26                 X509_NAME *name;
27                 char buf[1024];
28                 int i;
29         CODE:
30                 name=X509_get_subject_name(x509);
31                 X509_NAME_oneline(name,buf,sizeof(buf));
32                 p= &(buf[0]);
33                 RETVAL=p;
34         OUTPUT:
35                 RETVAL
36
37 char *
38 p5_X509_get_issuer_name(x509)
39         X509 *x509;
40         PREINIT:
41                 char *p;
42                 X509_NAME *name;
43                 char buf[1024];
44                 int i;
45         CODE:
46                 name=X509_get_issuer_name(x509);
47                 X509_NAME_oneline(name,buf,sizeof(buf));
48                 p= &(buf[0]);
49                 RETVAL=p;
50         OUTPUT:
51                 RETVAL
52
53 int
54 p5_X509_get_version(x509)
55         X509 *x509;
56         CODE:
57                 RETVAL=X509_get_version(x509);
58         OUTPUT:
59                 RETVAL
60
61 BIGNUM *
62 p5_X509_get_serialNumber(x509)
63         X509 *x509;
64         CODE:
65                 RETVAL=ASN1_INTEGER_to_BN(X509_get_serialNumber(x509),NULL);
66         OUTPUT:
67                 RETVAL
68
69 void
70 p5_X509_DESTROY(x509)
71         X509 *x509;
72         CODE:
73         pr_name("p5_X509_DESTROY");
74         X509_free(x509);
75