summaryrefslogtreecommitdiffstats
path: root/crypto/sm2
AgeCommit message (Collapse)Author
2018-08-29fix out-of-bounds write in sm2_crypt.cymlbright
asn1_encode has two form length octets: short form(1 byte), long form(1+n byte). CLA: Trivial Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7027)
2018-07-31Use the new non-curve type specific EC functions internallyMatt Caswell
Fixes #6646 Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6815)
2018-07-26Fix a trivial coding style nit in sm2_sign.cPaul Yang
Reviewed-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Andy Polyakov <appro@openssl.org> GH: #6787
2018-07-24Update sm2_crypt.cneighbads
asn1_encode : x, y => 0 | x,0 | y (because of DER encoding rules when x and y have high bit set) CLA: Trivial Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6694)
2018-07-07Remove a memsetMatt Caswell
Also avoids calling EVP_MD_size() and a missing negative result check. Issue found by Coverity. Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6592)
2018-07-07Check a return value for success in ec_field_size()Matt Caswell
Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6592)
2018-07-07Fix some Coverity issues in sm2_encrypt()Matt Caswell
Check for a negative EVP_MD_size(). Don't dereference group until we've checked if it is NULL. Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6592)
2018-07-07Check md_size isn't negative before we use itMatt Caswell
Issue found by Coverity Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6592)
2018-06-25Use ec_group_do_inverse_ord() in SM2Nicola Tuveri
Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6521)
2018-06-19Move SM2 algos to SM2 specific PKEY methodJack Lloyd
Use EVP_PKEY_set_alias_type to access Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6443)
2018-06-05crypto/sm2/sm2_za.c: include internal/numbers.hRichard Levitte
Needed for the platforms that don't define UINT16_MAX. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6414)
2018-06-04Rebuild error codesMatt Caswell
There were a large number of error codes that were unused (probably a copy&paste from somewhere else). Since these have never been made public we should remove then and rebuild the error codes. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6386)
2018-06-04Use lowercase for internal SM2 symbolsMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6386)
2018-06-04More more on SM2 error codes and tidy upMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6386)
2018-06-04Improve use of the test framework in the SM2 internal testsMatt Caswell
Also general clean up of those tests Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6386)
2018-06-04Further work on SM2 error codesMatt Caswell
Also does some reformatting to tidy things up Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6386)
2018-06-04Set SM2 error codesJack Lloyd
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6386)
2018-06-04Make SM2 functions privateJack Lloyd
Address issue #5670 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6386)
2018-04-25[SM2_sign] fix double free and return valueNicola Tuveri
Currently, critical bugs prevent using SM2 signatures through the `EVP_PKEY` interface: any application that managed to satisfy the requirement of forcing SM3 as the message digest – even if this is currently not possible transparently through the `EVP_PKEY` interface and requires manually forcing the MD selection – would crash with a segmentation fault upon calling the `SM2_sign()` function. This is easily verified using the OpenSSL CLI to execute this critical code path under the right conditions: `openssl dgst -sm3 -hex -sign sm2.eckey /path/to/file/to/sign` The issue is caused by a double free at the end of `SM2_sign()` in `crypto/sm2/sm2_sign.c` in case of successful signature generation. In addition, even if the double free was not causing segfaults, the function returns the wrong return value in case of success (it would return 0 rather than 1). This patch fixes both problems. Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6066)
2018-03-20Update copyright yearMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5689)
2018-03-19Handle evp_tests assumption of EVP_PKEY_FLAG_AUTOARGLENJack Lloyd
Without actually using EVP_PKEY_FLAG_AUTOARGLEN Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4793)
2018-03-19Support SM2 ECIES scheme via EVPJack Lloyd
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4793)
2018-03-19Add SM2 signature and ECIES schemesJack Lloyd
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4793)