Commit Graph

21 Commits

Author SHA1 Message Date
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 aeac109e50 crypto/bn:Add exponentiation algorithm in bignum
add exponentiation algorithm: pow_mod_faster
Signed-off-by: makejian <makejian@xiaomi.com>
2023-10-18 12:23:13 +08:00
makejian 12935f2d33 crypto/bn: porting tiny-Bignum-C into nuttx crypto
porting from https://github.com/kokke/tiny-bignum-c commit ac136565378c624365e0f5f556d386b3966bff32 and adapting to the nuttx
Signed-off-by: makejian <makejian@xiaomi.com>
2023-10-18 12:23:13 +08:00
makejian cb3abc48d7 crypto/cryptodev: expansion hash operation
(1) remove size restriction for single hash operation
(2) support hash operation to update uint32_t data
Signed-off-by: makejian <makejian@xiaomi.com>
2023-09-24 03:49:33 +08:00
makejian f4f2c9ed49 crypto: fix multiple definition of `poly1305_init'
apps/crypto/libtomcrypt/libtomcrypt/src/mac/poly1305/poly1305.c:90: multiple definition of `poly1305_init';
nuttx/crypto/poly1305.c:51: first defined here
Signed-off-by: makejian <makejian@xiaomi.com>
2023-09-07 17:02:08 -03: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
makejian d5041420a3 crypto: porting Curve25519 algorithm into nuttx crypto
Signed-off-by: makejian <makejian@xiaomi.com>
2023-08-03 03:20:13 -07:00
simbit18 9681c52517 Fix nuttx coding style
Remove TABs
Fix indentation
2023-07-11 23:32:17 +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
Gregory Nutt 1657e6296b Move crypto header files from include/crypto to include/nuttx/crypto 2014-07-03 18:35:08 -06:00
Gregory Nutt 71f6838129 Correct authorship on a few files 2014-07-03 18:28:26 -06:00
Gregory Nutt edb5f312ca Move cypto debug definitions to debug.h with other susbsystem-level debug 2014-07-03 07:58:43 -06:00
Gregory Nutt bb3dcccd98 Beginning of a crypto/ subsystem from Max Neklyudov 2014-07-03 07:42:44 -06:00