OLD | NEW |
1 /* ssl/s23_lib.c */ | 1 /* ssl/s23_lib.c */ |
2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * This package is an SSL implementation written | 5 * This package is an SSL implementation written |
6 * by Eric Young (eay@cryptsoft.com). | 6 * by Eric Young (eay@cryptsoft.com). |
7 * The implementation was written so as to conform with Netscapes SSL. | 7 * The implementation was written so as to conform with Netscapes SSL. |
8 * | 8 * |
9 * This library is free for commercial and non-commercial use as long as | 9 * This library is free for commercial and non-commercial use as long as |
10 * the following conditions are aheared to. The following conditions | 10 * the following conditions are aheared to. The following conditions |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 #include <stdio.h> | 59 #include <stdio.h> |
60 #include <openssl/objects.h> | 60 #include <openssl/objects.h> |
61 #include "ssl_locl.h" | 61 #include "ssl_locl.h" |
62 | 62 |
63 long ssl23_default_timeout(void) | 63 long ssl23_default_timeout(void) |
64 { | 64 { |
65 return(300); | 65 return(300); |
66 } | 66 } |
67 | 67 |
68 IMPLEMENT_ssl23_meth_func(sslv23_base_method, | |
69 ssl_undefined_function, | |
70 ssl_undefined_function, | |
71 ssl_bad_method) | |
72 | |
73 int ssl23_num_ciphers(void) | 68 int ssl23_num_ciphers(void) |
74 { | 69 { |
75 return(ssl3_num_ciphers() | 70 return(ssl3_num_ciphers() |
76 #ifndef OPENSSL_NO_SSL2 | 71 #ifndef OPENSSL_NO_SSL2 |
77 + ssl2_num_ciphers() | 72 + ssl2_num_ciphers() |
78 #endif | 73 #endif |
79 ); | 74 ); |
80 } | 75 } |
81 | 76 |
82 SSL_CIPHER *ssl23_get_cipher(unsigned int u) | 77 const SSL_CIPHER *ssl23_get_cipher(unsigned int u) |
83 { | 78 { |
84 unsigned int uu=ssl3_num_ciphers(); | 79 unsigned int uu=ssl3_num_ciphers(); |
85 | 80 |
86 if (u < uu) | 81 if (u < uu) |
87 return(ssl3_get_cipher(u)); | 82 return(ssl3_get_cipher(u)); |
88 else | 83 else |
89 #ifndef OPENSSL_NO_SSL2 | 84 #ifndef OPENSSL_NO_SSL2 |
90 return(ssl2_get_cipher(u-uu)); | 85 return(ssl2_get_cipher(u-uu)); |
91 #else | 86 #else |
92 return(NULL); | 87 return(NULL); |
93 #endif | 88 #endif |
94 } | 89 } |
95 | 90 |
96 /* This function needs to check if the ciphers required are actually | 91 /* This function needs to check if the ciphers required are actually |
97 * available */ | 92 * available */ |
98 SSL_CIPHER *ssl23_get_cipher_by_char(const unsigned char *p) | 93 const SSL_CIPHER *ssl23_get_cipher_by_char(const unsigned char *p) |
99 { | 94 { |
100 » SSL_CIPHER c,*cp; | 95 » const SSL_CIPHER *cp; |
101 » unsigned long id; | |
102 » int n; | |
103 | 96 |
104 n=ssl3_num_ciphers(); | |
105 id=0x03000000|((unsigned long)p[0]<<16L)| | |
106 ((unsigned long)p[1]<<8L)|(unsigned long)p[2]; | |
107 c.id=id; | |
108 cp=ssl3_get_cipher_by_char(p); | 97 cp=ssl3_get_cipher_by_char(p); |
109 #ifndef OPENSSL_NO_SSL2 | 98 #ifndef OPENSSL_NO_SSL2 |
110 if (cp == NULL) | 99 if (cp == NULL) |
111 cp=ssl2_get_cipher_by_char(p); | 100 cp=ssl2_get_cipher_by_char(p); |
112 #endif | 101 #endif |
113 return(cp); | 102 return(cp); |
114 } | 103 } |
115 | 104 |
116 int ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p) | 105 int ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p) |
117 { | 106 { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 return(-1); | 178 return(-1); |
190 } | 179 } |
191 return(SSL_write(s,buf,len)); | 180 return(SSL_write(s,buf,len)); |
192 } | 181 } |
193 else | 182 else |
194 { | 183 { |
195 ssl_undefined_function(s); | 184 ssl_undefined_function(s); |
196 return(-1); | 185 return(-1); |
197 } | 186 } |
198 } | 187 } |
OLD | NEW |