21 | 21 |
#define PERL5 1
|
22 | 22 |
#endif
|
23 | 23 |
|
24 | |
#include <openssl/ssl.h>
|
|
24 |
#include <openssl/bio.h>
|
25 | 25 |
#include <openssl/crypto.h>
|
26 | 26 |
#include <openssl/err.h>
|
|
27 |
#include <openssl/pkcs12.h>
|
27 | 28 |
#include <openssl/rand.h>
|
28 | |
#include <openssl/pkcs12.h>
|
|
29 |
#include <openssl/ssl.h>
|
29 | 30 |
|
30 | 31 |
#define CRYPT_SSLEAY_free OPENSSL_free
|
31 | 32 |
|
|
43 | 44 |
|
44 | 45 |
#define CRYPT_SSL_CLIENT_METHOD SSLv23_client_method()
|
45 | 46 |
|
46 | |
static void InfoCallback(const SSL *s,int where,int ret)
|
47 | |
{
|
48 | |
const char *str;
|
49 | |
int w;
|
50 | |
|
51 | |
w = where & ~SSL_ST_MASK;
|
52 | |
|
53 | |
if(w & SSL_ST_CONNECT)
|
54 | |
str="SSL_connect";
|
55 | |
else if(w & SSL_ST_ACCEPT)
|
56 | |
str="SSL_accept";
|
57 | |
else
|
58 | |
str="undefined";
|
59 | |
|
60 | |
if(where & SSL_CB_LOOP) {
|
61 | |
fprintf(stderr,"%s:%s\n",str,SSL_state_string_long(s));
|
|
47 |
static void
|
|
48 |
info_callback(const SSL *s, int where, int ret) {
|
|
49 |
BIO *bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
|
|
50 |
int w = where & ~SSL_ST_MASK;
|
|
51 |
const char *mode = (w & SSL_ST_CONNECT) ? "SSL_connect"
|
|
52 |
: (w & SSL_ST_ACCEPT) ? "SSL_accept"
|
|
53 |
: "unknown"
|
|
54 |
;
|
|
55 |
|
|
56 |
if (where & SSL_CB_LOOP) {
|
|
57 |
BIO_printf(bio_err, "%s: %s\n", mode, SSL_state_string_long(s));
|
|
58 |
return;
|
62 | 59 |
}
|
63 | |
else if(where & SSL_CB_ALERT) {
|
64 | |
str=(where & SSL_CB_READ)?"read":"write";
|
65 | |
fprintf(stderr,"SSL3 alert %s:%s:%s\n",str,
|
66 | |
SSL_alert_type_string_long(ret),
|
67 | |
SSL_alert_desc_string_long(ret));
|
68 | |
}
|
69 | |
else if(where & SSL_CB_EXIT) {
|
70 | |
if(ret == 0)
|
71 | |
fprintf(stderr,"%s:failed in %s\n",str,SSL_state_string_long(s));
|
72 | |
else if (ret < 0)
|
73 | |
fprintf(stderr,"%s:error in %s\n",str,SSL_state_string_long(s));
|
74 | |
}
|
|
60 |
|
|
61 |
if (where & SSL_CB_ALERT) {
|
|
62 |
BIO_printf(
|
|
63 |
bio_err, "SSL/TLS alert %s: %s: %s\n",
|
|
64 |
(where & SSL_CB_READ) ? "read" : "write",
|
|
65 |
SSL_alert_type_string_long(ret),
|
|
66 |
SSL_alert_desc_string_long(ret)
|
|
67 |
);
|
|
68 |
return;
|
75 | 69 |
}
|
|
70 |
|
|
71 |
if (where & SSL_CB_EXIT) {
|
|
72 |
if (ret == 0) {
|
|
73 |
BIO_printf(
|
|
74 |
bio_err, "%s: failed in %s\n",
|
|
75 |
mode, SSL_state_string_long(s)
|
|
76 |
);
|
|
77 |
return;
|
|
78 |
}
|
|
79 |
if (ret < 0) {
|
|
80 |
BIO_printf(
|
|
81 |
bio_err, "%s:error in %s\n",
|
|
82 |
mode, SSL_state_string_long(s)
|
|
83 |
);
|
|
84 |
return;
|
|
85 |
}
|
|
86 |
}
|
|
87 |
}
|
|
88 |
|
76 | 89 |
|
77 | 90 |
MODULE = Crypt::SSLeay PACKAGE = Crypt::SSLeay
|
78 | 91 |
|