OPTIGA Trust M  1.1.0
C++ library for Optiga Trust M Chip Security Controller
pal_crypt.h
Go to the documentation of this file.
1 
39 #ifndef _PAL_CRYPT_H_
40 #define _PAL_CRYPT_H_
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 #include "optiga_lib_types.h"
47 #include "pal.h"
48 
50 typedef struct pal_crypt_t
51 {
53  void * callback_ctx;
55 
82 LIBRARY_EXPORTS pal_status_t pal_crypt_tls_prf_sha256(pal_crypt_t* p_pal_crypt,
83  const uint8_t * p_secret,
84  uint16_t secret_length,
85  const uint8_t * p_label,
86  uint16_t label_length,
87  const uint8_t * p_seed,
88  uint16_t seed_length,
89  uint8_t * p_derived_key,
90  uint16_t derived_key_length);
91 
120 LIBRARY_EXPORTS pal_status_t pal_crypt_encrypt_aes128_ccm(pal_crypt_t* p_pal_crypt,
121  const uint8_t * p_plain_text,
122  uint16_t plain_text_length,
123  const uint8_t * p_encrypt_key,
124  const uint8_t * p_nonce,
125  uint16_t nonce_length,
126  const uint8_t * p_associated_data,
127  uint16_t associated_data_length,
128  uint8_t mac_size,
129  uint8_t * p_cipher_text);
130 
160 LIBRARY_EXPORTS pal_status_t pal_crypt_decrypt_aes128_ccm(pal_crypt_t* p_pal_crypt,
161  const uint8_t * p_cipher_text,
162  uint16_t cipher_text_length,
163  const uint8_t * p_decrypt_key,
164  const uint8_t * p_nonce,
165  uint16_t nonce_length,
166  const uint8_t * p_associated_data,
167  uint16_t associated_data_length,
168  uint8_t mac_size,
169  uint8_t * p_plain_text);
170 
190 pal_status_t pal_crypt_version(uint8_t * p_crypt_lib_version_info, uint16_t * length);
191 
192 #ifdef __cplusplus
193 }
194 #endif
195 
196 #endif /*_PAL_CRYPT_H_ */
197 
This file provides the prototype declarations of platform abstraction layer.
pal_status_t pal_crypt_version(uint8_t *p_crypt_lib_version_info, uint16_t *length)
Gets the external crypto library version number.
Definition: pal_crypt_mbedtls.c:281
This file contains the type definitions for the fundamental data types.
LIBRARY_EXPORTS 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)
Derives the key using the TLS PRF SHA256 for a given secret.
Definition: pal_crypt_mbedtls.c:48
void * callback_ctx
callback
Definition: pal_crypt.h:53
struct pal_crypt_t pal_crypt_t
PAL crypt context structure.
LIBRARY_EXPORTS pal_status_t pal_crypt_decrypt_aes128_ccm(pal_crypt_t *p_pal_crypt, const uint8_t *p_cipher_text, uint16_t cipher_text_length, const uint8_t *p_decrypt_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_plain_text)
Decrypts the cipher text using AES CCM algorithm and provides the plain text.
Definition: pal_crypt_mbedtls.c:229
PAL crypt context structure.
Definition: pal_crypt.h:50
LIBRARY_EXPORTS 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)
Encrypts the input plain text using AES CCM algorithm and provides the cipher text as well as MAC int...
Definition: pal_crypt_mbedtls.c:169
uint16_t pal_status_t
PAL return status.
Definition: pal.h:60