【问题标题】:Linux kernel aes encryption/decryptionLinux内核aes加密/解密
【发布时间】:2018-09-05 07:55:24
【问题描述】:

我正在使用这个示例示例在模块内进行一些 AES 加密/解密。所有调用都成功通过,但解密后的文本与纯文本不同。

[ 4703.053265] encrypting -> plain: bb 2b d7 fb fc c6 0c f6 82 92 cd e1 62 2f 9f 95  .+..........b/..
[ 4703.053277] encrypted: 91 1c 91 51 3c 22 77 dd 82 b4 b7 52 c7 95 af 18  ...Q<"w....R....
[ 4703.053280] Encryption triggered successfully
[ 4703.053290] decrypting -> encrypted: 91 1c 91 51 3c 22 77 dd 82 b4 b7 52 c7 95 af 18  ...Q<"w....R....
[ 4703.053295] decrypted: 31 81 92 38 37 da ac 6c 1b fd 4e 86 a1 1b 06 26  1..87..l..N....&
[ 4703.053297] Decryption triggered successfully

来源: https://kernel.readthedocs.io/en/sphinx-samples/crypto-API.html#code-example-for-symmetric-key-cipher-operation

任何正确方向的提示将不胜感激!

【问题讨论】:

  • 记录用于加密和解密的密钥和IV,问题可能会变得很明显。
  • 非常感谢。我传递了一个指向 IV 的指针,它在加密时被修改了!

标签: encryption linux-kernel linux-device-driver


【解决方案1】:

在调用者中存储密钥和 iv 并将其副本传递给加密和解密调用工作正常。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-12-08
    • 2012-02-24
    • 2016-09-22
    • 2020-01-22
    • 1970-01-01
    • 2015-01-20
    • 2014-01-05
    相关资源
    最近更新 更多