diff options
author | 1998-10-05 20:12:28 +0000 | |
---|---|---|
committer | 1998-10-05 20:12:28 +0000 | |
commit | 5b37fcf34e412bf0b6ad32ddb294e900d64c5855 (patch) | |
tree | cf5d52f4abf74eb3ee59fd705ef686e3c5b96d91 /lib/libssl/src/perl/cipher.pl | |
parent | add a reference to fork(2) \ (diff) | |
download | wireguard-openbsd-5b37fcf34e412bf0b6ad32ddb294e900d64c5855.tar.xz wireguard-openbsd-5b37fcf34e412bf0b6ad32ddb294e900d64c5855.zip |
Import of SSLeay-0.9.0b with RSA and IDEA stubbed + OpenBSD build
functionality for shared libs.
Note that routines such as sslv2_init and friends that use RSA will
not work due to lack of RSA in this library.
Needs documentation and help from ports for easy upgrade to full
functionality where legally possible.
Diffstat (limited to 'lib/libssl/src/perl/cipher.pl')
-rw-r--r-- | lib/libssl/src/perl/cipher.pl | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/libssl/src/perl/cipher.pl b/lib/libssl/src/perl/cipher.pl new file mode 100644 index 00000000000..e774bceed22 --- /dev/null +++ b/lib/libssl/src/perl/cipher.pl @@ -0,0 +1,39 @@ +#!/usr/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$md=SSLeay::MD::new("md5"); + +foreach (@SSLeay::Cipher::names) + { + ($c=SSLeay::Cipher::new($_)) || + die "'$_' is an unknown cipher algorithm\n"; + + + $data="012345678abcdefghijklmnopqrstuvwxyz"; + $c->init("01234567abcdefghABCDEFGH","zyxwvut",1); + + $in =$c->update(substr($data, 0, 5)); + $in.=$c->update(substr($data, 5,10)); + $in.=$c->update(substr($data,15,1)); + $in.=$c->update(substr($data,16)); + + $in.=$c->final(); + + $c->init("01234567abcdefghABCDEFGH","zyxwvut",0); + $out=$c->update($in); + $out.=$c->final(); + + ($out eq $data) || die "decrypt for $_ failed:$!\n"; + + $md->init(); + $md->update($in); + $digest=$md->final(); + + print unpack("H*",$digest); + printf " %2d %2d %2d %s\n", $c->key_length(), $c->iv_length(), + $c->block_size(), $c->name(); + } + |