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

Add SM2 #105

Open
wants to merge 7,300 commits into
base: master
Choose a base branch
from
Open

Add SM2 #105

wants to merge 7,300 commits into from

Conversation

ronaldtse
Copy link

This adds the SM2 algorithm defined in the Chinese standards GB/T 32918.1-2016, GB/T 32918.2-2016, GB/T 32918.3-2016, GB/T 32918.4-2016 and GB/T 32918.5-2017.

The code was ported from our original OpenSSL contribution (thanks @randombit!) with a number of changes to adapt to LibreSSL since the interface is rather different. The implementation was done by @ni4.

This is a contribution from Ribose Inc (@riboseinc).

P.S. It currently includes the code from #103 and will require a rebase.

cc: @bob-beck @botovq @dewyatt

otto added 30 commits January 14, 2019 06:23
Checking Disabled flag. Introduce a RES flag to do so. ok krw@
deraadt@ eric@
CAVEATS pointing to the new CAVEATS section in setlocale(3).
Make those in wprintf(3) and wscanf(3) more concise
since duplicate information is a bad idea.
Incompleteness of information originally pointed out by millert@.
OK millert@
At the moment this is mechanical, with the functions renamed. This will be
refactored for tls13.
ok jsing@
as per RFC8446 section 4.2. Recognized extensions that appear in an
incorrect message must abort the handshake.
ok jsing@
The read callback returns a TLS13_IO_* value on EOF, failure, want pollin
or want pollout, or a positive value indicating the number of bytes read.

This will be used by upcoming TLSv1.3 handshake message and record
processing code, both of which need the ability to read a fixed size
header, before extending the buffer to the number of bytes specified in the
header.

ok beck@ tb@
When the TLS extension code was rewritten, TLS extensions could only exist
in ClientHello and ServerHello messages - as such, they were named in pairs
of *_clienthello_{needs,build} which would be called by the client and
*_clienthello_parse. Likewise for *_serverhello_{needs,build} which would
be called by a server and *_serverhello_parse, which would be called by a
client.

Enter TLSv1.3 - TLS extensions can now exist in one of seven messages,
with only certain types being allowed to appear in each, meaning the naming
scheme no longer works. Instead, rename them to indicate the caller rather
than the message type - this effectively means:

  clienthello_needs -> client_needs
  clienthello_build -> client_build
  clienthello_parse -> server_parse
  serverhello_needs -> server_needs
  serverhello_build -> server_build
  serverhello_parse -> client_parse

ok beck@ tb@
pbkdf2 with OpenSSL compatible flags
ok jsing@
Update the handshake state tables and flag names according to the
design decisions and naming conventions in the hackroom. Garbage collect
some things that turn out not to belong here.

ok jsing
clearly stating which arguments have to be avoided, and mention the
header files defining the constants required for the checks.
Feedback and OK guenther@, OK bluhm@.
* mention LC_COLLATE;
* clarify that all these functions are infested, including the *_l() versions;
* avoid ENVIRONMENT, these functions don't inspect it;
* and point to the C library functions that change the locale.
OK millert@
Reorder option descriptions so -iter and -pbkdf2 show up alphabetically.
Add missing argument name for -iter.
ok jmc@
This commit adds init/free, support for signing, setting and
getting the method, engine support as well as extra data.

from markus
This commit adds missing API for ECDH/ECDSA_verify.

from markus
Pass const method to EC_KEY_METHOD_get_*() to get rid
of an XXX.

from markus
@ni4
Copy link

ni4 commented Apr 5, 2019

@botovq I updated with the commit. Will stop for now, however once you've got to back to this PR feel free to ping me once any other changes and/or fixes are required.

@botovq
Copy link

botovq commented Apr 5, 2019 via email

@ronaldtse
Copy link
Author

Hi @botovq , a quick ping since it's now May, with summer looming. Any bandwidth in merging this? Thanks!

@ronaldtse
Copy link
Author

@botovq quick check on whether we can move forward with the PR -- trying to tie up the loose ends!

@botovq
Copy link

botovq commented Sep 11, 2019 via email

@ronaldtse
Copy link
Author

@botovq thanks for the excellent news -- we're on standby when you need us.

busterb pushed a commit that referenced this pull request Aug 18, 2021
This adds the SM2 algorithm defined in the Chinese standards
GB/T 32918.1-2016, GB/T 32918.2-2016, GB/T 32918.3-2016,
GB/T 32918.4-2016 and GB/T 32918.5-2017.

This is an ISC licensed implementation contributed by Ribose.inc, based
on the same code that was contributed to OpenSSL by Jack Lloyd. The port
to LibreSSL was done by Ronald Tse and Nickolay Olshevsky.

Github PR #105

I made quite a few cleanup passes on this, but more is needed, some
of which will happen in-tree before this is linked to the build.

ok deraadt inoguchi (a long time ago), jsing
busterb pushed a commit that referenced this pull request Aug 18, 2021
@busterb busterb force-pushed the master branch 3 times, most recently from 388f2ae to a2210d0 Compare February 9, 2022 08:49
@botovq botovq force-pushed the master branch 6 times, most recently from fc84c6d to 384d7c0 Compare November 27, 2022 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants