27 static int modes[CRYPTO_NUM_LOCKS];
28 if(type < 0 || type >= CRYPTO_NUM_LOCKS)
30 printf(
"cryptoLockCallback::type out of bounds\n");
34 int rw = mode & (CRYPTO_READ|CRYPTO_WRITE);
35 if(!((rw == CRYPTO_READ) || (rw == CRYPTO_WRITE)))
37 printf(
"cryptoLockCallback::invalid mode\n");
41 if(mode & CRYPTO_LOCK)
45 errstr =
"already locked";
53 else if (mode & CRYPTO_UNLOCK)
57 errstr =
"not locked";
62 errstr = (rw == CRYPTO_READ) ?
63 "CRYPTO_r_unlock on write lock" :
64 "CRYPTO_w_unlock on read lock";
75 CRYPTO_set_id_callback(cryptoIdCallback);
77 SSL_load_error_strings();
87 SSL_METHOD *meth = TLSv1_client_method();
105 int ret = SSL_shutdown(rlssl->
sslStream);
106 if(ret <= 0) ret = -1;
119 int count = SSL_pending(rlssl->
sslStream);
125 unsigned char c = (
unsigned char) ch;
126 return SSL_write(rlssl->
sslStream, &c, 1);
131 return SSL_write(rlssl->
sslStream, text, strlen(text));
137 int ret = SSL_read(rlssl->
sslStream, &ch, 1);
140 printf(
"rlssl_read: ERROR SSL_read() ret=%d SSL_get_error=%d\n", ret, SSL_get_error(rlssl->
sslStream,ret));
int rlssl_starttls(rlssl_struct *rlssl)
int rlssl_init(rlssl_struct *rlssl)
int rlssl_available(rlssl_struct *rlssl)
static void cryptoLockCallback(int mode, int type, const char *file, int line)
int rlssl_disconnect(rlssl_struct *rlssl)
int rlssl_write(rlssl_struct *rlssl, int ch)
int rlssl_read(rlssl_struct *rlssl)