Commit Graph

20 Commits

Author SHA1 Message Date
makejian
222840e135 crypto/rsa: add exp mod in software crypto
Implemented a simple exponentiation.
Signed-off-by: makejian <makejian@xiaomi.com>
2024-09-13 23:08:39 +08:00
makejian
bcb90fab7c nuttx/crypto: export Diffie-Hellman algorithm
Supplementary CRK_DH_MAKE_PUBLIC and CRK_DH_COMPUTE_KEY with curve25519
Signed-off-by: makejian <makejian@xiaomi.com>
2024-09-09 23:55:33 +08:00
makejian
8de247543f crypto: export interfaces abort aes-cmac
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-27 07:44:06 -04:00
makejian
28974b8a21 crypto: export crc32 from /dev/crypto
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-27 07:44:06 -04:00
makejian
9769816385 crypto: fix wrong implementation in crypto module
(1) RSA_PKCS15_VERIFY Misspell
(2) if iv not provided during decryption, iv should get from data.
It was not discovered before because all symmetric decryption comes with iv.
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-23 12:57:37 -03:00
makejian
947b24c8c1 crypto/poly1305: export poly1305 mac algorithm via /dev/crypto
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-22 13:40:24 +08:00
makejian
8628cc9c0e crypto/ripemd160: export ripemd160 algorithm via /dev/crypto
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-22 13:40:24 +08:00
makejian
ee6fdb2c85 crypto: import the ability to clone session
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-21 18:02:54 +08:00
makejian
3dbe2d790e crypto/rsa_verify: export rsa verify via /dev/crypto
kernel supports asymmetric encryption RSA signature verification
Signed-off-by: makejian <makejian@xiaomi.com>
2023-10-18 12:23:13 +08:00
makejian
afbe6239ae crypto: update aes algorithm process
(1)update iv in each encryption process
(2)support aes-ofb/aes-cfb128/aes-cfb8
Signed-off-by: makejian <makejian@xiaomi.com>
2023-08-21 13:05:19 +08:00
makejian
120aaf27b3 crypto: remove software algorithm coupling in cryptodev
Signed-off-by: makejian <makejian@xiaomi.com>
2023-08-17 13:12:36 +08:00
makejian
ac76a8fe0f crypto: export SHA224/SHA384 via /dev/crypto
(1)add sha224 algorithm in sha2.c
(2)export sha224/sha384
Signed-off-by: makejian <makejian@xiaomi.com>
2023-08-10 13:36:19 +08:00
makejian
775d9de30a crypto: export MD5/SHA1/SHA256/SHA512 via /dev/crypto
refer to commit 649dc2d985
(1) import hash method
(2) separate the update and finish processes

Signed-off-by: makejian <makejian@xiaomi.com>
2023-08-03 22:37:30 -07:00
Gustavo Henrique Nihei
e6b204f438 nuttx: Use MIN/MAX definitions from "sys/param.h"
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-02-01 23:47:44 +08:00
anjiahao
43d2c595b1 crypto:support crypto can handle streaming data
in user space
Use the flag (COP_FLAG_UPDATE)structure member to mark
whether it is just input data.
like this:
can do manys times,just input data
....

  cryp.ses = session.ses;
  cryp.op = COP_ENCRYPT;
  cryp.src = (caddr_t) s;
  cryp.len = len;
  cryp.flags = COP_FLAG_UPDATE;
  cryp.dst = 0;
  cryp.mac = (caddr_t) out;
  cryp.iv = 0;
  if (ioctl(cryptodev_fd, CIOCCRYPT, &cryp) == -1)
    {
      warn("CIOCCRYPT");
      goto err;
    }

can do manys times like frist...

then,the last time

Don't use any flay structure member to mark
this is last time,need get final result
....
  cryp.ses = session.ses;
  cryp.op = COP_ENCRYPT;
  cryp.src = (caddr_t) s;
  cryp.len = len;
  cryp.flags = 0;
  cryp.dst = 0;
  cryp.mac = (caddr_t) out;
  cryp.iv = 0;
  if (ioctl(cryptodev_fd, CIOCCRYPT, &cryp) == -1)
    {
      warn("CIOCCRYPT");
      goto err;
    }
....
that will get last result.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-17 01:19:38 +08:00
anjiahao
bc0fe0ea16 crypto:add some hardware support
esp32c3: aes hmac-sha1 hmac-sha256
stm32f0l0g0 stm32l1 : aes
sam34: aes
lpc43: aes
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-12-14 02:33:56 +08:00
anjiahao
3d2f0c0e27 crypto:support nuttx /dev/crypto
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-12-14 02:33:56 +08:00
anjiahao
82956a2894 crypto:convert code style form openbsd to nuttx
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-12-14 02:33:56 +08:00
anjiahao
acd3350554 crypto:Sync version differences
1.fix type warning for compile
2.hamc key can less than specified length
3.add new version algorithms to cryptodev
    sha256hmac
    sha384hmac
    sha512hmac
    aes128gmac

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-12-14 02:33:56 +08:00
anjiahao
c7d347c7f0 crypto: Initial copy from https://github.com/openbsd/sys/crypto
public header files put into include/crpyto
private header/source files put into crpyto

crypto.c cryptodev.[c|h] cryptosoft.[c|h] come from:
commit id is f245bed2a7593bf0decce50caaed4ce05fefd6cf

the rest come from:
commit id is 61b0e532b2dce0a91cf3ea67d346645a61a88cdd

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-12-14 02:33:56 +08:00