CCF
Loading...
Searching...
No Matches
tls.h
Go to the documentation of this file.
1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the Apache 2.0 License.
3#pragma once
4
5// These macros setup return values for when the connection is reading/writing
6// and needs more data or has an error.
7//
8// In OpenSSL, the return is -1/0/1 and the error code depends on what
9// SSL_want() returns. So we need to return some distinct negative number
10// and then handle WANT_READ/WANT_WRITE and errors.
11//
12// Depending on the error, the connection needs to close with success, failure
13// or auth-failure.
14#define TLS_READING -SSL_READING
15#define TLS_WRITING -SSL_WRITING
16#define TLS_ERR_WANT_READ -SSL_ERROR_WANT_READ
17#define TLS_ERR_WANT_WRITE -SSL_ERROR_WANT_WRITE
18#define TLS_ERR_CONN_CLOSE_NOTIFY -SSL_ERROR_ZERO_RETURN
19#define TLS_ERR_NEED_CERT -SSL_ERROR_WANT_X509_LOOKUP
20// Specific error to check validity of certificate, not emitted by OpenSSL, but
21// by Context. We set to a bogus negative value that won't match any OpenSSL
22// error code.
23// Once we refactor the code to match the OpenSSL style we may not need this.
24#define TLS_ERR_X509_VERIFY INT_MIN
25
27
28#include <string>
29
30namespace tls
31{
32 inline std::string error_string(int ec)
33 {
35 }
36}
std::string error_string(unsigned long ec)
Returns the error string from an error code.
Definition openssl_wrappers.h:35
Definition key_exchange.h:18
std::string error_string(int ec)
Definition tls.h:32