Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement hashing to curve #3293

Merged
merged 7 commits into from
Sep 27, 2023
Merged

Implement hashing to curve #3293

merged 7 commits into from
Sep 27, 2023

Conversation

onvej-sl
Copy link
Contributor

This pull requests implements hashing to a curve that is compatible with the suite P256_XMD:SHA-256_SSWU_RO_ from RFC9380.

@onvej-sl onvej-sl force-pushed the onvej-sl/hash_to_curve branch from 032c927 to bff0c77 Compare September 21, 2023 11:34
@onvej-sl onvej-sl marked this pull request as ready for review September 21, 2023 11:52
@onvej-sl onvej-sl requested review from matejcik and hiviah September 21, 2023 11:52
@onvej-sl
Copy link
Contributor Author

@andrewkozlik is going to do a brief overall review.

@matejcik, @hiviah, I need at least one of you to check the memory safety (particularly the out-of-bound reads and writes) of these functions:

  • expand_message_xmd_sha256
  • hash_to_field
  • hash_to_curve

@onvej-sl onvej-sl added crypto Stand-alone cryptography library used by both Trezor Core and the Trezor Legacy firmware R&D Research and development team related labels Sep 21, 2023
#ifndef __HASH_TO_CURVE_H__
#define __HASH_TO_CURVE_H__

#include "bignum.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we don't need to include bignum.h.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in d4e8d2a.

Copy link
Contributor

@andrewkozlik andrewkozlik left a comment

Choose a reason for hiding this comment

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

I have looked over the API (crypto/hash_to_curve.h) and the test vectors (crypto/tests/test_check.c). Those LGTM.

Copy link
Contributor

@matejcik matejcik left a comment

Choose a reason for hiding this comment

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

C-wise LGTM.

crypto/hash_to_curve.c Show resolved Hide resolved
@onvej-sl onvej-sl force-pushed the onvej-sl/hash_to_curve branch from f89b889 to 4c144cd Compare September 27, 2023 11:09
@onvej-sl onvej-sl merged commit 4ecd4cc into master Sep 27, 2023
8 checks passed
@onvej-sl onvej-sl deleted the onvej-sl/hash_to_curve branch September 27, 2023 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crypto Stand-alone cryptography library used by both Trezor Core and the Trezor Legacy firmware R&D Research and development team related
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants