mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-08-08 06:03:47 +08:00
first step of v2 final release
This commit is contained in:
@@ -351,11 +351,19 @@ static void x509v3_cache_extensions(X509 *x)
|
||||
ASN1_BIT_STRING *ns;
|
||||
EXTENDED_KEY_USAGE *extusage;
|
||||
X509_EXTENSION *ex;
|
||||
const EVP_MD *md;
|
||||
#ifndef OPENSSL_NO_SHA
|
||||
md = EVP_sha1();
|
||||
#elif !defined(OPENSSL_NO_SM3)
|
||||
md = EVP_sm3();
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
|
||||
int i;
|
||||
if (x->ex_flags & EXFLAG_SET)
|
||||
return;
|
||||
X509_digest(x, EVP_sha1(), x->sha1_hash, NULL);
|
||||
X509_digest(x, md, x->sha1_hash, NULL);
|
||||
/* V1 should mean no extensions ... */
|
||||
if (!X509_get_version(x))
|
||||
x->ex_flags |= EXFLAG_V1;
|
||||
|
||||
@@ -61,6 +61,14 @@ static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method,
|
||||
int pklen;
|
||||
unsigned char pkey_dig[EVP_MAX_MD_SIZE];
|
||||
unsigned int diglen;
|
||||
const EVP_MD *md;
|
||||
#ifndef OPENSSL_NO_SHA
|
||||
md = EVP_sha1();
|
||||
#elif !defined(OPENSSL_NO_SM3)
|
||||
md = EVP_sm3();
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
if (strcmp(str, "hash"))
|
||||
return s2i_ASN1_OCTET_STRING(method, ctx, str);
|
||||
@@ -90,7 +98,7 @@ static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method,
|
||||
|
||||
X509_PUBKEY_get0_param(NULL, &pk, &pklen, NULL, pubkey);
|
||||
|
||||
if (!EVP_Digest(pk, pklen, pkey_dig, &diglen, EVP_sha1(), NULL))
|
||||
if (!EVP_Digest(pk, pklen, pkey_dig, &diglen, md, NULL))
|
||||
goto err;
|
||||
|
||||
if (!ASN1_OCTET_STRING_set(oct, pkey_dig, diglen)) {
|
||||
|
||||
Reference in New Issue
Block a user