mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 04:16:35 +08:00
crypto:support nuttx /dev/crypto
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
CONFIG_ALLOW_BSD_COMPONENTS=y
|
||||
CONFIG_ALLSYMS=y
|
||||
CONFIG_ARCH="sim"
|
||||
CONFIG_ARCH_BOARD="sim"
|
||||
CONFIG_ARCH_BOARD_SIM=y
|
||||
CONFIG_ARCH_CHIP="sim"
|
||||
CONFIG_ARCH_SIM=y
|
||||
CONFIG_BOARDCTL_APP_SYMTAB=y
|
||||
CONFIG_BOARDCTL_POWEROFF=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=0
|
||||
CONFIG_BOOT_RUNFROMEXTSRAM=y
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_CRYPTO=y
|
||||
CONFIG_CRYPTO_CRYPTODEV=y
|
||||
CONFIG_CRYPTO_RANDOM_POOL=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DEV_GPIO=y
|
||||
CONFIG_DEV_LOOP=y
|
||||
CONFIG_DEV_ZERO=y
|
||||
CONFIG_EXAMPLES_GPIO=y
|
||||
CONFIG_EXAMPLES_HELLO=y
|
||||
CONFIG_FAT_LCNAMES=y
|
||||
CONFIG_FAT_LFN=y
|
||||
CONFIG_FSUTILS_PASSWD=y
|
||||
CONFIG_FSUTILS_PASSWD_READONLY=y
|
||||
CONFIG_FS_BINFS=y
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_RAMMAP=y
|
||||
CONFIG_FS_ROMFS=y
|
||||
CONFIG_GPIO_LOWER_HALF=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=4096
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_IOEXPANDER=y
|
||||
CONFIG_IOEXPANDER_DUMMY=y
|
||||
CONFIG_LIBC_ENVPATH=y
|
||||
CONFIG_LIBC_EXECFUNCS=y
|
||||
CONFIG_LIBC_LOCALE=y
|
||||
CONFIG_LIBC_LOCALE_CATALOG=y
|
||||
CONFIG_LIBC_LOCALE_GETTEXT=y
|
||||
CONFIG_LIBC_MAX_EXITFUNS=1
|
||||
CONFIG_LIBC_NUMBERED_ARGS=y
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_ARCHROMFS=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FATDEVNO=2
|
||||
CONFIG_NSH_FILE_APPS=y
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NSH_ROMFSDEVNO=1
|
||||
CONFIG_NSH_ROMFSETC=y
|
||||
CONFIG_PATH_INITIAL="/bin"
|
||||
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=2048
|
||||
CONFIG_PSEUDOFS_ATTRIBUTES=y
|
||||
CONFIG_PSEUDOFS_SOFTLINKS=y
|
||||
CONFIG_READLINE_TABCOMPLETION=y
|
||||
CONFIG_SCHED_BACKTRACE=y
|
||||
CONFIG_SCHED_HAVE_PARENT=y
|
||||
CONFIG_SCHED_HPWORK=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_START_MONTH=6
|
||||
CONFIG_START_YEAR=2008
|
||||
CONFIG_SYSTEM_DUMPSTACK=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TESTING_CRYPTO=y
|
||||
@@ -37,6 +37,7 @@ endif # CRYPTO_ALGTEST
|
||||
|
||||
config CRYPTO_CRYPTODEV
|
||||
bool "cryptodev support"
|
||||
depends on ALLOW_BSD_COMPONENTS
|
||||
default n
|
||||
|
||||
config CRYPTO_SW_AES
|
||||
|
||||
+20
-5
@@ -30,12 +30,27 @@ CRYPTO_CSRCS += crypto.c testmngr.c
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_CRYPTODEV),y)
|
||||
CRYPTO_CSRCS += cryptodev.c
|
||||
endif
|
||||
|
||||
# Software AES library
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_SW_AES),y)
|
||||
CRYPTO_CSRCS += cryptosoft.c
|
||||
CRYPTO_CSRCS += xform.c
|
||||
CRYPTO_CSRCS += aes.c
|
||||
CRYPTO_CSRCS += blf.c
|
||||
CRYPTO_CSRCS += cast.c
|
||||
CRYPTO_CSRCS += chachapoly.c
|
||||
CRYPTO_CSRCS += ecb_enc.c
|
||||
CRYPTO_CSRCS += ecb3_enc.c
|
||||
CRYPTO_CSRCS += set_key.c
|
||||
CRYPTO_CSRCS += md5.c
|
||||
CRYPTO_CSRCS += poly1305.c
|
||||
CRYPTO_CSRCS += rijndael.c
|
||||
CRYPTO_CSRCS += rmd160.c
|
||||
CRYPTO_CSRCS += sha1.c
|
||||
CRYPTO_CSRCS += sha2.c
|
||||
CRYPTO_CSRCS += gmac.c
|
||||
CRYPTO_CSRCS += cmac.c
|
||||
CRYPTO_CSRCS += hmac.c
|
||||
CRYPTO_CSRCS += idgen.c
|
||||
CRYPTO_CSRCS += key_wrap.c
|
||||
CRYPTO_CSRCS += siphash.c
|
||||
endif
|
||||
|
||||
# BLAKE2s hash algorithm
|
||||
|
||||
+1
-2
@@ -31,9 +31,8 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/stdint.h>
|
||||
#include <crypto/aes.h>
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <crypto/blf.h>
|
||||
|
||||
|
||||
+2
-1
@@ -12,9 +12,10 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
#include <crypto/cast.h>
|
||||
|
||||
#include "castsb.h"
|
||||
|
||||
/* Macros to access 8-bit bytes out of a 32-bit word */
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/systm.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
+1
-2
@@ -21,9 +21,8 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <endian.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <lib/libkern/libkern.h>
|
||||
|
||||
#include <crypto/poly1305.h>
|
||||
#include <crypto/chachapoly.h>
|
||||
|
||||
+5
-2
@@ -26,12 +26,15 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <crypto/aes.h>
|
||||
#include <crypto/cmac.h>
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#define LSHIFT(v, r) do \
|
||||
{ \
|
||||
int i; \
|
||||
|
||||
+95
-157
File diff suppressed because it is too large
Load Diff
+184
-258
File diff suppressed because it is too large
Load Diff
+135
-569
File diff suppressed because it is too large
Load Diff
@@ -59,7 +59,6 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
typedef unsigned char des_cblock[8];
|
||||
typedef struct des_ks_struct
|
||||
|
||||
+2
-2
@@ -28,9 +28,9 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <endian.h>
|
||||
#include <strings.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <crypto/aes.h>
|
||||
#include <crypto/gmac.h>
|
||||
|
||||
|
||||
+2
-1
@@ -26,8 +26,9 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <crypto/md5.h>
|
||||
#include <crypto/sha1.h>
|
||||
|
||||
+7
-3
@@ -26,8 +26,11 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <stdlib.h>
|
||||
#include <nuttx/clock.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <crypto/idgen.h>
|
||||
@@ -119,7 +122,8 @@ static void idgen32_rekey(FAR struct idgen32_ctx *ctx)
|
||||
ctx->id32_hibit ^= 0x80000000;
|
||||
ctx->id32_offset = arc4random();
|
||||
arc4random_buf(ctx->id32_key, sizeof(ctx->id32_key));
|
||||
ctx->id32_rekey_time = getuptime() + IDGEN32_REKEY_TIME;
|
||||
ctx->id32_rekey_time = TICK2SEC(clock_systime_ticks()) +
|
||||
IDGEN32_REKEY_TIME;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -142,7 +146,7 @@ uint32_t idgen32(FAR struct idgen32_ctx *ctx)
|
||||
/* Rekey a little early to avoid "card counting" attack */
|
||||
|
||||
if (ctx->id32_counter > IDGEN32_REKEY_LIMIT ||
|
||||
ctx->id32_rekey_time < getuptime())
|
||||
ctx->id32_rekey_time < TICK2SEC(clock_systime_ticks()))
|
||||
{
|
||||
idgen32_rekey(ctx);
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,9 +23,9 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <endian.h>
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <crypto/aes.h>
|
||||
#include <crypto/key_wrap.h>
|
||||
|
||||
|
||||
+2
-1
@@ -22,8 +22,9 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <endian.h>
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <crypto/md5.h>
|
||||
|
||||
#define PUT_64BIT_LE(cp, value) \
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <crypto/poly1305.h>
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <crypto/rijndael.h>
|
||||
|
||||
|
||||
+2
-2
@@ -35,8 +35,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/endian.h>
|
||||
#include <endian.h>
|
||||
#include <string.h>
|
||||
#include <crypto/rmd160.h>
|
||||
|
||||
#define PUT_64BIT_LE(cp, value) \
|
||||
|
||||
@@ -61,6 +61,8 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <strings.h>
|
||||
|
||||
#include "des_locl.h"
|
||||
#include "podd.h"
|
||||
#include "sk.h"
|
||||
|
||||
+2
-1
@@ -20,8 +20,9 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <endian.h>
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <crypto/sha1.h>
|
||||
|
||||
|
||||
+2
-1
@@ -38,8 +38,9 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <endian.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/systm.h>
|
||||
#include <crypto/sha2.h>
|
||||
|
||||
/* UNROLLED TRANSFORM LOOP NOTE:
|
||||
|
||||
+2
-1
@@ -48,8 +48,9 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <endian.h>
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <crypto/siphash.h>
|
||||
|
||||
|
||||
@@ -51,6 +51,12 @@
|
||||
* [including the GNU Public Licence.]
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
static const uint32_t des_skb[8][64] =
|
||||
{
|
||||
{
|
||||
|
||||
@@ -50,6 +50,12 @@
|
||||
* [including the GNU Public Licence.]
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
static const uint32_t des_sptrans[8][64] =
|
||||
{
|
||||
{
|
||||
|
||||
+3
-41
@@ -53,12 +53,11 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include <crypto/md5.h>
|
||||
#include <crypto/sha1.h>
|
||||
@@ -118,9 +117,6 @@ int sha256update_int(FAR void *, FAR const uint8_t *, uint16_t);
|
||||
int sha384update_int(FAR void *, FAR const uint8_t *, uint16_t);
|
||||
int sha512update_int(FAR void *, FAR const uint8_t *, uint16_t);
|
||||
|
||||
uint32_t deflate_compress(FAR uint8_t *, uint32_t, FAR uint8_t **);
|
||||
uint32_t deflate_decompress(FAR uint8_t *, uint32_t, FAR uint8_t **);
|
||||
|
||||
struct aes_ctr_ctx
|
||||
{
|
||||
AES_CTX ac_key;
|
||||
@@ -337,15 +333,6 @@ const struct auth_hash auth_hash_chacha20_poly1305 =
|
||||
chacha20_poly1305_final
|
||||
};
|
||||
|
||||
/* Compression instance */
|
||||
|
||||
const struct comp_algo comp_algo_deflate =
|
||||
{
|
||||
CRYPTO_DEFLATE_COMP, "Deflate",
|
||||
90, deflate_compress,
|
||||
deflate_decompress
|
||||
};
|
||||
|
||||
/* Encryption wrapper routines. */
|
||||
|
||||
void des3_encrypt(caddr_t key, FAR uint8_t *blk)
|
||||
@@ -633,28 +620,3 @@ int sha512update_int(FAR void *ctx, FAR const uint8_t *buf, uint16_t len)
|
||||
sha512update(ctx, buf, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t deflate_global(FAR uint8_t *, uint32_t, int, FAR uint8_t **);
|
||||
|
||||
struct deflate_buf
|
||||
{
|
||||
FAR uint8_t *out;
|
||||
uint32_t size;
|
||||
int flag;
|
||||
};
|
||||
|
||||
/* And compression */
|
||||
|
||||
uint32_t deflate_compress(FAR uint8_t *data,
|
||||
uint32_t size,
|
||||
FAR uint8_t **out)
|
||||
{
|
||||
return deflate_global(data, size, 0, out);
|
||||
}
|
||||
|
||||
uint32_t deflate_decompress(FAR uint8_t *data,
|
||||
uint32_t size,
|
||||
FAR uint8_t **out)
|
||||
{
|
||||
return deflate_global(data, size, 1, out);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,12 @@
|
||||
#ifndef __INCLUDE_CRYPTO_AES_H
|
||||
#define __INCLUDE_CRYPTO_AES_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef AES_MAXROUNDS
|
||||
# define AES_MAXROUNDS (14)
|
||||
#endif
|
||||
|
||||
@@ -33,6 +33,12 @@
|
||||
#ifndef __INCLUDE_CRYPTO_BLF_H
|
||||
#define __INCLUDE_CRYPTO_BLF_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/* Schneier states the maximum key length to be 56 bytes.
|
||||
* The way how the subkeys are initialized by the key up
|
||||
* to (N+2)*4 i.e. 72 bytes are utilized.
|
||||
|
||||
@@ -21,6 +21,12 @@
|
||||
#ifndef __INCLUDE_CRYPTO_CMAC_H_
|
||||
#define __INCLUDE_CRYPTO_CMAC_H_
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define AES_CMAC_KEY_LENGTH 16
|
||||
#define AES_CMAC_DIGEST_LENGTH 16
|
||||
|
||||
|
||||
@@ -55,8 +55,7 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/ioccom.h>
|
||||
#include <sys/task.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/* Some initial values */
|
||||
|
||||
@@ -173,7 +172,6 @@ struct cryptodesc
|
||||
|
||||
struct cryptop
|
||||
{
|
||||
struct task crp_task;
|
||||
uint64_t crp_sid; /* Session ID */
|
||||
int crp_ilen; /* Input data total length */
|
||||
int crp_olen; /* Result total length */
|
||||
@@ -202,6 +200,7 @@ struct cryptop
|
||||
CODE int (*crp_callback)(FAR struct cryptop *); /* Callback function */
|
||||
|
||||
caddr_t crp_mac;
|
||||
caddr_t crp_dst;
|
||||
};
|
||||
|
||||
#define CRYPTO_BUF_IOV 0x1
|
||||
@@ -245,8 +244,6 @@ struct crypt_kop
|
||||
|
||||
struct cryptkop
|
||||
{
|
||||
struct task krp_task;
|
||||
|
||||
u_int krp_op; /* ie. CRK_MOD_EXP or other */
|
||||
u_int krp_status; /* return status */
|
||||
u_short krp_iparams; /* # of input parameters */
|
||||
@@ -322,21 +319,18 @@ struct crypt_op
|
||||
* Please use F_SETFD against the cloned descriptor.
|
||||
*/
|
||||
|
||||
#define CRIOGET _IOWR('c', 100, uint32_t)
|
||||
#define CRIOGET 100
|
||||
|
||||
/* the following are done against the cloned descriptor */
|
||||
#define CIOCGSESSION _IOWR('c', 101, struct session_op)
|
||||
#define CIOCFSESSION _IOW('c', 102, uint32_t)
|
||||
#define CIOCCRYPT _IOWR('c', 103, struct crypt_op)
|
||||
#define CIOCKEY _IOWR('c', 104, struct crypt_kop)
|
||||
|
||||
#define CIOCASYMFEAT _IOR('c', 105, uint32_t)
|
||||
#define CIOCGSESSION 101
|
||||
#define CIOCFSESSION 102
|
||||
#define CIOCCRYPT 103
|
||||
#define CIOCKEY 104
|
||||
#define CIOCASYMFEAT 105
|
||||
|
||||
#ifdef _KERNEL
|
||||
int crypto_newsession(FAR uint64_t *, FAR struct cryptoini *, int);
|
||||
int crypto_freesession(uint64_t);
|
||||
int crypto_dispatch(FAR struct cryptop *);
|
||||
int crypto_kdispatch(FAR struct cryptkop *);
|
||||
int crypto_register(uint32_t, FAR int *,
|
||||
CODE int (*)(uint32_t *, struct cryptoini *),
|
||||
CODE int (*)(uint64_t),
|
||||
@@ -346,17 +340,8 @@ int crypto_unregister(uint32_t, int);
|
||||
int crypto_get_driverid(uint8_t);
|
||||
int crypto_invoke(FAR struct cryptop *);
|
||||
int crypto_kinvoke(FAR struct cryptkop *);
|
||||
void crypto_done(FAR struct cryptop *);
|
||||
void crypto_kdone(FAR struct cryptkop *);
|
||||
int crypto_getfeat(FAR int *);
|
||||
|
||||
void cuio_copydata(FAR struct uio *, int, int, caddr_t);
|
||||
void cuio_copyback(FAR struct uio *, int, int, const void *);
|
||||
int cuio_getptr(FAR struct uio *, int, FAR int *);
|
||||
int cuio_apply(FAR struct uio *, int, int,
|
||||
CODE int (*f)(caddr_t, caddr_t, unsigned int), caddr_t);
|
||||
|
||||
FAR struct cryptop *crypto_getreq(int);
|
||||
void crypto_freereq(FAR struct cryptop *);
|
||||
#endif /* _KERNEL */
|
||||
#endif /* __INCLUDE_CRYPTO_CRYPTODEV_H */
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/queue.h>
|
||||
#include <crypto/cryptodev.h>
|
||||
|
||||
/* Software session entry */
|
||||
|
||||
struct swcr_data
|
||||
@@ -70,14 +73,13 @@ struct swcr_data
|
||||
struct swcr_data *sw_next;
|
||||
};
|
||||
|
||||
#ifdef _KERNEL
|
||||
extern const uint8_t hmac_ipad_buffer[HMAC_MAX_BLOCK_LEN];
|
||||
extern const uint8_t hmac_opad_buffer[HMAC_MAX_BLOCK_LEN];
|
||||
|
||||
int swcr_encdec(FAR struct cryptodesc *,
|
||||
FAR struct swcr_data *, caddr_t, int);
|
||||
int swcr_encdec(FAR struct cryptop *, FAR struct cryptodesc *,
|
||||
FAR struct swcr_data *, caddr_t);
|
||||
int swcr_authcompute(FAR struct cryptop *, FAR struct cryptodesc *,
|
||||
FAR struct swcr_data *, caddr_t, int);
|
||||
FAR struct swcr_data *, caddr_t);
|
||||
int swcr_authenc(FAR struct cryptop *);
|
||||
int swcr_compdec(FAR struct cryptodesc *, FAR struct swcr_data *,
|
||||
caddr_t, int);
|
||||
@@ -85,6 +87,5 @@ int swcr_process(FAR struct cryptop *);
|
||||
int swcr_newsession(FAR uint32_t *, FAR struct cryptoini *);
|
||||
int swcr_freesession(uint64_t);
|
||||
void swcr_init(void);
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* __INCLUDE_CRYPTO_CRYPTOSOFT_H */
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <crypto/aes.h>
|
||||
|
||||
#define GMAC_BLOCK_LEN 16
|
||||
|
||||
@@ -21,6 +21,12 @@
|
||||
#ifndef __INCLUDE_CRYPTO_HMAC_H_
|
||||
#define __INCLUDE_CRYPTO_HMAC_H_
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef struct _HMAC_MD5_CTX
|
||||
{
|
||||
MD5_CTX ctx;
|
||||
|
||||
@@ -20,6 +20,12 @@
|
||||
#ifndef __INCLUDE_CRYPTO_KEY_WRAP_H_
|
||||
#define __INCLUDE_CRYPTO_KEY_WRAP_H_
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef struct _aes_key_wrap_ctx
|
||||
{
|
||||
AES_CTX ctx;
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
#ifndef __INCLUDE_CRYPTO_MD5_H
|
||||
#define __INCLUDE_CRYPTO_MD5_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define MD5_BLOCK_LENGTH 64
|
||||
#define MD5_DIGEST_LENGTH 16
|
||||
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
#ifndef __INCLUDE_CRYPTO_POLY1305_H
|
||||
#define __INCLUDE_CRYPTO_POLY1305_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define poly1305_block_size 16
|
||||
|
||||
typedef struct poly1305_state
|
||||
|
||||
@@ -30,6 +30,12 @@
|
||||
#ifndef __INCLUDE_CRYPTO_RIJNDAEL_H
|
||||
#define __INCLUDE_CRYPTO_RIJNDAEL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define AES_MAXKEYBITS (256)
|
||||
#define AES_MAXKEYBYTES (AES_MAXKEYBITS / 8)
|
||||
|
||||
|
||||
@@ -28,6 +28,12 @@
|
||||
#ifndef __INCLUDE_CRYPTO_RMD160_H
|
||||
#define __INCLUDE_CRYPTO_RMD160_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define RMD160_BLOCK_LENGTH 64
|
||||
#define RMD160_DIGEST_LENGTH 20
|
||||
|
||||
|
||||
@@ -9,6 +9,12 @@
|
||||
#ifndef __INCLUDE_CRYPTO_SHA1_H
|
||||
#define __INCLUDE_CRYPTO_SHA1_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define SHA1_BLOCK_LENGTH 64
|
||||
#define SHA1_DIGEST_LENGTH 20
|
||||
|
||||
|
||||
@@ -38,6 +38,12 @@
|
||||
#ifndef __INCLUDE_CRYPTO_SHA2_H
|
||||
#define __INCLUDE_CRYPTO_SHA2_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/* SHA-256/384/512 Various Length Definitions */
|
||||
|
||||
#define SHA256_BLOCK_LENGTH 64
|
||||
|
||||
@@ -51,6 +51,12 @@
|
||||
#ifndef __INCLUDE_CRYPTO_SIPHASH_H_
|
||||
#define __INCLUDE_CRYPTO_SIPHASH_H_
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define SIPHASH_BLOCK_LENGTH 8
|
||||
#define SIPHASH_KEY_LENGTH 16
|
||||
#define SIPHASH_DIGEST_LENGTH 8
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <crypto/md5.h>
|
||||
#include <crypto/sha1.h>
|
||||
#include <crypto/rmd160.h>
|
||||
@@ -116,6 +117,4 @@ extern const struct auth_hash auth_hash_gmac_aes_192;
|
||||
extern const struct auth_hash auth_hash_gmac_aes_256;
|
||||
extern const struct auth_hash auth_hash_chacha20_poly1305;
|
||||
|
||||
extern const struct comp_algo comp_algo_deflate;
|
||||
|
||||
#endif /* __INCLUDE_CRYPTO_XFORM_H */
|
||||
|
||||
Reference in New Issue
Block a user