mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-26 10:16:24 +08:00
Fix sdftest command bugs
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user