diff options
author | markus <> | 2002-09-03 10:49:48 +0000 |
---|---|---|
committer | markus <> | 2002-09-03 10:49:48 +0000 |
commit | 745090f47e6fc5910ec4fe90341a2a06b1f204c1 (patch) | |
tree | 6d81890369bc1755ad0c9adff9925ee40f31b357 | |
parent | 2a403cf17b91db1355403be2649b62a15f65d0b1 (diff) | |
download | openbsd-745090f47e6fc5910ec4fe90341a2a06b1f204c1.tar.gz openbsd-745090f47e6fc5910ec4fe90341a2a06b1f204c1.tar.bz2 openbsd-745090f47e6fc5910ec4fe90341a2a06b1f204c1.zip |
unused files, perl subdir not part of OpenSSL 0.9.7
-rw-r--r-- | src/lib/libssl/src/perl/MANIFEST | 17 | ||||
-rw-r--r-- | src/lib/libssl/src/perl/Makefile.PL | 45 | ||||
-rw-r--r-- | src/lib/libssl/src/perl/OpenSSL.pm | 90 | ||||
-rw-r--r-- | src/lib/libssl/src/perl/OpenSSL.xs | 109 | ||||
-rw-r--r-- | src/lib/libssl/src/perl/README.1ST | 4 | ||||
-rw-r--r-- | src/lib/libssl/src/perl/openssl.h | 96 | ||||
-rw-r--r-- | src/lib/libssl/src/perl/openssl_bio.xs | 450 | ||||
-rw-r--r-- | src/lib/libssl/src/perl/openssl_bn.xs | 593 | ||||
-rw-r--r-- | src/lib/libssl/src/perl/openssl_cipher.xs | 154 | ||||
-rw-r--r-- | src/lib/libssl/src/perl/openssl_digest.xs | 85 | ||||
-rw-r--r-- | src/lib/libssl/src/perl/openssl_err.xs | 47 | ||||
-rw-r--r-- | src/lib/libssl/src/perl/openssl_ssl.xs | 483 | ||||
-rw-r--r-- | src/lib/libssl/src/perl/openssl_x509.xs | 75 | ||||
-rw-r--r-- | src/lib/libssl/src/perl/typemap | 96 |
14 files changed, 0 insertions, 2344 deletions
diff --git a/src/lib/libssl/src/perl/MANIFEST b/src/lib/libssl/src/perl/MANIFEST deleted file mode 100644 index 80c900769d..0000000000 --- a/src/lib/libssl/src/perl/MANIFEST +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | README.1ST | ||
2 | MANIFEST | ||
3 | Makefile.PL | ||
4 | typemap | ||
5 | OpenSSL.pm | ||
6 | OpenSSL.xs | ||
7 | openssl.h | ||
8 | openssl_bio.xs | ||
9 | openssl_bn.xs | ||
10 | openssl_cipher.xs | ||
11 | openssl_digest.xs | ||
12 | openssl_err.xs | ||
13 | openssl_ssl.xs | ||
14 | openssl_x509.xs | ||
15 | t/01-use.t | ||
16 | t/02-version.t | ||
17 | t/03-bio.t | ||
diff --git a/src/lib/libssl/src/perl/Makefile.PL b/src/lib/libssl/src/perl/Makefile.PL deleted file mode 100644 index 2a67ad061d..0000000000 --- a/src/lib/libssl/src/perl/Makefile.PL +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | ## | ||
2 | ## Makefile.PL -- Perl MakeMaker specification | ||
3 | ## | ||
4 | |||
5 | open(IN,"<../Makefile.ssl") || die "unable to open Makefile.ssl!\n"; | ||
6 | while(<IN>) { | ||
7 | $V=$1 if (/^VERSION=(.*)$/); | ||
8 | } | ||
9 | close(IN); | ||
10 | print "Configuring companion Perl module for OpenSSL $V\n"; | ||
11 | |||
12 | use ExtUtils::MakeMaker; | ||
13 | |||
14 | WriteMakefile( | ||
15 | 'OPTIMIZE' => '', | ||
16 | 'DISTNAME' => "openssl-$V", | ||
17 | 'NAME' => 'OpenSSL', | ||
18 | 'VERSION_FROM' => 'OpenSSL.pm', | ||
19 | 'LIBS' => ( $^O eq 'MSWin32' | ||
20 | ? [ '-L../out32dll -lssleay32 -llibeay32' ] | ||
21 | : [ '-L.. -lssl -lcrypto' ] ), | ||
22 | 'DEFINE' => '', | ||
23 | 'INC' => '-I../include', | ||
24 | 'H' => ['openssl.h'], | ||
25 | 'OBJECT' => | ||
26 | 'OpenSSL.o ' . | ||
27 | 'openssl_bio.o ' . | ||
28 | 'openssl_bn.o ' . | ||
29 | 'openssl_cipher.o ' . | ||
30 | 'openssl_digest.o ' . | ||
31 | 'openssl_err.o ' . | ||
32 | 'openssl_ssl.o ' . | ||
33 | 'openssl_x509.o ', | ||
34 | 'XS' => { | ||
35 | 'OpenSSL.xs' => 'OpenSSL.c', | ||
36 | 'openssl_bio.xs' => 'openssl_bio.c', | ||
37 | 'openssl_bn.xs' => 'openssl_bn.c', | ||
38 | 'openssl_cipher.xs' => 'openssl_cipher.c', | ||
39 | 'openssl_digest.xs' => 'openssl_digest.c', | ||
40 | 'openssl_err.xs' => 'openssl_err.c', | ||
41 | 'openssl_ssl.xs' => 'openssl_ssl.c', | ||
42 | 'openssl_x509.xs' => 'openssl_x509.c', | ||
43 | }, | ||
44 | ); | ||
45 | |||
diff --git a/src/lib/libssl/src/perl/OpenSSL.pm b/src/lib/libssl/src/perl/OpenSSL.pm deleted file mode 100644 index ae7265a21d..0000000000 --- a/src/lib/libssl/src/perl/OpenSSL.pm +++ /dev/null | |||
@@ -1,90 +0,0 @@ | |||
1 | ## | ||
2 | ## OpenSSL.pm | ||
3 | ## | ||
4 | |||
5 | package OpenSSL; | ||
6 | |||
7 | require 5.000; | ||
8 | use Exporter; | ||
9 | use DynaLoader; | ||
10 | |||
11 | @ISA = qw(Exporter DynaLoader); | ||
12 | @EXPORT = qw(); | ||
13 | |||
14 | $VERSION = '0.94'; | ||
15 | bootstrap OpenSSL; | ||
16 | |||
17 | @OpenSSL::BN::ISA = qw(OpenSSL::ERR); | ||
18 | @OpenSSL::MD::ISA = qw(OpenSSL::ERR); | ||
19 | @OpenSSL::Cipher::ISA = qw(OpenSSL::ERR); | ||
20 | @OpenSSL::SSL::CTX::ISA = qw(OpenSSL::ERR); | ||
21 | @OpenSSL::BIO::ISA = qw(OpenSSL::ERR); | ||
22 | @OpenSSL::SSL::ISA = qw(OpenSSL::ERR); | ||
23 | |||
24 | @BN::ISA = qw(OpenSSL::BN); | ||
25 | @MD::ISA = qw(OpenSSL::MD); | ||
26 | @Cipher::ISA = qw(OpenSSL::Cipher); | ||
27 | @SSL::ISA = qw(OpenSSL::SSL); | ||
28 | @SSL::CTX::ISA = qw(OpenSSL::SSL::CTX); | ||
29 | @BIO::ISA = qw(OpenSSL::BIO); | ||
30 | |||
31 | @OpenSSL::MD::names = qw( | ||
32 | md2 md5 sha sha1 ripemd160 mdc2 | ||
33 | ); | ||
34 | |||
35 | @OpenSSL::Cipher::names = qw( | ||
36 | des-ecb des-cfb des-ofb des-cbc | ||
37 | des-ede des-ede-cfb des-ede-ofb des-ede-cbc | ||
38 | des-ede3 des-ede3-cfb des-ede3-ofb des-ede3-cbc | ||
39 | desx-cbc rc4 rc4-40 | ||
40 | idea-ecb idea-cfb idea-ofb idea-cbc | ||
41 | rc2-ecb rc2-cbc rc2-40-cbc rc2-cfb rc2-ofb | ||
42 | bf-ecb bf-cfb bf-ofb bf-cbc | ||
43 | cast5-ecb cast5-cfb cast5-ofb cast5-cbc | ||
44 | rc5-ecb rc5-cfb rc5-ofb rc5-cbc | ||
45 | ); | ||
46 | |||
47 | sub OpenSSL::SSL::CTX::new_ssl { | ||
48 | OpenSSL::SSL::new($_[0]); | ||
49 | } | ||
50 | |||
51 | sub OpenSSL::ERR::error { | ||
52 | my($o) = @_; | ||
53 | my($s, $ret); | ||
54 | |||
55 | while (($s = $o->get_error()) != 0) { | ||
56 | $ret.=$s."\n"; | ||
57 | } | ||
58 | return($ret); | ||
59 | } | ||
60 | |||
61 | @OpenSSL::Cipher::aliases = qw( | ||
62 | des desx des3 idea rc2 bf cast | ||
63 | ); | ||
64 | |||
65 | package OpenSSL::BN; | ||
66 | |||
67 | sub bnfix { | ||
68 | (ref($_[0]) ne "OpenSSL::BN") ? OpenSSL::BN::dec2bn($_[0]) : $_[0]; | ||
69 | } | ||
70 | |||
71 | use overload | ||
72 | "=" => sub { dup($_[0]); }, | ||
73 | "+" => sub { add($_[0],$_[1]); }, | ||
74 | "-" => sub { ($_[1],$_[0])=($_[0],$_[1]) if $_[2]; OpenSSL::BN::sub($_[0],$_[1]); }, | ||
75 | "*" => sub { mul($_[0],$_[1]); }, | ||
76 | "**" => sub { ($_[1],$_[0])=($_[0],$_[1]) if $_[2]; OpenSSL::BN::exp($_[0],$_[1]); }, | ||
77 | "/" => sub { ($_[1],$_[0])=($_[0],$_[1]) if $_[2]; (div($_[0],$_[1]))[0]; }, | ||
78 | "%" => sub { ($_[1],$_[0])=($_[0],$_[1]) if $_[2]; mod($_[0],$_[1]); }, | ||
79 | "<<" => sub { lshift($_[0],$_[1]); }, | ||
80 | ">>" => sub { rshift($_[0],$_[1]); }, | ||
81 | "<=>" => sub { OpenSSL::BN::cmp($_[0],$_[1]); }, | ||
82 | '""' => sub { bn2dec($_[0]); }, | ||
83 | '0+' => sub { dec2bn($_[0]); }, | ||
84 | "bool" => sub { ref($_[0]) eq "OpenSSL::BN"; }; | ||
85 | |||
86 | sub OpenSSL::BIO::do_accept { | ||
87 | OpenSSL::BIO::do_handshake(@_); | ||
88 | } | ||
89 | |||
90 | 1; | ||
diff --git a/src/lib/libssl/src/perl/OpenSSL.xs b/src/lib/libssl/src/perl/OpenSSL.xs deleted file mode 100644 index 6ef66ccc1e..0000000000 --- a/src/lib/libssl/src/perl/OpenSSL.xs +++ /dev/null | |||
@@ -1,109 +0,0 @@ | |||
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 | |||
diff --git a/src/lib/libssl/src/perl/README.1ST b/src/lib/libssl/src/perl/README.1ST deleted file mode 100644 index 7b5a1aa5e9..0000000000 --- a/src/lib/libssl/src/perl/README.1ST +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | |||
2 | WARNING, this Perl interface to OpenSSL is horrible incomplete. | ||
3 | Don't expect it to be really useable!! | ||
4 | |||
diff --git a/src/lib/libssl/src/perl/openssl.h b/src/lib/libssl/src/perl/openssl.h deleted file mode 100644 index 2712324a30..0000000000 --- a/src/lib/libssl/src/perl/openssl.h +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
2 | * All rights reserved. | ||
3 | * | ||
4 | * This package is an SSL implementation written | ||
5 | * by Eric Young (eay@cryptsoft.com). | ||
6 | * The implementation was written so as to conform with Netscapes SSL. | ||
7 | * | ||
8 | * This library is free for commercial and non-commercial use as long as | ||
9 | * the following conditions are aheared to. The following conditions | ||
10 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
11 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
12 | * included with this distribution is covered by the same copyright terms | ||
13 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
14 | * | ||
15 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
16 | * the code are not to be removed. | ||
17 | * If this package is used in a product, Eric Young should be given attribution | ||
18 | * as the author of the parts of the library used. | ||
19 | * This can be in the form of a textual message at program startup or | ||
20 | * in documentation (online or textual) provided with the package. | ||
21 | * | ||
22 | * Redistribution and use in source and binary forms, with or without | ||
23 | * modification, are permitted provided that the following conditions | ||
24 | * are met: | ||
25 | * 1. Redistributions of source code must retain the copyright | ||
26 | * notice, this list of conditions and the following disclaimer. | ||
27 | * 2. Redistributions in binary form must reproduce the above copyright | ||
28 | * notice, this list of conditions and the following disclaimer in the | ||
29 | * documentation and/or other materials provided with the distribution. | ||
30 | * 3. All advertising materials mentioning features or use of this software | ||
31 | * must display the following acknowledgement: | ||
32 | * "This product includes cryptographic software written by | ||
33 | * Eric Young (eay@cryptsoft.com)" | ||
34 | * The word 'cryptographic' can be left out if the rouines from the library | ||
35 | * being used are not cryptographic related :-). | ||
36 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
37 | * the apps directory (application code) you must include an acknowledgement: | ||
38 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
39 | * | ||
40 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
41 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
43 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
44 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
45 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
46 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
48 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
49 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
50 | * SUCH DAMAGE. | ||
51 | * | ||
52 | * The licence and distribution terms for any publically available version or | ||
53 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
54 | * copied and put under another distribution licence | ||
55 | * [including the GNU Public Licence.] | ||
56 | */ | ||
57 | |||
58 | #ifdef __cplusplus | ||
59 | extern "C" { | ||
60 | #endif | ||
61 | |||
62 | #include "EXTERN.h" | ||
63 | #include "perl.h" | ||
64 | #include "XSUB.h" | ||
65 | |||
66 | #ifdef __cplusplus | ||
67 | } | ||
68 | #endif | ||
69 | |||
70 | typedef struct datum_st { | ||
71 | char *dptr; | ||
72 | int dsize; | ||
73 | } datum; | ||
74 | |||
75 | #include <openssl/crypto.h> | ||
76 | #include <openssl/buffer.h> | ||
77 | #include <openssl/bio.h> | ||
78 | #include <openssl/evp.h> | ||
79 | #include <openssl/err.h> | ||
80 | #include <openssl/x509.h> | ||
81 | #include <openssl/ssl.h> | ||
82 | |||
83 | #ifdef DEBUG | ||
84 | #define pr_name(name) printf("%s\n",name) | ||
85 | #define pr_name_d(name,p2) printf("%s %d\n",name,p2) | ||
86 | #define pr_name_dd(name,p2,p3) printf("%s %d %d\n",name,p2,p3) | ||
87 | #else | ||
88 | #define pr_name(name) | ||
89 | #define pr_name_d(name,p2) | ||
90 | #define pr_name_dd(name,p2,p3) | ||
91 | #endif | ||
92 | |||
93 | SV *new_ref(char *type, char *obj, int mort); | ||
94 | int ex_new(char *obj, SV *data, CRYPTO_EX_DATA *ad, int idx, long argl, char *argp); | ||
95 | void ex_cleanup(char *obj, SV *data, CRYPTO_EX_DATA *ad, int idx, long argl, char *argp); | ||
96 | |||
diff --git a/src/lib/libssl/src/perl/openssl_bio.xs b/src/lib/libssl/src/perl/openssl_bio.xs deleted file mode 100644 index 5628300d0b..0000000000 --- a/src/lib/libssl/src/perl/openssl_bio.xs +++ /dev/null | |||
@@ -1,450 +0,0 @@ | |||
1 | |||
2 | #include "openssl.h" | ||
3 | |||
4 | static int p5_bio_ex_bio_ptr = 0; | ||
5 | static int p5_bio_ex_bio_callback = 0; | ||
6 | static int p5_bio_ex_bio_callback_data = 0; | ||
7 | |||
8 | static long | ||
9 | p5_bio_callback(bio,state,parg,cmd,larg,ret) | ||
10 | BIO *bio; | ||
11 | int state; | ||
12 | char *parg; | ||
13 | int cmd; | ||
14 | long larg; | ||
15 | int ret; | ||
16 | { | ||
17 | int i; | ||
18 | SV *me,*cb; | ||
19 | |||
20 | me = (SV *)BIO_get_ex_data(bio, p5_bio_ex_bio_ptr); | ||
21 | cb = (SV *)BIO_get_ex_data(bio, p5_bio_ex_bio_callback); | ||
22 | if (cb != NULL) { | ||
23 | dSP; | ||
24 | |||
25 | ENTER; | ||
26 | SAVETMPS; | ||
27 | |||
28 | PUSHMARK(sp); | ||
29 | XPUSHs(sv_2mortal(newSVsv(me))); | ||
30 | XPUSHs(sv_2mortal(newSViv(state))); | ||
31 | XPUSHs(sv_2mortal(newSViv(cmd))); | ||
32 | if ((state == BIO_CB_READ) || (state == BIO_CB_WRITE)) | ||
33 | XPUSHs(sv_2mortal(newSVpv(parg,larg))); | ||
34 | else | ||
35 | XPUSHs(&PL_sv_undef); | ||
36 | /* ptr one */ | ||
37 | XPUSHs(sv_2mortal(newSViv(larg))); | ||
38 | XPUSHs(sv_2mortal(newSViv(ret))); | ||
39 | PUTBACK; | ||
40 | |||
41 | i = perl_call_sv(cb,G_SCALAR); | ||
42 | |||
43 | SPAGAIN; | ||
44 | if (i == 1) | ||
45 | ret = POPi; | ||
46 | else | ||
47 | ret = 1; | ||
48 | PUTBACK; | ||
49 | FREETMPS; | ||
50 | LEAVE; | ||
51 | } | ||
52 | else { | ||
53 | croak("Internal error in p5_bio_callback"); | ||
54 | } | ||
55 | return(ret); | ||
56 | } | ||
57 | |||
58 | int | ||
59 | boot_bio(void) | ||
60 | { | ||
61 | p5_bio_ex_bio_ptr = BIO_get_ex_new_index(0, "OpenSSL::BIO", ex_new, NULL, ex_cleanup); | ||
62 | p5_bio_ex_bio_callback = BIO_get_ex_new_index(0, "bio_callback", NULL, NULL, ex_cleanup); | ||
63 | p5_bio_ex_bio_callback_data = BIO_get_ex_new_index(0, "bio_callback_data", NULL, NULL, ex_cleanup); | ||
64 | return(1); | ||
65 | } | ||
66 | |||
67 | MODULE = OpenSSL::BIO PACKAGE = OpenSSL::BIO PREFIX = p5_BIO_ | ||
68 | |||
69 | PROTOTYPES: ENABLE | ||
70 | VERSIONCHECK: DISABLE | ||
71 | |||
72 | void | ||
73 | p5_BIO_new_buffer_ssl_connect(...) | ||
74 | PROTOTYPE: ;$ | ||
75 | PREINIT: | ||
76 | SSL_CTX *ctx; | ||
77 | BIO *bio; | ||
78 | SV *arg; | ||
79 | PPCODE: | ||
80 | if (items == 1) | ||
81 | arg = ST(0); | ||
82 | else if (items == 2) | ||
83 | arg = ST(1); | ||
84 | else | ||
85 | arg = NULL; | ||
86 | if ((arg == NULL) || !(sv_derived_from(arg,"OpenSSL::SSL::CTX"))) | ||
87 | croak("Usage: OpenSSL::BIO::new_buffer_ssl_connect(SSL_CTX)"); | ||
88 | else { | ||
89 | IV tmp = SvIV((SV *)SvRV(arg)); | ||
90 | ctx = (SSL_CTX *)tmp; | ||
91 | } | ||
92 | EXTEND(sp, 1); | ||
93 | bio = BIO_new_buffer_ssl_connect(ctx); | ||
94 | arg = (SV *)BIO_get_ex_data(bio, p5_bio_ex_bio_ptr); | ||
95 | PUSHs(arg); | ||
96 | |||
97 | void | ||
98 | p5_BIO_new_ssl_connect(...) | ||
99 | PROTOTYPE: ;$ | ||
100 | PREINIT: | ||
101 | SSL_CTX *ctx; | ||
102 | BIO *bio; | ||
103 | SV *arg; | ||
104 | PPCODE: | ||
105 | if (items == 1) | ||
106 | arg = ST(0); | ||
107 | else if (items == 2) | ||
108 | arg = ST(1); | ||
109 | else | ||
110 | arg = NULL; | ||
111 | if ((arg == NULL) || !(sv_derived_from(arg,"OpenSSL::SSL::CTX"))) | ||
112 | croak("Usage: OpenSSL::BIO::new_ssl_connect(SSL_CTX)"); | ||
113 | else { | ||
114 | IV tmp = SvIV((SV *)SvRV(arg)); | ||
115 | ctx = (SSL_CTX *)tmp; | ||
116 | } | ||
117 | EXTEND(sp,1); | ||
118 | bio = BIO_new_ssl_connect(ctx); | ||
119 | arg = (SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_ptr); | ||
120 | PUSHs(arg); | ||
121 | |||
122 | void | ||
123 | p5_BIO_new(...) | ||
124 | PROTOTYPE: ;$ | ||
125 | PREINIT: | ||
126 | BIO *bio; | ||
127 | char *type; | ||
128 | SV *arg; | ||
129 | PPCODE: | ||
130 | pr_name("p5_BIO_new"); | ||
131 | if ((items == 1) && SvPOK(ST(0))) | ||
132 | type = SvPV_nolen(ST(0)); | ||
133 | else if ((items == 2) && SvPOK(ST(1))) | ||
134 | type = SvPV_nolen(ST(1)); | ||
135 | else | ||
136 | croak("Usage: OpenSSL::BIO::new(type)"); | ||
137 | EXTEND(sp,1); | ||
138 | if (strcmp(type, "mem") == 0) | ||
139 | bio=BIO_new(BIO_s_mem()); | ||
140 | else if (strcmp(type, "socket") == 0) | ||
141 | bio=BIO_new(BIO_s_socket()); | ||
142 | else if (strcmp(type, "connect") == 0) | ||
143 | bio=BIO_new(BIO_s_connect()); | ||
144 | else if (strcmp(type, "accept") == 0) | ||
145 | bio=BIO_new(BIO_s_accept()); | ||
146 | else if (strcmp(type, "fd") == 0) | ||
147 | bio=BIO_new(BIO_s_fd()); | ||
148 | else if (strcmp(type, "file") == 0) | ||
149 | bio=BIO_new(BIO_s_file()); | ||
150 | else if (strcmp(type, "null") == 0) | ||
151 | bio=BIO_new(BIO_s_null()); | ||
152 | else if (strcmp(type, "ssl") == 0) | ||
153 | bio=BIO_new(BIO_f_ssl()); | ||
154 | else if (strcmp(type, "buffer") == 0) | ||
155 | bio=BIO_new(BIO_f_buffer()); | ||
156 | else | ||
157 | croak("unknown BIO type"); | ||
158 | arg = (SV *)BIO_get_ex_data(bio,p5_bio_ex_bio_ptr); | ||
159 | PUSHs(arg); | ||
160 | |||
161 | int | ||
162 | p5_BIO_hostname(bio, name) | ||
163 | BIO *bio; | ||
164 | char *name; | ||
165 | PROTOTYPE: $$ | ||
166 | CODE: | ||
167 | RETVAL = BIO_set_conn_hostname(bio, name); | ||
168 | OUTPUT: | ||
169 | RETVAL | ||
170 | |||
171 | int | ||
172 | p5_BIO_set_accept_port(bio, str) | ||
173 | BIO *bio; | ||
174 | char *str; | ||
175 | PROTOTYPE: $$ | ||
176 | CODE: | ||
177 | RETVAL = BIO_set_accept_port(bio, str); | ||
178 | OUTPUT: | ||
179 | RETVAL | ||
180 | |||
181 | int | ||
182 | p5_BIO_do_handshake(bio) | ||
183 | BIO *bio; | ||
184 | PROTOTYPE: $ | ||
185 | CODE: | ||
186 | RETVAL = BIO_do_handshake(bio); | ||
187 | OUTPUT: | ||
188 | RETVAL | ||
189 | |||
190 | BIO * | ||
191 | p5_BIO_push(b, bio) | ||
192 | BIO *b; | ||
193 | BIO *bio; | ||
194 | PROTOTYPE: $$ | ||
195 | CODE: | ||
196 | /* This reference will be reduced when the reference is | ||
197 | * let go, and then when the BIO_free_all() is called | ||
198 | * inside the OpenSSL library by the BIO with this | ||
199 | * pushed into */ | ||
200 | bio->references++; | ||
201 | RETVAL = BIO_push(b, bio); | ||
202 | OUTPUT: | ||
203 | RETVAL | ||
204 | |||
205 | void | ||
206 | p5_BIO_pop(b) | ||
207 | BIO *b | ||
208 | PROTOTYPE: $ | ||
209 | PREINIT: | ||
210 | BIO *bio; | ||
211 | char *type; | ||
212 | SV *arg; | ||
213 | PPCODE: | ||
214 | bio = BIO_pop(b); | ||
215 | if (bio != NULL) { | ||
216 | /* This BIO will either be one created in the | ||
217 | * perl library, in which case it will have a perl | ||
218 | * SV, otherwise it will have been created internally, | ||
219 | * inside OpenSSL. For the 'pushed in', it needs | ||
220 | * the reference count decremented. */ | ||
221 | arg = (SV *)BIO_get_ex_data(bio, p5_bio_ex_bio_ptr); | ||
222 | if (arg == NULL) { | ||
223 | arg = new_ref("OpenSSL::BIO",(char *)bio,0); | ||
224 | BIO_set_ex_data(bio, p5_bio_ex_bio_ptr, (char *)arg); | ||
225 | PUSHs(arg); | ||
226 | } | ||
227 | else { | ||
228 | /* it was pushed in */ | ||
229 | SvREFCNT_inc(arg); | ||
230 | PUSHs(arg); | ||
231 | } | ||
232 | } | ||
233 | |||
234 | int | ||
235 | p5_BIO_sysread(bio, in, num, ...) | ||
236 | BIO *bio; | ||
237 | SV *in; | ||
238 | int num; | ||
239 | PROTOTYPE: $$$; | ||
240 | PREINIT: | ||
241 | int i,n,olen; | ||
242 | int offset; | ||
243 | char *p; | ||
244 | CODE: | ||
245 | offset = 0; | ||
246 | if (!SvPOK(in)) | ||
247 | sv_setpvn(in, "", 0); | ||
248 | SvPV(in, olen); | ||
249 | if (items > 3) { | ||
250 | offset = SvIV(ST(3)); | ||
251 | if (offset < 0) { | ||
252 | if (-offset > olen) | ||
253 | croak("Offset outside string"); | ||
254 | offset+=olen; | ||
255 | } | ||
256 | } | ||
257 | if ((num+offset) > olen) { | ||
258 | SvGROW(in, num+offset+1); | ||
259 | p=SvPV(in, i); | ||
260 | memset(&(p[olen]), 0, (num+offset)-olen+1); | ||
261 | } | ||
262 | p = SvPV(in,n); | ||
263 | i = BIO_read(bio, p+offset, num); | ||
264 | RETVAL = i; | ||
265 | if (i <= 0) | ||
266 | i = 0; | ||
267 | SvCUR_set(in, offset+i); | ||
268 | OUTPUT: | ||
269 | RETVAL | ||
270 | |||
271 | int | ||
272 | p5_BIO_syswrite(bio, in, ...) | ||
273 | BIO *bio; | ||
274 | SV *in; | ||
275 | PROTOTYPE: $$; | ||
276 | PREINIT: | ||
277 | char *ptr; | ||
278 | int len,in_len; | ||
279 | int offset=0; | ||
280 | int n; | ||
281 | CODE: | ||
282 | ptr = SvPV(in, in_len); | ||
283 | if (items > 2) { | ||
284 | len = SvOK(ST(2)) ? SvIV(ST(2)) : in_len; | ||
285 | if (items > 3) { | ||
286 | offset = SvIV(ST(3)); | ||
287 | if (offset < 0) { | ||
288 | if (-offset > in_len) | ||
289 | croak("Offset outside string"); | ||
290 | offset+=in_len; | ||
291 | } | ||
292 | else if ((offset >= in_len) && (in_len > 0)) | ||
293 | croak("Offset outside string"); | ||
294 | } | ||
295 | if (len >= (in_len-offset)) | ||
296 | len = in_len-offset; | ||
297 | } | ||
298 | else | ||
299 | len = in_len; | ||
300 | RETVAL = BIO_write(bio, ptr+offset, len); | ||
301 | OUTPUT: | ||
302 | RETVAL | ||
303 | |||
304 | void | ||
305 | p5_BIO_getline(bio) | ||
306 | BIO *bio; | ||
307 | PROTOTYPE: $ | ||
308 | PREINIT: | ||
309 | int i; | ||
310 | char *p; | ||
311 | PPCODE: | ||
312 | pr_name("p5_BIO_gets"); | ||
313 | EXTEND(sp, 1); | ||
314 | PUSHs(sv_newmortal()); | ||
315 | sv_setpvn(ST(0), "", 0); | ||
316 | SvGROW(ST(0), 1024); | ||
317 | p=SvPV_nolen(ST(0)); | ||
318 | i = BIO_gets(bio, p, 1024); | ||
319 | if (i < 0) | ||
320 | i = 0; | ||
321 | SvCUR_set(ST(0), i); | ||
322 | |||
323 | int | ||
324 | p5_BIO_flush(bio) | ||
325 | BIO *bio; | ||
326 | PROTOTYPE: $ | ||
327 | CODE: | ||
328 | RETVAL = BIO_flush(bio); | ||
329 | OUTPUT: | ||
330 | RETVAL | ||
331 | |||
332 | char * | ||
333 | p5_BIO_type(bio) | ||
334 | BIO *bio; | ||
335 | PROTOTYPE: $ | ||
336 | CODE: | ||
337 | RETVAL = bio->method->name; | ||
338 | OUTPUT: | ||
339 | RETVAL | ||
340 | |||
341 | void | ||
342 | p5_BIO_next_bio(b) | ||
343 | BIO *b | ||
344 | PROTOTYPE: $ | ||
345 | PREINIT: | ||
346 | BIO *bio; | ||
347 | char *type; | ||
348 | SV *arg; | ||
349 | PPCODE: | ||
350 | bio = b->next_bio; | ||
351 | if (bio != NULL) { | ||
352 | arg = (SV *)BIO_get_ex_data(bio, p5_bio_ex_bio_ptr); | ||
353 | if (arg == NULL) { | ||
354 | arg = new_ref("OpenSSL::BIO", (char *)bio, 0); | ||
355 | BIO_set_ex_data(bio, p5_bio_ex_bio_ptr, (char *)arg); | ||
356 | bio->references++; | ||
357 | PUSHs(arg); | ||
358 | } | ||
359 | else { | ||
360 | SvREFCNT_inc(arg); | ||
361 | PUSHs(arg); | ||
362 | } | ||
363 | } | ||
364 | |||
365 | int | ||
366 | p5_BIO_puts(bio, in) | ||
367 | BIO *bio; | ||
368 | SV *in; | ||
369 | PROTOTYPE: $$ | ||
370 | PREINIT: | ||
371 | char *ptr; | ||
372 | CODE: | ||
373 | ptr = SvPV_nolen(in); | ||
374 | RETVAL = BIO_puts(bio, ptr); | ||
375 | OUTPUT: | ||
376 | RETVAL | ||
377 | |||
378 | void | ||
379 | p5_BIO_set_callback(bio, cb,...) | ||
380 | BIO *bio; | ||
381 | SV *cb; | ||
382 | PROTOTYPE: $$; | ||
383 | PREINIT: | ||
384 | SV *arg = NULL; | ||
385 | SV *arg2 = NULL; | ||
386 | CODE: | ||
387 | if (items > 3) | ||
388 | croak("Usage: OpenSSL::BIO::set_callback(bio,callback[,arg]"); | ||
389 | if (items == 3) { | ||
390 | arg2 = sv_mortalcopy(ST(2)); | ||
391 | SvREFCNT_inc(arg2); | ||
392 | BIO_set_ex_data(bio, p5_bio_ex_bio_callback_data, (char *)arg2); | ||
393 | } | ||
394 | arg = sv_mortalcopy(ST(1)); | ||
395 | SvREFCNT_inc(arg); | ||
396 | BIO_set_ex_data(bio, p5_bio_ex_bio_callback, (char *)arg); | ||
397 | /* printf("%08lx < bio_ptr\n",BIO_get_ex_data(bio,p5_bio_ex_bio_ptr)); */ | ||
398 | BIO_set_callback(bio, p5_bio_callback); | ||
399 | |||
400 | void | ||
401 | p5_BIO_DESTROY(bio) | ||
402 | BIO *bio | ||
403 | PROTOTYPE: $ | ||
404 | PREINIT: | ||
405 | SV *sv; | ||
406 | PPCODE: | ||
407 | pr_name_d("p5_BIO_DESTROY",bio->references); | ||
408 | /* printf("p5_BIO_DESTROY <%s> %d\n",bio->method->name,bio->references); */ | ||
409 | BIO_set_ex_data(bio,p5_bio_ex_bio_ptr,NULL); | ||
410 | BIO_free_all(bio); | ||
411 | |||
412 | int | ||
413 | p5_BIO_set_ssl(bio, ssl) | ||
414 | BIO *bio; | ||
415 | SSL *ssl; | ||
416 | PROTOTYPE: $$ | ||
417 | CODE: | ||
418 | pr_name("p5_BIO_set_ssl"); | ||
419 | ssl->references++; | ||
420 | RETVAL = BIO_set_ssl(bio, ssl, BIO_CLOSE); | ||
421 | OUTPUT: | ||
422 | RETVAL | ||
423 | |||
424 | int | ||
425 | p5_BIO_number_read(bio) | ||
426 | BIO *bio; | ||
427 | PROTOTYPE: $ | ||
428 | CODE: | ||
429 | RETVAL = BIO_number_read(bio); | ||
430 | OUTPUT: | ||
431 | RETVAL | ||
432 | |||
433 | int | ||
434 | p5_BIO_number_written(bio) | ||
435 | BIO *bio; | ||
436 | PROTOTYPE: $ | ||
437 | CODE: | ||
438 | RETVAL = BIO_number_written(bio); | ||
439 | OUTPUT: | ||
440 | RETVAL | ||
441 | |||
442 | int | ||
443 | p5_BIO_references(bio) | ||
444 | BIO *bio; | ||
445 | PROTOTYPE: $ | ||
446 | CODE: | ||
447 | RETVAL = bio->references; | ||
448 | OUTPUT: | ||
449 | RETVAL | ||
450 | |||
diff --git a/src/lib/libssl/src/perl/openssl_bn.xs b/src/lib/libssl/src/perl/openssl_bn.xs deleted file mode 100644 index 6817cfb740..0000000000 --- a/src/lib/libssl/src/perl/openssl_bn.xs +++ /dev/null | |||
@@ -1,593 +0,0 @@ | |||
1 | |||
2 | #include "openssl.h" | ||
3 | |||
4 | int sv_to_BIGNUM(var,arg,name) | ||
5 | BIGNUM **var; | ||
6 | SV *arg; | ||
7 | char *name; | ||
8 | { | ||
9 | int ret=1; | ||
10 | |||
11 | if (sv_derived_from(arg,"OpenSSL::BN")) | ||
12 | { | ||
13 | IV tmp = SvIV((SV*)SvRV(arg)); | ||
14 | *var = (BIGNUM *) tmp; | ||
15 | } | ||
16 | else if (SvIOK(arg)) { | ||
17 | SV *tmp=sv_newmortal(); | ||
18 | *var=BN_new(); | ||
19 | BN_set_word(*var,SvIV(arg)); | ||
20 | sv_setref_pv(tmp,"OpenSSL::BN",(void*)*var); | ||
21 | } | ||
22 | else if (SvPOK(arg)) { | ||
23 | char *ptr; | ||
24 | STRLEN len; | ||
25 | SV *tmp=sv_newmortal(); | ||
26 | *var=BN_new(); | ||
27 | sv_setref_pv(tmp,"OpenSSL::BN", (void*)*var); | ||
28 | ptr=SvPV(arg,len); | ||
29 | SvGROW(arg,len+1); | ||
30 | ptr[len]='\0'; | ||
31 | BN_dec2bn(var,ptr); | ||
32 | } | ||
33 | else | ||
34 | { | ||
35 | croak(name); | ||
36 | ret=0; | ||
37 | } | ||
38 | return(ret); | ||
39 | } | ||
40 | |||
41 | typedef struct gpc_args_st { | ||
42 | SV *cb; | ||
43 | SV *arg; | ||
44 | } GPC_ARGS; | ||
45 | |||
46 | static void generate_prime_callback(pos,num,arg) | ||
47 | int pos; | ||
48 | int num; | ||
49 | char *arg; | ||
50 | { | ||
51 | dSP ; | ||
52 | int i; | ||
53 | GPC_ARGS *a=(GPC_ARGS *)arg; | ||
54 | |||
55 | ENTER ; | ||
56 | SAVETMPS ; | ||
57 | |||
58 | PUSHMARK(sp); | ||
59 | XPUSHs(sv_2mortal(newSViv(pos))); | ||
60 | XPUSHs(sv_2mortal(newSViv(num))); | ||
61 | XPUSHs(sv_2mortal(newSVsv(a->arg))); | ||
62 | PUTBACK; | ||
63 | |||
64 | i=perl_call_sv(a->cb,G_DISCARD); | ||
65 | |||
66 | SPAGAIN; | ||
67 | |||
68 | PUTBACK; | ||
69 | FREETMPS; | ||
70 | LEAVE; | ||
71 | } | ||
72 | |||
73 | MODULE = OpenSSL::BN PACKAGE = OpenSSL::BN PREFIX = p5_BN_ | ||
74 | |||
75 | PROTOTYPES: ENABLE | ||
76 | VERSIONCHECK: DISABLE | ||
77 | |||
78 | void | ||
79 | p5_BN_new(...) | ||
80 | PREINIT: | ||
81 | BIGNUM *bn; | ||
82 | SV *arg; | ||
83 | PPCODE: | ||
84 | pr_name("p5_BN_new"); | ||
85 | EXTEND(sp,1); | ||
86 | PUSHs(sv_newmortal()); | ||
87 | bn=BN_new(); | ||
88 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)bn); | ||
89 | |||
90 | void | ||
91 | p5_BN_dup(a) | ||
92 | BIGNUM *a; | ||
93 | PREINIT: | ||
94 | BIGNUM *bn; | ||
95 | PPCODE: | ||
96 | pr_name("p5_BN_dup"); | ||
97 | EXTEND(sp,1); | ||
98 | PUSHs(sv_newmortal()); | ||
99 | bn=BN_dup(a); | ||
100 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)bn); | ||
101 | |||
102 | void | ||
103 | p5_BN_rand(bits,...) | ||
104 | int bits; | ||
105 | PREINIT: | ||
106 | int top=1; | ||
107 | int bottom=0; | ||
108 | BIGNUM *ret; | ||
109 | PPCODE: | ||
110 | pr_name("p5_BN_rand"); | ||
111 | if ((items < 1) || (items > 3)) | ||
112 | croak("Usage: OpenSSL::BN::rand(bits[,top_bit][,bottombit]"); | ||
113 | if (items >= 2) top=(int)SvIV(ST(0)); | ||
114 | if (items >= 3) bottom=(int)SvIV(ST(1)); | ||
115 | EXTEND(sp,1); | ||
116 | PUSHs(sv_newmortal()); | ||
117 | ret=BN_new(); | ||
118 | BN_rand(ret,bits,top,bottom); | ||
119 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
120 | |||
121 | void | ||
122 | p5_BN_bin2bn(a) | ||
123 | datum a; | ||
124 | PREINIT: | ||
125 | BIGNUM *ret; | ||
126 | PPCODE: | ||
127 | pr_name("p5_BN_bin2bn"); | ||
128 | EXTEND(sp,1); | ||
129 | PUSHs(sv_newmortal()); | ||
130 | ret=BN_bin2bn(a.dptr,a.dsize,NULL); | ||
131 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
132 | |||
133 | void | ||
134 | p5_BN_bn2bin(a) | ||
135 | BIGNUM *a; | ||
136 | PREINIT: | ||
137 | int i; | ||
138 | PPCODE: | ||
139 | pr_name("p5_BN_bn2bin"); | ||
140 | EXTEND(sp,1); | ||
141 | PUSHs(sv_newmortal()); | ||
142 | i=BN_num_bytes(a)+2; | ||
143 | sv_setpvn(ST(0),"",1); | ||
144 | SvGROW(ST(0),i+1); | ||
145 | SvCUR_set(ST(0),BN_bn2bin(a,SvPV_nolen(ST(0)))); | ||
146 | |||
147 | void | ||
148 | p5_BN_mpi2bn(a) | ||
149 | datum a; | ||
150 | PREINIT: | ||
151 | BIGNUM *ret; | ||
152 | PPCODE: | ||
153 | pr_name("p5_BN_mpi2bn"); | ||
154 | EXTEND(sp,1); | ||
155 | PUSHs(sv_newmortal()); | ||
156 | ret=BN_mpi2bn(a.dptr,a.dsize,NULL); | ||
157 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
158 | |||
159 | void | ||
160 | p5_BN_bn2mpi(a) | ||
161 | BIGNUM *a; | ||
162 | PREINIT: | ||
163 | int i; | ||
164 | PPCODE: | ||
165 | pr_name("p5_BN_bn2mpi"); | ||
166 | EXTEND(sp,1); | ||
167 | PUSHs(sv_newmortal()); | ||
168 | i=BN_bn2mpi(a,NULL); | ||
169 | sv_setpvn(ST(0),"",1); | ||
170 | SvGROW(ST(0),i+1); | ||
171 | SvCUR_set(ST(0),BN_bn2mpi(a,SvPV_nolen(ST(0)))); | ||
172 | |||
173 | void | ||
174 | p5_BN_hex2bn(a) | ||
175 | datum a; | ||
176 | PREINIT: | ||
177 | BIGNUM *ret; | ||
178 | PPCODE: | ||
179 | pr_name("p5_BN_hex2bn"); | ||
180 | EXTEND(sp,1); | ||
181 | PUSHs(sv_newmortal()); | ||
182 | ret=BN_new(); | ||
183 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
184 | BN_hex2bn(&ret,a.dptr); | ||
185 | |||
186 | void | ||
187 | p5_BN_dec2bn(a) | ||
188 | datum a; | ||
189 | PREINIT: | ||
190 | BIGNUM *ret; | ||
191 | PPCODE: | ||
192 | pr_name("p5_BN_dec2bn"); | ||
193 | EXTEND(sp,1); | ||
194 | PUSHs(sv_newmortal()); | ||
195 | ret=BN_new(); | ||
196 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
197 | BN_dec2bn(&ret,a.dptr); | ||
198 | |||
199 | SV * | ||
200 | p5_BN_bn2hex(a) | ||
201 | BIGNUM *a; | ||
202 | PREINIT: | ||
203 | char *ptr; | ||
204 | int i; | ||
205 | CODE: | ||
206 | pr_name("p5_BN_bn2hex"); | ||
207 | ptr=BN_bn2hex(a); | ||
208 | RETVAL=newSVpv("",0); | ||
209 | i=strlen(ptr); | ||
210 | SvGROW(RETVAL,i+1); | ||
211 | memcpy(SvPV_nolen(RETVAL),ptr,i+1); | ||
212 | SvCUR_set(RETVAL,i); | ||
213 | OPENSSL_free(ptr); | ||
214 | OUTPUT: | ||
215 | RETVAL | ||
216 | |||
217 | SV * | ||
218 | p5_BN_bn2dec(a) | ||
219 | BIGNUM *a; | ||
220 | PREINIT: | ||
221 | char *ptr; | ||
222 | int i; | ||
223 | CODE: | ||
224 | pr_name("p5_BN_bn2dec"); | ||
225 | ptr=BN_bn2dec(a); | ||
226 | RETVAL=newSVpv("",0); | ||
227 | i=strlen(ptr); | ||
228 | SvGROW(RETVAL,i+1); | ||
229 | memcpy(SvPV_nolen(RETVAL),ptr,i+1); | ||
230 | SvCUR_set(RETVAL,i); | ||
231 | OPENSSL_free(ptr); | ||
232 | OUTPUT: | ||
233 | RETVAL | ||
234 | |||
235 | void | ||
236 | p5_BN_add(a,b) | ||
237 | BIGNUM *a; | ||
238 | BIGNUM *b; | ||
239 | PREINIT: | ||
240 | BIGNUM *ret; | ||
241 | PPCODE: | ||
242 | pr_name("p5_BN_add"); | ||
243 | EXTEND(sp,1); | ||
244 | PUSHs(sv_newmortal()); | ||
245 | ret=BN_new(); | ||
246 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
247 | BN_add(ret,a,b); | ||
248 | |||
249 | void | ||
250 | p5_BN_sub(a,b) | ||
251 | BIGNUM *a; | ||
252 | BIGNUM *b; | ||
253 | PREINIT: | ||
254 | BIGNUM *ret; | ||
255 | PPCODE: | ||
256 | pr_name("p5_BN_sub"); | ||
257 | EXTEND(sp,1); | ||
258 | PUSHs(sv_newmortal()); | ||
259 | ret=BN_new(); | ||
260 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
261 | BN_sub(ret,a,b); | ||
262 | |||
263 | void | ||
264 | p5_BN_mul(a,b) | ||
265 | BIGNUM *a; | ||
266 | BIGNUM *b; | ||
267 | PREINIT: | ||
268 | static BN_CTX *ctx=NULL; | ||
269 | BIGNUM *ret; | ||
270 | PPCODE: | ||
271 | pr_name("p5_BN_mul"); | ||
272 | if (ctx == NULL) ctx=BN_CTX_new(); | ||
273 | EXTEND(sp,1); | ||
274 | PUSHs(sv_newmortal()); | ||
275 | ret=BN_new(); | ||
276 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
277 | BN_mul(ret,a,b,ctx); | ||
278 | |||
279 | void | ||
280 | p5_BN_div(a,b) | ||
281 | BIGNUM *a; | ||
282 | BIGNUM *b; | ||
283 | PREINIT: | ||
284 | static BN_CTX *ctx=NULL; | ||
285 | BIGNUM *div,*mod; | ||
286 | PPCODE: | ||
287 | pr_name("p5_BN_div"); | ||
288 | if (ctx == NULL) ctx=BN_CTX_new(); | ||
289 | EXTEND(sp,2); | ||
290 | PUSHs(sv_newmortal()); | ||
291 | PUSHs(sv_newmortal()); | ||
292 | div=BN_new(); | ||
293 | mod=BN_new(); | ||
294 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)div); | ||
295 | sv_setref_pv(ST(1), "OpenSSL::BN", (void*)mod); | ||
296 | BN_div(div,mod,a,b,ctx); | ||
297 | |||
298 | void | ||
299 | p5_BN_mod(a,b) | ||
300 | BIGNUM *a; | ||
301 | BIGNUM *b; | ||
302 | PREINIT: | ||
303 | static BN_CTX *ctx=NULL; | ||
304 | BIGNUM *rem; | ||
305 | PPCODE: | ||
306 | pr_name("p5_BN_mod"); | ||
307 | if (ctx == NULL) ctx=BN_CTX_new(); | ||
308 | EXTEND(sp,1); | ||
309 | PUSHs(sv_newmortal()); | ||
310 | rem=BN_new(); | ||
311 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)rem); | ||
312 | BN_mod(rem,a,b,ctx); | ||
313 | |||
314 | void | ||
315 | p5_BN_exp(a,p) | ||
316 | BIGNUM *a; | ||
317 | BIGNUM *p; | ||
318 | PREINIT: | ||
319 | BIGNUM *ret; | ||
320 | static BN_CTX *ctx=NULL; | ||
321 | PPCODE: | ||
322 | pr_name("p5_BN_exp"); | ||
323 | if (ctx == NULL) ctx=BN_CTX_new(); | ||
324 | EXTEND(sp,1); | ||
325 | PUSHs(sv_newmortal()); | ||
326 | ret=BN_new(); | ||
327 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
328 | BN_exp(ret,a,p,ctx); | ||
329 | |||
330 | void | ||
331 | p5_BN_mod_mul(a,b,c) | ||
332 | BIGNUM *a; | ||
333 | BIGNUM *b; | ||
334 | BIGNUM *c; | ||
335 | PREINIT: | ||
336 | static BN_CTX *ctx=NULL; | ||
337 | BIGNUM *ret; | ||
338 | PPCODE: | ||
339 | pr_name("p5_BN_mod_mul"); | ||
340 | if (ctx == NULL) ctx=BN_CTX_new(); | ||
341 | EXTEND(sp,1); | ||
342 | PUSHs(sv_newmortal()); | ||
343 | ret=BN_new(); | ||
344 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
345 | BN_mod_mul(ret,a,b,c,ctx); | ||
346 | |||
347 | void | ||
348 | p5_BN_mod_exp(a,b,c) | ||
349 | BIGNUM *a; | ||
350 | BIGNUM *b; | ||
351 | BIGNUM *c; | ||
352 | PREINIT: | ||
353 | static BN_CTX *ctx=NULL; | ||
354 | BIGNUM *ret; | ||
355 | PPCODE: | ||
356 | pr_name("p5_BN_mod_exp"); | ||
357 | if (ctx == NULL) ctx=BN_CTX_new(); | ||
358 | EXTEND(sp,1); | ||
359 | PUSHs(sv_newmortal()); | ||
360 | ret=BN_new(); | ||
361 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
362 | BN_mod_exp(ret,a,b,c,ctx); | ||
363 | |||
364 | void | ||
365 | p5_BN_generate_prime(...) | ||
366 | PREINIT: | ||
367 | int bits=512; | ||
368 | int strong=0; | ||
369 | BIGNUM *ret=NULL; | ||
370 | SV *callback=NULL; | ||
371 | SV *cb_arg=NULL; | ||
372 | GPC_ARGS arg; | ||
373 | dSP; | ||
374 | |||
375 | PPCODE: | ||
376 | pr_name("p5_BN_generate_prime"); | ||
377 | if ((items < 0) || (items > 4)) | ||
378 | croak("Usage: OpenSSL::BN::generate_prime(a[,strong][,callback][,cb_arg]"); | ||
379 | if (items >= 1) bits=(int)SvIV(ST(0)); | ||
380 | if (items >= 2) strong=(int)SvIV(ST(1)); | ||
381 | if (items >= 3) callback=ST(2); | ||
382 | if (items == 4) cb_arg=ST(3); | ||
383 | |||
384 | if (callback == NULL) | ||
385 | ret=BN_generate_prime(ret,bits,strong,NULL,NULL,NULL,NULL); | ||
386 | else | ||
387 | { | ||
388 | arg.cb=callback; | ||
389 | arg.arg=cb_arg; | ||
390 | |||
391 | ret=BN_generate_prime(ret,bits,strong,NULL,NULL, | ||
392 | generate_prime_callback,(char *)&arg); | ||
393 | } | ||
394 | |||
395 | SPAGAIN; | ||
396 | sp-=items; /* a bit evil that I do this */ | ||
397 | |||
398 | EXTEND(sp,1); | ||
399 | PUSHs(sv_newmortal()); | ||
400 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
401 | |||
402 | void | ||
403 | p5_BN_is_prime(p,...) | ||
404 | BIGNUM *p; | ||
405 | PREINIT: | ||
406 | int nchecks=5,ret; | ||
407 | SV *callback=NULL; | ||
408 | SV *cb_arg=NULL; | ||
409 | GPC_ARGS arg; | ||
410 | dSP; | ||
411 | static BN_CTX *ctx=NULL; | ||
412 | PPCODE: | ||
413 | pr_name("p5_BN_is_prime"); | ||
414 | if ((items < 1) || (items > 4)) | ||
415 | croak("Usage: OpenSSL::BN::is_prime(a[,ncheck][,callback][,callback_arg]"); | ||
416 | if (ctx == NULL) ctx=BN_CTX_new(); | ||
417 | if (items >= 2) nchecks=(int)SvIV(ST(1)); | ||
418 | if (items >= 3) callback=ST(2); | ||
419 | if (items >= 4) cb_arg=ST(3); | ||
420 | arg.arg=cb_arg; | ||
421 | if (callback == NULL) | ||
422 | ret=BN_is_prime(p,nchecks,NULL,ctx,NULL); | ||
423 | else | ||
424 | { | ||
425 | arg.cb=callback; | ||
426 | arg.arg=cb_arg; | ||
427 | ret=BN_is_prime(p,nchecks,generate_prime_callback, | ||
428 | ctx,(char *)&arg); | ||
429 | } | ||
430 | SPAGAIN; | ||
431 | sp-=items; /* a bit evil */ | ||
432 | PUSHs(sv_2mortal(newSViv(ret))); | ||
433 | |||
434 | int | ||
435 | p5_BN_num_bits(a) | ||
436 | BIGNUM *a; | ||
437 | CODE: | ||
438 | pr_name("p5_BN_num_bits"); | ||
439 | RETVAL=BN_num_bits(a); | ||
440 | OUTPUT: | ||
441 | RETVAL | ||
442 | |||
443 | int | ||
444 | p5_BN_cmp(a,b) | ||
445 | BIGNUM *a; | ||
446 | BIGNUM *b; | ||
447 | CODE: | ||
448 | pr_name("p5_BN_cmp"); | ||
449 | RETVAL=BN_cmp(a,b); | ||
450 | OUTPUT: | ||
451 | RETVAL | ||
452 | |||
453 | int | ||
454 | p5_BN_ucmp(a,b) | ||
455 | BIGNUM *a; | ||
456 | BIGNUM *b; | ||
457 | CODE: | ||
458 | pr_name("p5_BN_ucmp"); | ||
459 | RETVAL=BN_ucmp(a,b); | ||
460 | OUTPUT: | ||
461 | RETVAL | ||
462 | |||
463 | int | ||
464 | p5_BN_is_bit_set(a,b) | ||
465 | BIGNUM *a; | ||
466 | int b; | ||
467 | CODE: | ||
468 | pr_name("p5_BN_is_bit_set"); | ||
469 | RETVAL=BN_is_bit_set(a,b); | ||
470 | OUTPUT: | ||
471 | RETVAL | ||
472 | |||
473 | void | ||
474 | p5_BN_set_bit(a,b) | ||
475 | BIGNUM *a; | ||
476 | int b; | ||
477 | PREINIT: | ||
478 | BIGNUM *ret; | ||
479 | PPCODE: | ||
480 | pr_name("p5_BN_set_bit"); | ||
481 | EXTEND(sp,1); | ||
482 | PUSHs(sv_newmortal()); | ||
483 | ret=BN_dup(a); | ||
484 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
485 | BN_set_bit(ret,b); | ||
486 | |||
487 | void | ||
488 | p5_BN_clear_bit(a,b) | ||
489 | BIGNUM *a; | ||
490 | int b; | ||
491 | PREINIT: | ||
492 | BIGNUM *ret; | ||
493 | PPCODE: | ||
494 | pr_name("p5_BN_clear_bit"); | ||
495 | EXTEND(sp,1); | ||
496 | PUSHs(sv_newmortal()); | ||
497 | ret=BN_dup(a); | ||
498 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
499 | BN_clear_bit(ret,b); | ||
500 | |||
501 | void | ||
502 | p5_BN_lshift(a,b) | ||
503 | BIGNUM *a; | ||
504 | int b; | ||
505 | PREINIT: | ||
506 | BIGNUM *ret; | ||
507 | PPCODE: | ||
508 | pr_name("p5_BN_lshift"); | ||
509 | EXTEND(sp,1); | ||
510 | PUSHs(sv_newmortal()); | ||
511 | ret=BN_new(); | ||
512 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
513 | if (b == 1) | ||
514 | BN_lshift1(ret,a); | ||
515 | else | ||
516 | BN_lshift(ret,a,b); | ||
517 | |||
518 | void | ||
519 | p5_BN_rshift(a,b) | ||
520 | BIGNUM *a; | ||
521 | int b; | ||
522 | PREINIT: | ||
523 | BIGNUM *ret; | ||
524 | PPCODE: | ||
525 | pr_name("p5_BN_rshift"); | ||
526 | EXTEND(sp,1); | ||
527 | PUSHs(sv_newmortal()); | ||
528 | ret=BN_new(); | ||
529 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
530 | if (b == 1) | ||
531 | BN_rshift1(ret,a); | ||
532 | else | ||
533 | BN_rshift(ret,a,b); | ||
534 | |||
535 | void | ||
536 | p5_BN_mask_bits(a,b) | ||
537 | BIGNUM *a; | ||
538 | int b; | ||
539 | PREINIT: | ||
540 | BIGNUM *ret; | ||
541 | PPCODE: | ||
542 | pr_name("p5_BN_mask_bits"); | ||
543 | EXTEND(sp,1); | ||
544 | PUSHs(sv_newmortal()); | ||
545 | ret=BN_dup(a); | ||
546 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
547 | BN_mask_bits(ret,b); | ||
548 | |||
549 | void | ||
550 | p5_BN_clear(a) | ||
551 | BIGNUM *a; | ||
552 | PPCODE: | ||
553 | pr_name("p5_BN_clear"); | ||
554 | BN_clear(a); | ||
555 | |||
556 | void | ||
557 | p5_BN_gcd(a,b) | ||
558 | BIGNUM *a; | ||
559 | BIGNUM *b; | ||
560 | PREINIT: | ||
561 | static BN_CTX *ctx=NULL; | ||
562 | BIGNUM *ret; | ||
563 | PPCODE: | ||
564 | pr_name("p5_BN_gcd"); | ||
565 | if (ctx == NULL) ctx=BN_CTX_new(); | ||
566 | EXTEND(sp,1); | ||
567 | PUSHs(sv_newmortal()); | ||
568 | ret=BN_new(); | ||
569 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
570 | BN_gcd(ret,a,b,ctx); | ||
571 | |||
572 | void | ||
573 | p5_BN_mod_inverse(a,mod) | ||
574 | BIGNUM *a; | ||
575 | BIGNUM *mod; | ||
576 | PREINIT: | ||
577 | static BN_CTX *ctx=NULL; | ||
578 | BIGNUM *ret; | ||
579 | PPCODE: | ||
580 | pr_name("p5_BN_mod_inverse"); | ||
581 | if (ctx == NULL) ctx=BN_CTX_new(); | ||
582 | ret=BN_mod_inverse(ret,a,mod,ctx); | ||
583 | EXTEND(sp,1); | ||
584 | PUSHs(sv_newmortal()); | ||
585 | sv_setref_pv(ST(0), "OpenSSL::BN", (void*)ret); | ||
586 | |||
587 | void | ||
588 | p5_BN_DESTROY(bn) | ||
589 | BIGNUM *bn | ||
590 | CODE: | ||
591 | pr_name("p5_BN_DESTROY"); | ||
592 | BN_free(bn); | ||
593 | |||
diff --git a/src/lib/libssl/src/perl/openssl_cipher.xs b/src/lib/libssl/src/perl/openssl_cipher.xs deleted file mode 100644 index 580620ffbc..0000000000 --- a/src/lib/libssl/src/perl/openssl_cipher.xs +++ /dev/null | |||
@@ -1,154 +0,0 @@ | |||
1 | |||
2 | #include "openssl.h" | ||
3 | |||
4 | int boot_cipher() | ||
5 | { | ||
6 | SSLeay_add_all_ciphers(); | ||
7 | return(1); | ||
8 | } | ||
9 | |||
10 | MODULE = OpenSSL::Cipher PACKAGE = OpenSSL::Cipher PREFIX = p5_EVP_C_ | ||
11 | |||
12 | PROTOTYPES: ENABLE | ||
13 | VERSIONCHECK: DISABLE | ||
14 | |||
15 | void | ||
16 | p5_EVP_C_new(...) | ||
17 | PREINIT: | ||
18 | EVP_CIPHER_CTX *ctx; | ||
19 | const EVP_CIPHER *c; | ||
20 | char *name; | ||
21 | PPCODE: | ||
22 | if ((items == 1) && SvPOK(ST(0))) | ||
23 | name=SvPV_nolen(ST(0)); | ||
24 | else if ((items == 2) && SvPOK(ST(1))) | ||
25 | name=SvPV_nolen(ST(1)); | ||
26 | else | ||
27 | croak("Usage: OpenSSL::Cipher::new(type)"); | ||
28 | PUSHs(sv_newmortal()); | ||
29 | c=EVP_get_cipherbyname(name); | ||
30 | if (c != NULL) | ||
31 | { | ||
32 | ctx=malloc(sizeof(EVP_CIPHER_CTX)); | ||
33 | EVP_EncryptInit(ctx,c,NULL,NULL); | ||
34 | sv_setref_pv(ST(0), "OpenSSL::Cipher", (void*)ctx); | ||
35 | } | ||
36 | |||
37 | datum | ||
38 | p5_EVP_C_name(ctx) | ||
39 | EVP_CIPHER_CTX *ctx | ||
40 | CODE: | ||
41 | RETVAL.dptr=OBJ_nid2ln(EVP_CIPHER_CTX_nid(ctx)); | ||
42 | RETVAL.dsize=strlen(RETVAL.dptr); | ||
43 | OUTPUT: | ||
44 | RETVAL | ||
45 | |||
46 | int | ||
47 | p5_EVP_C_key_length(ctx) | ||
48 | EVP_CIPHER_CTX *ctx | ||
49 | CODE: | ||
50 | RETVAL=EVP_CIPHER_CTX_key_length(ctx); | ||
51 | OUTPUT: | ||
52 | RETVAL | ||
53 | |||
54 | int | ||
55 | p5_EVP_C_iv_length(ctx) | ||
56 | EVP_CIPHER_CTX *ctx | ||
57 | CODE: | ||
58 | RETVAL=EVP_CIPHER_CTX_iv_length(ctx); | ||
59 | OUTPUT: | ||
60 | RETVAL | ||
61 | |||
62 | int | ||
63 | p5_EVP_C_block_size(ctx) | ||
64 | EVP_CIPHER_CTX *ctx | ||
65 | CODE: | ||
66 | RETVAL=EVP_CIPHER_CTX_block_size(ctx); | ||
67 | OUTPUT: | ||
68 | RETVAL | ||
69 | |||
70 | void | ||
71 | p5_EVP_C_init(ctx,key,iv,enc) | ||
72 | EVP_CIPHER_CTX *ctx | ||
73 | datum key | ||
74 | datum iv | ||
75 | int enc | ||
76 | PREINIT: | ||
77 | char loc_iv[EVP_MAX_IV_LENGTH]; | ||
78 | char loc_key[EVP_MAX_KEY_LENGTH]; | ||
79 | char *ip=loc_iv,*kp=loc_key; | ||
80 | int i; | ||
81 | memset(loc_iv,0,EVP_MAX_IV_LENGTH); | ||
82 | memset(loc_key,0,EVP_MAX_KEY_LENGTH); | ||
83 | CODE: | ||
84 | i=key.dsize; | ||
85 | if (key.dsize > EVP_CIPHER_CTX_key_length(ctx)) | ||
86 | i=EVP_CIPHER_CTX_key_length(ctx); | ||
87 | if (i > 0) | ||
88 | { | ||
89 | memset(kp,0,EVP_MAX_KEY_LENGTH); | ||
90 | memcpy(kp,key.dptr,i); | ||
91 | } | ||
92 | else | ||
93 | kp=NULL; | ||
94 | i=iv.dsize; | ||
95 | if (iv.dsize > EVP_CIPHER_CTX_iv_length(ctx)) | ||
96 | i=EVP_CIPHER_CTX_iv_length(ctx); | ||
97 | if (i > 0) | ||
98 | { | ||
99 | memcpy(ip,iv.dptr,i); | ||
100 | memset(ip,0,EVP_MAX_IV_LENGTH); | ||
101 | } | ||
102 | else | ||
103 | ip=NULL; | ||
104 | EVP_CipherInit(ctx,EVP_CIPHER_CTX_cipher(ctx),kp,ip,enc); | ||
105 | memset(loc_key,0,sizeof(loc_key)); | ||
106 | memset(loc_iv,0,sizeof(loc_iv)); | ||
107 | |||
108 | SV * | ||
109 | p5_EVP_C_cipher(ctx,in) | ||
110 | EVP_CIPHER_CTX *ctx; | ||
111 | datum in; | ||
112 | CODE: | ||
113 | RETVAL=newSVpv("",0); | ||
114 | SvGROW(RETVAL,in.dsize+EVP_CIPHER_CTX_block_size(ctx)+1); | ||
115 | EVP_Cipher(ctx,SvPV_nolen(RETVAL),in.dptr,in.dsize); | ||
116 | SvCUR_set(RETVAL,in.dsize); | ||
117 | OUTPUT: | ||
118 | RETVAL | ||
119 | |||
120 | SV * | ||
121 | p5_EVP_C_update(ctx, in) | ||
122 | EVP_CIPHER_CTX *ctx | ||
123 | datum in | ||
124 | PREINIT: | ||
125 | int i; | ||
126 | CODE: | ||
127 | RETVAL=newSVpv("",0); | ||
128 | SvGROW(RETVAL,in.dsize+EVP_CIPHER_CTX_block_size(ctx)+1); | ||
129 | EVP_CipherUpdate(ctx,SvPV_nolen(RETVAL),&i,in.dptr,in.dsize); | ||
130 | SvCUR_set(RETVAL,i); | ||
131 | OUTPUT: | ||
132 | RETVAL | ||
133 | |||
134 | SV * | ||
135 | p5_EVP_C_final(ctx) | ||
136 | EVP_CIPHER_CTX *ctx | ||
137 | PREINIT: | ||
138 | int i; | ||
139 | CODE: | ||
140 | RETVAL=newSVpv("",0); | ||
141 | SvGROW(RETVAL,EVP_CIPHER_CTX_block_size(ctx)+1); | ||
142 | if (!EVP_CipherFinal(ctx,SvPV_nolen(RETVAL),&i)) | ||
143 | sv_setpv(RETVAL,"BAD DECODE"); | ||
144 | else | ||
145 | SvCUR_set(RETVAL,i); | ||
146 | OUTPUT: | ||
147 | RETVAL | ||
148 | |||
149 | void | ||
150 | p5_EVP_C_DESTROY(ctx) | ||
151 | EVP_CIPHER_CTX *ctx | ||
152 | CODE: | ||
153 | free((char *)ctx); | ||
154 | |||
diff --git a/src/lib/libssl/src/perl/openssl_digest.xs b/src/lib/libssl/src/perl/openssl_digest.xs deleted file mode 100644 index 4f2f8938cf..0000000000 --- a/src/lib/libssl/src/perl/openssl_digest.xs +++ /dev/null | |||
@@ -1,85 +0,0 @@ | |||
1 | |||
2 | #include "openssl.h" | ||
3 | |||
4 | int boot_digest() | ||
5 | { | ||
6 | SSLeay_add_all_digests(); | ||
7 | return(1); | ||
8 | } | ||
9 | |||
10 | MODULE = OpenSSL::MD PACKAGE = OpenSSL::MD PREFIX = p5_EVP_MD_ | ||
11 | |||
12 | PROTOTYPES: ENABLE | ||
13 | VERSIONCHECK: DISABLE | ||
14 | |||
15 | # OpenSSL::MD::new(name) name= md2, md5, sha, sha1, or mdc2 | ||
16 | # md->name() - returns the name | ||
17 | # md->init() - reinitalises the digest | ||
18 | # md->update(data) - adds more data to digest | ||
19 | # digest=md->final() - returns digest | ||
20 | # | ||
21 | |||
22 | void | ||
23 | p5_EVP_MD_new(...) | ||
24 | PREINIT: | ||
25 | EVP_MD_CTX *ctx; | ||
26 | const EVP_MD *md; | ||
27 | char *name; | ||
28 | PPCODE: | ||
29 | if ((items == 1) && SvPOK(ST(0))) | ||
30 | name=SvPV_nolen(ST(0)); | ||
31 | else if ((items == 2) && SvPOK(ST(1))) | ||
32 | name=SvPV_nolen(ST(1)); | ||
33 | else | ||
34 | croak("Usage: OpenSSL::MD::new(type)"); | ||
35 | PUSHs(sv_newmortal()); | ||
36 | md=EVP_get_digestbyname(name); | ||
37 | if (md != NULL) | ||
38 | { | ||
39 | ctx=malloc(sizeof(EVP_MD_CTX)); | ||
40 | EVP_DigestInit(ctx,md); | ||
41 | sv_setref_pv(ST(0), "OpenSSL::MD", (void*)ctx); | ||
42 | } | ||
43 | |||
44 | datum | ||
45 | p5_EVP_MD_name(ctx) | ||
46 | EVP_MD_CTX *ctx | ||
47 | CODE: | ||
48 | RETVAL.dptr=OBJ_nid2ln(EVP_MD_CTX_type(ctx)); | ||
49 | RETVAL.dsize=strlen(RETVAL.dptr); | ||
50 | |||
51 | OUTPUT: | ||
52 | RETVAL | ||
53 | |||
54 | void | ||
55 | p5_EVP_MD_init(ctx) | ||
56 | EVP_MD_CTX *ctx | ||
57 | CODE: | ||
58 | EVP_DigestInit(ctx,EVP_MD_CTX_type(ctx)); | ||
59 | |||
60 | void | ||
61 | p5_EVP_MD_update(ctx, in) | ||
62 | EVP_MD_CTX *ctx | ||
63 | datum in | ||
64 | CODE: | ||
65 | EVP_DigestUpdate(ctx,in.dptr,in.dsize); | ||
66 | |||
67 | datum | ||
68 | p5_EVP_MD_final(ctx) | ||
69 | EVP_MD_CTX *ctx | ||
70 | PREINIT: | ||
71 | char md[EVP_MAX_MD_SIZE]; | ||
72 | int len; | ||
73 | CODE: | ||
74 | EVP_DigestFinal(ctx,md,&len); | ||
75 | RETVAL.dptr=md; | ||
76 | RETVAL.dsize=len; | ||
77 | OUTPUT: | ||
78 | RETVAL | ||
79 | |||
80 | void | ||
81 | p5_EVP_MD_DESTROY(ctx) | ||
82 | EVP_MD_CTX *ctx | ||
83 | CODE: | ||
84 | free((char *)ctx); | ||
85 | |||
diff --git a/src/lib/libssl/src/perl/openssl_err.xs b/src/lib/libssl/src/perl/openssl_err.xs deleted file mode 100644 index 3a6f698f28..0000000000 --- a/src/lib/libssl/src/perl/openssl_err.xs +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | |||
2 | #include "openssl.h" | ||
3 | |||
4 | int boot_err() | ||
5 | { | ||
6 | SSL_load_error_strings(); | ||
7 | return(1); | ||
8 | } | ||
9 | |||
10 | MODULE = OpenSSL::ERR PACKAGE = OpenSSL::ERR PREFIX = p5_ERR_ | ||
11 | |||
12 | PROTOTYPES: ENABLE | ||
13 | VERSIONCHECK: DISABLE | ||
14 | |||
15 | # md->error() - returns the last error in text or numeric context | ||
16 | |||
17 | void | ||
18 | p5_ERR_get_error(...) | ||
19 | PPCODE: | ||
20 | char buf[512]; | ||
21 | unsigned long l; | ||
22 | |||
23 | pr_name("p5_ERR_get_code"); | ||
24 | EXTEND(sp,1); | ||
25 | PUSHs(sv_newmortal()); | ||
26 | l=ERR_get_error(); | ||
27 | ERR_error_string(l,buf); | ||
28 | sv_setiv(ST(0),l); | ||
29 | sv_setpv(ST(0),buf); | ||
30 | SvIOK_on(ST(0)); | ||
31 | |||
32 | void | ||
33 | p5_ERR_peek_error(...) | ||
34 | PPCODE: | ||
35 | char buf[512]; | ||
36 | unsigned long l; | ||
37 | |||
38 | pr_name("p5_ERR_get_code"); | ||
39 | EXTEND(sp,1); | ||
40 | PUSHs(sv_newmortal()); | ||
41 | l=ERR_peek_error(); | ||
42 | ERR_error_string(l,buf); | ||
43 | sv_setiv(ST(0),l); | ||
44 | sv_setpv(ST(0),buf); | ||
45 | SvIOK_on(ST(0)); | ||
46 | |||
47 | |||
diff --git a/src/lib/libssl/src/perl/openssl_ssl.xs b/src/lib/libssl/src/perl/openssl_ssl.xs deleted file mode 100644 index 146c1ace8e..0000000000 --- a/src/lib/libssl/src/perl/openssl_ssl.xs +++ /dev/null | |||
@@ -1,483 +0,0 @@ | |||
1 | |||
2 | #include "openssl.h" | ||
3 | |||
4 | static int p5_ssl_ex_ssl_ptr=0; | ||
5 | static int p5_ssl_ex_ssl_info_callback=0; | ||
6 | static int p5_ssl_ex_ssl_ctx_ptr=0; | ||
7 | static int p5_ssl_ctx_ex_ssl_info_callback=0; | ||
8 | |||
9 | typedef struct ssl_ic_args_st { | ||
10 | SV *cb; | ||
11 | SV *arg; | ||
12 | } SSL_IC_ARGS; | ||
13 | |||
14 | static void p5_ssl_info_callback(ssl,mode,ret) | ||
15 | SSL *ssl; | ||
16 | int mode; | ||
17 | int ret; | ||
18 | { | ||
19 | int i; | ||
20 | SV *me,*cb; | ||
21 | |||
22 | me=(SV *)SSL_get_ex_data(ssl,p5_ssl_ex_ssl_ptr); | ||
23 | cb=(SV *)SSL_get_ex_data(ssl,p5_ssl_ex_ssl_info_callback); | ||
24 | if (cb == NULL) | ||
25 | cb=(SV *)SSL_CTX_get_ex_data( | ||
26 | SSL_get_SSL_CTX(ssl),p5_ssl_ctx_ex_ssl_info_callback); | ||
27 | if (cb != NULL) | ||
28 | { | ||
29 | dSP; | ||
30 | |||
31 | PUSHMARK(sp); | ||
32 | XPUSHs(me); | ||
33 | XPUSHs(sv_2mortal(newSViv(mode))); | ||
34 | XPUSHs(sv_2mortal(newSViv(ret))); | ||
35 | PUTBACK; | ||
36 | |||
37 | i=perl_call_sv(cb,G_DISCARD); | ||
38 | } | ||
39 | else | ||
40 | { | ||
41 | croak("Internal error in SSL p5_ssl_info_callback"); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | int boot_ssl() | ||
46 | { | ||
47 | p5_ssl_ex_ssl_ptr= | ||
48 | SSL_get_ex_new_index(0,"OpenSSL::SSL",ex_new,NULL,ex_cleanup); | ||
49 | p5_ssl_ex_ssl_info_callback= | ||
50 | SSL_get_ex_new_index(0,"ssl_info_callback",NULL,NULL, | ||
51 | ex_cleanup); | ||
52 | p5_ssl_ex_ssl_ctx_ptr= | ||
53 | SSL_get_ex_new_index(0,"ssl_ctx_ptr",NULL,NULL, | ||
54 | ex_cleanup); | ||
55 | p5_ssl_ctx_ex_ssl_info_callback= | ||
56 | SSL_CTX_get_ex_new_index(0,"ssl_ctx_info_callback",NULL,NULL, | ||
57 | ex_cleanup); | ||
58 | return(1); | ||
59 | } | ||
60 | |||
61 | MODULE = OpenSSL::SSL PACKAGE = OpenSSL::SSL::CTX PREFIX = p5_SSL_CTX_ | ||
62 | |||
63 | PROTOTYPES: ENABLE | ||
64 | VERSIONCHECK: DISABLE | ||
65 | |||
66 | void | ||
67 | p5_SSL_CTX_new(...) | ||
68 | PREINIT: | ||
69 | SSL_METHOD *meth; | ||
70 | SSL_CTX *ctx; | ||
71 | char *method; | ||
72 | PPCODE: | ||
73 | pr_name("p5_SSL_CTX_new"); | ||
74 | if ((items == 1) && SvPOK(ST(0))) | ||
75 | method=SvPV_nolen(ST(0)); | ||
76 | else if ((items == 2) && SvPOK(ST(1))) | ||
77 | method=SvPV_nolen(ST(1)); | ||
78 | else | ||
79 | croak("Usage: OpenSSL::SSL::CTX::new(type)"); | ||
80 | |||
81 | if (strcmp(method,"SSLv3") == 0) | ||
82 | meth=SSLv3_method(); | ||
83 | else if (strcmp(method,"SSLv3_client") == 0) | ||
84 | meth=SSLv3_client_method(); | ||
85 | else if (strcmp(method,"SSLv3_server") == 0) | ||
86 | meth=SSLv3_server_method(); | ||
87 | else if (strcmp(method,"SSLv23") == 0) | ||
88 | meth=SSLv23_method(); | ||
89 | else if (strcmp(method,"SSLv23_client") == 0) | ||
90 | meth=SSLv23_client_method(); | ||
91 | else if (strcmp(method,"SSLv23_server") == 0) | ||
92 | meth=SSLv23_server_method(); | ||
93 | else if (strcmp(method,"SSLv2") == 0) | ||
94 | meth=SSLv2_method(); | ||
95 | else if (strcmp(method,"SSLv2_client") == 0) | ||
96 | meth=SSLv2_client_method(); | ||
97 | else if (strcmp(method,"SSLv2_server") == 0) | ||
98 | meth=SSLv2_server_method(); | ||
99 | else if (strcmp(method,"TLSv1") == 0) | ||
100 | meth=TLSv1_method(); | ||
101 | else if (strcmp(method,"TLSv1_client") == 0) | ||
102 | meth=TLSv1_client_method(); | ||
103 | else if (strcmp(method,"TLSv1_server") == 0) | ||
104 | meth=TLSv1_server_method(); | ||
105 | else | ||
106 | { | ||
107 | croak("Not a valid SSL method name, should be 'SSLv[23] [client|server]'"); | ||
108 | } | ||
109 | EXTEND(sp,1); | ||
110 | PUSHs(sv_newmortal()); | ||
111 | ctx=SSL_CTX_new(meth); | ||
112 | sv_setref_pv(ST(0), "OpenSSL::SSL::CTX", (void*)ctx); | ||
113 | |||
114 | int | ||
115 | p5_SSL_CTX_use_PrivateKey_file(ctx,file,...) | ||
116 | SSL_CTX *ctx; | ||
117 | char *file; | ||
118 | PREINIT: | ||
119 | int i=SSL_FILETYPE_PEM; | ||
120 | char *ptr; | ||
121 | CODE: | ||
122 | pr_name("p5_SSL_CTX_use_PrivateKey_file"); | ||
123 | if (items > 3) | ||
124 | croak("OpenSSL::SSL::CTX::use_PrivateKey_file(ssl_ctx,file[,type])"); | ||
125 | if (items == 3) | ||
126 | { | ||
127 | ptr=SvPV_nolen(ST(2)); | ||
128 | if (strcmp(ptr,"der") == 0) | ||
129 | i=SSL_FILETYPE_ASN1; | ||
130 | else | ||
131 | i=SSL_FILETYPE_PEM; | ||
132 | } | ||
133 | RETVAL=SSL_CTX_use_RSAPrivateKey_file(ctx,file,i); | ||
134 | OUTPUT: | ||
135 | RETVAL | ||
136 | |||
137 | int | ||
138 | p5_SSL_CTX_set_options(ctx,...) | ||
139 | SSL_CTX *ctx; | ||
140 | PREINIT: | ||
141 | int i; | ||
142 | char *ptr; | ||
143 | SV *sv; | ||
144 | CODE: | ||
145 | pr_name("p5_SSL_CTX_set_options"); | ||
146 | |||
147 | for (i=1; i<items; i++) | ||
148 | { | ||
149 | if (!SvPOK(ST(i))) | ||
150 | croak("Usage: OpenSSL::SSL_CTX::set_options(ssl_ctx[,option,value]+)"); | ||
151 | ptr=SvPV_nolen(ST(i)); | ||
152 | if (strcmp(ptr,"-info_callback") == 0) | ||
153 | { | ||
154 | SSL_CTX_set_info_callback(ctx, | ||
155 | p5_ssl_info_callback); | ||
156 | sv=sv_mortalcopy(ST(i+1)); | ||
157 | SvREFCNT_inc(sv); | ||
158 | SSL_CTX_set_ex_data(ctx, | ||
159 | p5_ssl_ctx_ex_ssl_info_callback, | ||
160 | (char *)sv); | ||
161 | i++; | ||
162 | } | ||
163 | else | ||
164 | { | ||
165 | croak("OpenSSL::SSL_CTX::set_options(): unknown option"); | ||
166 | } | ||
167 | } | ||
168 | |||
169 | void | ||
170 | p5_SSL_CTX_DESTROY(ctx) | ||
171 | SSL_CTX *ctx | ||
172 | PREINIT: | ||
173 | SV *sv; | ||
174 | PPCODE: | ||
175 | pr_name_d("p5_SSL_CTX_DESTROY",ctx->references); | ||
176 | SSL_CTX_free(ctx); | ||
177 | |||
178 | MODULE = OpenSSL::SSL PACKAGE = OpenSSL::SSL PREFIX = p5_SSL_ | ||
179 | |||
180 | void | ||
181 | p5_SSL_new(...) | ||
182 | PREINIT: | ||
183 | SV *sv_ctx; | ||
184 | SSL_CTX *ctx; | ||
185 | SSL *ssl; | ||
186 | SV *arg; | ||
187 | PPCODE: | ||
188 | pr_name("p5_SSL_new"); | ||
189 | if ((items != 1) && (items != 2)) | ||
190 | croak("Usage: OpenSSL::SSL::new(ssl_ctx)"); | ||
191 | if (sv_derived_from(ST(items-1),"OpenSSL::SSL::CTX")) | ||
192 | { | ||
193 | IV tmp = SvIV((SV*)SvRV(ST(items-1))); | ||
194 | ctx=(SSL_CTX *)tmp; | ||
195 | sv_ctx=ST(items-1); | ||
196 | } | ||
197 | else | ||
198 | croak("ssl_ctx is not of type OpenSSL::SSL::CTX"); | ||
199 | |||
200 | EXTEND(sp,1); | ||
201 | PUSHs(sv_newmortal()); | ||
202 | ssl=SSL_new(ctx); | ||
203 | sv_setref_pv(ST(0), "OpenSSL::SSL", (void*)ssl); | ||
204 | |||
205 | /* Now this is being a little hairy, we keep a pointer to | ||
206 | * our perl reference. We need to do a different one | ||
207 | * to the one we return because it will have its reference | ||
208 | * count dropped to 0 upon return and if we up its reference | ||
209 | * count, it will never be DESTROYED */ | ||
210 | arg=newSVsv(ST(0)); | ||
211 | SSL_set_ex_data(ssl,p5_ssl_ex_ssl_ptr,(char *)arg); | ||
212 | SvREFCNT_inc(sv_ctx); | ||
213 | SSL_set_ex_data(ssl,p5_ssl_ex_ssl_ctx_ptr,(char *)sv_ctx); | ||
214 | |||
215 | int | ||
216 | p5_SSL_connect(ssl) | ||
217 | SSL *ssl; | ||
218 | CODE: | ||
219 | RETVAL=SSL_connect(ssl); | ||
220 | OUTPUT: | ||
221 | RETVAL | ||
222 | |||
223 | int | ||
224 | p5_SSL_accept(ssl) | ||
225 | SSL *ssl; | ||
226 | CODE: | ||
227 | RETVAL=SSL_connect(ssl); | ||
228 | OUTPUT: | ||
229 | RETVAL | ||
230 | |||
231 | int | ||
232 | p5_SSL_sysread(ssl,in,num, ...) | ||
233 | SSL *ssl; | ||
234 | SV *in; | ||
235 | int num; | ||
236 | PREINIT: | ||
237 | int i,n,olen; | ||
238 | int offset; | ||
239 | char *p; | ||
240 | CODE: | ||
241 | offset=0; | ||
242 | if (!SvPOK(in)) | ||
243 | sv_setpvn(in,"",0); | ||
244 | SvPV(in,olen); | ||
245 | if (items > 3) | ||
246 | { | ||
247 | offset=SvIV(ST(3)); | ||
248 | if (offset < 0) | ||
249 | { | ||
250 | if (-offset > olen) | ||
251 | croak("Offset outside string"); | ||
252 | offset+=olen; | ||
253 | } | ||
254 | } | ||
255 | if ((num+offset) > olen) | ||
256 | { | ||
257 | SvGROW(in,num+offset+1); | ||
258 | p=SvPV(in,i); | ||
259 | memset(&(p[olen]),0,(num+offset)-olen+1); | ||
260 | } | ||
261 | p=SvPV(in,n); | ||
262 | |||
263 | i=SSL_read(ssl,p+offset,num); | ||
264 | RETVAL=i; | ||
265 | if (i <= 0) i=0; | ||
266 | SvCUR_set(in,offset+i); | ||
267 | OUTPUT: | ||
268 | RETVAL | ||
269 | |||
270 | int | ||
271 | p5_SSL_syswrite(ssl,in, ...) | ||
272 | SSL *ssl; | ||
273 | SV *in; | ||
274 | PREINIT: | ||
275 | char *ptr; | ||
276 | int len,in_len; | ||
277 | int offset=0; | ||
278 | int n; | ||
279 | CODE: | ||
280 | ptr=SvPV(in,in_len); | ||
281 | if (items > 2) | ||
282 | { | ||
283 | len=SvOK(ST(2))?SvIV(ST(2)):in_len; | ||
284 | if (items > 3) | ||
285 | { | ||
286 | offset=SvIV(ST(3)); | ||
287 | if (offset < 0) | ||
288 | { | ||
289 | if (-offset > in_len) | ||
290 | croak("Offset outside string"); | ||
291 | offset+=in_len; | ||
292 | } | ||
293 | else if ((offset >= in_len) && (in_len > 0)) | ||
294 | croak("Offset outside string"); | ||
295 | } | ||
296 | if (len >= (in_len-offset)) | ||
297 | len=in_len-offset; | ||
298 | } | ||
299 | else | ||
300 | len=in_len; | ||
301 | |||
302 | RETVAL=SSL_write(ssl,ptr+offset,len); | ||
303 | OUTPUT: | ||
304 | RETVAL | ||
305 | |||
306 | void | ||
307 | p5_SSL_set_bio(ssl,bio) | ||
308 | SSL *ssl; | ||
309 | BIO *bio; | ||
310 | CODE: | ||
311 | bio->references++; | ||
312 | SSL_set_bio(ssl,bio,bio); | ||
313 | |||
314 | int | ||
315 | p5_SSL_set_options(ssl,...) | ||
316 | SSL *ssl; | ||
317 | PREINIT: | ||
318 | int i; | ||
319 | char *ptr; | ||
320 | SV *sv; | ||
321 | CODE: | ||
322 | pr_name("p5_SSL_set_options"); | ||
323 | |||
324 | for (i=1; i<items; i++) | ||
325 | { | ||
326 | if (!SvPOK(ST(i))) | ||
327 | croak("Usage: OpenSSL::SSL::set_options(ssl[,option,value]+)"); | ||
328 | ptr=SvPV_nolen(ST(i)); | ||
329 | if (strcmp(ptr,"-info_callback") == 0) | ||
330 | { | ||
331 | SSL_set_info_callback(ssl, | ||
332 | p5_ssl_info_callback); | ||
333 | sv=sv_mortalcopy(ST(i+1)); | ||
334 | SvREFCNT_inc(sv); | ||
335 | SSL_set_ex_data(ssl, | ||
336 | p5_ssl_ex_ssl_info_callback,(char *)sv); | ||
337 | i++; | ||
338 | } | ||
339 | else if (strcmp(ptr,"-connect_state") == 0) | ||
340 | { | ||
341 | SSL_set_connect_state(ssl); | ||
342 | } | ||
343 | else if (strcmp(ptr,"-accept_state") == 0) | ||
344 | { | ||
345 | SSL_set_accept_state(ssl); | ||
346 | } | ||
347 | else | ||
348 | { | ||
349 | croak("OpenSSL::SSL::set_options(): unknown option"); | ||
350 | } | ||
351 | } | ||
352 | |||
353 | void | ||
354 | p5_SSL_state(ssl) | ||
355 | SSL *ssl; | ||
356 | PREINIT: | ||
357 | int state; | ||
358 | PPCODE: | ||
359 | pr_name("p5_SSL_state"); | ||
360 | EXTEND(sp,1); | ||
361 | PUSHs(sv_newmortal()); | ||
362 | state=SSL_state(ssl); | ||
363 | sv_setpv(ST(0),SSL_state_string_long(ssl)); | ||
364 | sv_setiv(ST(0),state); | ||
365 | SvPOK_on(ST(0)); | ||
366 | |||
367 | void | ||
368 | p5_SSL_DESTROY(ssl) | ||
369 | SSL *ssl; | ||
370 | CODE: | ||
371 | pr_name_dd("p5_SSL_DESTROY",ssl->references,ssl->ctx->references); | ||
372 | #ifdef DEBUG | ||
373 | fprintf(stderr,"SSL_DESTROY %d\n",ssl->references); | ||
374 | #endif | ||
375 | SSL_free(ssl); | ||
376 | |||
377 | int | ||
378 | p5_SSL_references(ssl) | ||
379 | SSL *ssl; | ||
380 | CODE: | ||
381 | RETVAL=ssl->references; | ||
382 | OUTPUT: | ||
383 | RETVAL | ||
384 | |||
385 | int | ||
386 | p5_SSL_do_handshake(ssl) | ||
387 | SSL *ssl; | ||
388 | CODE: | ||
389 | RETVAL=SSL_do_handshake(ssl); | ||
390 | OUTPUT: | ||
391 | RETVAL | ||
392 | |||
393 | int | ||
394 | p5_SSL_renegotiate(ssl) | ||
395 | SSL *ssl; | ||
396 | CODE: | ||
397 | RETVAL=SSL_renegotiate(ssl); | ||
398 | OUTPUT: | ||
399 | RETVAL | ||
400 | |||
401 | int | ||
402 | p5_SSL_shutdown(ssl) | ||
403 | SSL *ssl; | ||
404 | CODE: | ||
405 | RETVAL=SSL_shutdown(ssl); | ||
406 | OUTPUT: | ||
407 | RETVAL | ||
408 | |||
409 | char * | ||
410 | p5_SSL_get_version(ssl) | ||
411 | SSL *ssl; | ||
412 | CODE: | ||
413 | RETVAL=SSL_get_version(ssl); | ||
414 | OUTPUT: | ||
415 | RETVAL | ||
416 | |||
417 | SSL_CIPHER * | ||
418 | p5_SSL_get_current_cipher(ssl) | ||
419 | SSL *ssl; | ||
420 | CODE: | ||
421 | RETVAL=SSL_get_current_cipher(ssl); | ||
422 | OUTPUT: | ||
423 | RETVAL | ||
424 | |||
425 | X509 * | ||
426 | p5_SSL_get_peer_certificate(ssl) | ||
427 | SSL *ssl | ||
428 | CODE: | ||
429 | RETVAL=SSL_get_peer_certificate(ssl); | ||
430 | OUTPUT: | ||
431 | RETVAL | ||
432 | |||
433 | MODULE = OpenSSL::SSL PACKAGE = OpenSSL::SSL::CIPHER PREFIX = p5_SSL_CIPHER_ | ||
434 | |||
435 | int | ||
436 | p5_SSL_CIPHER_get_bits(sc) | ||
437 | SSL_CIPHER *sc | ||
438 | PREINIT: | ||
439 | int i,ret; | ||
440 | PPCODE: | ||
441 | EXTEND(sp,2); | ||
442 | PUSHs(sv_newmortal()); | ||
443 | PUSHs(sv_newmortal()); | ||
444 | ret=SSL_CIPHER_get_bits(sc,&i); | ||
445 | sv_setiv(ST(0),(IV)ret); | ||
446 | sv_setiv(ST(1),(IV)i); | ||
447 | |||
448 | char * | ||
449 | p5_SSL_CIPHER_get_version(sc) | ||
450 | SSL_CIPHER *sc | ||
451 | CODE: | ||
452 | RETVAL=SSL_CIPHER_get_version(sc); | ||
453 | OUTPUT: | ||
454 | RETVAL | ||
455 | |||
456 | char * | ||
457 | p5_SSL_CIPHER_get_name(sc) | ||
458 | SSL_CIPHER *sc | ||
459 | CODE: | ||
460 | RETVAL=SSL_CIPHER_get_name(sc); | ||
461 | OUTPUT: | ||
462 | RETVAL | ||
463 | |||
464 | MODULE = OpenSSL::SSL PACKAGE = OpenSSL::BIO PREFIX = p5_BIO_ | ||
465 | |||
466 | void | ||
467 | p5_BIO_get_ssl(bio) | ||
468 | BIO *bio; | ||
469 | PREINIT: | ||
470 | SSL *ssl; | ||
471 | SV *ret; | ||
472 | int i; | ||
473 | PPCODE: | ||
474 | if ((i=BIO_get_ssl(bio,&ssl)) > 0) | ||
475 | { | ||
476 | ret=(SV *)SSL_get_ex_data(ssl,p5_ssl_ex_ssl_ptr); | ||
477 | ret=sv_mortalcopy(ret); | ||
478 | } | ||
479 | else | ||
480 | ret= &PL_sv_undef; | ||
481 | EXTEND(sp,1); | ||
482 | PUSHs(ret); | ||
483 | |||
diff --git a/src/lib/libssl/src/perl/openssl_x509.xs b/src/lib/libssl/src/perl/openssl_x509.xs deleted file mode 100644 index 008d959c64..0000000000 --- a/src/lib/libssl/src/perl/openssl_x509.xs +++ /dev/null | |||
@@ -1,75 +0,0 @@ | |||
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 | |||
diff --git a/src/lib/libssl/src/perl/typemap b/src/lib/libssl/src/perl/typemap deleted file mode 100644 index f67b598adf..0000000000 --- a/src/lib/libssl/src/perl/typemap +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | |||
2 | datum T_DATUM | ||
3 | EVP_MD_CTX * T_MD_CTX | ||
4 | EVP_CIPHER_CTX * T_CIPHER_CTX | ||
5 | BIGNUM * T_BIGNUM | ||
6 | SSL_METHOD * T_SSL_METHOD | ||
7 | SSL_CTX * T_SSL_CTX | ||
8 | SSL_CIPHER * T_SSL_CIPHER | ||
9 | SSL * T_SSL | ||
10 | BIO * T_BIO | ||
11 | X509 * T_X509 | ||
12 | |||
13 | INPUT | ||
14 | T_DATUM | ||
15 | $var.dptr=SvPV($arg,$var.dsize); | ||
16 | T_MD_CTX | ||
17 | if (sv_derived_from($arg, \"OpenSSL::MD\")) { | ||
18 | IV tmp = SvIV((SV*)SvRV($arg)); | ||
19 | $var = (EVP_MD_CTX *) tmp; | ||
20 | } | ||
21 | else | ||
22 | croak(\"$var is not of type OpenSSL::MD\") | ||
23 | T_CIPHER_CTX | ||
24 | if (sv_derived_from($arg, \"OpenSSL::Cipher\")) { | ||
25 | IV tmp = SvIV((SV*)SvRV($arg)); | ||
26 | $var = (EVP_CIPHER_CTX *) tmp; | ||
27 | } | ||
28 | else | ||
29 | croak(\"$var is not of type OpenSSL::Cipher\") | ||
30 | T_BIGNUM | ||
31 | sv_to_BIGNUM(&($var),$arg,\"$var is not of type OpenSSL::MD, int or string\") | ||
32 | T_SSL_METHOD | ||
33 | if (sv_derived_from($arg, \"OpenSSL::SSL::METHOD\")) { | ||
34 | IV tmp = SvIV((SV*)SvRV($arg)); | ||
35 | $var = (SSL_METHOD *) tmp; | ||
36 | } | ||
37 | else | ||
38 | croak(\"$var is not of type OpenSSL::SSL::METHOD\") | ||
39 | T_SSL_CTX | ||
40 | if (sv_derived_from($arg, \"OpenSSL::SSL::CTX\")) { | ||
41 | IV tmp = SvIV((SV*)SvRV($arg)); | ||
42 | $var = (SSL_CTX *) tmp; | ||
43 | } | ||
44 | else | ||
45 | croak(\"$var is not of type OpenSSL::SSL::CTX\") | ||
46 | T_SSL_CIPHER | ||
47 | if (sv_derived_from($arg, \"OpenSSL::SSL::CIPHER\")) { | ||
48 | IV tmp = SvIV((SV*)SvRV($arg)); | ||
49 | $var = (SSL_CIPHER *) tmp; | ||
50 | } | ||
51 | else | ||
52 | croak(\"$var is not of type OpenSSL::SSL::CIPHER\") | ||
53 | T_SSL | ||
54 | if (sv_derived_from($arg, \"OpenSSL::SSL\")) { | ||
55 | IV tmp = SvIV((SV*)SvRV($arg)); | ||
56 | $var = (SSL *) tmp; | ||
57 | } | ||
58 | else | ||
59 | croak(\"$var is not of type OpenSSL::SSL\") | ||
60 | T_BIO | ||
61 | if (sv_derived_from($arg, \"OpenSSL::BIO\")) { | ||
62 | IV tmp = SvIV((SV*)SvRV($arg)); | ||
63 | $var = (BIO *) tmp; | ||
64 | } | ||
65 | else | ||
66 | croak(\"$var is not of type OpenSSL::BIO\") | ||
67 | T_X509 | ||
68 | if (sv_derived_from($arg, \"OpenSSL::X509\")) { | ||
69 | IV tmp = SvIV((SV*)SvRV($arg)); | ||
70 | $var = (X509 *) tmp; | ||
71 | } | ||
72 | else | ||
73 | croak(\"$var is not of type OpenSSL::X509\") | ||
74 | OUTPUT | ||
75 | T_DATUM | ||
76 | sv_setpvn($arg,$var.dptr,$var.dsize); | ||
77 | T_MD_CTX | ||
78 | sv_setref_pv($arg, \"OpenSSL::MD\", (void*)$var); | ||
79 | T_CIPHER_CTX | ||
80 | sv_setref_pv($arg, \"OpenSSL::Cipher\", (void*)$var); | ||
81 | T_BIGNUM | ||
82 | sv_setref_pv($arg, \"OpenSSL::BN\", (void*)$var); | ||
83 | T_SSL_METHOD | ||
84 | sv_setref_pv($arg, \"OpenSSL::SSL::METHOD\", (void*)$var); | ||
85 | T_SSL_CTX | ||
86 | sv_setref_pv($arg, \"OpenSSL::SSL::CTX\", (void*)$var); | ||
87 | T_SSL_CIPHER | ||
88 | sv_setref_pv($arg, \"OpenSSL::SSL::CIPHER\", (void*)$var); | ||
89 | T_SSL | ||
90 | sv_setref_pv($arg, \"OpenSSL::SSL\", (void*)$var); | ||
91 | T_BIO | ||
92 | sv_setref_pv($arg, \"OpenSSL::BIO\", (void*)$var); | ||
93 | T_X509 | ||
94 | sv_setref_pv($arg, \"OpenSSL::X509\", (void*)$var); | ||
95 | |||
96 | |||