18 #ifndef _VAL_CRYPTO_H_ 19 #define _VAL_CRYPTO_H_ 22 #include "psa/client.h" 23 #include "crypto_values.h" 26 #define BYTES_TO_BITS(byte) (byte * 8) 29 #define AES_16B_KEY_SIZE 16 30 #define AES_24B_KEY_SIZE 24 31 #define AES_32B_KEY_SIZE 32 32 #define AES_18B_KEY_SIZE 18 33 #define AES_34B_KEY_SIZE 34 34 #define DES_8B_KEY_SIZE 8 35 #define DES3_2KEY_SIZE 16 36 #define DES3_3KEY_SIZE 24 42 #define BUFFER_SIZE 1200 44 #define BUFFER_SIZE_HIGH 5130 47 #define INVALID_KEY_SLOT 0xDEAD 48 #define ZERO_KEY_SLOT 0 49 #define OCCUPIED_KEY_SLOT 1 50 #define MAX_KEY_SLOT 32 52 #define PSA_KEY_LIFETIME_INVALID 0xFFFFFFFF 53 #define PSA_KEY_USAGE_INVALID 0xFFFFFFFF 54 #define PSA_ALG_INVALID 0xFFFFFFFF 56 enum crypto_function_code {
57 VAL_CRYPTO_INIT = 0x1,
58 VAL_CRYPTO_GENERATE_RANDOM = 0x2,
59 VAL_CRYPTO_IMPORT_KEY = 0x3,
60 VAL_CRYPTO_EXPORT_KEY = 0x4,
61 VAL_CRYPTO_EXPORT_PUBLIC_KEY = 0x5,
62 VAL_CRYPTO_DESTROY_KEY = 0x6,
63 VAL_CRYPTO_GET_KEY_INFO = 0x7,
64 VAL_CRYPTO_KEY_POLICY_INIT = 0x8,
65 VAL_CRYPTO_KEY_POLICY_SET_USAGE = 0x9,
66 VAL_CRYPTO_KEY_POLICY_GET_USAGE = 0xA,
67 VAL_CRYPTO_KEY_POLICY_GET_ALGORITHM = 0xB,
68 VAL_CRYPTO_SET_KEY_POLICY = 0xC,
69 VAL_CRYPTO_GET_KEY_POLICY = 0xD,
70 VAL_CRYPTO_GET_KEY_INFORMATION = 0xE,
71 VAL_CRYPTO_GET_KEY_LIFETIME = 0xF,
72 VAL_CRYPTO_HASH_SETUP = 0x11,
73 VAL_CRYPTO_HASH_UPDATE = 0x12,
74 VAL_CRYPTO_HASH_VERIFY = 0x13,
75 VAL_CRYPTO_HASH_FINISH = 0x14,
76 VAL_CRYPTO_HASH_ABORT = 0x15,
77 VAL_CRYPTO_GENERATE_KEY = 0x16,
78 VAL_CRYPTO_GENERATOR_READ = 0x17,
79 VAL_CRYPTO_KEY_DERIVATION = 0x18,
80 VAL_CRYPTO_GET_GENERATOR_CAPACITY = 0x19,
81 VAL_CRYPTO_GENERATOR_IMPORT_KEY = 0x1A,
82 VAL_CRYPTO_GENERATOR_ABORT = 0x1B,
83 VAL_CRYPTO_AEAD_ENCRYPT = 0x1C,
84 VAL_CRYPTO_AEAD_DECRYPT = 0x1D,
85 VAL_CRYPTO_MAC_SIGN_SETUP = 0x1E,
86 VAL_CRYPTO_MAC_UPDATE = 0x1F,
87 VAL_CRYPTO_MAC_SIGN_FINISH = 0x20,
88 VAL_CRYPTO_MAC_VERIFY_SETUP = 0x21,
89 VAL_CRYPTO_MAC_VERIFY_FINISH = 0x22,
90 VAL_CRYPTO_MAC_ABORT = 0x23,
91 VAL_CRYPTO_ASYMMTERIC_ENCRYPT = 0x24,
92 VAL_CRYPTO_ASYMMTERIC_DECRYPT = 0x25,
93 VAL_CRYPTO_CIPHER_ENCRYPT_SETUP = 0x26,
94 VAL_CRYPTO_CIPHER_DECRYPT_SETUP = 0x2A,
95 VAL_CRYPTO_CIPHER_GENERATE_IV = 0x2B,
96 VAL_CRYPTO_CIPHER_SET_IV = 0x2C,
97 VAL_CRYPTO_CIPHER_UPDATE = 0x2D,
98 VAL_CRYPTO_CIPHER_FINISH = 0x2E,
99 VAL_CRYPTO_CIPHER_ABORT = 0x2F,
100 VAL_CRYPTO_ASYMMTERIC_SIGN = 0x30,
101 VAL_CRYPTO_ASYMMTERIC_VERIFY = 0x31,
102 VAL_CRYPTO_KEY_AGREEMENT = 0x32,
103 VAL_CRYPTO_ALLOCATE_KEY = 0x33,
104 VAL_CRYPTO_FREE = 0xFE,
107 int32_t val_crypto_function(
int type, ...);
Copyright (c) 2018-2019, Arm Limited or its affiliates.