mirror of
https://gitee.com/openharmony/interface_sdk_c
synced 2024-11-23 06:39:54 +00:00
同步NDK差异
Signed-off-by: huangdongting <huangdongting3@huawei.com>
This commit is contained in:
parent
7875955258
commit
3d4753c4f0
@ -45,8 +45,13 @@
|
||||
|
||||
|
||||
```
|
||||
|
||||
## 相关仓
|
||||
|
||||
[interface_sdk_c](https://gitee.com/openharmony-sig/interface_sdk_c/)
|
||||
|
||||
[C API编码规范](https://gitee.com/openharmony-sig/interface_sdk_c/blob/master/docs/capi_naming.md): 描述了OpenHarmony C API的设计规范,指导开发者如何设计发布一个接口。
|
||||
|
||||
[C API构建指南](https://gitee.com/openharmony-sig/interface_sdk_c/blob/master/docs/howto_add.md):描述了如何在build.gn中添加C API的构建目标。
|
||||
|
||||
|
||||
|
@ -35,8 +35,8 @@
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#ifndef ST_NATIVE_AUDIOSTREAM_BASE_H
|
||||
#define ST_NATIVE_AUDIOSTREAM_BASE_H
|
||||
#ifndef NATIVE_AUDIOSTREAM_BASE_H
|
||||
#define NATIVE_AUDIOSTREAM_BASE_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -479,7 +479,7 @@ typedef struct OH_AudioRenderer_Callbacks_Struct {
|
||||
*
|
||||
* @since 10
|
||||
*/
|
||||
int32_t (*OH_AudioRenderer_OnInterrptEvent)(
|
||||
int32_t (*OH_AudioRenderer_OnInterruptEvent)(
|
||||
OH_AudioRenderer* renderer,
|
||||
void* userData,
|
||||
OH_AudioInterrupt_ForceType type,
|
||||
@ -532,8 +532,8 @@ typedef struct OH_AudioCapturer_Callbacks_Struct {
|
||||
*
|
||||
* @since 10
|
||||
*/
|
||||
int32_t (*OH_AudioCapturer_OnInterrptEvent)(
|
||||
OH_AudioCapturer* renderer,
|
||||
int32_t (*OH_AudioCapturer_OnInterruptEvent)(
|
||||
OH_AudioCapturer* capturer,
|
||||
void* userData,
|
||||
OH_AudioInterrupt_ForceType type,
|
||||
OH_AudioInterrupt_Hint hint);
|
||||
@ -553,4 +553,4 @@ typedef struct OH_AudioCapturer_Callbacks_Struct {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // ST_NATIVE_AUDIOSTREAM_BASE_H
|
||||
#endif // NATIVE_AUDIOSTREAM_BASE_H
|
||||
|
@ -146,14 +146,18 @@ enum AudioChannelLayout : uint64_t {
|
||||
AudioChannelSet::TOP_FRONT_LEFT | AudioChannelSet::TOP_FRONT_RIGHT),
|
||||
STEREO_DOWNMIX = (AudioChannelSet::STEREO_LEFT | AudioChannelSet::STEREO_RIGHT),
|
||||
|
||||
HOA_FIRST = AudioChannelSet::AMBISONICS_ACN0 | AudioChannelSet::AMBISONICS_ACN1 | AudioChannelSet::AMBISONICS_ACN2 |
|
||||
AudioChannelSet::AMBISONICS_ACN3,
|
||||
HOA_SECOND = HOA_FIRST | AudioChannelSet::AMBISONICS_ACN4 | AudioChannelSet::AMBISONICS_ACN5 |
|
||||
AudioChannelSet::AMBISONICS_ACN6 | AudioChannelSet::AMBISONICS_ACN7 | AudioChannelSet::AMBISONICS_ACN8,
|
||||
HOA_THIRD = HOA_SECOND | AudioChannelSet::AMBISONICS_ACN9 | AudioChannelSet::AMBISONICS_ACN10 |
|
||||
AudioChannelSet::AMBISONICS_ACN11 | AudioChannelSet::AMBISONICS_ACN12 |
|
||||
AudioChannelSet::AMBISONICS_ACN13 | AudioChannelSet::AMBISONICS_ACN14 |
|
||||
AudioChannelSet::AMBISONICS_ACN15,
|
||||
CH_2POINT0POINT2 = (STEREO | AudioChannelSet::TOP_SIDE_LEFT | AudioChannelSet::TOP_SIDE_RIGHT),
|
||||
CH_2POINT1POINT2 = (CH_2POINT0POINT2 | AudioChannelSet::LOW_FREQUENCY),
|
||||
CH_3POINT0POINT2 = (CH_2POINT0POINT2 | AudioChannelSet::FRONT_CENTER),
|
||||
HOA_ORDER1_ACN_N3D = 0x100000000001,
|
||||
HOA_ORDER1_ACN_SN3D = 0x100000001001,
|
||||
HOA_ORDER1_FUMA = 0x100000000101,
|
||||
HOA_ORDER2_ACN_N3D = 0x100000000002,
|
||||
HOA_ORDER2_ACN_SN3D = 0x100000001002,
|
||||
HOA_ORDER2_FUMA = 0x100000000102,
|
||||
HOA_ORDER3_ACN_N3D = 0x100000000003,
|
||||
HOA_ORDER3_ACN_SN3D = 0x100000001003,
|
||||
HOA_ORDER3_FUMA = 0x100000000103,
|
||||
};
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -160,6 +160,10 @@ extern const char *OH_AVCODEC_MIMETYPE_VIDEO_MPEG4;
|
||||
extern const char *OH_AVCODEC_MIMETYPE_IMAGE_JPG;
|
||||
extern const char *OH_AVCODEC_MIMETYPE_IMAGE_PNG;
|
||||
extern const char *OH_AVCODEC_MIMETYPE_IMAGE_BMP;
|
||||
extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AVS3DA;
|
||||
extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AMR_NB;
|
||||
extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AMR_WB;
|
||||
extern const char *OH_AVCODEC_MIMETYPE_AUDIO_OPUS;
|
||||
|
||||
/**
|
||||
* @brief The extra data's key of surface Buffer
|
||||
@ -184,7 +188,7 @@ extern const char *OH_MD_KEY_TRACK_TYPE;
|
||||
extern const char *OH_MD_KEY_CODEC_MIME;
|
||||
/* Key for duration, value type is int64_t. */
|
||||
extern const char *OH_MD_KEY_DURATION;
|
||||
/* Key for bitrate, value type is uint32_t. */
|
||||
/* Key for bitrate, value type is int64_t. */
|
||||
extern const char *OH_MD_KEY_BITRATE;
|
||||
/* Key for max input size, value type is uint32_t */
|
||||
extern const char *OH_MD_KEY_MAX_INPUT_SIZE;
|
||||
@ -255,6 +259,18 @@ extern const char *OH_MD_KEY_DESCRIPTION;
|
||||
extern const char *OH_MD_KEY_LYRICS;
|
||||
/* source format Key for track count, value type is uint32_t */
|
||||
extern const char *OH_MD_KEY_TRACK_COUNT;
|
||||
/* Key for type of file, value type is int32_t, see @OH_FileType */
|
||||
extern const char *OH_MD_KEY_FILE_TYPE;
|
||||
/* Key for whether the file contains video tracks, value type is boolean */
|
||||
extern const char *OH_MD_KEY_HAS_VIDEO;
|
||||
/* Key for whether the file contains audio tracks, value type is boolean */
|
||||
extern const char *OH_MD_KEY_HAS_AUDIO;
|
||||
/* Key for author of file, value type is string */
|
||||
extern const char *OH_MD_KEY_AUTHOR;
|
||||
/* Key for composer of file, value type is string */
|
||||
extern const char *OH_MD_KEY_COMPOSER;
|
||||
/* Key for cover of file, value type is uint8_t pointer */
|
||||
extern const char *OH_MD_KEY_COVER;
|
||||
/* Key for the desired encoding channel layout, value type is int64_t, this key is only supported for encoders */
|
||||
extern const char *OH_MD_KEY_CHANNEL_LAYOUT;
|
||||
/* Key for bits per coded sample, value type is uint32_t, supported for flac encoder, see @OH_BitsPerSample */
|
||||
@ -275,6 +291,32 @@ extern const char *OH_MD_KEY_SCALING_MODE;
|
||||
extern const char *OH_MD_MAX_INPUT_BUFFER_COUNT;
|
||||
/* Key for max output buffer count, value type is int32_t */
|
||||
extern const char *OH_MD_MAX_OUTPUT_BUFFER_COUNT;
|
||||
/* Key for codec compression level, value type is uint32_t */
|
||||
extern const char *OH_MD_KEY_COMPRESSION_LEVEL;
|
||||
/* Key for encode level, value type is int32_t. see @OH_HEVCLevel. */
|
||||
extern const char *OH_MD_KEY_LEVEL;
|
||||
/* Key for chroma location, value type is int32_t. see @OH_ChromaLocation. */
|
||||
extern const char *OH_MD_KEY_VIDEO_CHROMA_LOCATION;
|
||||
|
||||
/**
|
||||
* @brief File type.
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
* @since 10
|
||||
* @version 1.0
|
||||
*/
|
||||
typedef enum OH_FileType {
|
||||
FILE_TYPE_UNKNOW = 0,
|
||||
FILE_TYPE_MP4 = 101,
|
||||
FILE_TYPE_MPEGTS = 102,
|
||||
FILE_TYPE_MKV = 103,
|
||||
FILE_TYPE_AMR = 201,
|
||||
FILE_TYPE_AAC = 202,
|
||||
FILE_TYPE_MP3 = 203,
|
||||
FILE_TYPE_FLAC = 204,
|
||||
FILE_TYPE_OGG = 205,
|
||||
FILE_TYPE_M4A = 206,
|
||||
FILE_TYPE_WAV = 207,
|
||||
} OH_FileType;
|
||||
|
||||
/**
|
||||
* @brief Media type.
|
||||
@ -349,6 +391,27 @@ typedef enum OH_HEVCProfile {
|
||||
HEVC_PROFILE_MAIN_10_HDR10_PLUS = 4,
|
||||
} OH_HEVCProfile;
|
||||
|
||||
/**
|
||||
* @brief HEVC Level
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
* @since 10
|
||||
*/
|
||||
enum OH_HEVCLevel {
|
||||
HEVC_LEVEL_1 = 0,
|
||||
HEVC_LEVEL_2 = 1,
|
||||
HEVC_LEVEL_21 = 2,
|
||||
HEVC_LEVEL_3 = 3,
|
||||
HEVC_LEVEL_31 = 4,
|
||||
HEVC_LEVEL_4 = 5,
|
||||
HEVC_LEVEL_41 = 6,
|
||||
HEVC_LEVEL_5 = 7,
|
||||
HEVC_LEVEL_51 = 8,
|
||||
HEVC_LEVEL_52 = 9,
|
||||
HEVC_LEVEL_6 = 10,
|
||||
HEVC_LEVEL_61 = 11,
|
||||
HEVC_LEVEL_62 = 12,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Color Primary
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
@ -415,6 +478,21 @@ typedef enum OH_MatrixCoefficient {
|
||||
MATRIX_COEFFICIENT_ICTCP = 14,
|
||||
} OH_MatrixCoefficient;
|
||||
|
||||
/**
|
||||
* @brief Chroma Location
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
* @since 10
|
||||
*/
|
||||
enum OH_ChromaLocation {
|
||||
CHROMA_LOC_UNSPECIFIED = 0,
|
||||
CHROMA_LOC_LEFT = 1, ///< MPEG-2/4 4:2:0, H.264 default for 4:2:0
|
||||
CHROMA_LOC_CENTER = 2, ///< MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0
|
||||
CHROMA_LOC_TOPLEFT = 3, ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2
|
||||
CHROMA_LOC_TOP = 4,
|
||||
CHROMA_LOC_BOTTOMLEFT = 5,
|
||||
CHROMA_LOC_BOTTOM = 6,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Scaling Mode
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
|
@ -31,8 +31,7 @@ typedef struct OH_AVSource OH_AVSource;
|
||||
* @brief Creates an OH_AVSource instance that models the media at the URI.
|
||||
* @syscap SystemCapability.Multimedia.Media.Spliter
|
||||
* @param uri An URI for a remote media resource.
|
||||
* @return Returns AV_ERR_OK if the execution is successful,
|
||||
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
|
||||
* @return Returns a pointer to an OH_AVSource instance
|
||||
* @since 10
|
||||
*/
|
||||
OH_AVSource *OH_AVSource_CreateWithURI(char *uri);
|
||||
@ -43,8 +42,7 @@ OH_AVSource *OH_AVSource_CreateWithURI(char *uri);
|
||||
* @param fd The fileDescriptor of data source.
|
||||
* @param offset The offset into the file to start reading.
|
||||
* @param size The file size in bytes.
|
||||
* @return Returns AV_ERR_OK if the execution is successful,
|
||||
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
|
||||
* @return Returns a pointer to an OH_AVSource instance
|
||||
* @since 10
|
||||
*/
|
||||
OH_AVSource *OH_AVSource_CreateWithFD(int32_t fd, int64_t offset, int64_t size);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* @since 10
|
||||
*/
|
||||
|
||||
/**
|
||||
/**
|
||||
* @file mutex.h
|
||||
*
|
||||
* @brief Declares the mutex interfaces in C.
|
||||
|
@ -118,6 +118,7 @@ FFRT_C_API void ffrt_task_attr_set_delay(ffrt_task_attr_t* attr, uint64_t delay_
|
||||
* @version 1.0
|
||||
*/
|
||||
FFRT_C_API uint64_t ffrt_task_attr_get_delay(const ffrt_task_attr_t* attr);
|
||||
|
||||
/**
|
||||
* @brief Updates the QoS of this task.
|
||||
*
|
||||
@ -127,7 +128,8 @@ FFRT_C_API uint64_t ffrt_task_attr_get_delay(const ffrt_task_attr_t* attr);
|
||||
* @since 10
|
||||
* @version 1.0
|
||||
*/
|
||||
FFRT_C_API int ffrt_this_task_update_qos(ffrt_qos_t task_qos);
|
||||
FFRT_C_API int ffrt_this_task_update_qos(ffrt_qos_t qos);
|
||||
|
||||
/**
|
||||
* @brief Obtains the ID of this task.
|
||||
*
|
||||
@ -201,4 +203,5 @@ FFRT_C_API void ffrt_wait_deps(const ffrt_deps_t* deps);
|
||||
* @version 1.0
|
||||
*/
|
||||
FFRT_C_API void ffrt_wait(void);
|
||||
|
||||
#endif
|
||||
|
@ -50,6 +50,7 @@
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
/** Inheritance. */
|
||||
ffrt_qos_inherit = -1,
|
||||
/** Background task. */
|
||||
ffrt_qos_background,
|
||||
@ -73,6 +74,7 @@ typedef struct {
|
||||
ffrt_function_t exec;
|
||||
/** Function used to destroy a task. */
|
||||
ffrt_function_t destroy;
|
||||
/** Need to be set to 0. */
|
||||
uint64_t reserve[2];
|
||||
} ffrt_function_header_t;
|
||||
|
||||
@ -104,13 +106,25 @@ typedef enum {
|
||||
ffrt_function_kind_queue
|
||||
} ffrt_function_kind_t;
|
||||
|
||||
/**
|
||||
* @brief dependency type.
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
/** Data dependency type. */
|
||||
ffrt_dependence_data,
|
||||
/** Task dependency type. */
|
||||
ffrt_dependence_task,
|
||||
} ffrt_dependence_type_t;
|
||||
|
||||
/**
|
||||
* @brief dependency data structure.
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
/** Dependency type. */
|
||||
ffrt_dependence_type_t type;
|
||||
/** Dependency pointer. */
|
||||
const void* ptr;
|
||||
} ffrt_dependence_t;
|
||||
|
||||
|
@ -1,126 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "native_huks_api.h"
|
||||
|
||||
#include "hks_api.h"
|
||||
#include "hks_errcode_adapter.h"
|
||||
#include "native_huks_api_adapter.h"
|
||||
|
||||
static struct OH_Huks_Result ConvertApiResult(int32_t ret)
|
||||
{
|
||||
struct HksResult result = HksConvertErrCode(ret);
|
||||
return *((struct OH_Huks_Result *)(&result));
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_GetSdkVersion(struct OH_Huks_Blob *sdkVersion)
|
||||
{
|
||||
int32_t result = HksGetSdkVersion((struct HksBlob *) sdkVersion);
|
||||
return ConvertApiResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_GenerateKeyItem(const struct OH_Huks_Blob *keyAlias,
|
||||
const struct OH_Huks_ParamSet *paramSetIn, struct OH_Huks_ParamSet *paramSetOut)
|
||||
{
|
||||
int32_t result = HksGenerateKey((const struct HksBlob *) keyAlias,
|
||||
(const struct HksParamSet *) paramSetIn, (struct HksParamSet *) paramSetOut);
|
||||
return ConvertApiResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_ImportKeyItem(const struct OH_Huks_Blob *keyAlias,
|
||||
const struct OH_Huks_ParamSet *paramSet, const struct OH_Huks_Blob *key)
|
||||
{
|
||||
int32_t result = HksImportKey((const struct HksBlob *) keyAlias,
|
||||
(const struct HksParamSet *) paramSet, (const struct HksBlob *) key);
|
||||
return ConvertApiResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_ImportWrappedKeyItem(const struct OH_Huks_Blob *keyAlias,
|
||||
const struct OH_Huks_Blob *wrappingKeyAlias, const struct OH_Huks_ParamSet *paramSet,
|
||||
const struct OH_Huks_Blob *wrappedKeyData)
|
||||
{
|
||||
int32_t result = HksImportWrappedKey((const struct HksBlob *) keyAlias,
|
||||
(const struct HksBlob *) wrappingKeyAlias, (const struct HksParamSet *) paramSet,
|
||||
(const struct HksBlob *) wrappedKeyData);
|
||||
return ConvertApiResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_ExportPublicKeyItem(const struct OH_Huks_Blob *keyAlias,
|
||||
const struct OH_Huks_ParamSet *paramSet, struct OH_Huks_Blob *key)
|
||||
{
|
||||
int32_t result = HksExportPublicKey((const struct HksBlob *) keyAlias,
|
||||
(const struct HksParamSet *) paramSet, (struct HksBlob *) key);
|
||||
return ConvertApiResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_DeleteKeyItem(const struct OH_Huks_Blob *keyAlias,
|
||||
const struct OH_Huks_ParamSet *paramSet)
|
||||
{
|
||||
int32_t result = HksDeleteKey((const struct HksBlob *) keyAlias, (const struct HksParamSet *) paramSet);
|
||||
return ConvertApiResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_GetKeyItemParamSet(const struct OH_Huks_Blob *keyAlias,
|
||||
const struct OH_Huks_ParamSet *paramSetIn, struct OH_Huks_ParamSet *paramSetOut)
|
||||
{
|
||||
int32_t result = HksGetKeyParamSet((const struct HksBlob *) keyAlias,
|
||||
(const struct HksParamSet *) paramSetIn, (struct HksParamSet *) paramSetOut);
|
||||
return ConvertApiResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_IsKeyItemExist(const struct OH_Huks_Blob *keyAlias,
|
||||
const struct OH_Huks_ParamSet *paramSet)
|
||||
{
|
||||
int32_t result = HksKeyExist((const struct HksBlob *) keyAlias, (const struct HksParamSet *) paramSet);
|
||||
return ConvertApiResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_AttestKeyItem(const struct OH_Huks_Blob *keyAlias,
|
||||
const struct OH_Huks_ParamSet *paramSet, struct OH_Huks_CertChain *certChain)
|
||||
{
|
||||
int32_t result = HuksAttestAdapter(keyAlias, paramSet, certChain);
|
||||
return ConvertApiResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_InitSession(const struct OH_Huks_Blob *keyAlias,
|
||||
const struct OH_Huks_ParamSet *paramSet, struct OH_Huks_Blob *handle, struct OH_Huks_Blob *token)
|
||||
{
|
||||
int32_t result = HksInit((const struct HksBlob *) keyAlias,
|
||||
(const struct HksParamSet *) paramSet, (struct HksBlob *) handle, (struct HksBlob *) token);
|
||||
return ConvertApiResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_UpdateSession(const struct OH_Huks_Blob *handle,
|
||||
const struct OH_Huks_ParamSet *paramSet, const struct OH_Huks_Blob *inData, struct OH_Huks_Blob *outData)
|
||||
{
|
||||
int32_t result = HksUpdate((const struct HksBlob *) handle,
|
||||
(const struct HksParamSet *) paramSet, (const struct HksBlob *) inData, (struct HksBlob *) outData);
|
||||
return ConvertApiResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_FinishSession(const struct OH_Huks_Blob *handle,
|
||||
const struct OH_Huks_ParamSet *paramSet, const struct OH_Huks_Blob *inData, struct OH_Huks_Blob *outData)
|
||||
{
|
||||
int32_t result = HksFinish((const struct HksBlob *) handle,
|
||||
(const struct HksParamSet *) paramSet, (const struct HksBlob *) inData, (struct HksBlob *) outData);
|
||||
return ConvertApiResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_AbortSession(const struct OH_Huks_Blob *handle,
|
||||
const struct OH_Huks_ParamSet *paramSet)
|
||||
{
|
||||
int32_t result = HksAbort((const struct HksBlob *) handle, (const struct HksParamSet *) paramSet);
|
||||
return ConvertApiResult(result);
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "hks_api.h"
|
||||
#include "hks_param.h"
|
||||
|
||||
#include "native_huks_api_adapter.h"
|
||||
#include "native_huks_param.h"
|
||||
|
||||
int32_t HuksAttestAdapter(const struct OH_Huks_Blob *keyAlias, const struct OH_Huks_ParamSet *paramSet,
|
||||
struct OH_Huks_CertChain *certChain)
|
||||
{
|
||||
int32_t ret;
|
||||
struct HksParamSet *newParamSet = NULL;
|
||||
do {
|
||||
if (paramSet == NULL) {
|
||||
ret = HKS_ERROR_NULL_POINTER;
|
||||
break;
|
||||
}
|
||||
ret = HksCheckParamSet((struct HksParamSet *)paramSet, paramSet->paramSetSize);
|
||||
if (ret != HKS_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
ret = HksInitParamSet(&newParamSet);
|
||||
if (ret != HKS_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
ret = HksFreshParamSet((struct HksParamSet *)paramSet, false);
|
||||
if (ret != HKS_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
ret = HksAddParams(newParamSet, (const struct HksParam *)paramSet->params, paramSet->paramsCnt);
|
||||
if (ret != HKS_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
struct HksParam isBase64Param = { .tag = HKS_TAG_ATTESTATION_BASE64, .boolParam = true };
|
||||
ret = HksAddParams(newParamSet, &isBase64Param, 1);
|
||||
if (ret != HKS_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
ret = HksBuildParamSet(&newParamSet);
|
||||
if (ret != HKS_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
ret = HksAttestKey((const struct HksBlob *)keyAlias, (struct HksParamSet *)newParamSet,
|
||||
(struct HksCertChain *)certChain);
|
||||
} while (0);
|
||||
HksFreeParamSet(&newParamSet);
|
||||
return ret;
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "native_huks_param.h"
|
||||
|
||||
#include "hks_param.h"
|
||||
#include "hks_errcode_adapter.h"
|
||||
|
||||
static struct OH_Huks_Result ConvertParamResult(int32_t ret)
|
||||
{
|
||||
struct HksResult result = HksConvertErrCode(ret);
|
||||
return *((struct OH_Huks_Result *)(&result));
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_InitParamSet(struct OH_Huks_ParamSet **paramSet)
|
||||
{
|
||||
int32_t result = HksInitParamSet((struct HksParamSet **) paramSet);
|
||||
return ConvertParamResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_AddParams(struct OH_Huks_ParamSet *paramSet,
|
||||
const struct OH_Huks_Param *params, uint32_t paramCnt)
|
||||
{
|
||||
int32_t result = HksAddParams((struct HksParamSet *) paramSet,
|
||||
(const struct HksParam *) params, paramCnt);
|
||||
return ConvertParamResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_BuildParamSet(struct OH_Huks_ParamSet **paramSet)
|
||||
{
|
||||
int32_t result = HksBuildParamSet((struct HksParamSet **) paramSet);
|
||||
return ConvertParamResult(result);
|
||||
}
|
||||
|
||||
void OH_Huks_FreeParamSet(struct OH_Huks_ParamSet **paramSet)
|
||||
{
|
||||
HksFreeParamSet((struct HksParamSet **) paramSet);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_CopyParamSet(const struct OH_Huks_ParamSet *fromParamSet,
|
||||
uint32_t fromParamSetSize, struct OH_Huks_ParamSet **paramSet)
|
||||
{
|
||||
int32_t result = HksGetParamSet((const struct HksParamSet *) fromParamSet,
|
||||
fromParamSetSize, (struct HksParamSet **) paramSet);
|
||||
return ConvertParamResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_GetParam(const struct OH_Huks_ParamSet *paramSet, uint32_t tag,
|
||||
struct OH_Huks_Param **param)
|
||||
{
|
||||
int32_t result = HksGetParam((const struct HksParamSet *) paramSet, tag, (struct HksParam **) param);
|
||||
return ConvertParamResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_FreshParamSet(struct OH_Huks_ParamSet *paramSet, bool isCopy)
|
||||
{
|
||||
int32_t result = HksFreshParamSet((struct HksParamSet *) paramSet, isCopy);
|
||||
return ConvertParamResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_IsParamSetTagValid(const struct OH_Huks_ParamSet *paramSet)
|
||||
{
|
||||
int32_t result = HksCheckParamSetTag((const struct HksParamSet *) paramSet);
|
||||
return ConvertParamResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_IsParamSetValid(const struct OH_Huks_ParamSet *paramSet, uint32_t size)
|
||||
{
|
||||
int32_t result = HksCheckParamSet((const struct HksParamSet *) paramSet, size);
|
||||
return ConvertParamResult(result);
|
||||
}
|
||||
|
||||
struct OH_Huks_Result OH_Huks_CheckParamMatch(const struct OH_Huks_Param *baseParam, const struct OH_Huks_Param *param)
|
||||
{
|
||||
int32_t result = HksCheckParamMatch((const struct HksParam *) baseParam, (const struct HksParam *) param);
|
||||
return ConvertParamResult(result);
|
||||
}
|
Loading…
Reference in New Issue
Block a user