diff options
author | Fergus Dall <sidereal@google.com> | 2023-06-12 12:02:14 +0200 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2023-06-28 00:00:43 +0200 |
commit | 81bafac5cbbd195ff9c53a06aaca7c3eacbb2fc0 (patch) | |
tree | c08c6dc6997d7f719830609d190275d6b6ceba7d /providers | |
parent | CONF_modules_load_file_ex(): Do not try to load an empty file name (diff) | |
download | openssl-81bafac5cbbd195ff9c53a06aaca7c3eacbb2fc0.tar.xz openssl-81bafac5cbbd195ff9c53a06aaca7c3eacbb2fc0.zip |
Add support for SHA256/192
This is defined in NIST SP 800-208 as the truncation to 192 bits of
SHA256. Unlike other truncated hashes in the SHA2 suite, this variant
doesn't have a different initial state, it is just a pure truncation
of the output.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21180)
Diffstat (limited to 'providers')
-rw-r--r-- | providers/defltprov.c | 1 | ||||
-rw-r--r-- | providers/implementations/digests/sha2_prov.c | 7 | ||||
-rw-r--r-- | providers/implementations/include/prov/implementations.h | 1 | ||||
-rw-r--r-- | providers/implementations/include/prov/names.h | 1 |
4 files changed, 9 insertions, 1 deletions
diff --git a/providers/defltprov.c b/providers/defltprov.c index 8b2ae6bfbf..fa4165b365 100644 --- a/providers/defltprov.c +++ b/providers/defltprov.c @@ -103,6 +103,7 @@ static const OSSL_ALGORITHM deflt_digests[] = { { PROV_NAMES_SHA1, "provider=default", ossl_sha1_functions }, { PROV_NAMES_SHA2_224, "provider=default", ossl_sha224_functions }, { PROV_NAMES_SHA2_256, "provider=default", ossl_sha256_functions }, + { PROV_NAMES_SHA2_256_192, "provider=default", ossl_sha256_192_functions }, { PROV_NAMES_SHA2_384, "provider=default", ossl_sha384_functions }, { PROV_NAMES_SHA2_512, "provider=default", ossl_sha512_functions }, { PROV_NAMES_SHA2_512_224, "provider=default", ossl_sha512_224_functions }, diff --git a/providers/implementations/digests/sha2_prov.c b/providers/implementations/digests/sha2_prov.c index 6f9c41a3a6..039c616095 100644 --- a/providers/implementations/digests/sha2_prov.c +++ b/providers/implementations/digests/sha2_prov.c @@ -71,7 +71,12 @@ IMPLEMENT_digest_functions(sha224, SHA256_CTX, IMPLEMENT_digest_functions(sha256, SHA256_CTX, SHA256_CBLOCK, SHA256_DIGEST_LENGTH, SHA2_FLAGS, SHA256_Init, SHA256_Update, SHA256_Final) - +#ifndef FIPS_MODULE +/* ossl_sha256_192_functions */ +IMPLEMENT_digest_functions(sha256_192, SHA256_CTX, + SHA256_CBLOCK, SHA256_192_DIGEST_LENGTH, SHA2_FLAGS, + ossl_sha256_192_init, SHA256_Update, SHA256_Final) +#endif /* ossl_sha384_functions */ IMPLEMENT_digest_functions(sha384, SHA512_CTX, SHA512_CBLOCK, SHA384_DIGEST_LENGTH, SHA2_FLAGS, diff --git a/providers/implementations/include/prov/implementations.h b/providers/implementations/include/prov/implementations.h index 2c3c54155f..1c7bb4ab8d 100644 --- a/providers/implementations/include/prov/implementations.h +++ b/providers/implementations/include/prov/implementations.h @@ -14,6 +14,7 @@ extern const OSSL_DISPATCH ossl_sha1_functions[]; extern const OSSL_DISPATCH ossl_sha224_functions[]; extern const OSSL_DISPATCH ossl_sha256_functions[]; +extern const OSSL_DISPATCH ossl_sha256_192_functions[]; extern const OSSL_DISPATCH ossl_sha384_functions[]; extern const OSSL_DISPATCH ossl_sha512_functions[]; extern const OSSL_DISPATCH ossl_sha512_224_functions[]; diff --git a/providers/implementations/include/prov/names.h b/providers/implementations/include/prov/names.h index dd40a6a8ed..af7e45a3f6 100644 --- a/providers/implementations/include/prov/names.h +++ b/providers/implementations/include/prov/names.h @@ -214,6 +214,7 @@ #define PROV_NAMES_SHA1 "SHA1:SHA-1:SSL3-SHA1:1.3.14.3.2.26" #define PROV_NAMES_SHA2_224 "SHA2-224:SHA-224:SHA224:2.16.840.1.101.3.4.2.4" #define PROV_NAMES_SHA2_256 "SHA2-256:SHA-256:SHA256:2.16.840.1.101.3.4.2.1" +#define PROV_NAMES_SHA2_256_192 "SHA2-256/192:SHA-256/192:SHA256-192" #define PROV_NAMES_SHA2_384 "SHA2-384:SHA-384:SHA384:2.16.840.1.101.3.4.2.2" #define PROV_NAMES_SHA2_512 "SHA2-512:SHA-512:SHA512:2.16.840.1.101.3.4.2.3" #define PROV_NAMES_SHA2_512_224 "SHA2-512/224:SHA-512/224:SHA512-224:2.16.840.1.101.3.4.2.5" |