/* * This file is part of the openHiTLS project. * * openHiTLS is licensed under the Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: * * http://license.coscl.org.cn/MulanPSL2 * * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. * See the Mulan PSL v2 for more details. */ #include "hitls_build.h" #ifdef HITLS_CRYPTO_PROVIDER #include "crypt_eal_implprovider.h" #include "crypt_eal_pkey.h" #include "crypt_decode_key_impl.h" const CRYPT_EAL_Func g_defEalPrvP8Enc2P8[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_EPKI2PKI_NewCtx}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_EPKI2PKI_SetParam}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_EPKI2PKI_GetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_EPKI2PKI_Decode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_EPKI2PKI_FreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_EPKI2PKI_FreeCtx}, CRYPT_EAL_FUNC_END, }; const CRYPT_EAL_Func g_defEalPem2Der[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_Pem2DerNewCtx}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_Pem2DerGetParam}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_Pem2DerSetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_Pem2DerDecode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_Pem2DerFreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_Pem2DerFreeCtx}, CRYPT_EAL_FUNC_END, }; const CRYPT_EAL_Func g_defEalRsaPrvDer2Key[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_RsaDer2KeyNewCtx}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_DER2KEY_GetParam}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_DER2KEY_SetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_RsaPrvKeyDer2KeyDecode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_DER2KEY_FreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_DER2KEY_FreeCtx}, CRYPT_EAL_FUNC_END, }; const CRYPT_EAL_Func g_defEalRsaPubDer2Key[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_RsaDer2KeyNewCtx}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_DER2KEY_GetParam}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_DER2KEY_SetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_RsaPubKeyDer2KeyDecode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_DER2KEY_FreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_DER2KEY_FreeCtx}, CRYPT_EAL_FUNC_END, }; const CRYPT_EAL_Func g_defEalEcdsaPrvDer2Key[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_EcdsaDer2KeyNewCtx}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_DER2KEY_GetParam}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_DER2KEY_SetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_EcdsaPrvKeyDer2KeyDecode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_DER2KEY_FreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_DER2KEY_FreeCtx}, CRYPT_EAL_FUNC_END, }; const CRYPT_EAL_Func g_defEalSm2PrvDer2Key[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_Sm2Der2KeyNewCtx}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_DER2KEY_GetParam}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_DER2KEY_SetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_Sm2PrvKeyDer2KeyDecode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_DER2KEY_FreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_DER2KEY_FreeCtx}, CRYPT_EAL_FUNC_END, }; const CRYPT_EAL_Func g_defEalP8Der2RsaKey[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_RsaDer2KeyNewCtx}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_DER2KEY_GetParam}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_DER2KEY_SetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_RsaPkcs8Der2KeyDecode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_DER2KEY_FreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_DER2KEY_FreeCtx}, CRYPT_EAL_FUNC_END, }; const CRYPT_EAL_Func g_defEalP8Der2EcdsaKey[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_EcdsaDer2KeyNewCtx}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_DER2KEY_GetParam}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_DER2KEY_SetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_EcdsaPkcs8Der2KeyDecode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_DER2KEY_FreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_DER2KEY_FreeCtx}, CRYPT_EAL_FUNC_END, }; const CRYPT_EAL_Func g_defEalP8Der2Sm2Key[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_Sm2Der2KeyNewCtx}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_DER2KEY_GetParam}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_DER2KEY_SetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_Sm2Pkcs8Der2KeyDecode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_DER2KEY_FreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_DER2KEY_FreeCtx}, CRYPT_EAL_FUNC_END, }; const CRYPT_EAL_Func g_defEalP8Der2Ed25519Key[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_Ed25519Der2KeyNewCtx}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_DER2KEY_GetParam}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_DER2KEY_SetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_Ed25519Pkcs8Der2KeyDecode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_DER2KEY_FreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_DER2KEY_FreeCtx}, CRYPT_EAL_FUNC_END, }; const CRYPT_EAL_Func g_defEalSubPubKeyDer2RsaKey[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_RsaDer2KeyNewCtx}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_DER2KEY_GetParam}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_DER2KEY_SetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_RsaSubPubKeyDer2KeyDecode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_DER2KEY_FreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_DER2KEY_FreeCtx}, CRYPT_EAL_FUNC_END, }; const CRYPT_EAL_Func g_defEalSubPubKeyDer2EcdsaKey[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_EcdsaDer2KeyNewCtx}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_DER2KEY_GetParam}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_DER2KEY_SetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_EcdsaSubPubKeyDer2KeyDecode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_DER2KEY_FreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_DER2KEY_FreeCtx}, CRYPT_EAL_FUNC_END, }; const CRYPT_EAL_Func g_defEalSubPubKeyDer2Sm2Key[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_Sm2Der2KeyNewCtx}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_DER2KEY_GetParam}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_DER2KEY_SetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_Sm2SubPubKeyDer2KeyDecode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_DER2KEY_FreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_DER2KEY_FreeCtx}, CRYPT_EAL_FUNC_END, }; const CRYPT_EAL_Func g_defEalSubPubKeyDer2Ed25519Key[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_Ed25519Der2KeyNewCtx}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_DER2KEY_GetParam}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_DER2KEY_SetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_Ed25519SubPubKeyDer2KeyDecode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_DER2KEY_FreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_DER2KEY_FreeCtx}, CRYPT_EAL_FUNC_END, }; const CRYPT_EAL_Func g_defEalSubPubKeyWithoutSeqDer2RsaKey[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_RsaDer2KeyNewCtx}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_DER2KEY_GetParam}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_DER2KEY_SetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_RsaSubPubKeyWithOutSeqDer2KeyDecode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_DER2KEY_FreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_DER2KEY_FreeCtx}, CRYPT_EAL_FUNC_END, }; const CRYPT_EAL_Func g_defEalSubPubKeyWithoutSeqDer2EcdsaKey[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_EcdsaDer2KeyNewCtx}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_DER2KEY_GetParam}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_DER2KEY_SetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_EcdsaSubPubKeyWithOutSeqDer2KeyDecode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_DER2KEY_FreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_DER2KEY_FreeCtx}, CRYPT_EAL_FUNC_END, }; const CRYPT_EAL_Func g_defEalSubPubKeyWithoutSeqDer2Sm2Key[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_Sm2Der2KeyNewCtx}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_DER2KEY_GetParam}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_DER2KEY_SetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_Sm2SubPubKeyWithOutSeqDer2KeyDecode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_DER2KEY_FreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_DER2KEY_FreeCtx}, CRYPT_EAL_FUNC_END, }; const CRYPT_EAL_Func g_defEalSubPubKeyWithoutSeqDer2Ed25519Key[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_Ed25519Der2KeyNewCtx}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_DER2KEY_GetParam}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_DER2KEY_SetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_Ed25519SubPubKeyWithOutSeqDer2KeyDecode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_DER2KEY_FreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_DER2KEY_FreeCtx}, CRYPT_EAL_FUNC_END, }; const CRYPT_EAL_Func g_defEalLowKeyObject2PkeyObject[] = { {CRYPT_DECODER_IMPL_NEWCTX, (CRYPT_DECODER_IMPL_NewCtx)DECODER_LowKeyObject2PkeyObjectNewCtx}, {CRYPT_DECODER_IMPL_GETPARAM, (CRYPT_DECODER_IMPL_GetParam)DECODER_LowKeyObject2PkeyObjectGetParam}, {CRYPT_DECODER_IMPL_SETPARAM, (CRYPT_DECODER_IMPL_SetParam)DECODER_LowKeyObject2PkeyObjectSetParam}, {CRYPT_DECODER_IMPL_DECODE, (CRYPT_DECODER_IMPL_Decode)DECODER_LowKeyObject2PkeyObjectDecode}, {CRYPT_DECODER_IMPL_FREEOUTDATA, (CRYPT_DECODER_IMPL_FreeOutData)DECODER_LowKeyObject2PkeyObjectFreeOutData}, {CRYPT_DECODER_IMPL_FREECTX, (CRYPT_DECODER_IMPL_FreeCtx)DECODER_LowKeyObject2PkeyObjectFreeCtx}, CRYPT_EAL_FUNC_END, }; #endif /* HITLS_CRYPTO_PROVIDER */