mirror of
https://gitee.com/openharmony/security_huks
synced 2025-03-05 00:47:28 +00:00
commit
851bc1a76f
@ -1156,6 +1156,7 @@ int32_t HksCheckGenKeyPurpose(uint32_t alg, uint32_t inputPurpose)
|
||||
return CheckPurposeValid(alg, inputPurpose);
|
||||
}
|
||||
|
||||
#ifdef HKS_SUPPORT_DSA_C
|
||||
static int32_t HksGetDsaKeySize(const struct HksBlob *key, uint32_t *keySize)
|
||||
|
||||
{
|
||||
@ -1180,6 +1181,7 @@ static int32_t HksGetDsaKeySize(const struct HksBlob *key, uint32_t *keySize)
|
||||
*keySize = keySizeParam->uint32Param;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t HksGetKeySize(uint32_t alg, const struct HksBlob *key, uint32_t *keySize)
|
||||
{
|
||||
@ -1357,6 +1359,9 @@ int32_t CheckImportMutableParams(uint32_t alg, const struct ParamsValues *params
|
||||
|
||||
int32_t HksCheckSignature(uint32_t cmdId, uint32_t alg, uint32_t keySize, const struct HksBlob *signature)
|
||||
{
|
||||
(void)cmdId;
|
||||
(void)keySize;
|
||||
(void)signature;
|
||||
switch (alg) {
|
||||
#if defined(HKS_SUPPORT_RSA_C) && defined(HKS_SUPPORT_RSA_SIGN_VERIFY)
|
||||
case HKS_ALG_RSA:
|
||||
|
@ -343,6 +343,7 @@ static int32_t CheckImportKeySize(uint32_t alg, const struct ParamsValues *param
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef HKS_SUPPORT_API_SIGN_VERIFY
|
||||
static int32_t CheckSignVerifyParamsByAlg(uint32_t cmdId, uint32_t alg, const struct ParamsValues *inputParams)
|
||||
{
|
||||
int32_t ret = HksCheckFixedParams(alg, HKS_CHECK_TYPE_USE_KEY, inputParams);
|
||||
@ -358,6 +359,7 @@ static int32_t CheckSignVerifyParamsByAlg(uint32_t cmdId, uint32_t alg, const st
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
#endif /* _CUT_AUTHENTICATE_ */
|
||||
|
||||
static int32_t CheckCipherParamsByAlg(
|
||||
|
@ -430,6 +430,7 @@ static int32_t AesEcbNoPaddingCrypt(const struct HksBlob *key, const struct HksU
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HKS_SUPPORT_AES_ECB_NOPADDING) || defined(HKS_SUPPORT_AES_ECB_PKCS7PADDING)
|
||||
static int32_t AesEcbCrypt(const struct HksBlob *key, const struct HksUsageSpec *usageSpec,
|
||||
const struct HksBlob *message, const bool encrypt, struct HksBlob *cipherText)
|
||||
{
|
||||
@ -445,6 +446,7 @@ static int32_t AesEcbCrypt(const struct HksBlob *key, const struct HksUsageSpec
|
||||
return HKS_ERROR_INVALID_PADDING;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int32_t CheckKeySize(const struct HksBlob *key)
|
||||
{
|
||||
|
@ -106,6 +106,7 @@ config("soft_huks_config") {
|
||||
cflags = [
|
||||
"-fvisibility=hidden",
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
]
|
||||
|
||||
if (disable_authenticate == true) {
|
||||
|
@ -1217,6 +1217,11 @@ int32_t HksServiceProcessFinal(uint32_t msgId, uint64_t operationHandle, const s
|
||||
int32_t HksServiceSignWithDeviceKey(const struct HksBlob *processName, uint32_t keyId,
|
||||
const struct HksParamSet *paramSet, const struct HksBlob *srcData, struct HksBlob *signature)
|
||||
{
|
||||
(void)processName;
|
||||
(void)keyId;
|
||||
(void)paramSet;
|
||||
(void)srcData;
|
||||
(void)signature;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1255,6 +1260,10 @@ int32_t HksServiceAttestKey(const struct HksBlob *processName, const struct HksB
|
||||
HksFreeParamSet(&newParamSet)
|
||||
return ret;
|
||||
#else
|
||||
(void)processName;
|
||||
(void)keyAlias;
|
||||
(void)paramSet;
|
||||
(void)certChain;
|
||||
return HKS_ERROR_NOT_SUPPORTED;
|
||||
#endif
|
||||
}
|
||||
@ -1282,6 +1291,10 @@ int32_t HksServiceGetCertificateChain(const struct HksBlob *processName, const s
|
||||
HKS_FREE_BLOB(certFromFile);
|
||||
return ret;
|
||||
#else
|
||||
(void)processName;
|
||||
(void)keyAlias;
|
||||
(void)paramSet;
|
||||
(void)certChain;
|
||||
return HKS_ERROR_NOT_SUPPORTED;
|
||||
#endif
|
||||
}
|
||||
@ -1289,27 +1302,43 @@ int32_t HksServiceGetCertificateChain(const struct HksBlob *processName, const s
|
||||
int32_t HksServiceWrapKey(const struct HksBlob *processName, const struct HksBlob *keyAlias,
|
||||
const struct HksBlob *targetKeyAlias, const struct HksParamSet *paramSet, struct HksBlob *wrappedData)
|
||||
{
|
||||
(void)processName;
|
||||
(void)keyAlias;
|
||||
(void)targetKeyAlias;
|
||||
(void)paramSet;
|
||||
(void)wrappedData;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HksServiceUnwrapKey(const struct HksBlob *processName, const struct HksBlob *keyAlias,
|
||||
const struct HksBlob *targetKeyAlias, const struct HksBlob *wrappedData, const struct HksParamSet *paramSet)
|
||||
{
|
||||
(void)processName;
|
||||
(void)keyAlias;
|
||||
(void)targetKeyAlias;
|
||||
(void)paramSet;
|
||||
(void)wrappedData;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HksServiceProvision(const struct HksBlob *srcData, const struct HksBlob *challengeIn)
|
||||
{
|
||||
(void)srcData;
|
||||
(void)challengeIn;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HksServiceProvisionVerify(const struct HksBlob *srcData, const struct HksBlob *challengeIn)
|
||||
{
|
||||
(void)srcData;
|
||||
(void)challengeIn;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HksServiceExportTrustCerts(const struct HksBlob *processName, struct HksBlob *certChain)
|
||||
{
|
||||
(void)processName;
|
||||
(void)certChain;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -96,18 +96,30 @@ int32_t HksAccessInitialize(void)
|
||||
int32_t HksAccessProcessInit(uint32_t msgId, const struct HksBlob *key, const struct HksParamSet *paramSet,
|
||||
uint64_t *operationHandle)
|
||||
{
|
||||
(void)msgId;
|
||||
(void)key;
|
||||
(void)paramSet;
|
||||
(void)operationHandle;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HksAccessProcessMultiUpdate(uint32_t msgId, uint64_t operationHandle, const struct HksBlob *inData,
|
||||
struct HksBlob *outData)
|
||||
{
|
||||
(void)msgId;
|
||||
(void)operationHandle;
|
||||
(void)inData;
|
||||
(void)outData;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HksAccessProcessFinal(uint32_t msgId, uint64_t operationHandle, const struct HksBlob *inData,
|
||||
struct HksBlob *outData)
|
||||
{
|
||||
(void)msgId;
|
||||
(void)operationHandle;
|
||||
(void)inData;
|
||||
(void)outData;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,10 @@ static_library("huks_3.0_test_common") {
|
||||
configs += [ ":hilog_lite_dir" ]
|
||||
deps += [ "//base/hiviewdfx/hilog_lite/frameworks/mini:hilog_lite" ]
|
||||
} else {
|
||||
cflags = [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
]
|
||||
configs += [ ":hilog_dir" ]
|
||||
deps += [ "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared" ]
|
||||
}
|
||||
|
@ -534,7 +534,7 @@ int32_t TestAes256ByLocal()
|
||||
testKey[i] = i + TEST_AES_32;
|
||||
}
|
||||
|
||||
keyBlob.data = testKey;
|
||||
keyBlob.data = (uint8_t *)testKey;
|
||||
keyBlob.size = sizeof(testKey);
|
||||
|
||||
/* encrypt by aes key 1 */
|
||||
|
@ -16,6 +16,9 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "hks_test_api_performance.h"
|
||||
|
||||
#include "securec.h"
|
||||
|
||||
#include "hks_api.h"
|
||||
#include "hks_param.h"
|
||||
|
||||
|
@ -19,8 +19,6 @@
|
||||
|
||||
#include "stdlib.h"
|
||||
|
||||
#include "time.h"
|
||||
|
||||
#define MAX_LOG_BUFF_LEN 512
|
||||
#define WAIT_TO_LOG_DONE 100000
|
||||
|
||||
@ -53,8 +51,6 @@ void HksTestLog(uint32_t logLevel, const char *funcName, int32_t lineNo, const c
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
usleep(WAIT_TO_LOG_DONE);
|
||||
}
|
||||
|
||||
void HksAssertLog(bool test)
|
||||
|
@ -16,8 +16,10 @@
|
||||
#ifndef HKS_TEST_LOG_H
|
||||
#define HKS_TEST_LOG_H
|
||||
|
||||
#include "stdint.h"
|
||||
#include "stdbool.h"
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "securec.h"
|
||||
|
||||
enum HksLogLevel {
|
||||
HKS_LOG_LEVEL_I,
|
||||
|
@ -49,8 +49,11 @@ unittest("huks_3.0_test") {
|
||||
"//base/security/huks/interfaces/innerkits/huks_lite:huks_3.0_sdk",
|
||||
"//base/security/huks/test/unittest/src/common:huks_3.0_test_common",
|
||||
]
|
||||
cflags = [ "-Wno-error" ]
|
||||
|
||||
cflags = [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
]
|
||||
if (disable_authenticate == true) {
|
||||
defines = [ "_CUT_AUTHENTICATE_" ]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user