Ssl_library_init

broken image


NAME

Unresolved external symbol SSLlibraryinit. This message: Message body More options Related messages: Next message Previous message. SSLlibraryinit registers the available ciphers and digests. OpenSSLaddsslalgorithms and SSLeayaddsslalgorithms are synonyms for SSLlibraryinit.

SSL_library_init, OpenSSL_add_ssl_algorithms, SSLeay_add_ssl_algorithms - initialize SSL library by registering algorithms

SYNOPSIS

DESCRIPTION

Ssl_library_init

SSL_library_init() registers the available SSL/TLS ciphers and digests.

OpenSSL_add_ssl_algorithms() and SSLeay_add_ssl_algorithms() are synonyms for SSL_library_init().

Ssl_library_init Openssl

NOTES

SSL_library_init() must be called before any other action takes place. SSL_library_init() is not reentrant.

WARNING

SSL_library_init() adds ciphers and digests used directly and indirectly by SSL/TLS.

EXAMPLES

A typical TLS/SSL application will start with the library initialization, and provide readable error messages.

RETURN VALUES

Ssl_library_init

SSL_library_init() registers the available SSL/TLS ciphers and digests.

OpenSSL_add_ssl_algorithms() and SSLeay_add_ssl_algorithms() are synonyms for SSL_library_init().

Ssl_library_init Openssl

NOTES

SSL_library_init() must be called before any other action takes place. SSL_library_init() is not reentrant.

WARNING

SSL_library_init() adds ciphers and digests used directly and indirectly by SSL/TLS.

EXAMPLES

A typical TLS/SSL application will start with the library initialization, and provide readable error messages.

RETURN VALUES

SSL_library_init() always returns '1', so it is safe to discard the return value.

NOTES

OpenSSL 0.9.8o and 1.0.0a and later added SHA2 algorithms to SSL_library_init(). Applications which need to use SHA2 in earlier versions of OpenSSL should call OpenSSL_add_all_algorithms() as well.

SEE ALSO

ssl(3), SSL_load_error_strings(3), RAND_add(3)

openssl_client.c
#include<openssl/ssl.h>
#include<openssl/bio.h>
#include<openssl/err.h>
#defineHOST'encrypted.google.com'
/**
* Example SSL client that connects to the HOST defined above,
* and prints out the raw response to stdout.
*/
intmain(int arc, char **argv)
{
SSL_load_error_strings();
ERR_load_crypto_strings();
OpenSSL_add_all_algorithms();
SSL_library_init();
SSL_CTX *ctx = SSL_CTX_new(SSLv23_client_method());
if (ctx NULL) {
printf('errored; unable to load context.n');
ERR_print_errors_fp(stderr);
return -3;
}
BIO *bio = BIO_new_ssl_connect(ctx);
SSL *ssl;
BIO_get_ssl(bio, &ssl);
SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
BIO_set_conn_hostname(bio, HOST':https');
if (BIO_do_connect(bio) <= 0) {
BIO_free_all(bio);
printf('errored; unable to connect.n');
ERR_print_errors_fp(stderr);
return -2;
}
constchar *request = 'GET / HTTP/1.1nHost: 'HOST'nUser Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)nConnection: Closenn';
if (BIO_puts(bio, request) <= 0) {
BIO_free_all(bio);
printf('errored; unable to write.n');
ERR_print_errors_fp(stderr);
return -1;
}
char tmpbuf[1024+1];
for (;;) {
int len = BIO_read(bio, tmpbuf, 1024);
if (len 0) {
break;
}
elseif (len < 0) {
if (!BIO_should_retry(bio)) {
printf('errored; read failed.n');
ERR_print_errors_fp(stderr);
break;
}
}
else {
tmpbuf[len] = 0;
printf('%s', tmpbuf);
}
}
BIO_free_all(bio);
return0;
}

commented Nov 24, 2020

Ssl_library_init 64

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment




broken image