Blame include/freerdp/crypto/tls.h

Packit 1fb8d4
/**
Packit 1fb8d4
 * FreeRDP: A Remote Desktop Protocol Implementation
Packit 1fb8d4
 * Transport Layer Security
Packit 1fb8d4
 *
Packit 1fb8d4
 * Copyright 2011-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
Packit 1fb8d4
 *
Packit 1fb8d4
 * Licensed under the Apache License, Version 2.0 (the "License");
Packit 1fb8d4
 * you may not use this file except in compliance with the License.
Packit 1fb8d4
 * You may obtain a copy of the License at
Packit 1fb8d4
 *
Packit 1fb8d4
 *     http://www.apache.org/licenses/LICENSE-2.0
Packit 1fb8d4
 *
Packit 1fb8d4
 * Unless required by applicable law or agreed to in writing, software
Packit 1fb8d4
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit 1fb8d4
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 1fb8d4
 * See the License for the specific language governing permissions and
Packit 1fb8d4
 * limitations under the License.
Packit 1fb8d4
 */
Packit 1fb8d4
Packit 1fb8d4
#ifndef FREERDP_CRYPTO_TLS_H
Packit 1fb8d4
#define FREERDP_CRYPTO_TLS_H
Packit 1fb8d4
Packit 1fb8d4
#include "crypto.h"
Packit 1fb8d4
#include "certificate.h"
Packit 1fb8d4
Packit 1fb8d4
#include <winpr/crt.h>
Packit 1fb8d4
#include <winpr/sspi.h>
Packit 1fb8d4
Packit 1fb8d4
#include <openssl/ssl.h>
Packit 1fb8d4
#include <openssl/err.h>
Packit 1fb8d4
Packit 1fb8d4
#include <freerdp/api.h>
Packit 1fb8d4
#include <freerdp/types.h>
Packit 1fb8d4
Packit 1fb8d4
#include <winpr/stream.h>
Packit 1fb8d4
Packit Service 5a9772
#define TLS_ALERT_LEVEL_WARNING 1
Packit Service 5a9772
#define TLS_ALERT_LEVEL_FATAL 2
Packit Service 5a9772
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_CLOSE_NOTIFY 0
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_UNEXPECTED_MESSAGE 10
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_BAD_RECORD_MAC 20
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_DECRYPTION_FAILED 21
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_RECORD_OVERFLOW 22
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_DECOMPRESSION_FAILURE 30
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_HANSHAKE_FAILURE 40
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_NO_CERTIFICATE 41
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_BAD_CERTIFICATE 42
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE 43
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_CERTIFICATE_REVOKED 44
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_CERTIFICATE_EXPIRED 45
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN 46
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_ILLEGAL_PARAMETER 47
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_UNKNOWN_CA 48
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_ACCESS_DENIED 49
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_DECODE_ERROR 50
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_DECRYPT_ERROR 51
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_EXPORT_RESTRICTION 60
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_PROTOCOL_VERSION 70
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_INSUFFICIENT_SECURITY 71
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_INTERNAL_ERROR 80
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_USER_CANCELED 90
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_NO_RENEGOTIATION 100
Packit Service 5a9772
#define TLS_ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION 110
Packit 1fb8d4
Packit 1fb8d4
typedef struct rdp_tls rdpTls;
Packit 1fb8d4
Packit 1fb8d4
struct rdp_tls
Packit 1fb8d4
{
Packit 1fb8d4
	SSL* ssl;
Packit 1fb8d4
	BIO* bio;
Packit 1fb8d4
	void* tsg;
Packit 1fb8d4
	SSL_CTX* ctx;
Packit 1fb8d4
	BYTE* PublicKey;
Packit 1fb8d4
	DWORD PublicKeyLength;
Packit 1fb8d4
	rdpSettings* settings;
Packit 1fb8d4
	SecPkgContext_Bindings* Bindings;
Packit 1fb8d4
	rdpCertificateStore* certificate_store;
Packit 1fb8d4
	BIO* underlying;
Packit 1fb8d4
	char* hostname;
Packit 1fb8d4
	int port;
Packit 1fb8d4
	int alertLevel;
Packit 1fb8d4
	int alertDescription;
Packit 1fb8d4
	BOOL isGatewayTransport;
Packit 1fb8d4
};
Packit 1fb8d4
Packit 1fb8d4
#ifdef __cplusplus
Packit Service 5a9772
extern "C"
Packit Service 5a9772
{
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit Service 5a9772
	FREERDP_API int tls_connect(rdpTls* tls, BIO* underlying);
Packit Service 5a9772
	FREERDP_API BOOL tls_accept(rdpTls* tls, BIO* underlying, rdpSettings* settings);
Packit Service 5a9772
	FREERDP_API BOOL tls_send_alert(rdpTls* tls);
Packit 1fb8d4
Packit Service 5a9772
	FREERDP_API int tls_write_all(rdpTls* tls, const BYTE* data, int length);
Packit 1fb8d4
Packit Service 5a9772
	FREERDP_API int tls_set_alert_code(rdpTls* tls, int level, int description);
Packit 1fb8d4
Packit Service 5a9772
	FREERDP_API rdpTls* tls_new(rdpSettings* settings);
Packit Service 5a9772
	FREERDP_API void tls_free(rdpTls* tls);
Packit 1fb8d4
Packit 1fb8d4
#ifdef __cplusplus
Packit 1fb8d4
}
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#endif /* FREERDP_CRYPTO_TLS_H */