Files
se050-wireguard/include/se050_i2c_hal.h
T
km 479fcd37c1 Fix WireGuard decryption failures
- Fix BLAKE2s final block handling when len == fill
- Fix key derivation order based on is_initiator flag
- Add missing header files (se050_i2c_hal.h, se050_scp03.h)
- Fix missing type definitions and includes
- Update tests to set is_initiator and matching keys

All 24 tests now pass.
2026-03-29 18:52:48 +09:00

42 lines
1.1 KiB
C

/**
* @file se050_i2c_hal.h
* @brief SE050 I2C HAL Interface
*/
#ifndef SE050_I2C_HAL_H
#define SE050_I2C_HAL_H
#include <stdint.h>
/* Status codes */
typedef enum {
SE050_OK = 0,
SE050_ERR_INVALID_ARG = -1,
SE050_ERR_I2C = -2,
SE050_ERR_TIMEOUT = -3,
SE050_ERR_INTERNAL = -4,
SE050_ERR_SESSION = -5,
SE050_ERR_FAIL = -6,
SE050_ERR_RNG = -7,
SE050_ERR_ECDH = -8,
SE050_ERR_NOT_INIT = -9,
SE050_ERR_SCP03 = -10
} se050_status_t;
/* I2C HAL structure */
typedef struct {
void *handle; /**< I2C file descriptor */
uint8_t slave_addr; /**< I2C slave address */
const char *dev_path; /**< I2C device path */
int wakeup_pin; /**< Wakeup GPIO pin (-1 if unused) */
} se050_i2c_hal_t;
/* Public API */
se050_status_t se050_i2c_init(se050_i2c_hal_t *hal, const char *dev_path, uint8_t slave_addr);
void se050_i2c_close(se050_i2c_hal_t *hal);
int se050_i2c_read(se050_i2c_hal_t *hal, uint8_t *buffer, int length);
int se050_i2c_write(se050_i2c_hal_t *hal, const uint8_t *buffer, int length);
se050_status_t se050_i2c_wakeup(se050_i2c_hal_t *hal);
#endif /* SE050_I2C_HAL_H */