diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/SecCryptoSvc.h | 88 | ||||
-rw-r--r-- | include/SecTzSvc.h | 10 | ||||
-rw-r--r-- | include/device_info.h | 4 |
3 files changed, 54 insertions, 48 deletions
diff --git a/include/SecCryptoSvc.h b/include/SecCryptoSvc.h index 6a9f696..4d5e572 100644 --- a/include/SecCryptoSvc.h +++ b/include/SecCryptoSvc.h @@ -33,27 +33,27 @@ extern "C" /*typedef enum { - SEC_CRYPTO_CIPHER_NULL = 0, - SEC_CRYPTO_CIPHER_AES_CBC_128, - SEC_CRYPTO_CIPHER_SEED_CBC, - SEC_CRYPTO_CIPHER_AES_CBC_192, - SEC_CRYPTO_CIPHER_AES_CBC_256, - SEC_CRYPTO_CIPHER_AES_CTR_128, - SEC_CRYPTO_CIPHER_AES_ECB_128, - SEC_CRYPTO_CIPHER_AES_ECB_192, - SEC_CRYPTO_CIPHER_AES_ECB_256 + SEC_CRYPTO_CIPHER_NULL = 0, + SEC_CRYPTO_CIPHER_AES_CBC_128, + SEC_CRYPTO_CIPHER_SEED_CBC, + SEC_CRYPTO_CIPHER_AES_CBC_192, + SEC_CRYPTO_CIPHER_AES_CBC_256, + SEC_CRYPTO_CIPHER_AES_CTR_128, + SEC_CRYPTO_CIPHER_AES_ECB_128, + SEC_CRYPTO_CIPHER_AES_ECB_192, + SEC_CRYPTO_CIPHER_AES_ECB_256 } SecCryptoCipherAlg; typedef enum { - SEC_SUCCESS = 0, - SEC_CRYPTO_ERROR_1, //algorithm error - SEC_CRYPTO_ERROR_2, //init error - SEC_CRYPTO_ERROR_3, //update error - SEC_CRYPTO_ERROR_4, //final error - SEC_CRYPTO_ERROR_5, //wrong param - SEC_CRYPTO_ERROR_6, //Memory alloc - SEC_CRYPTO_ERROR_7, //Internal error + SEC_SUCCESS = 0, + SEC_CRYPTO_ERROR_1, //algorithm error + SEC_CRYPTO_ERROR_2, //init error + SEC_CRYPTO_ERROR_3, //update error + SEC_CRYPTO_ERROR_4, //final error + SEC_CRYPTO_ERROR_5, //wrong param + SEC_CRYPTO_ERROR_6, //Memory alloc + SEC_CRYPTO_ERROR_7, //Internal error } SecError; */ @@ -80,18 +80,18 @@ typedef enum #define UINT32 unsigned int #endif -//#define EVP_ERROR 0 -//#define SEC_CRYPTO_ENCRYPT 1 -//#define SEC_CRYPTO_DECRYPT 0 -#define SEC_DUK_SIZE 16 -//#define SEC_CRYPTO_KEY_LENGTH 16 -//#define SEC_CRYPTP_ARR_LENGTH 1024 -#define SEC_FRAME_OSP_KEY "uniqueKey" -//#define SHA1_DIGEST_VALUE_LEN 20 -#define SHA256_DIGEST_VALUE_LEN 32 -//#define KDF_KEYLEN 16 -#define HASH_LEN 20 -//#define SEC_KEYMGR_FEK_SIZE 16 +//#define EVP_ERROR 0 +//#define SEC_CRYPTO_ENCRYPT 1 +//#define SEC_CRYPTO_DECRYPT 0 +#define SEC_DUK_SIZE 16 +//#define SEC_CRYPTO_KEY_LENGTH 16 +//#define SEC_CRYPTP_ARR_LENGTH 1024 +#define SEC_FRAME_OSP_KEY "uniqueKey" +//#define SHA1_DIGEST_VALUE_LEN 20 +#define SHA256_DIGEST_VALUE_LEN 32 +//#define KDF_KEYLEN 16 +#define HASH_LEN 20 +//#define SEC_KEYMGR_FEK_SIZE 16 #define CS_ERROR_NONE 0 #define CS_ERROR_BAD_ALLOC -1 @@ -100,27 +100,27 @@ typedef enum /*------ Base64 Encoding Table ------*/ static const char Base64EncodingTable[] = { - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', - 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', - 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', - 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', - 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', - 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', - 'w', 'x', 'y', 'z', '0', '1', '2', '3', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', + 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', + 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', + 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' }; /** - * This function provides Device UniqueKey for crypto with Hash - * @return This function returns TRUE on success - * @param[in] uLen Length of Device UniqueKey - * @param[in,out] pCek Device UniqueKey(Hashed) + * This function provides Device UniqueKey for crypto with Hash + * @return This function returns TRUE on success + * @param[in] uLen Length of Device UniqueKey + * @param[in,out] pCek Device UniqueKey(Hashed) */ bool SecFrameGeneratePlatformUniqueKey(IN UINT32 uLen, IN OUT UINT8 *pCek); -char* Base64Encoding(const char *data, int size); +char *Base64Encoding(const char *data, int size); -char* GetDuid(int size); +char *GetDuid(int size); /* * Password based derivation routines with platform key @@ -140,11 +140,11 @@ char* GetDuid(int size); * and keylen should be bigger than 0 */ int cs_derive_key_with_pass(const char *pass, int passlen, int keylen, - unsigned char **key); + unsigned char **key); #ifdef __cplusplus } #endif -#endif // _SEC_CRYPTO_SVC_H +#endif // _SEC_CRYPTO_SVC_H diff --git a/include/SecTzSvc.h b/include/SecTzSvc.h index 5ac5886..c4485e3 100644 --- a/include/SecTzSvc.h +++ b/include/SecTzSvc.h @@ -58,7 +58,10 @@ typedef unsigned long TZCRYPT_UINT64; * return SEC_CRYPTO_SUCCESS if operation has been succesfully completed. (Refer to the tlc error code) */ __attribute__((visibility("default"))) -TZCRYPT_Result SecEncryptTZCrypt(TZCRYPT_UINT8 *Src, TZCRYPT_UINT32 SrcLen, TZCRYPT_UINT8 *Dst, TZCRYPT_UINT32 *DstLen, TZCRYPT_UINT8 *AppInfo, TZCRYPT_UINT32 AppInfoLen, TZCRYPT_UINT8 *WrapAppInfo, TZCRYPT_UINT32 *WrapAppInfoLen); +TZCRYPT_Result SecEncryptTZCrypt(TZCRYPT_UINT8 *Src, TZCRYPT_UINT32 SrcLen, + TZCRYPT_UINT8 *Dst, TZCRYPT_UINT32 *DstLen, TZCRYPT_UINT8 *AppInfo, + TZCRYPT_UINT32 AppInfoLen, TZCRYPT_UINT8 *WrapAppInfo, + TZCRYPT_UINT32 *WrapAppInfoLen); /* * This function provides an decryption of user data. @@ -76,7 +79,10 @@ TZCRYPT_Result SecEncryptTZCrypt(TZCRYPT_UINT8 *Src, TZCRYPT_UINT32 SrcLen, TZCR * If a given application information (identifier) is wrong, then return UNIT_TEXT_HASH_ERROR */ __attribute__((visibility("default"))) -TZCRYPT_Result SecDecryptTZCrypt(TZCRYPT_UINT8 *Src, TZCRYPT_UINT32 SrcLen, TZCRYPT_UINT8 *Dst, TZCRYPT_UINT32 *DstLen, TZCRYPT_UINT8 *AppInfo, TZCRYPT_UINT32 AppInfoLen, TZCRYPT_UINT8 *WrapAppInfo, TZCRYPT_UINT32 WrapAppInfoLen); +TZCRYPT_Result SecDecryptTZCrypt(TZCRYPT_UINT8 *Src, TZCRYPT_UINT32 SrcLen, + TZCRYPT_UINT8 *Dst, TZCRYPT_UINT32 *DstLen, TZCRYPT_UINT8 *AppInfo, + TZCRYPT_UINT32 AppInfoLen, TZCRYPT_UINT8 *WrapAppInfo, + TZCRYPT_UINT32 WrapAppInfoLen); /* * This function provides the length of a given src len diff --git a/include/device_info.h b/include/device_info.h index d4c0e24..814839b 100644 --- a/include/device_info.h +++ b/include/device_info.h @@ -47,14 +47,14 @@ extern "C" { * device_id = get_device_id(); * if(device_id == NULL) * { - * // Error handling + * // Error handling * } * * ... * @endcode * */ -const char* get_device_id(void); +const char *get_device_id(void); #ifdef __cplusplus } |