mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-09-24 06:13:43 +08:00
Update CPK sub-lib
Use simple NID as arguments, and fix some bugs
This commit is contained in:
@@ -1,3 +1,2 @@
|
||||
LIBS=../../libcrypto
|
||||
SOURCE[../../libcrypto]=cpk_asn1.c cpk_err.c cpk_kap.c cpk_lib.c cpk_map.c \
|
||||
cpk_prn.c
|
||||
SOURCE[../../libcrypto]=cpk_asn1.c cpk_err.c cpk_lib.c cpk_map.c cpk_prn.c
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -19,26 +19,42 @@
|
||||
# define ERR_REASON(reason) ERR_PACK(ERR_LIB_CPK,0,reason)
|
||||
|
||||
static ERR_STRING_DATA CPK_str_functs[] = {
|
||||
{ERR_FUNC(CPK_F_CPK_MAP_GET_MD), "CPK_MAP_get_md"},
|
||||
{ERR_FUNC(CPK_F_CPK_MAP_IS_VALID), "CPK_MAP_is_valid"},
|
||||
{ERR_FUNC(CPK_F_CPK_MAP_NEW), "CPK_MAP_new"},
|
||||
{ERR_FUNC(CPK_F_CPK_MAP_NEW_DEFAULT), "CPK_MAP_new_default"},
|
||||
{ERR_FUNC(CPK_F_CPK_MAP_NUM_FACTORS), "CPK_MAP_num_factors"},
|
||||
{ERR_FUNC(CPK_F_CPK_MAP_NUM_INDEXES), "CPK_MAP_num_indexes"},
|
||||
{ERR_FUNC(CPK_F_CPK_MAP_NUM_SUBSET), "CPK_MAP_num_subset"},
|
||||
{ERR_FUNC(CPK_F_CPK_MAP_STR2INDEX), "CPK_MAP_str2index"},
|
||||
{ERR_FUNC(CPK_F_CPK_MASTER_SECRET_CREATE), "CPK_MASTER_SECRET_create"},
|
||||
{ERR_FUNC(CPK_F_CPK_MASTER_SECRET_EXTRACT_PRIVATE_KEY),
|
||||
"CPK_MASTER_SECRET_extract_private_key"},
|
||||
{ERR_FUNC(CPK_F_CPK_MASTER_SECRET_EXTRACT_PUBLIC_PARAMS),
|
||||
"CPK_MASTER_SECRET_extract_public_params"},
|
||||
{ERR_FUNC(CPK_F_CPK_MASTER_SECRET_PRINT), "CPK_MASTER_SECRET_print"},
|
||||
{ERR_FUNC(CPK_F_CPK_MASTER_SECRET_VALIDATE_PUBLIC_PARAMS),
|
||||
"CPK_MASTER_SECRET_validate_public_params"},
|
||||
{ERR_FUNC(CPK_F_CPK_PUBLIC_PARAMS_COMPUTE_SHARE_KEY),
|
||||
"CPK_PUBLIC_PARAMS_compute_share_key"},
|
||||
{ERR_FUNC(CPK_F_CPK_PUBLIC_PARAMS_EXTRACT_PUBLIC_KEY),
|
||||
"CPK_PUBLIC_PARAMS_extract_public_key"},
|
||||
{ERR_FUNC(CPK_F_CPK_PUBLIC_PARAMS_PRINT), "CPK_PUBLIC_PARAMS_print"},
|
||||
{ERR_FUNC(CPK_F_CPK_PUBLIC_PARAMS_VALIDATE_PRIVATE_KEY),
|
||||
"CPK_PUBLIC_PARAMS_validate_private_key"},
|
||||
{ERR_FUNC(CPK_F_EXTRACT_EC_PARAMS), "extract_ec_params"},
|
||||
{ERR_FUNC(CPK_F_EXTRACT_EC_PRIV_KEY), "extract_ec_priv_key"},
|
||||
{ERR_FUNC(CPK_F_EXTRACT_EC_PUB_KEY), "extract_ec_pub_key"},
|
||||
{ERR_FUNC(CPK_F_X509_ALGOR_GET1_EC_KEY), "X509_ALGOR_get1_EC_KEY"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
static ERR_STRING_DATA CPK_str_reasons[] = {
|
||||
{ERR_REASON(CPK_R_BAD_ARGUMENT), "bad argument"},
|
||||
{ERR_REASON(CPK_R_BAD_ARGUMENTS), "bad arguments"},
|
||||
{ERR_REASON(CPK_R_BAD_DATA), "bad data"},
|
||||
{ERR_REASON(CPK_R_INVALID_ALGORITHM), "invalid algorithm"},
|
||||
{ERR_REASON(CPK_R_INVALID_ARGUMENT), "invalid argument"},
|
||||
{ERR_REASON(CPK_R_INVALID_ID_LENGTH), "invalid id length"},
|
||||
{ERR_REASON(CPK_R_INVALID_MAP_ALGOR), "invalid map algor"},
|
||||
{ERR_REASON(CPK_R_INVALID_PKEY_TYPE), "invalid pkey type"},
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2007 - 2016 The GmSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the GmSSL Project.
|
||||
* (http://gmssl.org/)"
|
||||
*
|
||||
* 4. The name "GmSSL Project" must not be used to endorse or promote
|
||||
* products derived from this software without prior written
|
||||
* permission. For written permission, please contact
|
||||
* guanzhi1980@gmail.com.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "GmSSL"
|
||||
* nor may "GmSSL" appear in their names without prior written
|
||||
* permission of the GmSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the GmSSL Project
|
||||
* (http://gmssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE GmSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GmSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/ecdh.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/cpk.h>
|
||||
#include "cpk_lcl.h"
|
||||
|
||||
int CPK_PUBLIC_PARAMS_compute_share_key(CPK_PUBLIC_PARAMS *params,
|
||||
void *out, size_t outlen, const char *id, EVP_PKEY *priv_key,
|
||||
void *(*kdf)(const void *in, size_t inlen, void *out, size_t *outlen))
|
||||
{
|
||||
int ret = 0;
|
||||
EVP_PKEY *pub_key = NULL;
|
||||
int pkey_type = OBJ_obj2nid(params->pkey_algor->algorithm);
|
||||
|
||||
OPENSSL_assert(kdf != NULL);
|
||||
|
||||
printf("%d\n", __LINE__);
|
||||
if (EVP_PKEY_id(priv_key) != pkey_type) {
|
||||
CPKerr(CPK_F_CPK_PUBLIC_PARAMS_COMPUTE_SHARE_KEY,
|
||||
ERR_R_MALLOC_FAILURE); //FIXME: ERR_R_XXX
|
||||
goto err;
|
||||
}
|
||||
if (!(pub_key = CPK_PUBLIC_PARAMS_extract_public_key(params, id))) {
|
||||
CPKerr(CPK_F_CPK_PUBLIC_PARAMS_COMPUTE_SHARE_KEY,
|
||||
ERR_R_MALLOC_FAILURE); //FIXME: ERR_R_XXX
|
||||
goto err;
|
||||
}
|
||||
if (pkey_type == EVP_PKEY_EC) {
|
||||
|
||||
if (!ECDH_compute_key(out, outlen,
|
||||
EC_KEY_get0_public_key((EC_KEY *)EVP_PKEY_get0(pub_key)),
|
||||
(EC_KEY *)EVP_PKEY_get0(priv_key), kdf)) {
|
||||
CPKerr(CPK_F_CPK_PUBLIC_PARAMS_COMPUTE_SHARE_KEY,
|
||||
ERR_R_MALLOC_FAILURE); //FIXME: ERR_R_XXX
|
||||
goto err;
|
||||
}
|
||||
} else if (pkey_type == EVP_PKEY_DH) {
|
||||
// not supported yet
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
||||
ret = 1;
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -68,3 +68,11 @@ struct cpk_public_params_st {
|
||||
X509_ALGOR *map_algor;
|
||||
ASN1_OCTET_STRING *public_factors;
|
||||
};
|
||||
|
||||
X509_ALGOR *CPK_MAP_new(int type);
|
||||
X509_ALGOR * CPK_MAP_new_default(void);
|
||||
int CPK_MAP_is_valid(const X509_ALGOR *algor);
|
||||
int CPK_MAP_num_factors(const X509_ALGOR *algor);
|
||||
int CPK_MAP_num_indexes(const X509_ALGOR *algor);
|
||||
int CPK_MAP_str2index(const X509_ALGOR *algor, const char *str, int *index);
|
||||
|
||||
|
||||
@@ -62,30 +62,27 @@
|
||||
#include "../x509/x509_lcl.h"
|
||||
#include "cpk_lcl.h"
|
||||
|
||||
#define ASN1_STRING_data(a) ((a)->data)
|
||||
|
||||
|
||||
static EC_KEY *X509_ALGOR_get1_EC_KEY(X509_ALGOR *algor);
|
||||
static int extract_ec_params(CPK_MASTER_SECRET *master, CPK_PUBLIC_PARAMS *param);
|
||||
static EC_KEY *extract_ec_priv_key(CPK_MASTER_SECRET *master, const char *id);
|
||||
static EC_KEY *extract_ec_pub_key(CPK_PUBLIC_PARAMS *param, const char *id);
|
||||
|
||||
|
||||
|
||||
CPK_MASTER_SECRET *CPK_MASTER_SECRET_create(const char *domain_id,
|
||||
EVP_PKEY *pkey, X509_ALGOR *map_algor)
|
||||
CPK_MASTER_SECRET *CPK_MASTER_SECRET_create(const char *domain_id, int pkey_nid, int map_nid)
|
||||
{
|
||||
int e = 1;
|
||||
CPK_MASTER_SECRET *master = NULL;
|
||||
BIGNUM *bn = NULL;
|
||||
BIGNUM *order = NULL;
|
||||
X509_PUBKEY *pubkey = NULL;
|
||||
const X509_ALGOR *pkey_algor;
|
||||
X509_ALGOR *pkey_algor;
|
||||
int pkey_type;
|
||||
int i, bn_size, num_factors;
|
||||
unsigned char *bn_ptr;
|
||||
EVP_PKEY *pkey = NULL;
|
||||
X509_ALGOR *map_algor = NULL;
|
||||
|
||||
if (!domain_id || !pkey || !map_algor) {
|
||||
if (!domain_id) {
|
||||
CPKerr(CPK_F_CPK_MASTER_SECRET_CREATE, ERR_R_PASSED_NULL_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
@@ -94,6 +91,21 @@ CPK_MASTER_SECRET *CPK_MASTER_SECRET_create(const char *domain_id,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* pkey type and domain parameters is required
|
||||
* EC:curve
|
||||
* SM9:curve ...
|
||||
*
|
||||
* so we do not check pkey_nid
|
||||
*/
|
||||
|
||||
//FIXME: merge into ec routine
|
||||
EC_KEY *ec = EC_KEY_new_by_curve_name(NID_sm2p256v1);
|
||||
EC_KEY_generate_key(ec);
|
||||
pkey = EVP_PKEY_new();
|
||||
EVP_PKEY_set1_EC_KEY(pkey, ec);
|
||||
//FIXME: free ec
|
||||
map_algor = CPK_MAP_new(map_nid);
|
||||
|
||||
pkey_type = EVP_PKEY_id(pkey);
|
||||
if (pkey_type == EVP_PKEY_EC) {
|
||||
const EC_GROUP *ec_group;
|
||||
@@ -190,7 +202,7 @@ err:
|
||||
CPK_MASTER_SECRET_free(master);
|
||||
master = NULL;
|
||||
}
|
||||
if (pubkey) X509_PUBKEY_free(pubkey);
|
||||
X509_PUBKEY_free(pubkey);
|
||||
if (order && pkey_type == EVP_PKEY_EC) BN_free(order);
|
||||
if (bn) BN_free(bn);
|
||||
return master;
|
||||
@@ -302,7 +314,6 @@ EVP_PKEY *CPK_PUBLIC_PARAMS_extract_public_key(CPK_PUBLIC_PARAMS *param,
|
||||
{
|
||||
EVP_PKEY *pkey = NULL;
|
||||
int pkey_type;
|
||||
//char domain_id[CPK_MAX_ID_LENGTH + 1];
|
||||
|
||||
if (!(pkey = EVP_PKEY_new())) {
|
||||
CPKerr(CPK_F_CPK_PUBLIC_PARAMS_EXTRACT_PUBLIC_KEY,
|
||||
@@ -340,28 +351,6 @@ err:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int CPK_MASTER_SECRET_digest(CPK_MASTER_SECRET *master, const EVP_MD *md,
|
||||
unsigned char *dgst, unsigned int *dgstlen)
|
||||
{
|
||||
if (!EVP_Digest(ASN1_STRING_data(master->secret_factors),
|
||||
ASN1_STRING_length(master->secret_factors),
|
||||
dgst, dgstlen, md, NULL)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CPK_PUBLIC_PARAMS_digest(CPK_PUBLIC_PARAMS *params, const EVP_MD *md,
|
||||
unsigned char *dgst, unsigned int *dgstlen)
|
||||
{
|
||||
if (!EVP_Digest(ASN1_STRING_data(params->public_factors),
|
||||
ASN1_STRING_length(params->public_factors),
|
||||
dgst, dgstlen, md, NULL)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *CPK_MASTER_SECRET_get_name(CPK_MASTER_SECRET *master, char *buf, int size)
|
||||
{
|
||||
return X509_NAME_oneline(master->id, buf, size);
|
||||
@@ -379,15 +368,15 @@ int CPK_MASTER_SECRET_validate_public_params(CPK_MASTER_SECRET *master,
|
||||
CPK_PUBLIC_PARAMS *tmp = NULL;
|
||||
|
||||
if (!(tmp = CPK_MASTER_SECRET_extract_public_params(master))) {
|
||||
fprintf(stderr, "shit1\n");
|
||||
CPKerr(CPK_F_CPK_MASTER_SECRET_VALIDATE_PUBLIC_PARAMS, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (tmp->version != params->version) {
|
||||
fprintf(stderr, "shit2\n");
|
||||
CPKerr(CPK_F_CPK_MASTER_SECRET_VALIDATE_PUBLIC_PARAMS, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (X509_NAME_cmp(tmp->id, params->id)) {
|
||||
fprintf(stderr, "shit3\n");
|
||||
CPKerr(CPK_F_CPK_MASTER_SECRET_VALIDATE_PUBLIC_PARAMS, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -398,23 +387,23 @@ int CPK_MASTER_SECRET_validate_public_params(CPK_MASTER_SECRET *master,
|
||||
*/
|
||||
if (OBJ_obj2nid(tmp->pkey_algor->algorithm) !=
|
||||
OBJ_obj2nid(params->pkey_algor->algorithm)) {
|
||||
fprintf(stderr, "shit4\n");
|
||||
CPKerr(CPK_F_CPK_MASTER_SECRET_VALIDATE_PUBLIC_PARAMS, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
// FIXME: pkey_algor->parameters
|
||||
if (OBJ_obj2nid(tmp->map_algor->algorithm) !=
|
||||
OBJ_obj2nid(params->map_algor->algorithm)) {
|
||||
fprintf(stderr, "shit5\n");
|
||||
CPKerr(CPK_F_CPK_MASTER_SECRET_VALIDATE_PUBLIC_PARAMS, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (ASN1_STRING_cmp(tmp->public_factors, params->public_factors)) {
|
||||
fprintf(stderr, "shit6\n");
|
||||
CPKerr(CPK_F_CPK_MASTER_SECRET_VALIDATE_PUBLIC_PARAMS, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
err:
|
||||
if (tmp) CPK_PUBLIC_PARAMS_free(tmp);
|
||||
CPK_PUBLIC_PARAMS_free(tmp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -495,49 +484,60 @@ static int extract_ec_params(CPK_MASTER_SECRET *master, CPK_PUBLIC_PARAMS *param
|
||||
unsigned char *pt_ptr;
|
||||
|
||||
if (!bn || !order || !ctx) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PARAMS, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!(ec_key = X509_ALGOR_get1_EC_KEY(master->pkey_algor))) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PARAMS, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
ec_group = EC_KEY_get0_group(ec_key);
|
||||
if (!(EC_GROUP_get_order(ec_group, order, ctx))) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PARAMS, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
bn_size = BN_num_bytes(order);
|
||||
pt_size = bn_size + 1;
|
||||
|
||||
if ((num_factors = CPK_MAP_num_factors(master->map_algor)) <= 0) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PARAMS, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (ASN1_STRING_length(master->secret_factors) != bn_size * num_factors) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PARAMS, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (!ASN1_STRING_set(param->public_factors, NULL, pt_size * num_factors)) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PARAMS, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
||||
bn_ptr = ASN1_STRING_data(master->secret_factors);
|
||||
pt_ptr = ASN1_STRING_data(param->public_factors);
|
||||
bn_ptr = ASN1_STRING_get0_data(master->secret_factors);
|
||||
pt_ptr = ASN1_STRING_get0_data(param->public_factors);
|
||||
memset(pt_ptr, 0, ASN1_STRING_length(param->public_factors));
|
||||
|
||||
if (!(pt = EC_POINT_new(ec_group))) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PARAMS, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
for (i = 0; i < num_factors; i++) {
|
||||
if (!BN_bin2bn(bn_ptr, bn_size, bn)) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PARAMS, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (BN_is_zero(bn) || BN_cmp(bn, order) >= 0) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PARAMS, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (!EC_POINT_mul(ec_group, pt, bn, NULL, NULL, ctx)) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PARAMS, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!EC_POINT_point2oct(ec_group, pt,
|
||||
POINT_CONVERSION_COMPRESSED, pt_ptr, pt_size, ctx)) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PARAMS, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
bn_ptr += bn_size;
|
||||
@@ -569,56 +569,69 @@ static EC_KEY *extract_ec_priv_key(CPK_MASTER_SECRET *master, const char *id)
|
||||
|
||||
|
||||
if (!priv_key || !bn || !order || !ctx) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PRIV_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!(ec_key = X509_ALGOR_get1_EC_KEY(master->pkey_algor))) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PRIV_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
ec_group = EC_KEY_get0_group(ec_key);
|
||||
if (!(pub_key = EC_POINT_new(ec_group))) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PRIV_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if ((num_indexes = CPK_MAP_num_indexes(master->map_algor)) <= 0) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PRIV_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (!(index = OPENSSL_malloc(sizeof(int) * num_indexes))) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PRIV_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (!CPK_MAP_str2index(master->map_algor, id, index)) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PRIV_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
||||
BN_zero(priv_key);
|
||||
if (!(EC_GROUP_get_order(EC_KEY_get0_group(ec_key), order, ctx))) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PRIV_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
bn_size = BN_num_bytes(order);
|
||||
|
||||
for (i = 0; i < num_indexes; i++) {
|
||||
const unsigned char *p =
|
||||
ASN1_STRING_data(master->secret_factors) +
|
||||
const unsigned char *p =
|
||||
ASN1_STRING_get0_data(master->secret_factors) +
|
||||
bn_size * index[i];
|
||||
|
||||
|
||||
if (!BN_bin2bn(p, bn_size, bn)) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PRIV_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (BN_is_zero(bn) || BN_cmp(bn, order) >= 0) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PRIV_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
if (!BN_mod_add(priv_key, priv_key, bn, order, ctx)) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PRIV_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
if (!EC_KEY_set_private_key(ec_key, priv_key)) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PRIV_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!EC_POINT_mul(ec_group, pub_key, priv_key, NULL, NULL, ctx)) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PRIV_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (!EC_KEY_set_public_key(ec_key, pub_key)) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PRIV_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
e = 0;
|
||||
@@ -651,55 +664,70 @@ static EC_KEY *extract_ec_pub_key(CPK_PUBLIC_PARAMS *param, const char *id)
|
||||
int i, bn_size, pt_size, num_indexes, num_factors;
|
||||
|
||||
if (!(ec_key = X509_ALGOR_get1_EC_KEY(param->pkey_algor))) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PUB_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
ec_group = EC_KEY_get0_group(ec_key);
|
||||
|
||||
if (!(pub_key = EC_POINT_new(ec_group))) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PUB_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (!(pt = EC_POINT_new(ec_group))) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PUB_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (!EC_GROUP_get_order(ec_group, order, ctx)) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PUB_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
bn_size = BN_num_bytes(order);
|
||||
pt_size = bn_size + 1;
|
||||
|
||||
if ((num_factors = CPK_MAP_num_factors(param->map_algor)) <= 0) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PUB_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (ASN1_STRING_length(param->public_factors) != pt_size * num_factors) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PUB_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if ((num_indexes = CPK_MAP_num_indexes(param->map_algor)) <= 0) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PUB_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (!(index = OPENSSL_malloc(sizeof(int) * num_indexes))) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PUB_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (!CPK_MAP_str2index(param->map_algor, id, index)) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PUB_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!EC_POINT_set_to_infinity(ec_group, pub_key)) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PUB_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
for (i = 0; i < num_indexes; i++) {
|
||||
const unsigned char *p =
|
||||
ASN1_STRING_data(param->public_factors) +
|
||||
ASN1_STRING_get0_data(param->public_factors) +
|
||||
pt_size * index[i];
|
||||
|
||||
if (!EC_POINT_oct2point(ec_group, pt, p, pt_size, ctx)) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PUB_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!EC_POINT_add(ec_group, pub_key, pub_key, pt, ctx)) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PUB_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
if (!EC_KEY_set_public_key(ec_key, pub_key)) {
|
||||
CPKerr(CPK_F_EXTRACT_EC_PUB_KEY, ERR_R_CPK_LIB);
|
||||
goto err;
|
||||
}
|
||||
e = 0;
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
@@ -53,77 +52,119 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/cpk.h>
|
||||
#include "cpk_lcl.h"
|
||||
#include "../../e_os.h"
|
||||
|
||||
X509_ALGOR *CPK_MAP_new_default()
|
||||
/* Currently we only support fixed 32 indexes
|
||||
* this means EC_POINT_add() called 32 times */
|
||||
#define CPK_NUM_INDEXES 32
|
||||
|
||||
typedef struct {
|
||||
int map_nid;
|
||||
int md_nid;
|
||||
} CPK_MAP_TABLE;
|
||||
|
||||
static CPK_MAP_TABLE map_table[] = {
|
||||
{NID_cpk_map_sm3, NID_sm3},
|
||||
{NID_cpk_map_sha1, NID_sha1},
|
||||
{NID_cpk_map_sha256, NID_sha256},
|
||||
{NID_cpk_map_sha384, NID_sha384},
|
||||
{NID_cpk_map_sha512, NID_sha512}
|
||||
};
|
||||
|
||||
static const EVP_MD *cpk_map2md(int type)
|
||||
{
|
||||
X509_ALGOR *algor = NULL;
|
||||
const EVP_MD *md = EVP_sha1();
|
||||
int i;
|
||||
for (i = 0; i < OSSL_NELEM(map_table); i++) {
|
||||
if (map_table[i].map_nid == type) {
|
||||
return EVP_get_digestbynid(map_table[i].md_nid);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (md != EVP_sha1() && md != EVP_sha384()) {
|
||||
CPKerr(CPK_F_CPK_MAP_NEW_DEFAULT, CPK_R_BAD_ARGUMENT);
|
||||
goto end;
|
||||
static const EVP_MD *CPK_MAP_get_md(const X509_ALGOR *algor)
|
||||
{
|
||||
const EVP_MD *md;
|
||||
if (!algor->algorithm) {
|
||||
CPKerr(CPK_F_CPK_MAP_GET_MD, CPK_R_INVALID_ARGUMENT);
|
||||
return NULL;
|
||||
}
|
||||
if (!(md = cpk_map2md(OBJ_obj2nid(algor->algorithm)))) {
|
||||
CPKerr(CPK_F_CPK_MAP_GET_MD, ERR_R_CPK_LIB);
|
||||
return NULL;
|
||||
}
|
||||
return md;
|
||||
}
|
||||
|
||||
X509_ALGOR *CPK_MAP_new(int type)
|
||||
{
|
||||
X509_ALGOR *ret = NULL;
|
||||
X509_ALGOR *algor = NULL;
|
||||
|
||||
if (!cpk_map2md(type)) {
|
||||
CPKerr(CPK_F_CPK_MAP_NEW, CPK_R_INVALID_MAP_ALGOR);
|
||||
return NULL;
|
||||
}
|
||||
if (!(algor = X509_ALGOR_new())) {
|
||||
CPKerr(CPK_F_CPK_MAP_NEW_DEFAULT, ERR_R_X509_LIB);
|
||||
CPKerr(CPK_F_CPK_MAP_NEW, ERR_R_X509_LIB);
|
||||
goto end;
|
||||
}
|
||||
if (!X509_ALGOR_set0(algor, OBJ_nid2obj(EVP_MD_nid(md)),
|
||||
V_ASN1_UNDEF, NULL)) {
|
||||
X509_ALGOR_free(algor);
|
||||
algor = NULL;
|
||||
CPKerr(CPK_F_CPK_MAP_NEW_DEFAULT, ERR_R_X509_LIB);
|
||||
if (!X509_ALGOR_set0(algor, OBJ_nid2obj(type), V_ASN1_UNDEF, NULL)) {
|
||||
CPKerr(CPK_F_CPK_MAP_NEW, ERR_R_X509_LIB);
|
||||
goto end;
|
||||
}
|
||||
|
||||
ret = algor;
|
||||
algor = NULL;
|
||||
|
||||
end:
|
||||
return algor;
|
||||
X509_ALGOR_free(algor);
|
||||
return ret;
|
||||
}
|
||||
|
||||
X509_ALGOR *CPK_MAP_new_default(void)
|
||||
{
|
||||
return CPK_MAP_new(NID_cpk_map_sha1);
|
||||
}
|
||||
|
||||
int CPK_MAP_is_valid(const X509_ALGOR *algor)
|
||||
{
|
||||
OPENSSL_assert(algor);
|
||||
OPENSSL_assert(algor->algorithm);
|
||||
switch (OBJ_obj2nid(algor->algorithm)) {
|
||||
case NID_sha1:
|
||||
case NID_sha384:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CPK_MAP_num_subset(const X509_ALGOR *algor)
|
||||
{
|
||||
OPENSSL_assert(algor);
|
||||
OPENSSL_assert(algor->algorithm);
|
||||
switch (OBJ_obj2nid(algor->algorithm)) {
|
||||
case NID_sha1:
|
||||
return 32;
|
||||
case NID_sha384:
|
||||
return 4096;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int CPK_MAP_num_factors(const X509_ALGOR *algor)
|
||||
{
|
||||
return 1024;
|
||||
return CPK_MAP_get_md(algor) != NULL;
|
||||
}
|
||||
|
||||
int CPK_MAP_num_indexes(const X509_ALGOR *algor)
|
||||
{
|
||||
return 32;
|
||||
if (!CPK_MAP_is_valid(algor)) {
|
||||
CPKerr(CPK_F_CPK_MAP_NUM_INDEXES, CPK_R_INVALID_MAP_ALGOR);
|
||||
return 0;
|
||||
}
|
||||
/* current only use fixed num_indexes */
|
||||
return CPK_NUM_INDEXES;
|
||||
}
|
||||
|
||||
int CPK_MAP_num_index(const X509_ALGOR *algor)
|
||||
int CPK_MAP_num_subset(const X509_ALGOR *algor)
|
||||
{
|
||||
OPENSSL_assert(algor);
|
||||
OPENSSL_assert(algor->algorithm);
|
||||
switch (OBJ_obj2nid(algor->algorithm)) {
|
||||
case NID_sha1:
|
||||
return 32;
|
||||
case NID_sha384:
|
||||
return 32;
|
||||
const EVP_MD *md;
|
||||
if (!(md = CPK_MAP_get_md(algor))) {
|
||||
CPKerr(CPK_F_CPK_MAP_NUM_SUBSET, ERR_R_CPK_LIB);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
return 1 << ((EVP_MD_size(md) * 8) / CPK_MAP_num_indexes(algor));
|
||||
}
|
||||
|
||||
int CPK_MAP_num_factors(const X509_ALGOR *algor)
|
||||
{
|
||||
int num_indexes;
|
||||
int num_subset;
|
||||
if (!(num_indexes = CPK_MAP_num_indexes(algor))) {
|
||||
CPKerr(CPK_F_CPK_MAP_NUM_FACTORS, ERR_R_CPK_LIB);
|
||||
return 0;
|
||||
}
|
||||
if (!(num_subset = CPK_MAP_num_subset(algor))) {
|
||||
CPKerr(CPK_F_CPK_MAP_NUM_FACTORS, ERR_R_CPK_LIB);
|
||||
return 0;
|
||||
}
|
||||
return num_indexes * num_subset;
|
||||
}
|
||||
|
||||
int CPK_MAP_str2index(const X509_ALGOR *algor, const char *str, int *index)
|
||||
@@ -133,46 +174,46 @@ int CPK_MAP_str2index(const X509_ALGOR *algor, const char *str, int *index)
|
||||
unsigned char dgst[EVP_MAX_MD_SIZE];
|
||||
unsigned int dgstlen;
|
||||
BIGNUM *bn = NULL;
|
||||
int i, num_index, num_subset;
|
||||
int i;
|
||||
int num_indexes, num_subset;
|
||||
|
||||
OPENSSL_assert(algor);
|
||||
OPENSSL_assert(algor->algorithm);
|
||||
OPENSSL_assert(str);
|
||||
OPENSSL_assert(strlen(str) > 0);
|
||||
|
||||
if (!CPK_MAP_is_valid(algor)) {
|
||||
if (!(md = CPK_MAP_get_md(algor))
|
||||
|| !(num_indexes = CPK_MAP_num_indexes(algor))
|
||||
|| !(num_subset = CPK_MAP_num_subset(algor))) {
|
||||
CPKerr(CPK_F_CPK_MAP_STR2INDEX, CPK_R_INVALID_MAP_ALGOR);
|
||||
goto err;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!index) {
|
||||
ret = CPK_MAP_num_index(algor);
|
||||
goto err;
|
||||
}
|
||||
if (!(md = EVP_get_digestbyobj(algor->algorithm))) {
|
||||
CPKerr(CPK_F_CPK_MAP_STR2INDEX, ERR_R_EVP_LIB);
|
||||
goto err;
|
||||
return CPK_MAP_num_indexes(algor);
|
||||
}
|
||||
|
||||
if (!EVP_Digest(str, strlen(str), dgst, &dgstlen, md, NULL)) {
|
||||
CPKerr(CPK_F_CPK_MAP_STR2INDEX, ERR_R_EVP_LIB);
|
||||
return 0;
|
||||
}
|
||||
if (!(bn = BN_new())) {
|
||||
CPKerr(CPK_F_CPK_MAP_STR2INDEX, ERR_R_BN_LIB);
|
||||
goto err;
|
||||
CPKerr(CPK_F_CPK_MAP_STR2INDEX, ERR_R_MALLOC_FAILURE);
|
||||
goto end;
|
||||
}
|
||||
if (!BN_bin2bn(dgst, dgstlen, bn)) {
|
||||
CPKerr(CPK_F_CPK_MAP_STR2INDEX, ERR_R_BN_LIB);
|
||||
goto err;
|
||||
goto end;
|
||||
}
|
||||
num_index = CPK_MAP_num_index(algor);
|
||||
num_subset = CPK_MAP_num_subset(algor);
|
||||
|
||||
for (i = 0; i < num_index; i++) {
|
||||
for (i = 0; i < num_indexes; i++) {
|
||||
int r = BN_mod_word(bn, num_subset);
|
||||
BN_div_word(bn, num_subset);
|
||||
index[i] = num_subset * i + r;
|
||||
}
|
||||
ret = num_index;
|
||||
err:
|
||||
if (bn) BN_free(bn);
|
||||
|
||||
ret = num_indexes;
|
||||
end:
|
||||
BN_free(bn);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -50,13 +50,50 @@
|
||||
#include <string.h>
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/cpk.h>
|
||||
#include <openssl/objects.h>
|
||||
#include "cpk_lcl.h"
|
||||
|
||||
int CPK_MASTER_SECRET_print(BIO *out, CPK_MASTER_SECRET *master,
|
||||
int indent, unsigned long flags)
|
||||
{
|
||||
char name[1024] = {0};
|
||||
int num_factors;
|
||||
const unsigned char *p;
|
||||
int i, len;
|
||||
|
||||
BIO_printf(out, "%s() not implemented\n", __FUNCTION__);
|
||||
if (!X509_NAME_oneline(master->id, name, sizeof(name))) {
|
||||
CPKerr(CPK_F_CPK_MASTER_SECRET_PRINT, ERR_R_CPK_LIB);
|
||||
return 0;
|
||||
}
|
||||
|
||||
BIO_printf(out, "CPK_MASTER_SECRET\n");
|
||||
BIO_printf(out, " Version : %ld\n", master->version);
|
||||
BIO_printf(out, " Domain-ID : %s\n", name);
|
||||
BIO_printf(out, " Public-Key-Algor : %s\n", OBJ_nid2sn(OBJ_obj2nid(master->pkey_algor->algorithm)));
|
||||
BIO_printf(out, " Map-Algor : %s\n", OBJ_nid2sn(OBJ_obj2nid(master->map_algor->algorithm)));
|
||||
BIO_printf(out, " Secret-Factors :\n");
|
||||
|
||||
if ((num_factors = CPK_MAP_num_factors(master->map_algor)) <= 0) {
|
||||
fprintf(stderr, "%s %d\n", __FILE__, __LINE__);
|
||||
return 0;
|
||||
}
|
||||
p = ASN1_STRING_get0_data(master->secret_factors);
|
||||
|
||||
len = ASN1_STRING_length(master->secret_factors)/num_factors;
|
||||
if (ASN1_STRING_length(master->secret_factors) % num_factors) {
|
||||
CPKerr(CPK_F_CPK_MASTER_SECRET_PRINT, ERR_R_CPK_LIB);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_factors; i++) {
|
||||
int j;
|
||||
printf(" %-8d ", i);
|
||||
for (j = 0; j < len; j++) {
|
||||
BIO_printf(out, "%02X", p[j]);
|
||||
}
|
||||
printf("\n");
|
||||
p += len;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -64,7 +101,44 @@ int CPK_MASTER_SECRET_print(BIO *out, CPK_MASTER_SECRET *master,
|
||||
int CPK_PUBLIC_PARAMS_print(BIO *out, CPK_PUBLIC_PARAMS *params,
|
||||
int indent, unsigned long flags)
|
||||
{
|
||||
BIO_printf(out, "%s() not implemented\n", __FUNCTION__);
|
||||
char name[1024] = {0};
|
||||
int num_factors;
|
||||
const unsigned char *p;
|
||||
int len, i;
|
||||
|
||||
if (!X509_NAME_oneline(params->id, name, sizeof(name))) {
|
||||
CPKerr(CPK_F_CPK_PUBLIC_PARAMS_PRINT, ERR_R_CPK_LIB);
|
||||
return 0;
|
||||
}
|
||||
|
||||
BIO_printf(out, "CPK_PUBLIC_PARAMS\n");
|
||||
BIO_printf(out, " Version : %ld\n", params->version);
|
||||
BIO_printf(out, " Domain-ID : %s\n", name);
|
||||
BIO_printf(out, " Public-Key-Algor : %s\n", OBJ_nid2sn(OBJ_obj2nid(params->pkey_algor->algorithm)));
|
||||
BIO_printf(out, " Map-Algor : %s\n", OBJ_nid2sn(OBJ_obj2nid(params->map_algor->algorithm)));
|
||||
BIO_printf(out, " Secret-Factors :\n");
|
||||
|
||||
if ((num_factors = CPK_MAP_num_factors(params->map_algor)) <= 0) {
|
||||
fprintf(stderr, "%s %d\n", __FILE__, __LINE__);
|
||||
return 0;
|
||||
}
|
||||
p = ASN1_STRING_get0_data(params->public_factors);
|
||||
|
||||
len = ASN1_STRING_length(params->public_factors)/num_factors;
|
||||
if (ASN1_STRING_length(params->public_factors) % num_factors) {
|
||||
CPKerr(CPK_F_CPK_PUBLIC_PARAMS_PRINT, ERR_R_CPK_LIB);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_factors; i++) {
|
||||
int j;
|
||||
printf(" %-8d ", i);
|
||||
for (j = 0; j < len; j++) {
|
||||
BIO_printf(out, "%02X", p[j]);
|
||||
}
|
||||
printf("\n");
|
||||
p += len;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -151,12 +151,13 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
|
||||
int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, size_t count)
|
||||
{
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
if (ctx->pctx && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_UPDATED)) {
|
||||
if (ctx->pctx && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_UPDATED)
|
||||
&& EVP_PKEY_id(EVP_PKEY_CTX_get0_pkey(ctx->pctx)) == EVP_PKEY_EC) {
|
||||
const unsigned char *zid;
|
||||
if (1 == EVP_PKEY_CTX_get_signer_zid(ctx->pctx, &zid)) {
|
||||
ctx->update(ctx, zid, 32);
|
||||
# ifdef SM2_DEBUG
|
||||
fprintf(stderr, " %s() first update with SM2 ZID\n",
|
||||
fprintf(stderr, "[SM2_DEBUG] %s() first update with SM2 ZID\n",
|
||||
__FUNCTION__);
|
||||
# endif
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
/* Serialized OID's */
|
||||
static const unsigned char so[7905] = {
|
||||
static const unsigned char so[7927] = {
|
||||
0x2A,0x86,0x48,0x86,0xF7,0x0D, /* [ 0] OBJ_rsadsi */
|
||||
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, /* [ 6] OBJ_pkcs */
|
||||
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x02, /* [ 13] OBJ_md2 */
|
||||
@@ -1050,62 +1050,64 @@ static const unsigned char so[7905] = {
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x02, /* [ 7425] OBJ_sm2exchange */
|
||||
0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D, /* [ 7434] OBJ_GmSSL */
|
||||
0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D,0x01,0x01, /* [ 7442] OBJ_cpk_map */
|
||||
0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D,0x01,0x01,0x01, /* [ 7452] OBJ_cpk_sha1_map */
|
||||
0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D,0x01,0x01,0x02, /* [ 7463] OBJ_cpk_sha256_map */
|
||||
0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D,0x01,0x01,0x03, /* [ 7474] OBJ_cpk_sm3_map */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x01, /* [ 7485] OBJ_sm2encrypt_with_sm3 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x02, /* [ 7496] OBJ_sm2encrypt_with_sha1 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x03, /* [ 7507] OBJ_sm2encrypt_with_sha224 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x04, /* [ 7518] OBJ_sm2encrypt_with_sha256 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x05, /* [ 7529] OBJ_sm2encrypt_with_sha384 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x06, /* [ 7540] OBJ_sm2encrypt_with_sha512 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x07, /* [ 7551] OBJ_sm2encrypt_with_rmd160 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x08, /* [ 7562] OBJ_sm2encrypt_with_whirlpool */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x09, /* [ 7573] OBJ_sm2encrypt_with_blake2b512 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x0A, /* [ 7584] OBJ_sm2encrypt_with_blake2s256 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x0B, /* [ 7595] OBJ_sm2encrypt_with_md5 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x84,0x08, /* [ 7606] OBJ_sm2sign_with_whirlpool */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x84,0x09, /* [ 7614] OBJ_sm2sign_with_blake2b512 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x84,0x0A, /* [ 7622] OBJ_sm2sign_with_blake2s256 */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x01, /* [ 7630] OBJ_ecies_with_x9_63_sha1_xor_hmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x02, /* [ 7636] OBJ_ecies_with_x9_63_sha256_xor_hmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x03, /* [ 7642] OBJ_ecies_with_x9_63_sha512_xor_hmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x04, /* [ 7648] OBJ_ecies_with_x9_63_sha1_aes128_cbc_hmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x05, /* [ 7654] OBJ_ecies_with_x9_63_sha256_aes128_cbc_hmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x06, /* [ 7660] OBJ_ecies_with_x9_63_sha512_aes256_cbc_hmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x07, /* [ 7666] OBJ_ecies_with_x9_63_sha256_aes128_ctr_hmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x08, /* [ 7672] OBJ_ecies_with_x9_63_sha512_aes256_ctr_hmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x09, /* [ 7678] OBJ_ecies_with_x9_63_sha256_aes128_cbc_hmac_half */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x0A, /* [ 7684] OBJ_ecies_with_x9_63_sha512_aes256_cbc_hmac_half */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x0B, /* [ 7690] OBJ_ecies_with_x9_63_sha256_aes128_ctr_hmac_half */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x0C, /* [ 7696] OBJ_ecies_with_x9_63_sha512_aes256_ctr_hmac_half */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x0D, /* [ 7702] OBJ_ecies_with_x9_63_sha1_aes128_cbc_cmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x0E, /* [ 7708] OBJ_ecies_with_x9_63_sha256_aes128_cbc_cmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x0F, /* [ 7714] OBJ_ecies_with_x9_63_sha512_aes256_cbc_cmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x10, /* [ 7720] OBJ_ecies_with_x9_63_sha256_aes128_ctr_cmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x11, /* [ 7726] OBJ_ecies_with_x9_63_sha512_aes256_ctr_cmac */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x86,0x20,0x01, /* [ 7732] OBJ_zuc_128eea3 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x86,0x20,0x02, /* [ 7741] OBJ_zuc_128eia3 */
|
||||
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x0C,0x01,0x64, /* [ 7750] OBJ_pbe_WithSM3AndSMS4_CBC */
|
||||
0x2A,0x81,0x1C,0xD7,0x63, /* [ 7760] OBJ_bwips */
|
||||
0x2A,0x81,0x1C,0xD7,0x63,0x01, /* [ 7765] OBJ_wapi_crypto */
|
||||
0x2A,0x81,0x1C,0xD7,0x63,0x01,0x01, /* [ 7771] OBJ_wapi_ec */
|
||||
0x2A,0x81,0x1C,0xD7,0x63,0x01,0x01,0x01, /* [ 7778] OBJ_wapi_ecdsa192_sha256 */
|
||||
0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D,0x09,0x01, /* [ 7786] OBJ_sm9bn256v1 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x04, /* [ 7796] OBJ_sm9hash1 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x04,0x01, /* [ 7805] OBJ_sm9hash1_with_sm3 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x04,0x02, /* [ 7815] OBJ_sm9hash1_with_sha256 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x01,0x01, /* [ 7825] OBJ_sm9sign_with_sm3 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x01,0x02, /* [ 7835] OBJ_sm9sign_with_sha256 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x03,0x01, /* [ 7845] OBJ_sm9encrypt_with_sm3_xor */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x03,0x02, /* [ 7855] OBJ_sm9encrypt_with_sm3_sms4_cbc */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x03,0x03, /* [ 7865] OBJ_sm9encrypt_with_sm3_sms4_ctr */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x05, /* [ 7875] OBJ_sm9kdf */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x05,0x01, /* [ 7884] OBJ_sm9kdf_with_sm3 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x05,0x02, /* [ 7894] OBJ_sm9kdf_with_sha256 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x01, /* [ 7452] OBJ_sm2encrypt_with_sm3 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x02, /* [ 7463] OBJ_sm2encrypt_with_sha1 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x03, /* [ 7474] OBJ_sm2encrypt_with_sha224 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x04, /* [ 7485] OBJ_sm2encrypt_with_sha256 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x05, /* [ 7496] OBJ_sm2encrypt_with_sha384 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x06, /* [ 7507] OBJ_sm2encrypt_with_sha512 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x07, /* [ 7518] OBJ_sm2encrypt_with_rmd160 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x08, /* [ 7529] OBJ_sm2encrypt_with_whirlpool */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x09, /* [ 7540] OBJ_sm2encrypt_with_blake2b512 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x0A, /* [ 7551] OBJ_sm2encrypt_with_blake2s256 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2D,0x03,0x02,0x0B, /* [ 7562] OBJ_sm2encrypt_with_md5 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x84,0x08, /* [ 7573] OBJ_sm2sign_with_whirlpool */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x84,0x09, /* [ 7581] OBJ_sm2sign_with_blake2b512 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x84,0x0A, /* [ 7589] OBJ_sm2sign_with_blake2s256 */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x01, /* [ 7597] OBJ_ecies_with_x9_63_sha1_xor_hmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x02, /* [ 7603] OBJ_ecies_with_x9_63_sha256_xor_hmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x03, /* [ 7609] OBJ_ecies_with_x9_63_sha512_xor_hmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x04, /* [ 7615] OBJ_ecies_with_x9_63_sha1_aes128_cbc_hmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x05, /* [ 7621] OBJ_ecies_with_x9_63_sha256_aes128_cbc_hmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x06, /* [ 7627] OBJ_ecies_with_x9_63_sha512_aes256_cbc_hmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x07, /* [ 7633] OBJ_ecies_with_x9_63_sha256_aes128_ctr_hmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x08, /* [ 7639] OBJ_ecies_with_x9_63_sha512_aes256_ctr_hmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x09, /* [ 7645] OBJ_ecies_with_x9_63_sha256_aes128_cbc_hmac_half */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x0A, /* [ 7651] OBJ_ecies_with_x9_63_sha512_aes256_cbc_hmac_half */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x0B, /* [ 7657] OBJ_ecies_with_x9_63_sha256_aes128_ctr_hmac_half */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x0C, /* [ 7663] OBJ_ecies_with_x9_63_sha512_aes256_ctr_hmac_half */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x0D, /* [ 7669] OBJ_ecies_with_x9_63_sha1_aes128_cbc_cmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x0E, /* [ 7675] OBJ_ecies_with_x9_63_sha256_aes128_cbc_cmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x0F, /* [ 7681] OBJ_ecies_with_x9_63_sha512_aes256_cbc_cmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x10, /* [ 7687] OBJ_ecies_with_x9_63_sha256_aes128_ctr_cmac */
|
||||
0x2B,0x81,0x04,0x01,0x08,0x11, /* [ 7693] OBJ_ecies_with_x9_63_sha512_aes256_ctr_cmac */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x86,0x20,0x01, /* [ 7699] OBJ_zuc_128eea3 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x86,0x20,0x02, /* [ 7708] OBJ_zuc_128eia3 */
|
||||
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x0C,0x01,0x64, /* [ 7717] OBJ_pbe_WithSM3AndSMS4_CBC */
|
||||
0x2A,0x81,0x1C,0xD7,0x63, /* [ 7727] OBJ_bwips */
|
||||
0x2A,0x81,0x1C,0xD7,0x63,0x01, /* [ 7732] OBJ_wapi_crypto */
|
||||
0x2A,0x81,0x1C,0xD7,0x63,0x01,0x01, /* [ 7738] OBJ_wapi_ec */
|
||||
0x2A,0x81,0x1C,0xD7,0x63,0x01,0x01,0x01, /* [ 7745] OBJ_wapi_ecdsa192_sha256 */
|
||||
0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D,0x09,0x01, /* [ 7753] OBJ_sm9bn256v1 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x04, /* [ 7763] OBJ_sm9hash1 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x04,0x01, /* [ 7772] OBJ_sm9hash1_with_sm3 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x04,0x02, /* [ 7782] OBJ_sm9hash1_with_sha256 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x01,0x01, /* [ 7792] OBJ_sm9sign_with_sm3 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x01,0x02, /* [ 7802] OBJ_sm9sign_with_sha256 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x03,0x01, /* [ 7812] OBJ_sm9encrypt_with_sm3_xor */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x03,0x02, /* [ 7822] OBJ_sm9encrypt_with_sm3_sms4_cbc */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x03,0x03, /* [ 7832] OBJ_sm9encrypt_with_sm3_sms4_ctr */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x05, /* [ 7842] OBJ_sm9kdf */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x05,0x01, /* [ 7851] OBJ_sm9kdf_with_sm3 */
|
||||
0x2A,0x81,0x1C,0xCF,0x55,0x01,0x82,0x2E,0x05,0x02, /* [ 7861] OBJ_sm9kdf_with_sha256 */
|
||||
0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D,0x01,0x01,0x01, /* [ 7871] OBJ_cpk_map_sha1 */
|
||||
0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D,0x01,0x01,0x02, /* [ 7882] OBJ_cpk_map_sha256 */
|
||||
0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D,0x01,0x01,0x03, /* [ 7893] OBJ_cpk_map_sm3 */
|
||||
0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D,0x01,0x01,0x04, /* [ 7904] OBJ_cpk_map_sha384 */
|
||||
0x2B,0x06,0x01,0x04,0x01,0x83,0x83,0x0D,0x01,0x01,0x05, /* [ 7915] OBJ_cpk_map_sha512 */
|
||||
};
|
||||
|
||||
#define NUM_NID 1212
|
||||
#define NUM_NID 1223
|
||||
static const ASN1_OBJECT nid_objs[NUM_NID] = {
|
||||
{"UNDEF", "undefined", NID_undef},
|
||||
{"rsadsi", "RSA Data Security, Inc.", NID_rsadsi, 6, &so[0]},
|
||||
@@ -2259,40 +2261,40 @@ static const ASN1_OBJECT nid_objs[NUM_NID] = {
|
||||
{"sm2exchange", "sm2exchange", NID_sm2exchange, 9, &so[7425]},
|
||||
{"gmssl", "GmSSL", NID_GmSSL, 8, &so[7434]},
|
||||
{"cpk-map", "cpk-map", NID_cpk_map, 10, &so[7442]},
|
||||
{"cpk-sha1-map", "cpk-sha1-map", NID_cpk_sha1_map, 11, &so[7452]},
|
||||
{"cpk-sha256-map", "cpk-sha256-map", NID_cpk_sha256_map, 11, &so[7463]},
|
||||
{"cpk-sm3-map", "cpk-sm3-map", NID_cpk_sm3_map, 11, &so[7474]},
|
||||
{"sm2encrypt-with-sm3", "sm2encrypt-with-sm3", NID_sm2encrypt_with_sm3, 11, &so[7485]},
|
||||
{"sm2encrypt-with-sha1", "sm2encrypt-with-sha1", NID_sm2encrypt_with_sha1, 11, &so[7496]},
|
||||
{"sm2encrypt-with-sha224", "sm2encrypt-with-sha224", NID_sm2encrypt_with_sha224, 11, &so[7507]},
|
||||
{"sm2encrypt-with-sha256", "sm2encrypt-with-sha256", NID_sm2encrypt_with_sha256, 11, &so[7518]},
|
||||
{"sm2encrypt-with-sha384", "sm2encrypt-with-sha384", NID_sm2encrypt_with_sha384, 11, &so[7529]},
|
||||
{"sm2encrypt-with-sha512", "sm2encrypt-with-sha512", NID_sm2encrypt_with_sha512, 11, &so[7540]},
|
||||
{"sm2encrypt-with-rmd160", "sm2encrypt-with-rmd160", NID_sm2encrypt_with_rmd160, 11, &so[7551]},
|
||||
{"sm2encrypt-with-whirlpool", "sm2encrypt-with-whirlpool", NID_sm2encrypt_with_whirlpool, 11, &so[7562]},
|
||||
{"sm2encrypt-with-blake2b512", "sm2encrypt-with-blake2b512", NID_sm2encrypt_with_blake2b512, 11, &so[7573]},
|
||||
{"sm2encrypt-with-blake2s256", "sm2encrypt-with-blake2s256", NID_sm2encrypt_with_blake2s256, 11, &so[7584]},
|
||||
{"sm2encrypt-with-md5", "sm2encrypt-with-md5", NID_sm2encrypt_with_md5, 11, &so[7595]},
|
||||
{"SM2Sign-with-Whirlpool", "sm2sign-with-whirlpool", NID_sm2sign_with_whirlpool, 8, &so[7606]},
|
||||
{"SM2Sign-with-Blake2b512", "sm2sign-with-blake2b512", NID_sm2sign_with_blake2b512, 8, &so[7614]},
|
||||
{"SM2Sign-with-Blake2s256", "sm2sign-with-blake2s256", NID_sm2sign_with_blake2s256, 8, &so[7622]},
|
||||
{"ecies-with-x9-63-sha1-xor-hmac", "ecies-with-x9-63-sha1-xor-hmac", NID_ecies_with_x9_63_sha1_xor_hmac, 6, &so[7630]},
|
||||
{"ecies-with-x9-63-sha256-xor-hmac", "ecies-with-x9-63-sha256-xor-hmac", NID_ecies_with_x9_63_sha256_xor_hmac, 6, &so[7636]},
|
||||
{"ecies-with-x9-63-sha512-xor-hmac", "ecies-with-x9-63-sha512-xor-hmac", NID_ecies_with_x9_63_sha512_xor_hmac, 6, &so[7642]},
|
||||
{"ecies-with-x9-63-sha1-aes128-cbc-hmac", "ecies-with-x9-63-sha1-aes128-cbc-hmac", NID_ecies_with_x9_63_sha1_aes128_cbc_hmac, 6, &so[7648]},
|
||||
{"ecies-with-x9-63-sha256-aes128-cbc-hmac", "ecies-with-x9-63-sha256-aes128-cbc-hmac", NID_ecies_with_x9_63_sha256_aes128_cbc_hmac, 6, &so[7654]},
|
||||
{"ecies-with-x9-63-sha512-aes256-cbc-hmac", "ecies-with-x9-63-sha512-aes256-cbc-hmac", NID_ecies_with_x9_63_sha512_aes256_cbc_hmac, 6, &so[7660]},
|
||||
{"ecies-with-x9-63-sha256-aes128-ctr-hmac", "ecies-with-x9-63-sha256-aes128-ctr-hmac", NID_ecies_with_x9_63_sha256_aes128_ctr_hmac, 6, &so[7666]},
|
||||
{"ecies-with-x9-63-sha512-aes256-ctr-hmac", "ecies-with-x9-63-sha512-aes256-ctr-hmac", NID_ecies_with_x9_63_sha512_aes256_ctr_hmac, 6, &so[7672]},
|
||||
{"ecies-with-x9-63-sha256-aes128-cbc-hmac-half", "ecies-with-x9-63-sha256-aes128-cbc-hmac-half", NID_ecies_with_x9_63_sha256_aes128_cbc_hmac_half, 6, &so[7678]},
|
||||
{"ecies-with-x9-63-sha512-aes256-cbc-hmac-half", "ecies-with-x9-63-sha512-aes256-cbc-hmac-half", NID_ecies_with_x9_63_sha512_aes256_cbc_hmac_half, 6, &so[7684]},
|
||||
{"ecies-with-x9-63-sha256-aes128-ctr-hmac-half", "ecies-with-x9-63-sha256-aes128-ctr-hmac-half", NID_ecies_with_x9_63_sha256_aes128_ctr_hmac_half, 6, &so[7690]},
|
||||
{"ecies-with-x9-63-sha512-aes256-ctr-hmac-half", "ecies-with-x9-63-sha512-aes256-ctr-hmac-half", NID_ecies_with_x9_63_sha512_aes256_ctr_hmac_half, 6, &so[7696]},
|
||||
{"ecies-with-x9-63-sha1-aes128-cbc-cmac", "ecies-with-x9-63-sha1-aes128-cbc-cmac", NID_ecies_with_x9_63_sha1_aes128_cbc_cmac, 6, &so[7702]},
|
||||
{"ecies-with-x9-63-sha256-aes128-cbc-cmac", "ecies-with-x9-63-sha256-aes128-cbc-cmac", NID_ecies_with_x9_63_sha256_aes128_cbc_cmac, 6, &so[7708]},
|
||||
{"ecies-with-x9-63-sha512-aes256-cbc-cmac", "ecies-with-x9-63-sha512-aes256-cbc-cmac", NID_ecies_with_x9_63_sha512_aes256_cbc_cmac, 6, &so[7714]},
|
||||
{"ecies-with-x9-63-sha256-aes128-ctr-cmac", "ecies-with-x9-63-sha256-aes128-ctr-cmac", NID_ecies_with_x9_63_sha256_aes128_ctr_cmac, 6, &so[7720]},
|
||||
{"ecies-with-x9-63-sha512-aes256-ctr-cmac", "ecies-with-x9-63-sha512-aes256-ctr-cmac", NID_ecies_with_x9_63_sha512_aes256_ctr_cmac, 6, &so[7726]},
|
||||
{ NULL, NULL, NID_undef },
|
||||
{ NULL, NULL, NID_undef },
|
||||
{ NULL, NULL, NID_undef },
|
||||
{"sm2encrypt-with-sm3", "sm2encrypt-with-sm3", NID_sm2encrypt_with_sm3, 11, &so[7452]},
|
||||
{"sm2encrypt-with-sha1", "sm2encrypt-with-sha1", NID_sm2encrypt_with_sha1, 11, &so[7463]},
|
||||
{"sm2encrypt-with-sha224", "sm2encrypt-with-sha224", NID_sm2encrypt_with_sha224, 11, &so[7474]},
|
||||
{"sm2encrypt-with-sha256", "sm2encrypt-with-sha256", NID_sm2encrypt_with_sha256, 11, &so[7485]},
|
||||
{"sm2encrypt-with-sha384", "sm2encrypt-with-sha384", NID_sm2encrypt_with_sha384, 11, &so[7496]},
|
||||
{"sm2encrypt-with-sha512", "sm2encrypt-with-sha512", NID_sm2encrypt_with_sha512, 11, &so[7507]},
|
||||
{"sm2encrypt-with-rmd160", "sm2encrypt-with-rmd160", NID_sm2encrypt_with_rmd160, 11, &so[7518]},
|
||||
{"sm2encrypt-with-whirlpool", "sm2encrypt-with-whirlpool", NID_sm2encrypt_with_whirlpool, 11, &so[7529]},
|
||||
{"sm2encrypt-with-blake2b512", "sm2encrypt-with-blake2b512", NID_sm2encrypt_with_blake2b512, 11, &so[7540]},
|
||||
{"sm2encrypt-with-blake2s256", "sm2encrypt-with-blake2s256", NID_sm2encrypt_with_blake2s256, 11, &so[7551]},
|
||||
{"sm2encrypt-with-md5", "sm2encrypt-with-md5", NID_sm2encrypt_with_md5, 11, &so[7562]},
|
||||
{"SM2Sign-with-Whirlpool", "sm2sign-with-whirlpool", NID_sm2sign_with_whirlpool, 8, &so[7573]},
|
||||
{"SM2Sign-with-Blake2b512", "sm2sign-with-blake2b512", NID_sm2sign_with_blake2b512, 8, &so[7581]},
|
||||
{"SM2Sign-with-Blake2s256", "sm2sign-with-blake2s256", NID_sm2sign_with_blake2s256, 8, &so[7589]},
|
||||
{"ecies-with-x9-63-sha1-xor-hmac", "ecies-with-x9-63-sha1-xor-hmac", NID_ecies_with_x9_63_sha1_xor_hmac, 6, &so[7597]},
|
||||
{"ecies-with-x9-63-sha256-xor-hmac", "ecies-with-x9-63-sha256-xor-hmac", NID_ecies_with_x9_63_sha256_xor_hmac, 6, &so[7603]},
|
||||
{"ecies-with-x9-63-sha512-xor-hmac", "ecies-with-x9-63-sha512-xor-hmac", NID_ecies_with_x9_63_sha512_xor_hmac, 6, &so[7609]},
|
||||
{"ecies-with-x9-63-sha1-aes128-cbc-hmac", "ecies-with-x9-63-sha1-aes128-cbc-hmac", NID_ecies_with_x9_63_sha1_aes128_cbc_hmac, 6, &so[7615]},
|
||||
{"ecies-with-x9-63-sha256-aes128-cbc-hmac", "ecies-with-x9-63-sha256-aes128-cbc-hmac", NID_ecies_with_x9_63_sha256_aes128_cbc_hmac, 6, &so[7621]},
|
||||
{"ecies-with-x9-63-sha512-aes256-cbc-hmac", "ecies-with-x9-63-sha512-aes256-cbc-hmac", NID_ecies_with_x9_63_sha512_aes256_cbc_hmac, 6, &so[7627]},
|
||||
{"ecies-with-x9-63-sha256-aes128-ctr-hmac", "ecies-with-x9-63-sha256-aes128-ctr-hmac", NID_ecies_with_x9_63_sha256_aes128_ctr_hmac, 6, &so[7633]},
|
||||
{"ecies-with-x9-63-sha512-aes256-ctr-hmac", "ecies-with-x9-63-sha512-aes256-ctr-hmac", NID_ecies_with_x9_63_sha512_aes256_ctr_hmac, 6, &so[7639]},
|
||||
{"ecies-with-x9-63-sha256-aes128-cbc-hmac-half", "ecies-with-x9-63-sha256-aes128-cbc-hmac-half", NID_ecies_with_x9_63_sha256_aes128_cbc_hmac_half, 6, &so[7645]},
|
||||
{"ecies-with-x9-63-sha512-aes256-cbc-hmac-half", "ecies-with-x9-63-sha512-aes256-cbc-hmac-half", NID_ecies_with_x9_63_sha512_aes256_cbc_hmac_half, 6, &so[7651]},
|
||||
{"ecies-with-x9-63-sha256-aes128-ctr-hmac-half", "ecies-with-x9-63-sha256-aes128-ctr-hmac-half", NID_ecies_with_x9_63_sha256_aes128_ctr_hmac_half, 6, &so[7657]},
|
||||
{"ecies-with-x9-63-sha512-aes256-ctr-hmac-half", "ecies-with-x9-63-sha512-aes256-ctr-hmac-half", NID_ecies_with_x9_63_sha512_aes256_ctr_hmac_half, 6, &so[7663]},
|
||||
{"ecies-with-x9-63-sha1-aes128-cbc-cmac", "ecies-with-x9-63-sha1-aes128-cbc-cmac", NID_ecies_with_x9_63_sha1_aes128_cbc_cmac, 6, &so[7669]},
|
||||
{"ecies-with-x9-63-sha256-aes128-cbc-cmac", "ecies-with-x9-63-sha256-aes128-cbc-cmac", NID_ecies_with_x9_63_sha256_aes128_cbc_cmac, 6, &so[7675]},
|
||||
{"ecies-with-x9-63-sha512-aes256-cbc-cmac", "ecies-with-x9-63-sha512-aes256-cbc-cmac", NID_ecies_with_x9_63_sha512_aes256_cbc_cmac, 6, &so[7681]},
|
||||
{"ecies-with-x9-63-sha256-aes128-ctr-cmac", "ecies-with-x9-63-sha256-aes128-ctr-cmac", NID_ecies_with_x9_63_sha256_aes128_ctr_cmac, 6, &so[7687]},
|
||||
{"ecies-with-x9-63-sha512-aes256-ctr-cmac", "ecies-with-x9-63-sha512-aes256-ctr-cmac", NID_ecies_with_x9_63_sha512_aes256_ctr_cmac, 6, &so[7693]},
|
||||
{"KxSM2", "kx-sm2", NID_kx_sm2},
|
||||
{"AuthSM2", "auth-sm2", NID_auth_sm2},
|
||||
{"KxSM9", "kx-sm9", NID_kx_sm9},
|
||||
@@ -2300,28 +2302,39 @@ static const ASN1_OBJECT nid_objs[NUM_NID] = {
|
||||
{"KxSM2DHE", "kx-sm2dhe", NID_kx_sm2dhe},
|
||||
{"KxSM2-PSK", "kx-sm2-psk", NID_kx_sm2_psk},
|
||||
{"KxSM9DHE", "kx-sm9dhe", NID_kx_sm9dhe},
|
||||
{"zuc-128eea3", "zuc-128eea3", NID_zuc_128eea3, 9, &so[7732]},
|
||||
{"zuc-128eia3", "zuc-128eia3", NID_zuc_128eia3, 9, &so[7741]},
|
||||
{"PBE-SM3-SMS4", "pbeWithSM3AndSMS4-CBC", NID_pbe_WithSM3AndSMS4_CBC, 10, &so[7750]},
|
||||
{"bwips", "bwips", NID_bwips, 5, &so[7760]},
|
||||
{"wapi-crypto", "wapi-crypto", NID_wapi_crypto, 6, &so[7765]},
|
||||
{"wapi-ec", "wapi-ec", NID_wapi_ec, 7, &so[7771]},
|
||||
{"wapi-ecdsa192-sha256", "wapi-ecdsa192-sha256", NID_wapi_ecdsa192_sha256, 8, &so[7778]},
|
||||
{"sm9bn256v1", "sm9bn256v1", NID_sm9bn256v1, 10, &so[7786]},
|
||||
{"sm9hash1", "sm9hash1", NID_sm9hash1, 9, &so[7796]},
|
||||
{"sm9hash1-with-sm3", "sm9hash1-with-sm3", NID_sm9hash1_with_sm3, 10, &so[7805]},
|
||||
{"sm9hash1-with-sha256", "sm9hash1-with-sha256", NID_sm9hash1_with_sha256, 10, &so[7815]},
|
||||
{"sm9sign-with-sm3", "sm9sign-with-sm3", NID_sm9sign_with_sm3, 10, &so[7825]},
|
||||
{"sm9sign-with-sha256", "sm9sign-with-sha256", NID_sm9sign_with_sha256, 10, &so[7835]},
|
||||
{"sm9encrypt-with-sm3-xor", "sm9encrypt-with-sm3-xor", NID_sm9encrypt_with_sm3_xor, 10, &so[7845]},
|
||||
{"sm9encrypt-with-sm3-sms4-cbc", "sm9encrypt-with-sm3-sms4-cbc", NID_sm9encrypt_with_sm3_sms4_cbc, 10, &so[7855]},
|
||||
{"sm9encrypt-with-sm3-sms4-ctr", "sm9encrypt-with-sm3-sms4-ctr", NID_sm9encrypt_with_sm3_sms4_ctr, 10, &so[7865]},
|
||||
{"sm9kdf", "sm9kdf", NID_sm9kdf, 9, &so[7875]},
|
||||
{"sm9kdf-with-sm3", "sm9kdf-with-sm3", NID_sm9kdf_with_sm3, 10, &so[7884]},
|
||||
{"sm9kdf-with-sha256", "sm9kdf-with-sha256", NID_sm9kdf_with_sha256, 10, &so[7894]},
|
||||
{"zuc-128eea3", "zuc-128eea3", NID_zuc_128eea3, 9, &so[7699]},
|
||||
{"zuc-128eia3", "zuc-128eia3", NID_zuc_128eia3, 9, &so[7708]},
|
||||
{"PBE-SM3-SMS4", "pbeWithSM3AndSMS4-CBC", NID_pbe_WithSM3AndSMS4_CBC, 10, &so[7717]},
|
||||
{"bwips", "bwips", NID_bwips, 5, &so[7727]},
|
||||
{"wapi-crypto", "wapi-crypto", NID_wapi_crypto, 6, &so[7732]},
|
||||
{"wapi-ec", "wapi-ec", NID_wapi_ec, 7, &so[7738]},
|
||||
{"wapi-ecdsa192-sha256", "wapi-ecdsa192-sha256", NID_wapi_ecdsa192_sha256, 8, &so[7745]},
|
||||
{"sm9bn256v1", "sm9bn256v1", NID_sm9bn256v1, 10, &so[7753]},
|
||||
{"sm9hash1", "sm9hash1", NID_sm9hash1, 9, &so[7763]},
|
||||
{"sm9hash1-with-sm3", "sm9hash1-with-sm3", NID_sm9hash1_with_sm3, 10, &so[7772]},
|
||||
{"sm9hash1-with-sha256", "sm9hash1-with-sha256", NID_sm9hash1_with_sha256, 10, &so[7782]},
|
||||
{"sm9sign-with-sm3", "sm9sign-with-sm3", NID_sm9sign_with_sm3, 10, &so[7792]},
|
||||
{"sm9sign-with-sha256", "sm9sign-with-sha256", NID_sm9sign_with_sha256, 10, &so[7802]},
|
||||
{"sm9encrypt-with-sm3-xor", "sm9encrypt-with-sm3-xor", NID_sm9encrypt_with_sm3_xor, 10, &so[7812]},
|
||||
{"sm9encrypt-with-sm3-sms4-cbc", "sm9encrypt-with-sm3-sms4-cbc", NID_sm9encrypt_with_sm3_sms4_cbc, 10, &so[7822]},
|
||||
{"sm9encrypt-with-sm3-sms4-ctr", "sm9encrypt-with-sm3-sms4-ctr", NID_sm9encrypt_with_sm3_sms4_ctr, 10, &so[7832]},
|
||||
{"sm9kdf", "sm9kdf", NID_sm9kdf, 9, &so[7842]},
|
||||
{"sm9kdf-with-sm3", "sm9kdf-with-sm3", NID_sm9kdf_with_sm3, 10, &so[7851]},
|
||||
{"sm9kdf-with-sha256", "sm9kdf-with-sha256", NID_sm9kdf_with_sha256, 10, &so[7861]},
|
||||
{ NULL, NULL, NID_undef },
|
||||
{ NULL, NULL, NID_undef },
|
||||
{ NULL, NULL, NID_undef },
|
||||
{ NULL, NULL, NID_undef },
|
||||
{ NULL, NULL, NID_undef },
|
||||
{ NULL, NULL, NID_undef },
|
||||
{"cpk-map-sha1", "cpk-map-sha1", NID_cpk_map_sha1, 11, &so[7871]},
|
||||
{"cpk-map-sha256", "cpk-map-sha256", NID_cpk_map_sha256, 11, &so[7882]},
|
||||
{"cpk-map-sm3", "cpk-map-sm3", NID_cpk_map_sm3, 11, &so[7893]},
|
||||
{"cpk-map-sha384", "cpk-map-sha384", NID_cpk_map_sha384, 11, &so[7904]},
|
||||
{"cpk-map-sha512", "cpk-map-sha512", NID_cpk_map_sha512, 11, &so[7915]},
|
||||
};
|
||||
|
||||
#define NUM_SN 1201
|
||||
#define NUM_SN 1203
|
||||
static const unsigned int sn_objs[NUM_SN] = {
|
||||
364, /* "AD_DVCS" */
|
||||
419, /* "AES-128-CBC" */
|
||||
@@ -2702,9 +2715,11 @@ static const unsigned int sn_objs[NUM_SN] = {
|
||||
50, /* "contentType" */
|
||||
53, /* "countersignature" */
|
||||
1151, /* "cpk-map" */
|
||||
1152, /* "cpk-sha1-map" */
|
||||
1153, /* "cpk-sha256-map" */
|
||||
1154, /* "cpk-sm3-map" */
|
||||
1218, /* "cpk-map-sha1" */
|
||||
1219, /* "cpk-map-sha256" */
|
||||
1221, /* "cpk-map-sha384" */
|
||||
1222, /* "cpk-map-sha512" */
|
||||
1220, /* "cpk-map-sm3" */
|
||||
153, /* "crlBag" */
|
||||
103, /* "crlDistributionPoints" */
|
||||
88, /* "crlNumber" */
|
||||
@@ -3526,7 +3541,7 @@ static const unsigned int sn_objs[NUM_SN] = {
|
||||
1194, /* "zuc-128eia3" */
|
||||
};
|
||||
|
||||
#define NUM_LN 1201
|
||||
#define NUM_LN 1203
|
||||
static const unsigned int ln_objs[NUM_LN] = {
|
||||
363, /* "AD Time Stamping" */
|
||||
405, /* "ANSI X9.62" */
|
||||
@@ -3871,9 +3886,11 @@ static const unsigned int ln_objs[NUM_LN] = {
|
||||
14, /* "countryName" */
|
||||
1147, /* "cpk" */
|
||||
1151, /* "cpk-map" */
|
||||
1152, /* "cpk-sha1-map" */
|
||||
1153, /* "cpk-sha256-map" */
|
||||
1154, /* "cpk-sm3-map" */
|
||||
1218, /* "cpk-map-sha1" */
|
||||
1219, /* "cpk-map-sha256" */
|
||||
1221, /* "cpk-map-sha384" */
|
||||
1222, /* "cpk-map-sha512" */
|
||||
1220, /* "cpk-map-sm3" */
|
||||
153, /* "crlBag" */
|
||||
884, /* "crossCertificatePair" */
|
||||
806, /* "cryptocom" */
|
||||
@@ -4731,7 +4748,7 @@ static const unsigned int ln_objs[NUM_LN] = {
|
||||
1194, /* "zuc-128eia3" */
|
||||
};
|
||||
|
||||
#define NUM_OBJ 1098
|
||||
#define NUM_OBJ 1100
|
||||
static const unsigned int obj_objs[NUM_OBJ] = {
|
||||
0, /* OBJ_undef 0 */
|
||||
181, /* OBJ_iso 1 */
|
||||
@@ -5826,9 +5843,11 @@ static const unsigned int obj_objs[NUM_OBJ] = {
|
||||
955, /* OBJ_jurisdictionLocalityName 1 3 6 1 4 1 311 60 2 1 1 */
|
||||
956, /* OBJ_jurisdictionStateOrProvinceName 1 3 6 1 4 1 311 60 2 1 2 */
|
||||
957, /* OBJ_jurisdictionCountryName 1 3 6 1 4 1 311 60 2 1 3 */
|
||||
1152, /* OBJ_cpk_sha1_map 1 3 6 1 4 1 49549 1 1 1 */
|
||||
1153, /* OBJ_cpk_sha256_map 1 3 6 1 4 1 49549 1 1 2 */
|
||||
1154, /* OBJ_cpk_sm3_map 1 3 6 1 4 1 49549 1 1 3 */
|
||||
1218, /* OBJ_cpk_map_sha1 1 3 6 1 4 1 49549 1 1 1 */
|
||||
1219, /* OBJ_cpk_map_sha256 1 3 6 1 4 1 49549 1 1 2 */
|
||||
1220, /* OBJ_cpk_map_sm3 1 3 6 1 4 1 49549 1 1 3 */
|
||||
1221, /* OBJ_cpk_map_sha384 1 3 6 1 4 1 49549 1 1 4 */
|
||||
1222, /* OBJ_cpk_map_sha512 1 3 6 1 4 1 49549 1 1 5 */
|
||||
1056, /* OBJ_blake2b512 1 3 6 1 4 1 1722 12 2 1 16 */
|
||||
1057, /* OBJ_blake2s256 1 3 6 1 4 1 1722 12 2 2 8 */
|
||||
};
|
||||
|
||||
@@ -1209,3 +1209,14 @@ sm9encrypt_with_sm3_sms4_ctr 1208
|
||||
sm9kdf 1209
|
||||
sm9kdf_with_sm3 1210
|
||||
sm9kdf_with_sha256 1211
|
||||
cpk_map32x32_sha1 1212
|
||||
cpk_map32x256_sha256 1213
|
||||
cpk_map32x256_sm3 1214
|
||||
cpk_map_with_sha1 1215
|
||||
cpk_map_with_sha256 1216
|
||||
cpk_map_with_sm3 1217
|
||||
cpk_map_sha1 1218
|
||||
cpk_map_sha256 1219
|
||||
cpk_map_sm3 1220
|
||||
cpk_map_sha384 1221
|
||||
cpk_map_sha512 1222
|
||||
|
||||
@@ -1666,10 +1666,14 @@ ibcs1 3 4 : r-ate-pairing
|
||||
Enterprises 49549 : gmssl : GmSSL
|
||||
|
||||
GmSSL 1 : CPK : cpk
|
||||
|
||||
# map algorithms
|
||||
cpk 1 : cpk-map
|
||||
cpk-map 1 : cpk-sha1-map
|
||||
cpk-map 2 : cpk-sha256-map
|
||||
cpk-map 3 : cpk-sm3-map
|
||||
cpk-map 1 : cpk-map-sha1
|
||||
cpk-map 2 : cpk-map-sha256
|
||||
cpk-map 3 : cpk-map-sm3
|
||||
cpk-map 4 : cpk-map-sha384
|
||||
cpk-map 5 : cpk-map-sha512
|
||||
|
||||
GmSSL 21 : paillier
|
||||
|
||||
|
||||
Reference in New Issue
Block a user