mirror of
https://github.com/curl/curl.git
synced 2026-08-25 20:53:37 +03:00
CURLcode: add CURLE_SSL_CLIENTCERT
When a TLS server requests a client certificate during handshake and none can be provided, libcurl now returns this new error code CURLE_SSL_CLIENTCERT Only supported by Secure Transport and OpenSSL for TLS 1.3 so far. Closes #6721
This commit is contained in:
parent
0acfe05c2e
commit
94241a9e78
7 changed files with 26 additions and 4 deletions
|
|
@ -320,9 +320,12 @@ curl_easy_strerror(CURLcode error)
|
|||
case CURLE_QUIC_CONNECT_ERROR:
|
||||
return "QUIC connection error";
|
||||
|
||||
case CURLE_PROXY:
|
||||
case CURLE_PROXY:
|
||||
return "proxy handshake error";
|
||||
|
||||
case CURLE_SSL_CLIENTCERT:
|
||||
return "SSL Client Certificate required";
|
||||
|
||||
/* error codes not used by current libcurl */
|
||||
case CURLE_OBSOLETE20:
|
||||
case CURLE_OBSOLETE24:
|
||||
|
|
|
|||
|
|
@ -3292,6 +3292,19 @@ static CURLcode ossl_connect_step2(struct Curl_easy *data,
|
|||
error_buffer */
|
||||
strcpy(error_buffer, "SSL certificate verification failed");
|
||||
}
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x10101000L && \
|
||||
!defined(LIBRESSL_VERSION_NUMBER) && \
|
||||
!defined(OPENSSL_IS_BORINGSSL))
|
||||
/* SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED is only available on
|
||||
OpenSSL version above v1.1.1, not Libre SSL nor BoringSSL */
|
||||
else if((lib == ERR_LIB_SSL) &&
|
||||
(reason == SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED)) {
|
||||
/* If client certificate is required, communicate the
|
||||
error to client */
|
||||
result = CURLE_SSL_CLIENTCERT;
|
||||
ossl_strerror(errdetail, error_buffer, sizeof(error_buffer));
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
result = CURLE_SSL_CONNECT_ERROR;
|
||||
ossl_strerror(errdetail, error_buffer, sizeof(error_buffer));
|
||||
|
|
|
|||
|
|
@ -2708,8 +2708,9 @@ sectransp_connect_step2(struct Curl_easy *data, struct connectdata *conn,
|
|||
#if CURL_BUILD_MAC_10_6
|
||||
/* Only returned when kSSLSessionOptionBreakOnCertRequested is set */
|
||||
case errSSLClientCertRequested:
|
||||
failf(data, "The server has requested a client certificate");
|
||||
break;
|
||||
failf(data, "Server requested a client certificate during the "
|
||||
"handshake");
|
||||
return CURLE_SSL_CLIENTCERT;
|
||||
#endif
|
||||
#if CURL_BUILD_MAC_10_9
|
||||
/* Alias for errSSLLast, end of error range */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue