bdk: se: add AES OFB encryption/decryption support

This commit is contained in:
CTCaer
2026-01-06 22:49:57 +02:00
parent ee1b0db130
commit b7f1641bce
2 changed files with 11 additions and 0 deletions

View File

@@ -350,6 +350,16 @@ int se_aes_crypt_cbc(u32 ks, int enc, void *dst, const void *src, u32 size)
return _se_execute_aes_oneshot(dst, src, size);
}
int se_aes_crypt_ofb(u32 ks, void *dst, const void *src, u32 size)
{
SE(SE_SPARE_REG) = SE_INPUT_NONCE_LE;
SE(SE_CONFIG_REG) = SE_CONFIG_ENC_MODE(MODE_KEY128) | SE_CONFIG_ENC_ALG(ALG_AES_ENC) | SE_CONFIG_DST(DST_MEMORY);
SE(SE_CRYPTO_CONFIG_REG) = SE_CRYPTO_KEY_INDEX(ks) | SE_CRYPTO_INPUT_SEL(INPUT_AESOUT) |
SE_CRYPTO_CORE_SEL(CORE_ENCRYPT) | SE_CRYPTO_XOR_POS(XOR_BOTTOM);
return _se_execute_aes_oneshot(dst, src, size);
}
int se_aes_crypt_ctr(u32 ks, void *dst, const void *src, u32 size, void *ctr)
{
SE(SE_SPARE_REG) = SE_INPUT_NONCE_LE;

View File

@@ -36,6 +36,7 @@ void se_get_aes_keys(u8 *buf, u8 *keys, u32 keysize);
/*! Encryption Functions */
int se_aes_crypt_ecb(u32 ks, int enc, void *dst, const void *src, u32 size);
int se_aes_crypt_cbc(u32 ks, int enc, void *dst, const void *src, u32 size);
int se_aes_crypt_ofb(u32 ks, void *dst, const void *src, u32 size);
int se_aes_crypt_ctr(u32 ks, void *dst, const void *src, u32 size, void *ctr);
int se_aes_xts_crypt_sec(u32 tweak_ks, u32 crypt_ks, int enc, u64 sec, void *dst, void *src, u32 secsize);
int se_aes_xts_crypt_sec_nx(u32 tweak_ks, u32 crypt_ks, int enc, u64 sec, u8 *tweak, bool regen_tweak, u32 tweak_exp, void *dst, void *src, u32 sec_size);