crypto: Introduce SM3 hash hmac pbkdf algorithm
Introduce the SM3 cryptographic hash algorithm (GB/T 32905-2016). SM3 (GB/T 32905-2016) is a cryptographic standard issued by the Organization of State Commercial Cryptography Administration (OSCCA) as an authorized cryptographic algorithm for use within China. Detect the SM3 cryptographic hash algorithm and enable the feature silently if it is available. Signed-off-by: cheliequan <cheliequan@inspur.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
committed by
Daniel P. Berrangé
parent
62eb377e0a
commit
d078da86d6
@@ -33,6 +33,9 @@ bool qcrypto_pbkdf2_supports(QCryptoHashAlgo hash)
|
||||
case QCRYPTO_HASH_ALGO_SHA384:
|
||||
case QCRYPTO_HASH_ALGO_SHA512:
|
||||
case QCRYPTO_HASH_ALGO_RIPEMD160:
|
||||
#ifdef CONFIG_CRYPTO_SM3
|
||||
case QCRYPTO_HASH_ALGO_SM3:
|
||||
#endif
|
||||
return qcrypto_hash_supports(hash);
|
||||
default:
|
||||
return false;
|
||||
@@ -54,6 +57,9 @@ int qcrypto_pbkdf2(QCryptoHashAlgo hash,
|
||||
[QCRYPTO_HASH_ALGO_SHA384] = GCRY_MD_SHA384,
|
||||
[QCRYPTO_HASH_ALGO_SHA512] = GCRY_MD_SHA512,
|
||||
[QCRYPTO_HASH_ALGO_RIPEMD160] = GCRY_MD_RMD160,
|
||||
#ifdef CONFIG_CRYPTO_SM3
|
||||
[QCRYPTO_HASH_ALGO_SM3] = GCRY_MD_SM3,
|
||||
#endif
|
||||
};
|
||||
int ret;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user