Fix sdftest command bugs

This commit is contained in:
Zhi Guan
2024-06-08 10:35:38 +08:00
parent c4e5cf0deb
commit 3614daf6a6
5 changed files with 36 additions and 36 deletions

View File

@@ -22,6 +22,19 @@
extern void *globalDeviceHandle;
typedef struct {
uint32_t index;
uint8_t passlen;
unsigned char pass[26 + 1];
} SDF_ENC_PRIVATE_KEY;
typedef struct {
uint32_t index;
uint8_t passlen;
unsigned char pass[26 + 1];
} SDF_PRIVATE_KEY;
static const uint8_t zeros[ECCref_MAX_LEN - 32] = {0};
// hSession is from HashInit/Update/Final, also means the uiISKIndex key has been opened with password

View File

@@ -17,16 +17,15 @@
#include "sdf.h"
#include "sdf_ext.h"
/*
* TODO:
* 1. SM3-HMAC
*/
void *globalDeviceHandle = NULL;
typedef struct {
void *hSession;
} SDF_SM3_CTX;
int sm3_digest_init(SM3_DIGEST_CTX *ctx, const uint8_t *key, size_t keylen)
{
SDF_SM3_CTX *sdf_sm3_ctx = (SDF_SM3_CTX *)&ctx->sm3_ctx;

View File

@@ -19,6 +19,11 @@
extern void *globalDeviceHandle;
typedef struct {
void *hSession;
void *hKey;
} SDF_SM4_KEY;
static int sdf_sm4_cbc_encrypt_blocks(SDF_SM4_KEY *key,
const uint8_t iv[16], const uint8_t *in, size_t inlen, uint8_t *out)