diff options
author | Bodo Möller <bodo@openssl.org> | 2006-01-03 03:27:19 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2006-01-03 03:27:19 +0000 |
commit | f1fd4544a3747682010ed89ac908713fe90b8304 (patch) | |
tree | 065bf82040e2d29ce319117bec6952e59ede2fcb /ssl/ssl_lib.c | |
parent | 349eb12fd5ac3ce216a6d89084b8c6a63b9388b7 (diff) | |
download | openssl-f1fd4544a3747682010ed89ac908713fe90b8304.zip openssl-f1fd4544a3747682010ed89ac908713fe90b8304.tar.gz openssl-f1fd4544a3747682010ed89ac908713fe90b8304.tar.bz2 |
Various changes in the new TLS extension code, including the following:
- fix indentation
- rename some functions and macros
- fix up confusion between SSL_ERROR_... and SSL_AD_... values
Diffstat (limited to 'ssl/ssl_lib.c')
-rw-r--r-- | ssl/ssl_lib.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index afe7162..841d75d 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -58,7 +58,7 @@ * [including the GNU Public Licence.] */ /* ==================================================================== - * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. + * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1315,27 +1315,30 @@ err: return(NULL); } + #ifndef OPENSSL_TLSEXT -/** return a servername extension value if provided in CLIENT HELLO - * or NULL. - * For the moment, only hostname types are supported. +/** return a servername extension value if provided in Client Hello, or NULL. + * So far, only host_name types are defined (RFC 3546). */ -const char *SSL_get_servername(const SSL *s, const int type) { - - if (type != TLSEXT_TYPE_SERVER_host) +const char *SSL_get_servername(const SSL *s, const int type) + { + if (type != TLSEXT_NAMETYPE_host_name) return NULL; - return s->session /*&&s->session->tlsext_hostname*/?s->session->tlsext_hostname:s->tlsext_hostname; -} - -int SSL_get_servername_type(const SSL *s) { + /* XXX cf. SSL_CTRL_GET_TLSEXT_HOSTNAME case in ssl3_ctrl (s3_lib.c) */ + return s->session /*&&s->session->tlsext_hostname*/ ? + s->session->tlsext_hostname : + s->tlsext_hostname; + } - if (s->session &&s->session->tlsext_hostname ?s->session->tlsext_hostname:s->tlsext_hostname) - return TLSEXT_TYPE_SERVER_host; +int SSL_get_servername_type(const SSL *s) + { + if (s->session &&s->session->tlsext_hostname ? s->session->tlsext_hostname : s->tlsext_hostname) + return TLSEXT_NAMETYPE_host_name; return -1; -} - + } #endif + unsigned long SSL_SESSION_hash(const SSL_SESSION *a) { unsigned long l; @@ -1488,7 +1491,7 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth) ret->max_send_fragment = SSL3_RT_MAX_PLAIN_LENGTH; #ifndef OPENSSL_NO_TLSEXT - ret->tlsext_servername_callback = NULL; + ret->tlsext_servername_callback = 0; ret->tlsext_servername_arg = NULL; #endif return(ret); @@ -2442,7 +2445,6 @@ SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl) SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX* ctx) { - if (ssl->cert != NULL) ssl_cert_free(ssl->cert); ssl->cert = ssl_cert_dup(ctx->cert); |