11bcc5e0c3
- Add static memory pool implementation (se050_mem_pool.c/h) - Replace all malloc/calloc with pool allocations - Replace all free with pool deallocations - Remove strdup usage (use fixed-size buffer instead) - Update I2C HAL to use fixed-size dev_path array - All 24 tests pass with static memory only Suitable for embedded environments (u-boot, ESP32) without heap.
44 lines
1.2 KiB
C
44 lines
1.2 KiB
C
/**
|
|
* @file se050_scp03.h
|
|
* @brief SE050 Platform SCP03 Secure Channel Interface
|
|
*/
|
|
|
|
#ifndef SE050_SCP03_H
|
|
#define SE050_SCP03_H
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include "se050_i2c_hal.h"
|
|
|
|
/* Forward declarations */
|
|
typedef struct se050_session_ctx se050_session_ctx_t;
|
|
typedef struct se050_scp03_ctx se050_scp03_ctx_t;
|
|
|
|
/* SCP03 key sizes */
|
|
#define SCP03_KEY_SIZE 16
|
|
#define SCP03_IV_SIZE 16
|
|
#define SCP03_CMAC_SIZE 8
|
|
|
|
/* Initialize SCP03 context */
|
|
se050_status_t se050_scp03_init(se050_scp03_ctx_t **ctx, se050_session_ctx_t *session);
|
|
|
|
/* Set SCP03 keys */
|
|
se050_status_t se050_scp03_set_keys(se050_scp03_ctx_t *ctx,
|
|
const uint8_t *enc_key,
|
|
const uint8_t *mac_key,
|
|
const uint8_t *dek_key);
|
|
|
|
/* Encrypt command */
|
|
se050_status_t se050_scp03_encrypt_command(se050_scp03_ctx_t *ctx,
|
|
uint8_t *cmd, size_t *cmd_len);
|
|
|
|
/* Decrypt response */
|
|
uint16_t se050_scp03_decrypt_response(se050_scp03_ctx_t *ctx,
|
|
size_t cmd_len,
|
|
uint8_t *rsp, size_t *rsp_len);
|
|
|
|
/* Cleanup SCP03 context */
|
|
void se050_scp03_cleanup(se050_scp03_ctx_t *ctx);
|
|
|
|
#endif /* SE050_SCP03_H */
|