Update naming and remove static library build

pull/392/head
Bill Phipps 2023-07-25 13:08:41 -04:00
parent 14321a7a19
commit 4cd631dc2f
2 changed files with 38 additions and 17 deletions

View File

@ -12,7 +12,7 @@ WOLFSSL_DIR?=../../bill_wolfssl
VAULTIC_DIR?=VaultIC-TLS_420/vaultic_tls-4xx VAULTIC_DIR?=VaultIC-TLS_420/vaultic_tls-4xx
# Common settings and files # Common settings and files
CFLAGS+=-I. -O2 CFLAGS+=-I. -O2 -DHAVE_CCBVAULTIC
OBJS=ccb_vaultic.o OBJS=ccb_vaultic.o
# Uncomment to enable verbose debug logging # Uncomment to enable verbose debug logging
@ -22,9 +22,9 @@ CFLAGS+=-DCCBVAULTIC_DEBUG_TIMING
#CFLAGS+=-DSPI_TRACE_ERRORS #CFLAGS+=-DSPI_TRACE_ERRORS
# Optionally disable certain kinds of offload # Optionally disable certain kinds of offload
#CFLAGS+=-DNO_CCBVIC_AES #CFLAGS+=-DCCBVAULTIC_NO_AES
CFLAGS+=-DNO_CCBVIC_SHA CFLAGS+=-DCCBVAULTIC_NO_SHA
#CFLAGS+=-DNO_CCBVIC_RSA #CFLAGS+=-DCCBVAULTIC_NO_RSA
# wolfSSL settings and files # wolfSSL settings and files
# ./configure --enable-cryptocb --enable-static --disable-shared --host aarch64-linux-android # ./configure --enable-cryptocb --enable-static --disable-shared --host aarch64-linux-android
@ -60,10 +60,6 @@ wolfcrypt-test: $(OBJS) $(TEST_OBJS)
wolfcrypt-benchmark: $(OBJS) $(BENCH_OBJS) wolfcrypt-benchmark: $(OBJS) $(BENCH_OBJS)
$(CC) -o $@ $^ $(LDFLAGS) $(CC) -o $@ $^ $(LDFLAGS)
lib: $(OBJS)
cp $(VAULTIC_TLS)/VaultIC_420_TLS_Lib-SPI-Release/libvaultic420_tls.a libccbvaultic.a
$(AR) -r libccbvaultic.a $(OBJS)
clean: clean:
rm -f *.o *.d wolfcrypt-test wolfcrypt-benchmark rm -f *.o *.d wolfcrypt-test wolfcrypt-benchmark
rm -f $(WOLFSSL_DIR)/wolfcrypt/benchmark/*.o rm -f $(WOLFSSL_DIR)/wolfcrypt/benchmark/*.o

View File

@ -35,6 +35,30 @@
#include "wolfssl/wolfcrypt/hash.h" /* For HASH_FLAGS and types */ #include "wolfssl/wolfcrypt/hash.h" /* For HASH_FLAGS and types */
#include "wolfssl/wolfcrypt/rsa.h" /* For RSA_MAX_SIZE */ #include "wolfssl/wolfcrypt/rsa.h" /* For RSA_MAX_SIZE */
/* Local include */
#include "ccb_vaultic.h"
#ifndef HAVE_CCBVAULTIC
/* Provide dummy implementations of callbacks */
int ccbVaultIc_Init(ccbVaultIc_Context *c)
{
return CRYPTOCB_UNAVAILABLE;
}
/* Close the Wisekey VaultIC library. */
void ccbVaultIc_Cleanup(ccbVaultIc_Context *c) {
return;
}
int ccbVaultIc_CryptoDevCb(int devId,
wc_CryptoInfo* info,
void* ctx)
{
return CRYPTOCB_UNAVAILABLE;
}
#else
/* WiseKey VaultIC includes */ /* WiseKey VaultIC includes */
#include "vaultic_tls.h" #include "vaultic_tls.h"
#include "vaultic_config.h" #include "vaultic_config.h"
@ -45,16 +69,15 @@
#define VAULTIC_KP_ALL 0xFF /* Allow all users all privileges */ #define VAULTIC_KP_ALL 0xFF /* Allow all users all privileges */
#define VAULTIC_PKV_ASSURED VLT_PKV_ASSURED_EXPLICIT_VALIDATION #define VAULTIC_PKV_ASSURED VLT_PKV_ASSURED_EXPLICIT_VALIDATION
/* Local include */
#include "ccb_vaultic.h"
/* Defined options: /* Defined options:
* CCBVAULTIC_DEBUG: Print useful callback info using printf * CCBVAULTIC_DEBUG: Print useful callback info using printf
* CCBVAULTIC_DEBUG_TIMING: Print useful timing info using printf * CCBVAULTIC_DEBUG_TIMING: Print useful timing info using printf
* CCBVAULTIC_DEBUG_ALL: Print copious info using printf * CCBVAULTIC_DEBUG_ALL: Print copious info using printf
* NO_CCBVIC_SHA: Do not handle SHA256 callback * CCBVAULTIC_NO_SHA: Do not handle SHA256 callback
* NO_CCBVIC_RSA: Do not handle RSA callback * CCBVAULTIC_NO_RSA: Do not handle RSA callback
* NO_CCBVIC_AES: Do not handle AES callback * CCBVAULTIC_NO_AES: Do not handle AES callback
*/ */
#ifdef CCBVAULTIC_DEBUG_ALL #ifdef CCBVAULTIC_DEBUG_ALL
@ -335,7 +358,7 @@ static int HandlePkCallback(int devId, wc_CryptoInfo* info,
#if defined(CCBVAULTIC_DEBUG_ALL) #if defined(CCBVAULTIC_DEBUG_ALL)
printf(" HandlePkCallback RSA: Type:%d\n",info->pk.rsa.type); printf(" HandlePkCallback RSA: Type:%d\n",info->pk.rsa.type);
#endif #endif
#if !defined(NO_CCBVIC_RSA) #if !defined(CCBVAULTIC_NO_RSA)
{ {
if((info->pk.rsa.type == RSA_PUBLIC_DECRYPT) || /* RSA Verify */ if((info->pk.rsa.type == RSA_PUBLIC_DECRYPT) || /* RSA Verify */
@ -587,7 +610,7 @@ static int HandleHashCallback(int devId, wc_CryptoInfo* info,
info->hash.in, info->hash.inSz, info->hash.digest, info->hash.in, info->hash.inSz, info->hash.digest,
c->m, c->m_len, c->hash_type); c->m, c->m_len, c->hash_type);
#endif #endif
#if !defined(NO_CCBVIC_SHA) #if !defined(CCBVAULTIC_NO_SHA)
/* /*
* info->hash.flag | WC_HASH_FLAGS_WILL_COPY --> Buffer entire message * info->hash.flag | WC_HASH_FLAGS_WILL_COPY --> Buffer entire message
* info->hash.in != NULL --> Update * info->hash.in != NULL --> Update
@ -778,7 +801,7 @@ static int HandleCipherCallback(int devId, wc_CryptoInfo* info,
#if defined(CCBVAULTIC_DEBUG_ALL) #if defined(CCBVAULTIC_DEBUG_ALL)
printf(" HandleCipherCallback AES_CBC\n"); printf(" HandleCipherCallback AES_CBC\n");
#endif #endif
#if !defined(NO_CCBVIC_AES) #if !defined(CCBVAULTIC_NO_AES)
{ {
Aes* aes = info->cipher.aescbc.aes; Aes* aes = info->cipher.aescbc.aes;
int encrypt = info->cipher.enc; int encrypt = info->cipher.enc;
@ -948,7 +971,7 @@ static int HandleCipherCallback(int devId, wc_CryptoInfo* info,
/* Update return value to indicate success */ /* Update return value to indicate success */
rc=0; rc=0;
} }
#endif /* NO_CCBVIC_AES */ #endif /* CCBVAULTIC_NO_AES */
break; break;
case WC_CIPHER_AES_GCM: case WC_CIPHER_AES_GCM:
@ -994,3 +1017,5 @@ static int HandleCipherCallback(int devId, wc_CryptoInfo* info,
} }
return rc; return rc;
} }
#endif /* HAVE_CCBVAULTIC */