Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Mar 5, 2024. It is now read-only.

Add support for SHA-512 message digest #42

Open
utzig wants to merge 1 commit into intel:master
base: master
Choose a base branch
Loading
from utzig:add-sha512

Conversation

@utzig
Copy link

@utzig utzig commented Jan 3, 2020

This adds SHA-512, which is based on the current SHA-256 code, with the small changes to accommodate the differences between both message digests. I left the license headers basically the same with updated copyright year.

The main reason for adding this is because ed25519 requires the use of SHA-512, and we support ed25519 signature checking in https://github.com/JuulLabs-OSS/mcuboot/, but it currently depends on mbedTLS. With this change it would be possible to build ed25519 validation with our bundled Tinycrypt.

Signed-off-by: Fabio Utzig <utzig@apache.org>
#define sigma1(a)(ROTR((a), 19) ^ ROTR((a), 61) ^ ((a) >> 6))

#define Ch(a, b, c)(((a) & (b)) ^ ((~(a)) & (c)))
#define Maj(a, b, c)(((a) & (b)) ^ ((a) & (c)) ^ ((b) & (c)))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these two macros are exactly the same in sha256.c maybe would be better move it utils.h

Copy link
Author

@utzig utzig Jan 15, 2020
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it makes more sense to leave them here, because it's just two simple definitions that don't increase code size; it ends up being just a maintenance issue, but since the SHA family of hash primitives is not going to change, these definitions are most probably gonna stay here untouched forever! Also utils.h feels a bit too generic, maybe then it would be better to add a sha.h (or sha_data.h, sha_priv.h, etc) file under lib/source to store the shared code.

Copy link

@ceolin ceolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patch looks good to me. @mczraf can you take a look too ?

utzig added a commit to utzig/mcuboot that referenced this pull request Feb 3, 2020
A patch adding sha-512 to upstream tinycrypt was submitted:
intel/tinycrypt#42
While it is not accepted, add the code under a new ext/tinycrypt-sha512
depedency.
Signed-off-by: Fabio Utzig <utzig@apache.org>
utzig added a commit to mcu-tools/mcuboot that referenced this pull request Feb 4, 2020
A patch adding sha-512 to upstream tinycrypt was submitted:
intel/tinycrypt#42
While it is not accepted, add the code under a new ext/tinycrypt-sha512
depedency.
Signed-off-by: Fabio Utzig <utzig@apache.org>
Copy link
Author

utzig commented Mar 13, 2020

@mczraf @ceolin So is someone still reviewing this or am I missing something?

Copy link
Contributor

mczraf commented Mar 13, 2020 via email

Hi Fabio, Please allow me some time to see how this code can be reviewed from a cryptographic perspective. I will get back to you late next week. Thank you for your understanding. Rafael
...
On Fri, Mar 13, 2020 at 8:43 AM Fabio Utzig ***@***.***> wrote: @mczraf <https://github.com/mczraf> @ceolin <https://github.com/ceolin> So is someone still reviewing this or am I missing something? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#42 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACDY5OUOFDXSMIOYJGLMR63RHIS6RANCNFSM4KCIJPYQ> .
utzig reacted with thumbs up emoji

@utzig utzig closed this Jun 2, 2020
@utzig utzig reopened this Aug 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

1 more reviewer

@ceolin ceolin ceolin approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /