summaryrefslogtreecommitdiff
path: root/src/lib/libssl/s23_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/s23_lib.c')
-rw-r--r--src/lib/libssl/s23_lib.c158
1 files changed, 78 insertions, 80 deletions
diff --git a/src/lib/libssl/s23_lib.c b/src/lib/libssl/s23_lib.c
index a6285b767f..3a4d5a6ecb 100644
--- a/src/lib/libssl/s23_lib.c
+++ b/src/lib/libssl/s23_lib.c
@@ -60,128 +60,126 @@
60#include <openssl/objects.h> 60#include <openssl/objects.h>
61#include "ssl_locl.h" 61#include "ssl_locl.h"
62 62
63long ssl23_default_timeout(void) 63long
64 { 64ssl23_default_timeout(void)
65 return(300); 65{
66 } 66 return (300);
67}
67 68
68int ssl23_num_ciphers(void) 69int
69 { 70ssl23_num_ciphers(void)
71{
70 return(ssl3_num_ciphers() 72 return(ssl3_num_ciphers()
71#ifndef OPENSSL_NO_SSL2 73#ifndef OPENSSL_NO_SSL2
72 + ssl2_num_ciphers() 74 + ssl2_num_ciphers()
73#endif 75#endif
74 ); 76 );
75 } 77}
76 78
77const SSL_CIPHER *ssl23_get_cipher(unsigned int u) 79const SSL_CIPHER
78 { 80*ssl23_get_cipher(unsigned int u)
79 unsigned int uu=ssl3_num_ciphers(); 81{
82 unsigned int uu = ssl3_num_ciphers();
80 83
81 if (u < uu) 84 if (u < uu)
82 return(ssl3_get_cipher(u)); 85 return (ssl3_get_cipher(u));
83 else 86 else
84#ifndef OPENSSL_NO_SSL2 87#ifndef OPENSSL_NO_SSL2
85 return(ssl2_get_cipher(u-uu)); 88 return (ssl2_get_cipher(u - uu));
86#else 89#else
87 return(NULL); 90 return (NULL);
88#endif 91#endif
89 } 92}
90 93
91/* This function needs to check if the ciphers required are actually 94/* This function needs to check if the ciphers required are actually
92 * available */ 95 * available */
93const SSL_CIPHER *ssl23_get_cipher_by_char(const unsigned char *p) 96const SSL_CIPHER
94 { 97*ssl23_get_cipher_by_char(const unsigned char *p)
98{
95 const SSL_CIPHER *cp; 99 const SSL_CIPHER *cp;
96 100
97 cp=ssl3_get_cipher_by_char(p); 101 cp = ssl3_get_cipher_by_char(p);
98#ifndef OPENSSL_NO_SSL2 102#ifndef OPENSSL_NO_SSL2
99 if (cp == NULL) 103 if (cp == NULL)
100 cp=ssl2_get_cipher_by_char(p); 104 cp = ssl2_get_cipher_by_char(p);
101#endif 105#endif
102 return(cp); 106 return (cp);
103 } 107}
104 108
105int ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p) 109int
106 { 110ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p)
111{
107 long l; 112 long l;
108 113
109 /* We can write SSLv2 and SSLv3 ciphers */ 114 /* We can write SSLv2 and SSLv3 ciphers */
110 if (p != NULL) 115 if (p != NULL) {
111 { 116 l = c->id;
112 l=c->id; 117 p[0] = ((unsigned char)(l >> 16L))&0xFF;
113 p[0]=((unsigned char)(l>>16L))&0xFF; 118 p[1] = ((unsigned char)(l >> 8L))&0xFF;
114 p[1]=((unsigned char)(l>> 8L))&0xFF; 119 p[2] = ((unsigned char)(l ))&0xFF;
115 p[2]=((unsigned char)(l ))&0xFF;
116 }
117 return(3);
118 } 120 }
121 return (3);
122}
119 123
120int ssl23_read(SSL *s, void *buf, int len) 124int
121 { 125ssl23_read(SSL *s, void *buf, int len)
126{
122 int n; 127 int n;
123 128
124 errno = 0; 129 errno = 0;
125 if (SSL_in_init(s) && (!s->in_handshake)) 130 if (SSL_in_init(s) && (!s->in_handshake)) {
126 { 131 n = s->handshake_func(s);
127 n=s->handshake_func(s); 132 if (n < 0)
128 if (n < 0) return(n); 133 return (n);
129 if (n == 0) 134 if (n == 0) {
130 { 135 SSLerr(SSL_F_SSL23_READ, SSL_R_SSL_HANDSHAKE_FAILURE);
131 SSLerr(SSL_F_SSL23_READ,SSL_R_SSL_HANDSHAKE_FAILURE); 136 return (-1);
132 return(-1);
133 }
134 return(SSL_read(s,buf,len));
135 } 137 }
136 else 138 return (SSL_read(s, buf, len));
137 { 139 } else {
138 ssl_undefined_function(s); 140 ssl_undefined_function(s);
139 return(-1); 141 return (-1);
140 }
141 } 142 }
143}
142 144
143int ssl23_peek(SSL *s, void *buf, int len) 145int
144 { 146ssl23_peek(SSL *s, void *buf, int len)
147{
145 int n; 148 int n;
146 149
147 errno = 0; 150 errno = 0;
148 if (SSL_in_init(s) && (!s->in_handshake)) 151 if (SSL_in_init(s) && (!s->in_handshake)) {
149 { 152 n = s->handshake_func(s);
150 n=s->handshake_func(s); 153 if (n < 0)
151 if (n < 0) return(n); 154 return (n);
152 if (n == 0) 155 if (n == 0) {
153 { 156 SSLerr(SSL_F_SSL23_PEEK, SSL_R_SSL_HANDSHAKE_FAILURE);
154 SSLerr(SSL_F_SSL23_PEEK,SSL_R_SSL_HANDSHAKE_FAILURE); 157 return (-1);
155 return(-1);
156 }
157 return(SSL_peek(s,buf,len));
158 } 158 }
159 else 159 return (SSL_peek(s, buf, len));
160 { 160 } else {
161 ssl_undefined_function(s); 161 ssl_undefined_function(s);
162 return(-1); 162 return (-1);
163 }
164 } 163 }
164}
165 165
166int ssl23_write(SSL *s, const void *buf, int len) 166int
167 { 167ssl23_write(SSL *s, const void *buf, int len)
168{
168 int n; 169 int n;
169 170
170 errno = 0; 171 errno = 0;
171 if (SSL_in_init(s) && (!s->in_handshake)) 172 if (SSL_in_init(s) && (!s->in_handshake)) {
172 { 173 n = s->handshake_func(s);
173 n=s->handshake_func(s); 174 if (n < 0)
174 if (n < 0) return(n); 175 return (n);
175 if (n == 0) 176 if (n == 0) {
176 { 177 SSLerr(SSL_F_SSL23_WRITE, SSL_R_SSL_HANDSHAKE_FAILURE);
177 SSLerr(SSL_F_SSL23_WRITE,SSL_R_SSL_HANDSHAKE_FAILURE); 178 return (-1);
178 return(-1);
179 }
180 return(SSL_write(s,buf,len));
181 } 179 }
182 else 180 return (SSL_write(s, buf, len));
183 { 181 } else {
184 ssl_undefined_function(s); 182 ssl_undefined_function(s);
185 return(-1); 183 return (-1);
186 }
187 } 184 }
185}