blob: 4c358e95da19969bb3eecee0f9a7a457a53ea76e [file] [log] [blame]
Alexandre Lisionddd731e2014-01-31 11:50:08 -05001// Copyright (C) 2010 David Sugar, Tycho Softworks.
2//
3// This file is part of GNU uCommon C++.
4//
5// GNU uCommon C++ is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published
7// by the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// GNU uCommon C++ is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with GNU uCommon C++. If not, see <http://www.gnu.org/licenses/>.
17
18#include <ucommon-config.h>
19#include <ucommon/ucommon.h>
20#include <ucommon/export.h>
21#include <ucommon/secure.h>
22#include <gnutls/gnutls.h>
23#include <gnutls/crypto.h>
24
25#ifdef _MSWINDOWS_
26#include <wincrypt.h>
27#endif
28
29#define NAMESPACE_LOCAL namespace __secure__ {
30#define LOCAL_NAMESPACE __secure__
31
32NAMESPACE_LOCAL
33using namespace UCOMMON_NAMESPACE;
34
35class __LOCAL context : public secure
36{
37public:
38 ~context();
39
40 unsigned int connect;
41 gnutls_credentials_type_t xtype;
42 gnutls_certificate_credentials_t xcred;
43 gnutls_dh_params_t dh;
44
45 static gnutls_priority_t priority_cache;
46
47 static gnutls_session_t session(context *ctx);
48
49 static int map_digest(const char *type);
50 static int map_cipher(const char *type);
51 static int map_hmac(const char *type);
52};
53
54typedef gnutls_session_t SSL;
55typedef gnutls_mac_algorithm_t HMAC_ID;
56typedef gnutls_hmac_hd_t HMAC_CTX;
57typedef gnutls_digest_algorithm_t MD_ID;
58typedef gnutls_hash_hd_t MD_CTX;
59typedef gnutls_cipher_hd_t CIPHER_CTX;
60typedef gnutls_cipher_algorithm_t CIPHER_ID;
61typedef gnutls_datum_t CIPHER_KEYDATA;
62typedef context *SSL_CTX;
63
64END_NAMESPACE
65
66using namespace UCOMMON_NAMESPACE;
67using namespace LOCAL_NAMESPACE;