192 |
#endif |
#endif |
193 |
} |
} |
194 |
|
|
195 |
|
/** |
196 |
|
* Updates some data in the ssl connection |
197 |
|
* @param ssl reference to ssl connection |
198 |
|
* @return TRUE, if not successful FALSE |
199 |
|
*/ |
200 |
|
|
201 |
int update_ssl_cert_data(ssl_connection *ssl) { |
int update_ssl_cert_data(ssl_connection *ssl) { |
202 |
|
|
226 |
} |
} |
227 |
|
|
228 |
/** |
/** |
229 |
|
* Compare certificate with given md5 sum |
230 |
|
* @param ssl reference to ssl connection |
231 |
|
* @param md5sum string of the md5sum to test against |
232 |
|
* @return TRUE, if sums do not match FALSE |
233 |
|
*/ |
234 |
|
|
235 |
|
int check_ssl_md5sum(ssl_connection * ssl, char *md5sum) { |
236 |
|
|
237 |
|
int i= 0; |
238 |
|
|
239 |
|
while (( i < ssl->cert_md5_len ) && |
240 |
|
( md5sum[2*i] != '\0' ) && |
241 |
|
( md5sum[2*i+1] != '\0' )) { |
242 |
|
|
243 |
|
unsigned char c= |
244 |
|
(md5sum[2*i] > 57 ? md5sum[2*i] - 87 : md5sum[2*i] - 48) * 0x10+ |
245 |
|
(md5sum[2*i+1] > 57 ? md5sum[2*i+1] - 87 : md5sum[2*i+1] - 48); |
246 |
|
|
247 |
|
if ( c!=ssl->cert_md5[i] ) { |
248 |
|
|
249 |
|
return FALSE; |
250 |
|
|
251 |
|
} |
252 |
|
|
253 |
|
i ++; |
254 |
|
|
255 |
|
} |
256 |
|
|
257 |
|
return TRUE; |
258 |
|
|
259 |
|
} |
260 |
|
|
261 |
|
|
262 |
|
/** |
263 |
* Open a socket against hostname:port with the given protocol. |
* Open a socket against hostname:port with the given protocol. |
264 |
* This socket is sent through a ssl connection. |
* This socket is sent through a ssl connection. |
265 |
* The protocol is normaly either SOCK_STREAM or SOCK_DGRAM. |
* The protocol is normaly either SOCK_STREAM or SOCK_DGRAM. |