summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/ssl_lib.c')
-rw-r--r--src/lib/libssl/ssl_lib.c140
1 files changed, 71 insertions, 69 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c
index dc36747833..3ab353b8eb 100644
--- a/src/lib/libssl/ssl_lib.c
+++ b/src/lib/libssl/ssl_lib.c
@@ -256,8 +256,8 @@ SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth)
256 return (1); 256 return (1);
257} 257}
258 258
259SSL 259SSL *
260*SSL_new(SSL_CTX *ctx) 260SSL_new(SSL_CTX *ctx)
261{ 261{
262 SSL *s; 262 SSL *s;
263 263
@@ -604,14 +604,16 @@ SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio)
604 s->wbio = wbio; 604 s->wbio = wbio;
605} 605}
606 606
607BIO 607BIO *
608*SSL_get_rbio(const SSL *s) 608SSL_get_rbio(const SSL *s)
609 { return (s->rbio); 609{
610 return (s->rbio);
610} 611}
611 612
612BIO 613BIO *
613*SSL_get_wbio(const SSL *s) 614SSL_get_wbio(const SSL *s)
614 { return (s->wbio); 615{
616 return (s->wbio);
615} 617}
616 618
617int 619int
@@ -819,8 +821,8 @@ SSL_pending(const SSL *s)
819 return (s->method->ssl_pending(s)); 821 return (s->method->ssl_pending(s));
820} 822}
821 823
822X509 824X509 *
823*SSL_get_peer_certificate(const SSL *s) 825SSL_get_peer_certificate(const SSL *s)
824{ 826{
825 X509 *r; 827 X509 *r;
826 828
@@ -837,8 +839,8 @@ X509
837 return (r); 839 return (r);
838} 840}
839 841
840STACK_OF(X509) 842STACK_OF(X509) *
841*SSL_get_peer_cert_chain(const SSL *s) 843SSL_get_peer_cert_chain(const SSL *s)
842{ 844{
843 STACK_OF(X509) *r; 845 STACK_OF(X509) *r;
844 846
@@ -1115,8 +1117,8 @@ SSL_callback_ctrl(SSL *s, int cmd, void (*fp)(void))
1115 } 1117 }
1116} 1118}
1117 1119
1118LHASH_OF(SSL_SESSION) 1120LHASH_OF(SSL_SESSION) *
1119*SSL_CTX_sessions(SSL_CTX *ctx) 1121SSL_CTX_sessions(SSL_CTX *ctx)
1120{ 1122{
1121 return ctx->sessions; 1123 return ctx->sessions;
1122} 1124}
@@ -1240,8 +1242,8 @@ ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap,
1240 1242
1241/** return a STACK of the ciphers available for the SSL and in order of 1243/** return a STACK of the ciphers available for the SSL and in order of
1242 * preference */ 1244 * preference */
1243STACK_OF(SSL_CIPHER) 1245STACK_OF(SSL_CIPHER) *
1244*SSL_get_ciphers(const SSL *s) 1246SSL_get_ciphers(const SSL *s)
1245{ 1247{
1246 if (s != NULL) { 1248 if (s != NULL) {
1247 if (s->cipher_list != NULL) { 1249 if (s->cipher_list != NULL) {
@@ -1256,8 +1258,8 @@ STACK_OF(SSL_CIPHER)
1256 1258
1257/** return a STACK of the ciphers available for the SSL and in order of 1259/** return a STACK of the ciphers available for the SSL and in order of
1258 * algorithm id */ 1260 * algorithm id */
1259STACK_OF(SSL_CIPHER) 1261STACK_OF(SSL_CIPHER) *
1260*ssl_get_ciphers_by_id(SSL *s) 1262ssl_get_ciphers_by_id(SSL *s)
1261{ 1263{
1262 if (s != NULL) { 1264 if (s != NULL) {
1263 if (s->cipher_list_by_id != NULL) { 1265 if (s->cipher_list_by_id != NULL) {
@@ -1271,8 +1273,8 @@ STACK_OF(SSL_CIPHER)
1271} 1273}
1272 1274
1273/** The old interface to get the same thing as SSL_get_ciphers() */ 1275/** The old interface to get the same thing as SSL_get_ciphers() */
1274const char 1276const char *
1275*SSL_get_cipher_list(const SSL *s, int n) 1277SSL_get_cipher_list(const SSL *s, int n)
1276{ 1278{
1277 SSL_CIPHER *c; 1279 SSL_CIPHER *c;
1278 STACK_OF(SSL_CIPHER) *sk; 1280 STACK_OF(SSL_CIPHER) *sk;
@@ -1331,8 +1333,8 @@ SSL_set_cipher_list(SSL *s, const char *str)
1331} 1333}
1332 1334
1333/* works well for SSLv2, not so good for SSLv3 */ 1335/* works well for SSLv2, not so good for SSLv3 */
1334char 1336char *
1335*SSL_get_shared_ciphers(const SSL *s, char *buf, int len) 1337SSL_get_shared_ciphers(const SSL *s, char *buf, int len)
1336{ 1338{
1337 char *end; 1339 char *end;
1338 STACK_OF(SSL_CIPHER) *sk; 1340 STACK_OF(SSL_CIPHER) *sk;
@@ -1414,9 +1416,9 @@ ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, unsigned char *p,
1414 return (p - q); 1416 return (p - q);
1415} 1417}
1416 1418
1417STACK_OF(SSL_CIPHER) 1419STACK_OF(SSL_CIPHER) *
1418*ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num, 1420ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num,
1419STACK_OF(SSL_CIPHER) **skp) 1421 STACK_OF(SSL_CIPHER) **skp)
1420{ 1422{
1421 const SSL_CIPHER *c; 1423 const SSL_CIPHER *c;
1422 STACK_OF(SSL_CIPHER) *sk; 1424 STACK_OF(SSL_CIPHER) *sk;
@@ -1481,8 +1483,8 @@ err:
1481 * So far, only host_name types are defined (RFC 3546). 1483 * So far, only host_name types are defined (RFC 3546).
1482 */ 1484 */
1483 1485
1484const char 1486const char *
1485*SSL_get_servername(const SSL *s, const int type) 1487SSL_get_servername(const SSL *s, const int type)
1486{ 1488{
1487 if (type != TLSEXT_NAMETYPE_host_name) 1489 if (type != TLSEXT_NAMETYPE_host_name)
1488 return NULL; 1490 return NULL;
@@ -1669,8 +1671,8 @@ IMPLEMENT_LHASH_HASH_FN(ssl_session, SSL_SESSION)
1669static 1671static
1670IMPLEMENT_LHASH_COMP_FN(ssl_session, SSL_SESSION) 1672IMPLEMENT_LHASH_COMP_FN(ssl_session, SSL_SESSION)
1671 1673
1672SSL_CTX 1674SSL_CTX *
1673*SSL_CTX_new(const SSL_METHOD *meth) 1675SSL_CTX_new(const SSL_METHOD *meth)
1674{ 1676{
1675 SSL_CTX *ret = NULL; 1677 SSL_CTX *ret = NULL;
1676 1678
@@ -2217,8 +2219,8 @@ ssl_check_srvr_ecc_cert_and_alg(X509 *x, SSL *s)
2217#endif 2219#endif
2218 2220
2219/* THIS NEEDS CLEANING UP */ 2221/* THIS NEEDS CLEANING UP */
2220CERT_PKEY 2222CERT_PKEY *
2221*ssl_get_server_send_pkey(const SSL *s) 2223ssl_get_server_send_pkey(const SSL *s)
2222{ 2224{
2223 unsigned long alg_k, alg_a; 2225 unsigned long alg_k, alg_a;
2224 CERT *c; 2226 CERT *c;
@@ -2272,8 +2274,8 @@ CERT_PKEY
2272 return c->pkeys + i; 2274 return c->pkeys + i;
2273} 2275}
2274 2276
2275X509 2277X509 *
2276*ssl_get_server_send_cert(const SSL *s) 2278ssl_get_server_send_cert(const SSL *s)
2277{ 2279{
2278 CERT_PKEY *cpk; 2280 CERT_PKEY *cpk;
2279 cpk = ssl_get_server_send_pkey(s); 2281 cpk = ssl_get_server_send_pkey(s);
@@ -2282,8 +2284,8 @@ X509
2282 return cpk->x509; 2284 return cpk->x509;
2283} 2285}
2284 2286
2285EVP_PKEY 2287EVP_PKEY *
2286*ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher, const EVP_MD **pmd) 2288ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher, const EVP_MD **pmd)
2287{ 2289{
2288 unsigned long alg_a; 2290 unsigned long alg_a;
2289 CERT *c; 2291 CERT *c;
@@ -2343,8 +2345,8 @@ ssl_update_cache(SSL *s, int mode)
2343 } 2345 }
2344} 2346}
2345 2347
2346const SSL_METHOD 2348const SSL_METHOD *
2347*SSL_get_ssl_method(SSL *s) 2349SSL_get_ssl_method(SSL *s)
2348{ 2350{
2349 return (s->method); 2351 return (s->method);
2350} 2352}
@@ -2684,8 +2686,8 @@ ssl_clear_cipher_ctx(SSL *s)
2684} 2686}
2685 2687
2686/* Fix this function so that it takes an optional type parameter */ 2688/* Fix this function so that it takes an optional type parameter */
2687X509 2689X509 *
2688*SSL_get_certificate(const SSL *s) 2690SSL_get_certificate(const SSL *s)
2689{ 2691{
2690 if (s->cert != NULL) 2692 if (s->cert != NULL)
2691 return (s->cert->key->x509); 2693 return (s->cert->key->x509);
@@ -2694,8 +2696,8 @@ X509
2694} 2696}
2695 2697
2696/* Fix this function so that it takes an optional type parameter */ 2698/* Fix this function so that it takes an optional type parameter */
2697EVP_PKEY 2699EVP_PKEY *
2698*SSL_get_privatekey(SSL *s) 2700SSL_get_privatekey(SSL *s)
2699{ 2701{
2700 if (s->cert != NULL) 2702 if (s->cert != NULL)
2701 return (s->cert->key->privatekey); 2703 return (s->cert->key->privatekey);
@@ -2703,37 +2705,37 @@ EVP_PKEY
2703 return (NULL); 2705 return (NULL);
2704} 2706}
2705 2707
2706const SSL_CIPHER 2708const SSL_CIPHER *
2707*SSL_get_current_cipher(const SSL *s) 2709SSL_get_current_cipher(const SSL *s)
2708{ 2710{
2709 if ((s->session != NULL) && (s->session->cipher != NULL)) 2711 if ((s->session != NULL) && (s->session->cipher != NULL))
2710 return (s->session->cipher); 2712 return (s->session->cipher);
2711 return (NULL); 2713 return (NULL);
2712} 2714}
2713#ifdef OPENSSL_NO_COMP 2715#ifdef OPENSSL_NO_COMP
2714const void 2716const void *
2715*SSL_get_current_compression(SSL *s) 2717SSL_get_current_compression(SSL *s)
2716{ 2718{
2717 return NULL; 2719 return NULL;
2718} 2720}
2719 2721
2720const void 2722const void *
2721*SSL_get_current_expansion(SSL *s) 2723SSL_get_current_expansion(SSL *s)
2722{ 2724{
2723 return NULL; 2725 return NULL;
2724} 2726}
2725#else 2727#else
2726 2728
2727const COMP_METHOD 2729const COMP_METHOD *
2728*SSL_get_current_compression(SSL *s) 2730SSL_get_current_compression(SSL *s)
2729{ 2731{
2730 if (s->compress != NULL) 2732 if (s->compress != NULL)
2731 return (s->compress->meth); 2733 return (s->compress->meth);
2732 return (NULL); 2734 return (NULL);
2733} 2735}
2734 2736
2735const COMP_METHOD 2737const COMP_METHOD *
2736*SSL_get_current_expansion(SSL *s) 2738SSL_get_current_expansion(SSL *s)
2737{ 2739{
2738 if (s->expand != NULL) 2740 if (s->expand != NULL)
2739 return (s->expand->meth); 2741 return (s->expand->meth);
@@ -2828,14 +2830,14 @@ SSL_version(const SSL *s)
2828 return (s->version); 2830 return (s->version);
2829} 2831}
2830 2832
2831SSL_CTX 2833SSL_CTX *
2832*SSL_get_SSL_CTX(const SSL *ssl) 2834SSL_get_SSL_CTX(const SSL *ssl)
2833{ 2835{
2834 return (ssl->ctx); 2836 return (ssl->ctx);
2835} 2837}
2836 2838
2837SSL_CTX 2839SSL_CTX *
2838*SSL_set_SSL_CTX(SSL *ssl, SSL_CTX* ctx) 2840SSL_set_SSL_CTX(SSL *ssl, SSL_CTX* ctx)
2839{ 2841{
2840 if (ssl->ctx == ctx) 2842 if (ssl->ctx == ctx)
2841 return ssl->ctx; 2843 return ssl->ctx;
@@ -2920,8 +2922,8 @@ SSL_set_ex_data(SSL *s, int idx, void *arg)
2920 return (CRYPTO_set_ex_data(&s->ex_data, idx, arg)); 2922 return (CRYPTO_set_ex_data(&s->ex_data, idx, arg));
2921} 2923}
2922 2924
2923void 2925void *
2924*SSL_get_ex_data(const SSL *s, int idx) 2926SSL_get_ex_data(const SSL *s, int idx)
2925{ 2927{
2926 return (CRYPTO_get_ex_data(&s->ex_data, idx)); 2928 return (CRYPTO_get_ex_data(&s->ex_data, idx));
2927} 2929}
@@ -2940,8 +2942,8 @@ SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg)
2940 return (CRYPTO_set_ex_data(&s->ex_data, idx, arg)); 2942 return (CRYPTO_set_ex_data(&s->ex_data, idx, arg));
2941} 2943}
2942 2944
2943void 2945void *
2944*SSL_CTX_get_ex_data(const SSL_CTX *s, int idx) 2946SSL_CTX_get_ex_data(const SSL_CTX *s, int idx)
2945{ 2947{
2946 return (CRYPTO_get_ex_data(&s->ex_data, idx)); 2948 return (CRYPTO_get_ex_data(&s->ex_data, idx));
2947} 2949}
@@ -2952,8 +2954,8 @@ ssl_ok(SSL *s)
2952 return (1); 2954 return (1);
2953} 2955}
2954 2956
2955X509_STORE 2957X509_STORE *
2956*SSL_CTX_get_cert_store(const SSL_CTX *ctx) 2958SSL_CTX_get_cert_store(const SSL_CTX *ctx)
2957{ 2959{
2958 return (ctx->cert_store); 2960 return (ctx->cert_store);
2959} 2961}
@@ -3005,8 +3007,8 @@ int keylength))
3005 * \sa SSL_CTX_set_tmp_rsa_callback, SSL_set_tmp_rsa_callback 3007 * \sa SSL_CTX_set_tmp_rsa_callback, SSL_set_tmp_rsa_callback
3006 */ 3008 */
3007 3009
3008RSA 3010RSA *
3009*cb(SSL *ssl, int is_export, int keylength) 3011cb(SSL *ssl, int is_export, int keylength)
3010{} 3012{}
3011#endif 3013#endif
3012 3014
@@ -3091,16 +3093,16 @@ SSL_use_psk_identity_hint(SSL *s, const char *identity_hint)
3091 return 1; 3093 return 1;
3092} 3094}
3093 3095
3094const char 3096const char *
3095*SSL_get_psk_identity_hint(const SSL *s) 3097SSL_get_psk_identity_hint(const SSL *s)
3096{ 3098{
3097 if (s == NULL || s->session == NULL) 3099 if (s == NULL || s->session == NULL)
3098 return NULL; 3100 return NULL;
3099 return (s->session->psk_identity_hint); 3101 return (s->session->psk_identity_hint);
3100} 3102}
3101 3103
3102const char 3104const char *
3103*SSL_get_psk_identity(const SSL *s) 3105SSL_get_psk_identity(const SSL *s)
3104{ 3106{
3105 if (s == NULL || s->session == NULL) 3107 if (s == NULL || s->session == NULL)
3106 return NULL; 3108 return NULL;
@@ -3160,8 +3162,8 @@ SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, int content_
3160 * Returns newly allocated ctx; 3162 * Returns newly allocated ctx;
3161 */ 3163 */
3162 3164
3163EVP_MD_CTX 3165EVP_MD_CTX *
3164*ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) 3166ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
3165{ 3167{
3166 ssl_clear_hash_ctx(hash); 3168 ssl_clear_hash_ctx(hash);
3167 *hash = EVP_MD_CTX_create(); 3169 *hash = EVP_MD_CTX_create();