aboutsummaryrefslogtreecommitdiff
path: root/core/include
diff options
context:
space:
mode:
authorSumit Garg <sumit.garg@linaro.org>2018-11-15 12:08:05 +0530
committerJérôme Forissier <jerome.forissier@linaro.org>2018-12-18 10:45:46 +0100
commitb8bb0afa738e6038bbd92b57742aa2526df9f20a (patch)
treefcd90ee302bae4322ada3eb2e495db23696a9c3f /core/include
parent5481559069fd1c671e041a96d35e63f134ea3d60 (diff)
libtomcrypt: Import SHA512/256 approved hash algorithm
SHA-512/256 is an approved hash algorithm and a vetted conditioner as per NIST.SP.800-90B spec. We have used it to condition raw thermal sensor noise on Developerbox to condense entropy. It is imported from libtomcrypt: Git url: https://github.com/libtom/libtomcrypt.git, release tag: v1.18.0. Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Joakim Bech <joakim.bech@linaro.org>
Diffstat (limited to 'core/include')
-rw-r--r--core/include/crypto/crypto.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/include/crypto/crypto.h b/core/include/crypto/crypto.h
index 2018d3cf..54a5f74f 100644
--- a/core/include/crypto/crypto.h
+++ b/core/include/crypto/crypto.h
@@ -256,6 +256,17 @@ TEE_Result crypto_acipher_ecc_shared_secret(struct ecc_keypair *private_key,
TEE_Result hash_sha256_check(const uint8_t *hash, const uint8_t *data,
size_t data_size);
+/*
+ * Computes a SHA-512/256 hash, vetted conditioner as per NIST.SP.800-90B.
+ * It doesn't require crypto_init() to be called in advance and has as few
+ * dependencies as possible.
+ *
+ * This function could be used inside interrupt context where the crypto
+ * library can't be used due to mutex handling.
+ */
+TEE_Result hash_sha512_256_compute(uint8_t *digest, const uint8_t *data,
+ size_t data_size);
+
#define CRYPTO_RNG_SRC_IS_QUICK(sid) (!!((sid) & 1))
/*