My Project
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
ps.h
Go to the documentation of this file.
1 #pragma once
2 
3 typedef enum
4 {
11 } ps_aes_algo;
12 
13 typedef enum
14 {
25 
26 /*
27  Requires access to "ps:ps" service
28 */
29 
30 Result psInit();
31 Result psExit();
32 
33 /* PS_EncryptDecryptAes()
34 About: Is an interface for the AES Engine, you can only use predetermined keyslots though.
35 Note: Does not support AES CCM, see PS_EncryptSignDecryptVerifyAesCcm()
36 
37  size size of data
38  in input buffer ptr
39  out output buffer ptr
40  aes_algo AES Algorithm to use, see ps_aes_algo
41  key_type see ps_aes_keytypes
42  iv ptr to the CTR/IV (This is updated before returning)
43 */
44 Result PS_EncryptDecryptAes(u32 size, u8* in, u8* out, u32 aes_algo, u32 key_type, u8* iv);
45 
46 /* PS_EncryptSignDecryptVerifyAesCcm()
47 About: Is an interface for the AES Engine (CCM Encrypt/Decrypt only), you can only use predetermined keyslots though.
48 Note: When encrypting, the output buffer size must include the MAC size, when decrypting, the input buffer size must include MAC size.
49 MAC: When decrypting, if the MAC is invalid, 0xC9010401 is returned. After encrypting the MAC is located at inputbufptr+(totalassocdata+totaldatasize)
50 
51  in input buffer ptr
52  in_size size of input buffer
53  out output buffer ptr
54  out_size size of output buffer
55  data_len length of data to be crypted
56  mac_data_len length of data associated with MAC
57  mac_len length of MAC
58  aes_algo AES Algorithm to use, see ps_aes_algo
59  key_type see ps_aes_keytypes
60  nonce ptr to the nonce
61 */
62 Result PS_EncryptSignDecryptVerifyAesCcm(u8* in, u32 in_size, u8* out, u32 out_size, u32 data_len, u32 mac_data_len, u32 mac_len, u32 aes_algo, u32 key_type, u8* nonce);
63 
64 /* PS_GetLocalFriendCodeSeed()
65 About: Gets a 64bit console id, it's used for some key slot inits
66 
67  seed ptr to where the seed is written to
68 */
70 
71 /* PS_GetDeviceId()
72 About: Gets a 32bit device id, it's used for some key slot inits
73 
74  device_id ptr to where the device id is written to
75 */
76 Result PS_GetDeviceId(u32* device_id);
Definition: ps.h:6
s32 Result
Definition: types.h:42
Result psExit()
Definition: ps.c:11
Definition: ps.h:7
uint8_t u8
Definition: types.h:21
Result PS_GetDeviceId(u32 *device_id)
Definition: ps.c:88
uint64_t u64
Definition: types.h:24
Definition: ps.h:8
Definition: ps.h:5
uint32_t u32
Definition: types.h:23
Definition: ps.h:10
Result PS_EncryptDecryptAes(u32 size, u8 *in, u8 *out, u32 aes_algo, u32 key_type, u8 *iv)
Definition: ps.c:16
ps_aes_algo
Definition: ps.h:3
Result PS_EncryptSignDecryptVerifyAesCcm(u8 *in, u32 in_size, u8 *out, u32 out_size, u32 data_len, u32 mac_data_len, u32 mac_len, u32 aes_algo, u32 key_type, u8 *nonce)
Definition: ps.c:46
Result PS_GetLocalFriendCodeSeed(u64 *seed)
Definition: ps.c:74
Result psInit()
Definition: ps.c:6
Definition: ps.h:9
ps_aes_keytypes
Definition: ps.h:13