mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
minor adjustments and add README
This commit is contained in:
@@ -2176,7 +2176,8 @@ static void wc_AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock)
|
|||||||
|
|
||||||
ret = wc_AesSetKeyLocal(aes, userKey, keylen, iv, dir);
|
ret = wc_AesSetKeyLocal(aes, userKey, keylen, iv, dir);
|
||||||
|
|
||||||
#if defined(WOLFSSL_DEVCRYPTO_AES) || defined(WOLFSSL_DEVCRYPTO_CBC)
|
#if defined(WOLFSSL_DEVCRYPTO) && \
|
||||||
|
(defined(WOLFSSL_DEVCRYPTO_AES) || defined(WOLFSSL_DEVCRYPTO_CBC))
|
||||||
aes->ctx.cfd = -1;
|
aes->ctx.cfd = -1;
|
||||||
XMEMCPY(aes->devKey, userKey, keylen);
|
XMEMCPY(aes->devKey, userKey, keylen);
|
||||||
#endif
|
#endif
|
||||||
@@ -9457,7 +9458,8 @@ int wc_AesInit(Aes* aes, void* heap, int devId)
|
|||||||
aes->alFd = -1;
|
aes->alFd = -1;
|
||||||
aes->rdFd = -1;
|
aes->rdFd = -1;
|
||||||
#endif
|
#endif
|
||||||
#if defined(WOLFSSL_DEVCRYPTO_AES) || defined(WOLFSSL_DEVCRYPTO_CBC)
|
#if defined(WOLFSSL_DEVCRYPTO) && \
|
||||||
|
(defined(WOLFSSL_DEVCRYPTO_AES) || defined(WOLFSSL_DEVCRYPTO_CBC))
|
||||||
aes->ctx.cfd = -1;
|
aes->ctx.cfd = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -9481,7 +9483,8 @@ void wc_AesFree(Aes* aes)
|
|||||||
close(aes->alFd);
|
close(aes->alFd);
|
||||||
}
|
}
|
||||||
#endif /* WOLFSSL_AFALG */
|
#endif /* WOLFSSL_AFALG */
|
||||||
#if defined(WOLFSSL_DEVCRYPTO_AES) || defined(WOLFSSL_DEVCRYPTO_CBC)
|
#if defined(WOLFSSL_DEVCRYPTO) && \
|
||||||
|
(defined(WOLFSSL_DEVCRYPTO_AES) || defined(WOLFSSL_DEVCRYPTO_CBC))
|
||||||
wc_DevCryptoFree(&aes->ctx);
|
wc_DevCryptoFree(&aes->ctx);
|
||||||
ForceZero((byte*)aes->devKey, AES_MAX_KEY_SIZE/WOLFSSL_BIT_SIZE);
|
ForceZero((byte*)aes->devKey, AES_MAX_KEY_SIZE/WOLFSSL_BIT_SIZE);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -67,7 +67,8 @@ EXTRA_DIST += wolfcrypt/src/port/ti/ti-aes.c \
|
|||||||
wolfcrypt/src/port/af_alg/afalg_aes.c \
|
wolfcrypt/src/port/af_alg/afalg_aes.c \
|
||||||
wolfcrypt/src/port/af_alg/afalg_hash.c \
|
wolfcrypt/src/port/af_alg/afalg_hash.c \
|
||||||
wolfcrypt/src/port/devcrypto/devcrypto_hash.c \
|
wolfcrypt/src/port/devcrypto/devcrypto_hash.c \
|
||||||
wolfcrypt/src/port/devcrypto/wc_devcrypto.c
|
wolfcrypt/src/port/devcrypto/wc_devcrypto.c \
|
||||||
|
wolfcrypt/src/port/devcrypto/README.md
|
||||||
|
|
||||||
if BUILD_CRYPTODEV
|
if BUILD_CRYPTODEV
|
||||||
src_libwolfssl_la_SOURCES += wolfcrypt/src/cryptodev.c
|
src_libwolfssl_la_SOURCES += wolfcrypt/src/cryptodev.c
|
||||||
|
43
wolfcrypt/src/port/devcrypto/README.md
Normal file
43
wolfcrypt/src/port/devcrypto/README.md
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Description
|
||||||
|
|
||||||
|
Used to build with cryptodev-linux library with Linux OS.
|
||||||
|
|
||||||
|
# Quick Start
|
||||||
|
|
||||||
|
## Installing cryptodev module
|
||||||
|
|
||||||
|
If not already installed then the cryptodev-linux module will need installed.
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://github.com/cryptodev-linux/cryptodev-linux.git
|
||||||
|
cd cryptodev-linux
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
modprobe cryptodev
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Options for building wolfSSL
|
||||||
|
|
||||||
|
For default build with all supported features use:
|
||||||
|
|
||||||
|
```
|
||||||
|
./configure --enable-cryptodev
|
||||||
|
```
|
||||||
|
|
||||||
|
Or for more control over features used:
|
||||||
|
|
||||||
|
```
|
||||||
|
./configure --enable-devcrypto=cbc
|
||||||
|
./configure --enable-devcrypto=hash
|
||||||
|
./configure --enable-devcrypto=aes
|
||||||
|
./configure --enable-devcrypto=all
|
||||||
|
```
|
||||||
|
|
||||||
|
Then build the wolfSSL library with:
|
||||||
|
|
||||||
|
```
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
./wolfcrypt/test/testwolfcrypt
|
||||||
|
```
|
@@ -61,7 +61,7 @@ static int HashInit(void* ctx, int type, byte* key, word32 keySz)
|
|||||||
WC_CRYPTODEV* cdev;
|
WC_CRYPTODEV* cdev;
|
||||||
|
|
||||||
if ((cdev = GetHashContext(ctx, type)) == NULL) {
|
if ((cdev = GetHashContext(ctx, type)) == NULL) {
|
||||||
WOLFSSL_MSG("Unsuported hash type");
|
WOLFSSL_MSG("Unsupported hash type");
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -47,7 +47,7 @@ int wc_DevCryptoCreate(WC_CRYPTODEV* ctx, int type, byte* key, word32 keySz)
|
|||||||
XMEMSET(ctx, 0, sizeof(WC_CRYPTODEV));
|
XMEMSET(ctx, 0, sizeof(WC_CRYPTODEV));
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case CRYPTO_SHA1:
|
case CRYPTO_SHA1:
|
||||||
case CRYPTO_SHA2_256:
|
case CRYPTO_SHA2_256:
|
||||||
isHash = 1;
|
isHash = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ void wc_SetupCrypt(struct crypt_op* crt, WC_CRYPTODEV* dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* setup crypt_op structure for symetric key operations */
|
/* setup crypt_op structure for symmetric key operations */
|
||||||
void wc_SetupCryptSym(struct crypt_op* crt, WC_CRYPTODEV* dev,
|
void wc_SetupCryptSym(struct crypt_op* crt, WC_CRYPTODEV* dev,
|
||||||
byte* src, word32 srcSz, byte* dst, byte* iv, int flag)
|
byte* src, word32 srcSz, byte* dst, byte* iv, int flag)
|
||||||
|
|
||||||
|
@@ -48,7 +48,8 @@ typedef struct WOLFSSL_AES_KEY {
|
|||||||
/* key-based fast multiplication table. */
|
/* key-based fast multiplication table. */
|
||||||
ALIGN16 void* M0[4096 / sizeof(void*)];
|
ALIGN16 void* M0[4096 / sizeof(void*)];
|
||||||
#endif /* GCM_TABLE */
|
#endif /* GCM_TABLE */
|
||||||
#if defined(WOLFSSL_DEVCRYPTO_AES) || defined(WOLFSSL_DEVCRYPTO_CBC)
|
#if defined(WOLFSSL_DEVCRYPTO) && \
|
||||||
|
(defined(WOLFSSL_DEVCRYPTO_AES) || defined(WOLFSSL_DEVCRYPTO_CBC))
|
||||||
/* large enough for additional devcrypto information */
|
/* large enough for additional devcrypto information */
|
||||||
void* devKey[288 / sizeof(void*)];
|
void* devKey[288 / sizeof(void*)];
|
||||||
#endif
|
#endif
|
||||||
|
@@ -166,7 +166,8 @@ typedef struct Aes {
|
|||||||
struct msghdr msg;
|
struct msghdr msg;
|
||||||
int dir; /* flag for encrpyt or decrypt */
|
int dir; /* flag for encrpyt or decrypt */
|
||||||
#endif
|
#endif
|
||||||
#if defined(WOLFSSL_DEVCRYPTO_AES) || defined(WOLFSSL_DEVCRYPTO_CBC)
|
#if defined(WOLFSSL_DEVCRYPTO) && \
|
||||||
|
(defined(WOLFSSL_DEVCRYPTO_AES) || defined(WOLFSSL_DEVCRYPTO_CBC))
|
||||||
word32 devKey[AES_MAX_KEY_SIZE/WOLFSSL_BIT_SIZE/sizeof(word32)]; /* raw key */
|
word32 devKey[AES_MAX_KEY_SIZE/WOLFSSL_BIT_SIZE/sizeof(word32)]; /* raw key */
|
||||||
WC_CRYPTODEV ctx;
|
WC_CRYPTODEV ctx;
|
||||||
#endif
|
#endif
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#include <wolfssl/wolfcrypt/types.h>
|
#include <wolfssl/wolfcrypt/types.h>
|
||||||
|
|
||||||
|
#ifdef WOLFSSL_DEVCRYPTO
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@@ -45,6 +47,7 @@ WOLFSSL_LOCAL void wc_SetupCryptAead(struct crypt_auth_op* crt, WC_CRYPTODEV* de
|
|||||||
byte* src, word32 srcSz, byte* dst, byte* iv, word32 ivSz, int flag,
|
byte* src, word32 srcSz, byte* dst, byte* iv, word32 ivSz, int flag,
|
||||||
byte* authIn, word32 authInSz, byte* authTag, word32 authTagSz);
|
byte* authIn, word32 authInSz, byte* authTag, word32 authTagSz);
|
||||||
|
|
||||||
|
#endif /* WOLFSSL_DEVCRYPTO */
|
||||||
#endif /* WOLFSSL_DEVCRYPTO_H */
|
#endif /* WOLFSSL_DEVCRYPTO_H */
|
||||||
|
|
||||||
|
|
||||||
|
@@ -80,7 +80,7 @@
|
|||||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||||
#include <wolfssl/wolfcrypt/async.h>
|
#include <wolfssl/wolfcrypt/async.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef WOLFSSL_DEVCRYPTO_HASH
|
#if defined(WOLFSSL_DEVCRYPTO) && defined(WOLFSSL_DEVCRYPTO_HASH)
|
||||||
#include <wolfssl/wolfcrypt/port/devcrypto/wc_devcrypto.h>
|
#include <wolfssl/wolfcrypt/port/devcrypto/wc_devcrypto.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user