porting from https://github.com/kokke/tiny-bignum-c commit ac136565378c624365e0f5f556d386b3966bff32 and adapting to the nuttx
Signed-off-by: makejian <makejian@xiaomi.com>
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>
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>
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>
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>