vtls.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. /***************************************************************************
  2. * _ _ ____ _
  3. * Project ___| | | | _ \| |
  4. * / __| | | | |_) | |
  5. * | (__| |_| | _ <| |___
  6. * \___|\___/|_| \_\_____|
  7. *
  8. * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. *
  10. * This software is licensed as described in the file COPYING, which
  11. * you should have received as part of this distribution. The terms
  12. * are also available at http://curl.haxx.se/docs/copyright.html.
  13. *
  14. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. * copies of the Software, and permit persons to whom the Software is
  16. * furnished to do so, under the terms of the COPYING file.
  17. *
  18. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. * KIND, either express or implied.
  20. *
  21. ***************************************************************************/
  22. /* This file is for implementing all "generic" SSL functions that all libcurl
  23. internals should use. It is then responsible for calling the proper
  24. "backend" function.
  25. SSL-functions in libcurl should call functions in this source file, and not
  26. to any specific SSL-layer.
  27. Curl_ssl_ - prefix for generic ones
  28. Curl_ossl_ - prefix for OpenSSL ones
  29. Curl_gtls_ - prefix for GnuTLS ones
  30. Curl_nss_ - prefix for NSS ones
  31. Curl_qssl_ - prefix for QsoSSL ones
  32. Curl_gskit_ - prefix for GSKit ones
  33. Curl_polarssl_ - prefix for PolarSSL ones
  34. Curl_cyassl_ - prefix for CyaSSL ones
  35. Curl_schannel_ - prefix for Schannel SSPI ones
  36. Curl_darwinssl_ - prefix for SecureTransport (Darwin) ones
  37. Note that this source code uses curlssl_* functions, and they are all
  38. defines/macros #defined by the lib-specific header files.
  39. "SSL/TLS Strong Encryption: An Introduction"
  40. http://httpd.apache.org/docs-2.0/ssl/ssl_intro.html
  41. */
  42. #include "curl_setup.h"
  43. #ifdef HAVE_SYS_TYPES_H
  44. #include <sys/types.h>
  45. #endif
  46. #ifdef HAVE_SYS_STAT_H
  47. #include <sys/stat.h>
  48. #endif
  49. #ifdef HAVE_FCNTL_H
  50. #include <fcntl.h>
  51. #endif
  52. #include "urldata.h"
  53. #include "vtls.h" /* generic SSL protos etc */
  54. #include "openssl.h" /* OpenSSL versions */
  55. #include "gtls.h" /* GnuTLS versions */
  56. #include "nssg.h" /* NSS versions */
  57. #include "qssl.h" /* QSOSSL versions */
  58. #include "gskit.h" /* Global Secure ToolKit versions */
  59. #include "polarssl.h" /* PolarSSL versions */
  60. #include "axtls.h" /* axTLS versions */
  61. #include "cyassl.h" /* CyaSSL versions */
  62. #include "curl_schannel.h" /* Schannel SSPI version */
  63. #include "curl_darwinssl.h" /* SecureTransport (Darwin) version */
  64. #include "slist.h"
  65. #include "sendf.h"
  66. #include "rawstr.h"
  67. #include "url.h"
  68. #include "curl_memory.h"
  69. #include "progress.h"
  70. #include "share.h"
  71. #include "timeval.h"
  72. #define _MPRINTF_REPLACE /* use our functions only */
  73. #include <curl/mprintf.h>
  74. /* The last #include file should be: */
  75. #include "memdebug.h"
  76. /* convenience macro to check if this handle is using a shared SSL session */
  77. #define SSLSESSION_SHARED(data) (data->share && \
  78. (data->share->specifier & \
  79. (1<<CURL_LOCK_DATA_SSL_SESSION)))
  80. static bool safe_strequal(char* str1, char* str2)
  81. {
  82. if(str1 && str2)
  83. /* both pointers point to something then compare them */
  84. return (0 != Curl_raw_equal(str1, str2)) ? TRUE : FALSE;
  85. else
  86. /* if both pointers are NULL then treat them as equal */
  87. return (!str1 && !str2) ? TRUE : FALSE;
  88. }
  89. bool
  90. Curl_ssl_config_matches(struct ssl_config_data* data,
  91. struct ssl_config_data* needle)
  92. {
  93. if((data->version == needle->version) &&
  94. (data->verifypeer == needle->verifypeer) &&
  95. (data->verifyhost == needle->verifyhost) &&
  96. safe_strequal(data->CApath, needle->CApath) &&
  97. safe_strequal(data->CAfile, needle->CAfile) &&
  98. safe_strequal(data->random_file, needle->random_file) &&
  99. safe_strequal(data->egdsocket, needle->egdsocket) &&
  100. safe_strequal(data->cipher_list, needle->cipher_list))
  101. return TRUE;
  102. return FALSE;
  103. }
  104. bool
  105. Curl_clone_ssl_config(struct ssl_config_data *source,
  106. struct ssl_config_data *dest)
  107. {
  108. dest->sessionid = source->sessionid;
  109. dest->verifyhost = source->verifyhost;
  110. dest->verifypeer = source->verifypeer;
  111. dest->version = source->version;
  112. if(source->CAfile) {
  113. dest->CAfile = strdup(source->CAfile);
  114. if(!dest->CAfile)
  115. return FALSE;
  116. }
  117. else
  118. dest->CAfile = NULL;
  119. if(source->CApath) {
  120. dest->CApath = strdup(source->CApath);
  121. if(!dest->CApath)
  122. return FALSE;
  123. }
  124. else
  125. dest->CApath = NULL;
  126. if(source->cipher_list) {
  127. dest->cipher_list = strdup(source->cipher_list);
  128. if(!dest->cipher_list)
  129. return FALSE;
  130. }
  131. else
  132. dest->cipher_list = NULL;
  133. if(source->egdsocket) {
  134. dest->egdsocket = strdup(source->egdsocket);
  135. if(!dest->egdsocket)
  136. return FALSE;
  137. }
  138. else
  139. dest->egdsocket = NULL;
  140. if(source->random_file) {
  141. dest->random_file = strdup(source->random_file);
  142. if(!dest->random_file)
  143. return FALSE;
  144. }
  145. else
  146. dest->random_file = NULL;
  147. return TRUE;
  148. }
  149. void Curl_free_ssl_config(struct ssl_config_data* sslc)
  150. {
  151. Curl_safefree(sslc->CAfile);
  152. Curl_safefree(sslc->CApath);
  153. Curl_safefree(sslc->cipher_list);
  154. Curl_safefree(sslc->egdsocket);
  155. Curl_safefree(sslc->random_file);
  156. }
  157. /*
  158. * Curl_rand() returns a random unsigned integer, 32bit.
  159. *
  160. * This non-SSL function is put here only because this file is the only one
  161. * with knowledge of what the underlying SSL libraries provide in terms of
  162. * randomizers.
  163. *
  164. * NOTE: 'data' may be passed in as NULL when coming from external API without
  165. * easy handle!
  166. *
  167. */
  168. unsigned int Curl_rand(struct SessionHandle *data)
  169. {
  170. unsigned int r;
  171. static unsigned int randseed;
  172. static bool seeded = FALSE;
  173. #ifdef CURLDEBUG
  174. char *force_entropy = getenv("CURL_ENTROPY");
  175. if(force_entropy) {
  176. if(!seeded) {
  177. size_t elen = strlen(force_entropy);
  178. size_t clen = sizeof(randseed);
  179. size_t min = elen < clen ? elen : clen;
  180. memcpy((char *)&randseed, force_entropy, min);
  181. seeded = TRUE;
  182. }
  183. else
  184. randseed++;
  185. return randseed;
  186. }
  187. #endif
  188. #ifndef have_curlssl_random
  189. (void)data;
  190. #else
  191. if(data) {
  192. curlssl_random(data, (unsigned char *)&r, sizeof(r));
  193. return r;
  194. }
  195. #endif
  196. #ifdef RANDOM_FILE
  197. if(!seeded) {
  198. /* if there's a random file to read a seed from, use it */
  199. int fd = open(RANDOM_FILE, O_RDONLY);
  200. if(fd > -1) {
  201. /* read random data into the randseed variable */
  202. ssize_t nread = read(fd, &randseed, sizeof(randseed));
  203. if(nread == sizeof(randseed))
  204. seeded = TRUE;
  205. close(fd);
  206. }
  207. }
  208. #endif
  209. if(!seeded) {
  210. struct timeval now = curlx_tvnow();
  211. randseed += (unsigned int)now.tv_usec + (unsigned int)now.tv_sec;
  212. randseed = randseed * 1103515245 + 12345;
  213. randseed = randseed * 1103515245 + 12345;
  214. randseed = randseed * 1103515245 + 12345;
  215. seeded = TRUE;
  216. }
  217. /* Return an unsigned 32-bit pseudo-random number. */
  218. r = randseed = randseed * 1103515245 + 12345;
  219. return (r << 16) | ((r >> 16) & 0xFFFF);
  220. }
  221. #ifdef USE_SSL
  222. /* "global" init done? */
  223. static bool init_ssl=FALSE;
  224. /**
  225. * Global SSL init
  226. *
  227. * @retval 0 error initializing SSL
  228. * @retval 1 SSL initialized successfully
  229. */
  230. int Curl_ssl_init(void)
  231. {
  232. /* make sure this is only done once */
  233. if(init_ssl)
  234. return 1;
  235. init_ssl = TRUE; /* never again */
  236. return curlssl_init();
  237. }
  238. /* Global cleanup */
  239. void Curl_ssl_cleanup(void)
  240. {
  241. if(init_ssl) {
  242. /* only cleanup if we did a previous init */
  243. curlssl_cleanup();
  244. init_ssl = FALSE;
  245. }
  246. }
  247. CURLcode
  248. Curl_ssl_connect(struct connectdata *conn, int sockindex)
  249. {
  250. CURLcode res;
  251. /* mark this is being ssl-enabled from here on. */
  252. conn->ssl[sockindex].use = TRUE;
  253. conn->ssl[sockindex].state = ssl_connection_negotiating;
  254. res = curlssl_connect(conn, sockindex);
  255. if(!res)
  256. Curl_pgrsTime(conn->data, TIMER_APPCONNECT); /* SSL is connected */
  257. return res;
  258. }
  259. CURLcode
  260. Curl_ssl_connect_nonblocking(struct connectdata *conn, int sockindex,
  261. bool *done)
  262. {
  263. CURLcode res;
  264. /* mark this is being ssl requested from here on. */
  265. conn->ssl[sockindex].use = TRUE;
  266. #ifdef curlssl_connect_nonblocking
  267. res = curlssl_connect_nonblocking(conn, sockindex, done);
  268. #else
  269. *done = TRUE; /* fallback to BLOCKING */
  270. res = curlssl_connect(conn, sockindex);
  271. #endif /* non-blocking connect support */
  272. if(!res && *done)
  273. Curl_pgrsTime(conn->data, TIMER_APPCONNECT); /* SSL is connected */
  274. return res;
  275. }
  276. /*
  277. * Check if there's a session ID for the given connection in the cache, and if
  278. * there's one suitable, it is provided. Returns TRUE when no entry matched.
  279. */
  280. int Curl_ssl_getsessionid(struct connectdata *conn,
  281. void **ssl_sessionid,
  282. size_t *idsize) /* set 0 if unknown */
  283. {
  284. struct curl_ssl_session *check;
  285. struct SessionHandle *data = conn->data;
  286. size_t i;
  287. long *general_age;
  288. bool no_match = TRUE;
  289. *ssl_sessionid = NULL;
  290. if(!conn->ssl_config.sessionid)
  291. /* session ID re-use is disabled */
  292. return TRUE;
  293. /* Lock if shared */
  294. if(SSLSESSION_SHARED(data)) {
  295. Curl_share_lock(data, CURL_LOCK_DATA_SSL_SESSION, CURL_LOCK_ACCESS_SINGLE);
  296. general_age = &data->share->sessionage;
  297. }
  298. else
  299. general_age = &data->state.sessionage;
  300. for(i = 0; i < data->set.ssl.max_ssl_sessions; i++) {
  301. check = &data->state.session[i];
  302. if(!check->sessionid)
  303. /* not session ID means blank entry */
  304. continue;
  305. if(Curl_raw_equal(conn->host.name, check->name) &&
  306. (conn->remote_port == check->remote_port) &&
  307. Curl_ssl_config_matches(&conn->ssl_config, &check->ssl_config)) {
  308. /* yes, we have a session ID! */
  309. (*general_age)++; /* increase general age */
  310. check->age = *general_age; /* set this as used in this age */
  311. *ssl_sessionid = check->sessionid;
  312. if(idsize)
  313. *idsize = check->idsize;
  314. no_match = FALSE;
  315. break;
  316. }
  317. }
  318. /* Unlock */
  319. if(SSLSESSION_SHARED(data))
  320. Curl_share_unlock(data, CURL_LOCK_DATA_SSL_SESSION);
  321. return no_match;
  322. }
  323. /*
  324. * Kill a single session ID entry in the cache.
  325. */
  326. void Curl_ssl_kill_session(struct curl_ssl_session *session)
  327. {
  328. if(session->sessionid) {
  329. /* defensive check */
  330. /* free the ID the SSL-layer specific way */
  331. curlssl_session_free(session->sessionid);
  332. session->sessionid = NULL;
  333. session->age = 0; /* fresh */
  334. Curl_free_ssl_config(&session->ssl_config);
  335. Curl_safefree(session->name);
  336. }
  337. }
  338. /*
  339. * Delete the given session ID from the cache.
  340. */
  341. void Curl_ssl_delsessionid(struct connectdata *conn, void *ssl_sessionid)
  342. {
  343. size_t i;
  344. struct SessionHandle *data=conn->data;
  345. if(SSLSESSION_SHARED(data))
  346. Curl_share_lock(data, CURL_LOCK_DATA_SSL_SESSION, CURL_LOCK_ACCESS_SINGLE);
  347. for(i = 0; i < data->set.ssl.max_ssl_sessions; i++) {
  348. struct curl_ssl_session *check = &data->state.session[i];
  349. if(check->sessionid == ssl_sessionid) {
  350. Curl_ssl_kill_session(check);
  351. break;
  352. }
  353. }
  354. if(SSLSESSION_SHARED(data))
  355. Curl_share_unlock(data, CURL_LOCK_DATA_SSL_SESSION);
  356. }
  357. /*
  358. * Store session id in the session cache. The ID passed on to this function
  359. * must already have been extracted and allocated the proper way for the SSL
  360. * layer. Curl_XXXX_session_free() will be called to free/kill the session ID
  361. * later on.
  362. */
  363. CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
  364. void *ssl_sessionid,
  365. size_t idsize)
  366. {
  367. size_t i;
  368. struct SessionHandle *data=conn->data; /* the mother of all structs */
  369. struct curl_ssl_session *store = &data->state.session[0];
  370. long oldest_age=data->state.session[0].age; /* zero if unused */
  371. char *clone_host;
  372. long *general_age;
  373. /* Even though session ID re-use might be disabled, that only disables USING
  374. IT. We still store it here in case the re-using is again enabled for an
  375. upcoming transfer */
  376. clone_host = strdup(conn->host.name);
  377. if(!clone_host)
  378. return CURLE_OUT_OF_MEMORY; /* bail out */
  379. /* Now we should add the session ID and the host name to the cache, (remove
  380. the oldest if necessary) */
  381. /* If using shared SSL session, lock! */
  382. if(SSLSESSION_SHARED(data)) {
  383. Curl_share_lock(data, CURL_LOCK_DATA_SSL_SESSION, CURL_LOCK_ACCESS_SINGLE);
  384. general_age = &data->share->sessionage;
  385. }
  386. else {
  387. general_age = &data->state.sessionage;
  388. }
  389. /* find an empty slot for us, or find the oldest */
  390. for(i = 1; (i < data->set.ssl.max_ssl_sessions) &&
  391. data->state.session[i].sessionid; i++) {
  392. if(data->state.session[i].age < oldest_age) {
  393. oldest_age = data->state.session[i].age;
  394. store = &data->state.session[i];
  395. }
  396. }
  397. if(i == data->set.ssl.max_ssl_sessions)
  398. /* cache is full, we must "kill" the oldest entry! */
  399. Curl_ssl_kill_session(store);
  400. else
  401. store = &data->state.session[i]; /* use this slot */
  402. /* now init the session struct wisely */
  403. store->sessionid = ssl_sessionid;
  404. store->idsize = idsize;
  405. store->age = *general_age; /* set current age */
  406. if(store->name)
  407. /* free it if there's one already present */
  408. free(store->name);
  409. store->name = clone_host; /* clone host name */
  410. store->remote_port = conn->remote_port; /* port number */
  411. /* Unlock */
  412. if(SSLSESSION_SHARED(data))
  413. Curl_share_unlock(data, CURL_LOCK_DATA_SSL_SESSION);
  414. if(!Curl_clone_ssl_config(&conn->ssl_config, &store->ssl_config)) {
  415. store->sessionid = NULL; /* let caller free sessionid */
  416. free(clone_host);
  417. return CURLE_OUT_OF_MEMORY;
  418. }
  419. return CURLE_OK;
  420. }
  421. void Curl_ssl_close_all(struct SessionHandle *data)
  422. {
  423. size_t i;
  424. /* kill the session ID cache if not shared */
  425. if(data->state.session && !SSLSESSION_SHARED(data)) {
  426. for(i = 0; i < data->set.ssl.max_ssl_sessions; i++)
  427. /* the single-killer function handles empty table slots */
  428. Curl_ssl_kill_session(&data->state.session[i]);
  429. /* free the cache data */
  430. Curl_safefree(data->state.session);
  431. }
  432. curlssl_close_all(data);
  433. }
  434. void Curl_ssl_close(struct connectdata *conn, int sockindex)
  435. {
  436. DEBUGASSERT((sockindex <= 1) && (sockindex >= -1));
  437. curlssl_close(conn, sockindex);
  438. }
  439. CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex)
  440. {
  441. if(curlssl_shutdown(conn, sockindex))
  442. return CURLE_SSL_SHUTDOWN_FAILED;
  443. conn->ssl[sockindex].use = FALSE; /* get back to ordinary socket usage */
  444. conn->ssl[sockindex].state = ssl_connection_none;
  445. conn->recv[sockindex] = Curl_recv_plain;
  446. conn->send[sockindex] = Curl_send_plain;
  447. return CURLE_OK;
  448. }
  449. /* Selects an SSL crypto engine
  450. */
  451. CURLcode Curl_ssl_set_engine(struct SessionHandle *data, const char *engine)
  452. {
  453. return curlssl_set_engine(data, engine);
  454. }
  455. /* Selects the default SSL crypto engine
  456. */
  457. CURLcode Curl_ssl_set_engine_default(struct SessionHandle *data)
  458. {
  459. return curlssl_set_engine_default(data);
  460. }
  461. /* Return list of OpenSSL crypto engine names. */
  462. struct curl_slist *Curl_ssl_engines_list(struct SessionHandle *data)
  463. {
  464. return curlssl_engines_list(data);
  465. }
  466. /*
  467. * This sets up a session ID cache to the specified size. Make sure this code
  468. * is agnostic to what underlying SSL technology we use.
  469. */
  470. CURLcode Curl_ssl_initsessions(struct SessionHandle *data, size_t amount)
  471. {
  472. struct curl_ssl_session *session;
  473. if(data->state.session)
  474. /* this is just a precaution to prevent multiple inits */
  475. return CURLE_OK;
  476. session = calloc(amount, sizeof(struct curl_ssl_session));
  477. if(!session)
  478. return CURLE_OUT_OF_MEMORY;
  479. /* store the info in the SSL section */
  480. data->set.ssl.max_ssl_sessions = amount;
  481. data->state.session = session;
  482. data->state.sessionage = 1; /* this is brand new */
  483. return CURLE_OK;
  484. }
  485. size_t Curl_ssl_version(char *buffer, size_t size)
  486. {
  487. return curlssl_version(buffer, size);
  488. }
  489. /*
  490. * This function tries to determine connection status.
  491. *
  492. * Return codes:
  493. * 1 means the connection is still in place
  494. * 0 means the connection has been closed
  495. * -1 means the connection status is unknown
  496. */
  497. int Curl_ssl_check_cxn(struct connectdata *conn)
  498. {
  499. return curlssl_check_cxn(conn);
  500. }
  501. bool Curl_ssl_data_pending(const struct connectdata *conn,
  502. int connindex)
  503. {
  504. return curlssl_data_pending(conn, connindex);
  505. }
  506. void Curl_ssl_free_certinfo(struct SessionHandle *data)
  507. {
  508. int i;
  509. struct curl_certinfo *ci = &data->info.certs;
  510. if(ci->num_of_certs) {
  511. /* free all individual lists used */
  512. for(i=0; i<ci->num_of_certs; i++) {
  513. curl_slist_free_all(ci->certinfo[i]);
  514. ci->certinfo[i] = NULL;
  515. }
  516. free(ci->certinfo); /* free the actual array too */
  517. ci->certinfo = NULL;
  518. ci->num_of_certs = 0;
  519. }
  520. }
  521. int Curl_ssl_init_certinfo(struct SessionHandle * data,
  522. int num)
  523. {
  524. struct curl_certinfo * ci = &data->info.certs;
  525. struct curl_slist * * table;
  526. /* Initialize the certificate information structures. Return 0 if OK, else 1.
  527. */
  528. Curl_ssl_free_certinfo(data);
  529. ci->num_of_certs = num;
  530. table = calloc((size_t) num, sizeof(struct curl_slist *));
  531. if(!table)
  532. return 1;
  533. ci->certinfo = table;
  534. return 0;
  535. }
  536. /*
  537. * 'value' is NOT a zero terminated string
  538. */
  539. CURLcode Curl_ssl_push_certinfo_len(struct SessionHandle *data,
  540. int certnum,
  541. const char *label,
  542. const char *value,
  543. size_t valuelen)
  544. {
  545. struct curl_certinfo * ci = &data->info.certs;
  546. char * output;
  547. struct curl_slist * nl;
  548. CURLcode res = CURLE_OK;
  549. size_t labellen = strlen(label);
  550. size_t outlen = labellen + 1 + valuelen + 1; /* label:value\0 */
  551. output = malloc(outlen);
  552. if(!output)
  553. return CURLE_OUT_OF_MEMORY;
  554. /* sprintf the label and colon */
  555. snprintf(output, outlen, "%s:", label);
  556. /* memcpy the value (it might not be zero terminated) */
  557. memcpy(&output[labellen+1], value, valuelen);
  558. /* zero terminate the output */
  559. output[labellen + 1 + valuelen] = 0;
  560. nl = Curl_slist_append_nodup(ci->certinfo[certnum], output);
  561. if(!nl) {
  562. free(output);
  563. curl_slist_free_all(ci->certinfo[certnum]);
  564. res = CURLE_OUT_OF_MEMORY;
  565. }
  566. ci->certinfo[certnum] = nl;
  567. return res;
  568. }
  569. /*
  570. * This is a convenience function for push_certinfo_len that takes a zero
  571. * terminated value.
  572. */
  573. CURLcode Curl_ssl_push_certinfo(struct SessionHandle *data,
  574. int certnum,
  575. const char *label,
  576. const char *value)
  577. {
  578. size_t valuelen = strlen(value);
  579. return Curl_ssl_push_certinfo_len(data, certnum, label, value, valuelen);
  580. }
  581. #ifdef have_curlssl_md5sum
  582. void Curl_ssl_md5sum(unsigned char *tmp, /* input */
  583. size_t tmplen,
  584. unsigned char *md5sum, /* output */
  585. size_t md5len)
  586. {
  587. curlssl_md5sum(tmp, tmplen, md5sum, md5len);
  588. }
  589. #endif
  590. #endif /* USE_SSL */