1 | /* -*- c-basic-offset: 8 -*-
|
---|
2 | rdesktop: A Remote Desktop Protocol client.
|
---|
3 | Secure sockets abstraction layer
|
---|
4 | Copyright (C) Matthew Chapman 1999-2008
|
---|
5 | Copyright (C) Jay Sorg 2006-2008
|
---|
6 |
|
---|
7 | This program is free software: you can redistribute it and/or modify
|
---|
8 | it under the terms of the GNU General Public License as published by
|
---|
9 | the Free Software Foundation, either version 3 of the License, or
|
---|
10 | (at your option) any later version.
|
---|
11 |
|
---|
12 | This program is distributed in the hope that it will be useful,
|
---|
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | GNU General Public License for more details.
|
---|
16 |
|
---|
17 | You should have received a copy of the GNU General Public License
|
---|
18 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 |
|
---|
21 | /*
|
---|
22 | * Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
23 | * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
|
---|
24 | * the General Public License version 2 (GPLv2) at this time for any software where
|
---|
25 | * a choice of GPL license versions is made available with the language indicating
|
---|
26 | * that GPLv2 or any later version may be used, or where a choice of which version
|
---|
27 | * of the GPL is applied is otherwise unspecified.
|
---|
28 | */
|
---|
29 |
|
---|
30 | #ifndef _RDSSL_H
|
---|
31 | #define _RDSSL_H
|
---|
32 |
|
---|
33 | #include <openssl/rc4.h>
|
---|
34 | #include <openssl/md5.h>
|
---|
35 | #include <openssl/sha.h>
|
---|
36 | #include <openssl/bn.h>
|
---|
37 | #include <openssl/x509v3.h>
|
---|
38 | #include <openssl/hmac.h>
|
---|
39 |
|
---|
40 | #if defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x0090800f)
|
---|
41 | #define D2I_X509_CONST const
|
---|
42 | #else
|
---|
43 | #define D2I_X509_CONST
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | #define RDSSL_RC4 RC4_KEY
|
---|
47 | #define RDSSL_SHA1 SHA_CTX
|
---|
48 | #define RDSSL_MD5 MD5_CTX
|
---|
49 | #define RDSSL_CERT X509
|
---|
50 | #define RDSSL_RKEY RSA
|
---|
51 |
|
---|
52 | void rdssl_sha1_init(RDSSL_SHA1 * sha1);
|
---|
53 | void rdssl_sha1_update(RDSSL_SHA1 * sha1, uint8 * data, uint32 len);
|
---|
54 | void rdssl_sha1_final(RDSSL_SHA1 * sha1, uint8 * out_data);
|
---|
55 | void rdssl_md5_init(RDSSL_MD5 * md5);
|
---|
56 | void rdssl_md5_update(RDSSL_MD5 * md5, uint8 * data, uint32 len);
|
---|
57 | void rdssl_md5_final(RDSSL_MD5 * md5, uint8 * out_data);
|
---|
58 | void rdssl_rc4_set_key(RDSSL_RC4 * rc4, uint8 * key, uint32 len);
|
---|
59 | void rdssl_rc4_crypt(RDSSL_RC4 * rc4, uint8 * in_data, uint8 * out_data, uint32 len);
|
---|
60 | void rdssl_rsa_encrypt(uint8 * out, uint8 * in, int len, uint32 modulus_size, uint8 * modulus,
|
---|
61 | uint8 * exponent);
|
---|
62 | RDSSL_CERT *rdssl_cert_read(uint8 * data, uint32 len);
|
---|
63 | void rdssl_cert_free(RDSSL_CERT * cert);
|
---|
64 | RDSSL_RKEY *rdssl_cert_to_rkey(RDSSL_CERT * cert, uint32 * key_len);
|
---|
65 | RD_BOOL rdssl_certs_ok(RDSSL_CERT * server_cert, RDSSL_CERT * cacert);
|
---|
66 | int rdssl_cert_print_fp(FILE * fp, RDSSL_CERT * cert);
|
---|
67 | void rdssl_rkey_free(RDSSL_RKEY * rkey);
|
---|
68 | int rdssl_rkey_get_exp_mod(RDSSL_RKEY * rkey, uint8 * exponent, uint32 max_exp_len, uint8 * modulus,
|
---|
69 | uint32 max_mod_len);
|
---|
70 | RD_BOOL rdssl_sig_ok(uint8 * exponent, uint32 exp_len, uint8 * modulus, uint32 mod_len,
|
---|
71 | uint8 * signature, uint32 sig_len);
|
---|
72 |
|
---|
73 | void rdssl_hmac_md5(const void *key, int key_len,
|
---|
74 | const unsigned char *msg, int msg_len, unsigned char *md);
|
---|
75 |
|
---|
76 | #endif
|
---|