如何将加密算法添加到 linux crypto api

how to add an crypto algorithm to linux crypto api

我需要将特定的加密算法添加到 Linux 加密 API,这样我就可以在 /proc/crypto 中看到它并在 IPsec ESP 中使用它。有没有为 Linux 内核开发加密算法的模板?

您需要使用内核加密 API(但我不建议推出您自己的加密算法)。您使用此函数调用注册您的加密算法。

int crypto_register_alg(struct crypto_alg *alg);

但请确保您首先正确填写了 struct crypto_algstruct crypto_alg Link holds info about your algorithm which also contain struct cipher_alg Link 又包含指向加密和解密函数的指针。