diff options
Diffstat (limited to 'lib/libssl/src/ssl/s23_lib.c')
| -rw-r--r-- | lib/libssl/src/ssl/s23_lib.c | 158 |
1 files changed, 78 insertions, 80 deletions
diff --git a/lib/libssl/src/ssl/s23_lib.c b/lib/libssl/src/ssl/s23_lib.c index a6285b767fb..3a4d5a6ecb0 100644 --- a/lib/libssl/src/ssl/s23_lib.c +++ b/lib/libssl/src/ssl/s23_lib.c @@ -60,128 +60,126 @@ #include <openssl/objects.h> #include "ssl_locl.h" -long ssl23_default_timeout(void) - { - return(300); - } +long +ssl23_default_timeout(void) +{ + return (300); +} -int ssl23_num_ciphers(void) - { +int +ssl23_num_ciphers(void) +{ return(ssl3_num_ciphers() #ifndef OPENSSL_NO_SSL2 - + ssl2_num_ciphers() + + ssl2_num_ciphers() #endif - ); - } + ); +} -const SSL_CIPHER *ssl23_get_cipher(unsigned int u) - { - unsigned int uu=ssl3_num_ciphers(); +const SSL_CIPHER +*ssl23_get_cipher(unsigned int u) +{ + unsigned int uu = ssl3_num_ciphers(); if (u < uu) - return(ssl3_get_cipher(u)); + return (ssl3_get_cipher(u)); else #ifndef OPENSSL_NO_SSL2 - return(ssl2_get_cipher(u-uu)); + return (ssl2_get_cipher(u - uu)); #else - return(NULL); + return (NULL); #endif - } +} /* This function needs to check if the ciphers required are actually * available */ -const SSL_CIPHER *ssl23_get_cipher_by_char(const unsigned char *p) - { +const SSL_CIPHER +*ssl23_get_cipher_by_char(const unsigned char *p) +{ const SSL_CIPHER *cp; - cp=ssl3_get_cipher_by_char(p); + cp = ssl3_get_cipher_by_char(p); #ifndef OPENSSL_NO_SSL2 if (cp == NULL) - cp=ssl2_get_cipher_by_char(p); + cp = ssl2_get_cipher_by_char(p); #endif - return(cp); - } + return (cp); +} -int ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p) - { +int +ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p) +{ long l; /* We can write SSLv2 and SSLv3 ciphers */ - if (p != NULL) - { - l=c->id; - p[0]=((unsigned char)(l>>16L))&0xFF; - p[1]=((unsigned char)(l>> 8L))&0xFF; - p[2]=((unsigned char)(l ))&0xFF; - } - return(3); + if (p != NULL) { + l = c->id; + p[0] = ((unsigned char)(l >> 16L))&0xFF; + p[1] = ((unsigned char)(l >> 8L))&0xFF; + p[2] = ((unsigned char)(l ))&0xFF; } + return (3); +} -int ssl23_read(SSL *s, void *buf, int len) - { +int +ssl23_read(SSL *s, void *buf, int len) +{ int n; errno = 0; - if (SSL_in_init(s) && (!s->in_handshake)) - { - n=s->handshake_func(s); - if (n < 0) return(n); - if (n == 0) - { - SSLerr(SSL_F_SSL23_READ,SSL_R_SSL_HANDSHAKE_FAILURE); - return(-1); - } - return(SSL_read(s,buf,len)); + if (SSL_in_init(s) && (!s->in_handshake)) { + n = s->handshake_func(s); + if (n < 0) + return (n); + if (n == 0) { + SSLerr(SSL_F_SSL23_READ, SSL_R_SSL_HANDSHAKE_FAILURE); + return (-1); } - else - { + return (SSL_read(s, buf, len)); + } else { ssl_undefined_function(s); - return(-1); - } + return (-1); } +} -int ssl23_peek(SSL *s, void *buf, int len) - { +int +ssl23_peek(SSL *s, void *buf, int len) +{ int n; errno = 0; - if (SSL_in_init(s) && (!s->in_handshake)) - { - n=s->handshake_func(s); - if (n < 0) return(n); - if (n == 0) - { - SSLerr(SSL_F_SSL23_PEEK,SSL_R_SSL_HANDSHAKE_FAILURE); - return(-1); - } - return(SSL_peek(s,buf,len)); + if (SSL_in_init(s) && (!s->in_handshake)) { + n = s->handshake_func(s); + if (n < 0) + return (n); + if (n == 0) { + SSLerr(SSL_F_SSL23_PEEK, SSL_R_SSL_HANDSHAKE_FAILURE); + return (-1); } - else - { + return (SSL_peek(s, buf, len)); + } else { ssl_undefined_function(s); - return(-1); - } + return (-1); } +} -int ssl23_write(SSL *s, const void *buf, int len) - { +int +ssl23_write(SSL *s, const void *buf, int len) +{ int n; errno = 0; - if (SSL_in_init(s) && (!s->in_handshake)) - { - n=s->handshake_func(s); - if (n < 0) return(n); - if (n == 0) - { - SSLerr(SSL_F_SSL23_WRITE,SSL_R_SSL_HANDSHAKE_FAILURE); - return(-1); - } - return(SSL_write(s,buf,len)); + if (SSL_in_init(s) && (!s->in_handshake)) { + n = s->handshake_func(s); + if (n < 0) + return (n); + if (n == 0) { + SSLerr(SSL_F_SSL23_WRITE, SSL_R_SSL_HANDSHAKE_FAILURE); + return (-1); } - else - { + return (SSL_write(s, buf, len)); + } else { ssl_undefined_function(s); - return(-1); - } + return (-1); } +} |
