1 /**
2  * FreeRDP: A Remote Desktop Protocol Implementation
3  * RDP Security
4  *
5  * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef FREERDP_LIB_CORE_SECURITY_H
21 #define FREERDP_LIB_CORE_SECURITY_H
22 
23 #include "rdp.h"
24 #include <freerdp/crypto/crypto.h>
25 
26 #include <freerdp/freerdp.h>
27 #include <freerdp/api.h>
28 
29 #include <winpr/stream.h>
30 
31 FREERDP_LOCAL BOOL security_master_secret(const BYTE* premaster_secret, const BYTE* client_random,
32                                           const BYTE* server_random, BYTE* output);
33 FREERDP_LOCAL BOOL security_session_key_blob(const BYTE* master_secret, const BYTE* client_random,
34                                              const BYTE* server_random, BYTE* output);
35 FREERDP_LOCAL void security_mac_salt_key(const BYTE* session_key_blob, const BYTE* client_random,
36                                          const BYTE* server_random, BYTE* output);
37 FREERDP_LOCAL BOOL security_licensing_encryption_key(const BYTE* session_key_blob,
38                                                      const BYTE* client_random,
39                                                      const BYTE* server_random, BYTE* output);
40 FREERDP_LOCAL BOOL security_mac_data(const BYTE* mac_salt_key, const BYTE* data, UINT32 length,
41                                      BYTE* output);
42 FREERDP_LOCAL BOOL security_mac_signature(rdpRdp* rdp, const BYTE* data, UINT32 length,
43                                           BYTE* output);
44 FREERDP_LOCAL BOOL security_salted_mac_signature(rdpRdp* rdp, const BYTE* data, UINT32 length,
45                                                  BOOL encryption, BYTE* output);
46 FREERDP_LOCAL BOOL security_establish_keys(const BYTE* client_random, rdpRdp* rdp);
47 FREERDP_LOCAL BOOL security_encrypt(BYTE* data, size_t length, rdpRdp* rdp);
48 FREERDP_LOCAL BOOL security_decrypt(BYTE* data, size_t length, rdpRdp* rdp);
49 FREERDP_LOCAL BOOL security_hmac_signature(const BYTE* data, size_t length, BYTE* output,
50                                            rdpRdp* rdp);
51 FREERDP_LOCAL BOOL security_fips_encrypt(BYTE* data, size_t length, rdpRdp* rdp);
52 FREERDP_LOCAL BOOL security_fips_decrypt(BYTE* data, size_t length, rdpRdp* rdp);
53 FREERDP_LOCAL BOOL security_fips_check_signature(const BYTE* data, size_t length, const BYTE* sig,
54                                                  rdpRdp* rdp);
55 
56 #endif /* FREERDP_LIB_CORE_SECURITY_H */
57