OPTIGA™ Trust M
Host Library Documentation
examples/tools/protected_update_data_set/include/pal/pal_crypt.h
Go to the documentation of this file.
1 
39 #ifndef _PROTECTED_UPDATE_PAL_CRYPTO_
40 #define _PROTECTED_UPDATE_PAL_CRYPTO_
41 
42 #include <stdint.h>
44 
45 typedef struct pal_crypt
46 {
48  void * callback_ctx;
50 
54 typedef uint16_t pal_status_t;
55 
56 // Generates hash
58  uint8_t hash_algorithm,
59  const uint8_t * p_message,
60  uint32_t message_length,
61  uint8_t * p_digest);
62 
63 // Calculates signature
65  uint8_t * p_digest,
66  uint16_t digest_length,
67  uint8_t * p_signature,
68  uint16_t * signature_length,
69  const uint8_t * p_private_key,
70  uint16_t private_key_length);
71 
72 // Gets the signature length based on private key
74  uint16_t * sign_len,
75  signature_algo_t sign_algo);
76 
77 // Generate encrypted data
79  const uint8_t * p_plain_text,
80  uint16_t plain_text_length,
81  const uint8_t * p_encrypt_key,
82  const uint8_t * p_nonce,
83  uint16_t nonce_length,
84  const uint8_t * p_associated_data,
85  uint16_t associated_data_length,
86  uint8_t mac_size,
87  uint8_t * p_cipher_text);
88 // Derive key
90  const uint8_t * p_secret,
91  uint16_t secret_length,
92  const uint8_t * p_label,
93  uint16_t label_length,
94  const uint8_t * p_seed,
95  uint16_t seed_length,
96  uint8_t * p_derived_key,
97  uint16_t derived_key_length);
98 
99 
100 // Generate random
102  uint8_t * p_random_data ,
103  uint16_t random_data_length );
104 
105 // Set seed
107  uint8_t * p_seed,
108  uint16_t seed_length);
109 
111 
113  uint8_t ** D, uint16_t * D_length,
114  uint8_t ** X, uint16_t * X_length,
115  uint8_t ** Y, uint16_t * Y_length);
116 
118  uint8_t ** N, uint16_t * N_length,
119  uint8_t ** E, uint16_t * E_length,
120  uint8_t ** D, uint16_t * D_length);
121 
122 #endif //_PROTECTED_UPDATE_PAL_CRYPTO_
123 
pal_status_t
uint16_t pal_status_t
PAL return status.
Definition: examples/tools/protected_update_data_set/include/pal/pal_crypt.h:54
pal_crypt_parse_rsa_key
pal_status_t pal_crypt_parse_rsa_key(void *key_file, uint8_t **N, uint16_t *N_length, uint8_t **E, uint16_t *E_length, uint8_t **D, uint16_t *D_length)
protected_update_data_set.h
This file defines APIs, types and data structures used for protected update data set creation.
pal_crypt_t
PAL crypt context structure.
Definition: optiga/include/optiga/pal/pal_crypt.h:51
pal_crypt_tls_prf_sha256
pal_status_t pal_crypt_tls_prf_sha256(pal_crypt_t *p_pal_crypt, const uint8_t *p_secret, uint16_t secret_length, const uint8_t *p_label, uint16_t label_length, const uint8_t *p_seed, uint16_t seed_length, uint8_t *p_derived_key, uint16_t derived_key_length)
pal_crypt
Definition: examples/tools/protected_update_data_set/include/pal/pal_crypt.h:46
pal_crypt_parse_ecc_key
pal_status_t pal_crypt_parse_ecc_key(void *key_file, uint8_t **D, uint16_t *D_length, uint8_t **X, uint16_t *X_length, uint8_t **Y, uint16_t *Y_length)
pal_crypt_sign
pal_status_t pal_crypt_sign(pal_crypt_t *p_pal_crypt, uint8_t *p_digest, uint16_t digest_length, uint8_t *p_signature, uint16_t *signature_length, const uint8_t *p_private_key, uint16_t private_key_length)
pal_crypt_get_signature_length
pal_status_t pal_crypt_get_signature_length(uint8_t *p_private_key, uint16_t *sign_len, signature_algo_t sign_algo)
pal_crypt::callback_ctx
void * callback_ctx
callback
Definition: examples/tools/protected_update_data_set/include/pal/pal_crypt.h:48
pal_crypt_generate_random
pal_status_t pal_crypt_generate_random(pal_crypt_t *p_pal_crypt, uint8_t *p_random_data, uint16_t random_data_length)
pal_crypt_encrypt_aes128_ccm
pal_status_t pal_crypt_encrypt_aes128_ccm(pal_crypt_t *p_pal_crypt, const uint8_t *p_plain_text, uint16_t plain_text_length, const uint8_t *p_encrypt_key, const uint8_t *p_nonce, uint16_t nonce_length, const uint8_t *p_associated_data, uint16_t associated_data_length, uint8_t mac_size, uint8_t *p_cipher_text)
pal_crypt_hash
pal_status_t pal_crypt_hash(pal_crypt_t *p_pal_crypt, uint8_t hash_algorithm, const uint8_t *p_message, uint32_t message_length, uint8_t *p_digest)
pal_crypt_t
struct pal_crypt pal_crypt_t
signature_algo_t
enum signature_algo signature_algo_t
pal_crypt_set_seed
pal_status_t pal_crypt_set_seed(pal_crypt_t *p_pal_crypt, uint8_t *p_seed, uint16_t seed_length)
pal_crypt_get_key_type
pal_status_t pal_crypt_get_key_type(int8_t *key_file)