zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.44k stars 6.4k forks source link

drivers: hash: Add Hash API support for HMAC_SHA256 #55390

Open albertofloyd opened 1 year ago

albertofloyd commented 1 year ago

Is your enhancement proposal related to a problem? Please describe. Currently hash algorithms is limited to

CRYPTO_HASH_ALGO_SHA224 |  
CRYPTO_HASH_ALGO_SHA256 |  
CRYPTO_HASH_ALGO_SHA384 |  
CRYPTO_HASH_ALGO_SHA512

This doesn't allow to take advantage of other HW crypto engine capabilities such as HMAC ( https://tools.ietf.org/html/rfc2104)

Describe the solution you'd like An extended enumerated for additional algorithms operations such as HMAC CRYPTO_HASH_ALGO_HMAC_SHA256

This should have a well documented parameter about how to pass both the key and data. e.g.

uint8_t *   in_buf      provides key + data
size_t  in_len       indicates keylen + datalen where keylen is fixed for the algorithm
uint8_t *   out_buf
 struct hash_ctx *  ctx

image

Describe alternatives you've considered 1) Implement HMAC as SW layer that calls into Zephyr HASH API using underlying SHA256 algorithm image

2) Use SW tinycrypt which is slower than HW crypto engine.

zephyrbot commented 7 months ago

Hi @d3zd3z, @ceolin,

This issue, marked as an Enhancement, was opened a while ago and did not get any traction. It was just assigned to you based on the labels. If you don't consider yourself the right person to address this issue, please re-assing it to the right person.

Please take a moment to review if the issue is still relevant to the project. If it is, please provide feedback and direction on how to move forward. If it is not, has already been addressed, is a duplicate, or is no longer relevant, please close it with a short comment explaining the reason.

@albertofloyd you are also encouraged to help moving this issue forward by providing additional information and confirming this request/issue is still relevant to you.

Thanks!