Initial commit - from Precise source
[freerdp-ubuntu-pcb-backport.git] / libfreerdp-core / security.h
1 /**
2  * FreeRDP: A Remote Desktop Protocol Client
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 __SECURITY_H
21 #define __SECURITY_H
22
23 #include "rdp.h"
24 #include "crypto.h"
25
26 #include <freerdp/freerdp.h>
27 #include <freerdp/utils/stream.h>
28
29 void security_master_secret(uint8* premaster_secret, uint8* client_random, uint8* server_random, uint8* output);
30 void security_session_key_blob(uint8* master_secret, uint8* client_random, uint8* server_random, uint8* output);
31 void security_mac_salt_key(uint8* session_key_blob, uint8* client_random, uint8* server_random, uint8* output);
32 void security_licensing_encryption_key(uint8* session_key_blob, uint8* client_random, uint8* server_random, uint8* output);
33 void security_mac_data(uint8* mac_salt_key, uint8* data, uint32 length, uint8* output);
34
35 void security_mac_signature(rdpRdp *rdp, uint8* data, uint32 length, uint8* output);
36 void security_salted_mac_signature(rdpRdp *rdp, uint8* data, uint32 length, boolean encryption, uint8* output);
37 boolean security_establish_keys(uint8* client_random, rdpRdp* rdp);
38
39 boolean security_encrypt(uint8* data, int length, rdpRdp* rdp);
40 boolean security_decrypt(uint8* data, int length, rdpRdp* rdp);
41
42 void security_hmac_signature(uint8* data, int length, uint8* output, rdpRdp* rdp);
43 boolean security_fips_encrypt(uint8* data, int length, rdpRdp* rdp);
44 boolean security_fips_decrypt(uint8* data, int length, rdpRdp* rdp);
45 boolean security_fips_check_signature(uint8* data, int length, uint8* sig, rdpRdp* rdp);
46
47 #endif /* __SECURITY_H */