oweals/openssl.git
6 years agoAdd a missing check on s->s3->tmp.pkey
Mansour Ahmadi [Mon, 15 Oct 2018 19:11:24 +0000 (15:11 -0400)]
Add a missing check on s->s3->tmp.pkey

Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7405)

(cherry picked from commit 61bef9bde09dc6099a7c59baa79898e3b003fec3)

6 years agoprint() is a function in Python 3
cclauss [Tue, 16 Oct 2018 04:57:41 +0000 (06:57 +0200)]
print() is a function in Python 3

CLA: trivial

Discovered via #7410 @ https://travis-ci.org/openssl/openssl/jobs/442003489#L440

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/7403)

(cherry picked from commit 83e4533a71c5c78278e9763552a5e5f1806473ee)

6 years agoDRBG: fix reseeding via RAND_add()/RAND_seed() with large input
Dr. Matthias St. Pierre [Tue, 9 Oct 2018 23:53:29 +0000 (01:53 +0200)]
DRBG: fix reseeding via RAND_add()/RAND_seed() with large input

In pull request #4328 the seeding of the DRBG via RAND_add()/RAND_seed()
was implemented by buffering the data in a random pool where it is
picked up later by the rand_drbg_get_entropy() callback. This buffer
was limited to the size of 4096 bytes.

When a larger input was added via RAND_add() or RAND_seed() to the DRBG,
the reseeding failed, but the error returned by the DRBG was ignored
by the two calling functions, which both don't return an error code.
As a consequence, the data provided by the application was effectively
ignored.

This commit fixes the problem by a more efficient implementation which
does not copy the data in memory and by raising the buffer the size limit
to INT32_MAX (2 gigabytes). This is less than the NIST limit of 2^35 bits
but it was chosen intentionally to avoid platform dependent problems
like integer sizes and/or signed/unsigned conversion.

Additionally, the DRBG is now less permissive on errors: In addition to
pushing a message to the openssl error stack, it enters the error state,
which forces a reinstantiation on next call.

Thanks go to Dr. Falko Strenzke for reporting this issue to the
openssl-security mailing list. After internal discussion the issue
has been categorized as not being security relevant, because the DRBG
reseeds automatically and is fully functional even without additional
randomness provided by the application.

Fixes #7381

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7382)

(cherry picked from commit 3064b55134434a0b2850f07eff57120f35bb269a)

6 years agoFix no-engine
Matt Caswell [Mon, 8 Oct 2018 11:16:22 +0000 (12:16 +0100)]
Fix no-engine

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/7365)

(cherry picked from commit 5f9f67b9d494e26941aa8d66d28a6a993c557643)

6 years agoIndentation fixes.
Pauli [Sun, 7 Oct 2018 21:23:44 +0000 (07:23 +1000)]
Indentation fixes.

The PR #7329 left some indentation slightly off.  This fixes it.

Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
(Merged from https://github.com/openssl/openssl/pull/7360)

(cherry picked from commit 5b639d4cb3b9a33536e2ebadf6a03149ea26ba32)

6 years agoRemove useless check.
Mykola Baibuz [Sun, 7 Oct 2018 21:14:08 +0000 (07:14 +1000)]
Remove useless check.
Hash can be longer than EC group degree and it will be truncated.

CLA: trivial

Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7329)

(cherry picked from commit b770a80f6d0b08659cd03f26388b45512adb84f3)

6 years agoFix no-psk
Matt Caswell [Mon, 24 Sep 2018 11:00:10 +0000 (12:00 +0100)]
Fix no-psk

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7306)

(cherry picked from commit 734af93a278a7a06710167219e1f05e525c9dd49)

6 years agoFix no-tls1_2
Matt Caswell [Mon, 24 Sep 2018 11:20:45 +0000 (12:20 +0100)]
Fix no-tls1_2

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7308)

(cherry picked from commit 7f1d923aa9dc55dd23a7741e4341ec421c683941)

6 years agoSafer memory cleanup in (crypto/rsa/rsa_lib.c)
Mykola Baibuz [Thu, 11 Oct 2018 04:07:26 +0000 (12:07 +0800)]
Safer memory cleanup in (crypto/rsa/rsa_lib.c)

We don't need to use secure clean for public key.

CLA: trivial

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
(Merged from https://github.com/openssl/openssl/pull/7363)

(cherry picked from commit c033101db39c93cf41d80dfee4357f2617ede1a0)

6 years agoFix copy&paste error found in Coverity scan
Tomas Mraz [Tue, 9 Oct 2018 16:37:10 +0000 (18:37 +0200)]
Fix copy&paste error found in Coverity scan

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7377)

(cherry picked from commit 628ee796389b555ddb5fc28355e16e9417ab1724)

6 years agorsa/rsa_ossl.c: fix and extend commentary [skip ci].
Andy Polyakov [Wed, 5 Sep 2018 12:33:21 +0000 (14:33 +0200)]
rsa/rsa_ossl.c: fix and extend commentary [skip ci].

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/7123)

(cherry picked from commit d1c008f66bad435b18aa45aa59f72bed7c682849)

6 years agossl/s3_enc.c: fix logical errors in ssl3_final_finish_mac.
Andy Polyakov [Sun, 2 Sep 2018 11:07:58 +0000 (13:07 +0200)]
ssl/s3_enc.c: fix logical errors in ssl3_final_finish_mac.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7085)

(cherry picked from commit 7d0effeacbb50b12bfc24df7614d7cf5c8686f51)

6 years agosha/asm/keccak1600-s390x.pl: resolve -march=z900 portability issue.
Andy Polyakov [Mon, 17 Sep 2018 10:36:37 +0000 (12:36 +0200)]
sha/asm/keccak1600-s390x.pl: resolve -march=z900 portability issue.

Negative displacement in memory references was not originally specified,
so that for maximum coverage one should abstain from it, just like with
any other extension. [Unless it's guarded by run-time switch, but there
is no switch in keccak1600-s390x.]

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7239)

(cherry picked from commit fc97c882f443060dffd8eb56a6b8784e52096c86)

6 years agoFix a typo in a macro
Matt Caswell [Thu, 11 Oct 2018 10:59:57 +0000 (11:59 +0100)]
Fix a typo in a macro

Fixes #7385

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7385)

(cherry picked from commit 990fe909949a58398b3a0cbbdc52b9bbb9cefaa0)

6 years agoFix compiling warnings in example code
Paul Yang [Mon, 8 Oct 2018 08:36:49 +0000 (16:36 +0800)]
Fix compiling warnings in example code

The example code in EVP_DigestInit.pod generates warnings if users try
to compile it.

[skip ci]

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7362)

(cherry picked from commit 19ac1bf2de07214ee7ee6d2e118fa3aa8e5850f3)

6 years agocrypto/rand: fix some style nit's
FdaSilvaYY [Fri, 15 Sep 2017 19:14:34 +0000 (21:14 +0200)]
crypto/rand: fix some style nit's

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7378)

(cherry picked from commit c2e33a05b1eb9dda988aebdeaa529973d7c22142)

6 years agorand_unix.c: fix --with-rand-seed=none build
Dr. Matthias St. Pierre [Wed, 10 Oct 2018 00:31:37 +0000 (02:31 +0200)]
rand_unix.c: fix --with-rand-seed=none build

Fixes a compiler warning about an unused syscall_random()
and cleans up the OPENSSL_RAND_SEED preprocessor logic.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/779)

(cherry picked from commit d90e128be6e584d319931c78cb8f8f68d17b6a34)

6 years agoFix a nit of copyright date range
Paul Yang [Mon, 8 Oct 2018 09:04:14 +0000 (17:04 +0800)]
Fix a nit of copyright date range

Should be 2018 instead of 20018.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7364)

6 years agoapps: allow empty attribute values with -subj
Benjamin Kaduk [Thu, 4 Oct 2018 18:49:21 +0000 (13:49 -0500)]
apps: allow empty attribute values with -subj

Historically (i.e., OpenSSL 1.0.x), the openssl applications would
allow for empty subject attributes to be passed via the -subj argument,
e.g., `opensl req -subj '/CN=joe/O=/OU=local' ...`.  Commit
db4c08f0194d58c6192f0d8311bf3f20e251cf4f applied a badly needed rewrite
to the parse_name() helper function that parses these strings, but
in the process dropped a check that would skip attributes with no
associated value.  As a result, such strings are now treated as
hard errors and the operation fails.

Restore the check to skip empty attribute values and restore
the historical behavior.

Document the behavior for empty subject attribute values in the
corresponding applications' manual pages.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7349)

(cherry picked from commit 3d362f190306b62a17aa2fd475b2bc8b3faa8142)

6 years agoCleanup typos and grammar in DES_random_key.pod
Ԝеѕ [Fri, 5 Oct 2018 18:58:30 +0000 (14:58 -0400)]
Cleanup typos and grammar in DES_random_key.pod

CLA: trivial

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/7356)

(cherry picked from commit 4fef4981f8cc614559b86a06532b0eeac6ffd0d9)

6 years ago/dev/crypto engine: give CIOCFSESSION the actual sess-id
Richard Levitte [Mon, 24 Sep 2018 10:18:31 +0000 (12:18 +0200)]
/dev/crypto engine: give CIOCFSESSION the actual sess-id

We passed that ioctl a pointer to the whole session_op structure,
which wasn't quite right.

Notified by David Legault.

Fixes #7302

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/7304)

(cherry picked from commit 470096e576941566fd094f2fd793dc2948804ea8)

6 years agotest/secmemtest: test secure memory only if it is implemented
Dr. Matthias St. Pierre [Thu, 4 Oct 2018 23:05:54 +0000 (01:05 +0200)]
test/secmemtest: test secure memory only if it is implemented

Fixes #7322

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/7351)

(cherry picked from commit 8529b156421805415bc7b17758255394de580c61)

6 years agoExtend the BIO callback tests to check the return value semantics
Matt Caswell [Wed, 3 Oct 2018 14:29:47 +0000 (15:29 +0100)]
Extend the BIO callback tests to check the return value semantics

Check that different return values passed to the BIO callback are
correctly handled.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7344)

(cherry picked from commit 52d78cc5ebc1d4fc021cabbcb09f4efb4c6ae82d)

6 years agoFix the BIO callback return code handling
Matt Caswell [Wed, 3 Oct 2018 14:27:31 +0000 (15:27 +0100)]
Fix the BIO callback return code handling

The BIO callback handling incorrectly wrote over the return code passed
to the callback, meaning that an incorrect result was (eventually) returned
to the caller.

Fixes #7343

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7344)

(cherry picked from commit d97ce8d9a0619c1d9d1222dc1b44dbebb58dd966)

6 years agoClean out aliases in include/openssl/symhacks.h
Richard Levitte [Sun, 30 Sep 2018 00:18:47 +0000 (02:18 +0200)]
Clean out aliases in include/openssl/symhacks.h

Only a few clashing ones remain

Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
(Merged from https://github.com/openssl/openssl/pull/7331)

(cherry picked from commit b44882a0bd0717e0aab84f5dc3ef81ab673155e9)

6 years agoSmall cleanup (util/mkdef.pl, crypto/bio/bss_log.c, include/openssl/ocsp.h)
Richard Levitte [Sat, 29 Sep 2018 23:59:11 +0000 (01:59 +0200)]
Small cleanup (util/mkdef.pl, crypto/bio/bss_log.c, include/openssl/ocsp.h)

BIO_s_log() is declared for everyone, so should return NULL when not
actually implemented.  Also, it had explicit platform limitations in
util/mkdef.pl that didn't correspond to what was actually in code.
While at it, a few other hard coded things that have lost their
relevance were removed.

include/openssl/ocsp.h had a few duplicate declarations.

Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
(Merged from https://github.com/openssl/openssl/pull/7331)

(cherry picked from commit 7e09c5eaa57295f87453286ffe25277c2f2bc73f)

6 years agoFix some Coverity warnings
Matt Caswell [Mon, 1 Oct 2018 12:16:55 +0000 (13:16 +0100)]
Fix some Coverity warnings

Check some return values on some functions.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7335)

(cherry picked from commit 434893af2bd4c1fa72655f8e5262c8a432713968)

6 years agoFix a mem leak in the ocsp app
Matt Caswell [Mon, 1 Oct 2018 11:06:06 +0000 (12:06 +0100)]
Fix a mem leak in the ocsp app

Free memory allocated in the parent process that is not needed in the
child. We also free it in the parent. Technically this isn't really
required since we end up calling exit() soon afterwards - but to
prevent false positives we free it anyway.

Fixes a Coverity issue.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7335)

(cherry picked from commit c20a76f695922f409c316399f7290530f7728f19)

6 years agoAdd missing cipher aliases to openssl(1)
Antoine Salon [Wed, 26 Sep 2018 08:56:05 +0000 (16:56 +0800)]
Add missing cipher aliases to openssl(1)

And references to other manpages are also added in openssl(1).

Signed-off-by: Antoine Salon <asalon@vmware.com>
Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7314)

6 years agodoc/man3/SSL_set_bio.pod: Fix wrong function name in return values section
James Callahan [Thu, 23 Aug 2018 02:12:05 +0000 (12:12 +1000)]
doc/man3/SSL_set_bio.pod: Fix wrong function name in return values section

Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7035)

6 years agoUpdate enc(1) examples to more recent ciphers and key derivation algorithms
Antoine Salon [Mon, 17 Sep 2018 22:42:19 +0000 (15:42 -0700)]
Update enc(1) examples to more recent ciphers and key derivation algorithms

Signed-off-by: Antoine Salon <asalon@vmware.com>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7248)

(cherry picked from commit eadde90bff01a6755399a4e1f6a3e4a9ed0fd61d)

6 years agoReduce stack usage in tls13_hkdf_expand
Bernd Edlinger [Sun, 23 Sep 2018 07:20:54 +0000 (09:20 +0200)]
Reduce stack usage in tls13_hkdf_expand

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7297)

(cherry picked from commit ec0c5f5693e39c5a013f81e6dd9dfd09ec65162d)

6 years agoDocument OPENSSL_VERSION_TEXT macro
Daniel Bevenius [Mon, 24 Sep 2018 06:43:35 +0000 (08:43 +0200)]
Document OPENSSL_VERSION_TEXT macro

This commit documents the OPENSSL_VERSION_TEXT which is currently
missing in the man page.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7301)

(cherry picked from commit 7c69495712e3dc9aa8db38271f0c3faeb2037165)

6 years agoUse secure_getenv(3) when available.
Pauli [Mon, 24 Sep 2018 01:21:18 +0000 (11:21 +1000)]
Use secure_getenv(3) when available.

Change all calls to getenv() inside libcrypto to use a new wrapper function
that use secure_getenv() if available and an issetugid then getenv if not.

CPU processor override flags are unchanged.

Extra checks for OPENSSL_issetugid() have been removed in favour of the
safe getenv.

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/7047)

(cherry picked from commit 5c39a55d04ea6e6f734b627a050b9e702788d50d)

6 years agoCreate the .rnd file it it does not exist
Bernd Edlinger [Thu, 13 Sep 2018 16:25:37 +0000 (18:25 +0200)]
Create the .rnd file it it does not exist

It's a bit annoying, since some commands try to read a .rnd file,
and print an error message if the file does not exist.

But previously a .rnd file was created on exit, and that does no longer
happen.

Fixed by continuing in app_RAND_load_conf regardless of the error in
RAND_load_file.

If the random number generator is still not initalized on exit, the
function RAND_write_file will fail and no .rnd file would be created.

Remove RANDFILE from openssl.cnf

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/7217)

(cherry picked from commit 0f58220973a02248ca5c69db59e615378467b9c8)

6 years agotypo-fixes: miscellaneous typo fixes
agnosticdev [Thu, 20 Sep 2018 10:23:27 +0000 (05:23 -0500)]
typo-fixes: miscellaneous typo fixes

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/7277)

(cherry picked from commit 46d085096c6ead624c61e4b8b301421301511e64)

6 years agoFix the max psk len for TLSv1.3
Matt Caswell [Wed, 19 Sep 2018 09:09:39 +0000 (10:09 +0100)]
Fix the max psk len for TLSv1.3

If using an old style TLSv1.2 PSK callback then the maximum possible PSK
len is PSK_MAX_PSK_LEN (256) - not 64.

Fixes #7261

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7267)

(cherry picked from commit f39a02c68abc8936db24499cb3cfcba206a2e7eb)

6 years agoAdd a test for the certificate callback
Matt Caswell [Wed, 19 Sep 2018 13:51:49 +0000 (14:51 +0100)]
Add a test for the certificate callback

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/7257)

(cherry picked from commit cd6fe29f5bad1a350a039673e06f83ec7a7ef619)

6 years agoDelay setting the sig algs until after the cert_cb has been called
Matt Caswell [Tue, 18 Sep 2018 16:45:39 +0000 (17:45 +0100)]
Delay setting the sig algs until after the cert_cb has been called

Otherwise the sig algs are reset if SSL_set_SSL_CTX() gets called.

Fixes #7244

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/7257)

(cherry picked from commit 524006dd1b80c1a86a20119ad988666a80d8d8f5)

6 years agocrypto/bn/asm/x86_64-gcc.c: remove unnecessary redefinition of BN_ULONG
Richard Levitte [Fri, 21 Sep 2018 09:11:15 +0000 (11:11 +0200)]
crypto/bn/asm/x86_64-gcc.c: remove unnecessary redefinition of BN_ULONG

This module includes bn.h via other headers, so it picks up the
definition from there and doesn't need to define them locally (any
more?).  Worst case scenario, the redefinition may be different and
cause all sorts of compile errors.

Fixes #7227

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/7287)

(cherry picked from commit dda5396aaec315bdbcb080e42fb5cd0191f2ad72)

6 years ago/dev/crypto engine: add missing RC4 parameter
Richard Levitte [Thu, 20 Sep 2018 13:33:21 +0000 (15:33 +0200)]
/dev/crypto engine: add missing RC4 parameter

Fixes #7280

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/7281)

(cherry picked from commit f52f2c1ae8f2ec378c5a20fb4104aa38edbabfcb)

6 years agoAdd some missing ciphers in 'enc' document
Paul Yang [Thu, 20 Sep 2018 09:04:15 +0000 (17:04 +0800)]
Add some missing ciphers in 'enc' document

The original issue is #7273 and this commit fixes part of that issue.

[skip ci]

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7275)

6 years agoutil/mkdef.pl, util/add-depends.pl: don't lowercase file names
Richard Levitte [Wed, 12 Sep 2018 00:38:22 +0000 (02:38 +0200)]
util/mkdef.pl, util/add-depends.pl: don't lowercase file names

It turns out to be detrimental on some file systems that may or may not
be case sensitive (such as NTFS, which has a case sensitive mode).

Fixes #7172

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7172)

(cherry picked from commit d3c72e392ab72d418ea5147857701a8730def3fd)

6 years agocrypto/ui/ui_openssl.c: make sure to recognise ENXIO and EIO too
Richard Levitte [Wed, 19 Sep 2018 19:33:45 +0000 (21:33 +0200)]
crypto/ui/ui_openssl.c: make sure to recognise ENXIO and EIO too

These both indicate that the file descriptor we're trying to use as a
terminal isn't, in fact, a terminal.

Fixes #7271

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/7272)

(cherry picked from commit 276bf8620ce35a613c856f2b70348f65ffe94067)

6 years agoReset TLS 1.3 ciphers in SSL_CTX_set_ssl_version()
Benjamin Kaduk [Wed, 19 Sep 2018 14:02:04 +0000 (09:02 -0500)]
Reset TLS 1.3 ciphers in SSL_CTX_set_ssl_version()

Historically SSL_CTX_set_ssl_version() has reset the cipher list
to the default.  Splitting TLS 1.3 ciphers to be tracked separately
caused a behavior change, in that TLS 1.3 cipher configuration was
preserved across calls to SSL_CTX_set_ssl_version().  To restore commensurate
behavior with the historical behavior, set the ciphersuites to the default as
well as setting the cipher list to the default.

Closes: #7226

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7270)

(cherry picked from commit 2340ed277b7c5365e83a32eb7d5fa32c4071fb21)

6 years agossl/ssl_ciph.c: make set_ciphersuites static
Dr. Matthias St. Pierre [Tue, 18 Sep 2018 05:56:27 +0000 (07:56 +0200)]
ssl/ssl_ciph.c: make set_ciphersuites static

Fixes #7252

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7253)

(cherry picked from commit f9a22815f386dbe7a13822f0ac3629ae8521cd76)

6 years agoTrivial test improvements
Tobias Nießen [Fri, 14 Sep 2018 19:43:12 +0000 (21:43 +0200)]
Trivial test improvements

This commit reuses a variable instead of reevaluating the expression
and updates an outdated comment in the EVP test.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/7242)

(cherry picked from commit 523fcfb4c081ec346f117fd493103ddcd521e431)

6 years agoFixed typos in hkdf documentation.
David Makepeace [Mon, 17 Sep 2018 03:46:08 +0000 (13:46 +1000)]
Fixed typos in hkdf documentation.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7236)

(cherry picked from commit d474100af0827d9ba87f3bb25a34867244552df5)

6 years agoAdd missing include file.
Pauli [Mon, 17 Sep 2018 00:40:32 +0000 (10:40 +1000)]
Add missing include file.
Specifically, include e_os.h to pick up alloca definition for WIN32.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7234)

(cherry picked from commit a825856ab719b0fcce229faad2b437fc88985251)

6 years agoUse 'i' as parameter name not 'I'.
Pauli [Sun, 16 Sep 2018 21:47:42 +0000 (07:47 +1000)]
Use 'i' as parameter name not 'I'.

The latter causes problems when complex.h is #included.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7233)

(cherry picked from commit 972f67889b5a10c33dbc3d500cfa65b544e68b46)

6 years agoAdd a compile time test to verify that openssl/rsa.h and complex.h can
Pauli [Sun, 16 Sep 2018 22:09:25 +0000 (08:09 +1000)]
Add a compile time test to verify that openssl/rsa.h and complex.h can
coexist.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7233)

(cherry picked from commit da5fac72b1cba5651b871902eea234e693cf01e5)

6 years agoUpdate RAND_DRBG.pod
Matt Eaton [Fri, 14 Sep 2018 02:11:14 +0000 (21:11 -0500)]
Update RAND_DRBG.pod

Fixed a minor typo while reading the documentation.
I agree that this contribution is trivial can be freely used.

CLA: trivial

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/7221)

6 years agoImprove SSL_shutdown() documentation
Kurt Roeckx [Tue, 11 Sep 2018 21:39:25 +0000 (23:39 +0200)]
Improve SSL_shutdown() documentation

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
GH: #7188
(cherry picked from commit 8e593f0a0dbcb3193548ced3c2e78fbbd201b2db)

6 years agoVMS: only use the high precision on VMS v8.4 and up
Richard Levitte [Sat, 15 Sep 2018 12:59:06 +0000 (14:59 +0200)]
VMS: only use the high precision on VMS v8.4 and up

It simply isn't available on older versions.

Issue submitted by Mark Daniels

Fixes #7229

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/7230)

6 years agoMake some return checks consistent with others
Paul Yang [Thu, 13 Sep 2018 02:17:14 +0000 (11:17 +0900)]
Make some return checks consistent with others

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/7209)

6 years agoDon't allow -early_data with other options where it doesn't work
Matt Caswell [Wed, 12 Sep 2018 16:11:10 +0000 (17:11 +0100)]
Don't allow -early_data with other options where it doesn't work

-early_data is not compatible with -www, -WWW, -HTTP or -rev.

Fixes #7200

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7206)

(cherry picked from commit 6ef40f1fc08f0c4ffb08438d63eed83eae7eb2b8)

6 years agoAdd an explicit cast to time_t
Matt Caswell [Wed, 12 Sep 2018 15:49:19 +0000 (16:49 +0100)]
Add an explicit cast to time_t

Caused a compilation failure in some environments

Fixes #7204

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7205)

(cherry picked from commit bc278f30f0b766bfb82426c641dc1d51ace4a994)

6 years agoReplace the public RAND_DRBG_USED_FLAGS #define by an internal constant
Dr. Matthias St. Pierre [Tue, 11 Sep 2018 22:37:15 +0000 (00:37 +0200)]
Replace the public RAND_DRBG_USED_FLAGS #define by an internal constant

The new DRBG API added the aforementioned #define. However, it is
used internally only and having it defined publicly does not serve
any purpose except causing potential version compatibility problems.

Fixes #7182

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7190)

(cherry picked from commit c402e943cd0d748ca2a74a37caeccdfc59ce2870)

6 years agoFix a possible recursion in SSLfatal handling
Bernd Edlinger [Tue, 11 Sep 2018 09:44:13 +0000 (11:44 +0200)]
Fix a possible recursion in SSLfatal handling

Fixes: #7161 (hopefully)

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7175)

(cherry picked from commit 6839a7a7f4973a3fc2f87b12664c26d524bef1f4)

6 years agoUpdate README.md
Brian 'geeknik' Carpenter [Wed, 12 Sep 2018 06:24:00 +0000 (01:24 -0500)]
Update README.md

Fixes a minor typo that would cause the linker to complain about not finding -lFuzzer

CLA: trivial

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7197)

(cherry picked from commit 8e8fe187f1559a7fc9f50cc4af7f880273a4eea2)

6 years agominor fixes for Windows
Viktor Szakats [Tue, 11 Sep 2018 22:34:00 +0000 (22:34 +0000)]
minor fixes for Windows

- fix to use secure URL in generated Windows resources
- fix a potentially uninitialized variable
- fix an unused variable warning

CLA: trivial

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/7189)

6 years agocrypto/sm2/sm2_sign.c: ensure UINT16_MAX is properly defined
Richard Levitte [Wed, 12 Sep 2018 00:06:26 +0000 (02:06 +0200)]
crypto/sm2/sm2_sign.c: ensure UINT16_MAX is properly defined

Fixes #7186

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7193)

(cherry picked from commit 88ea3685e4bf30fc529fe46e19effc6317726de8)

6 years agoPrepare for 1.1.1a-dev
Matt Caswell [Tue, 11 Sep 2018 12:49:46 +0000 (13:49 +0100)]
Prepare for 1.1.1a-dev

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agoPrepare for 1.1.1 release OpenSSL_1_1_1
Matt Caswell [Tue, 11 Sep 2018 12:48:18 +0000 (13:48 +0100)]
Prepare for 1.1.1 release

Reviewed-by: Richard Levitte <levitte@openssl.org>
6 years agoUpdate copyright year
Matt Caswell [Tue, 11 Sep 2018 12:22:14 +0000 (13:22 +0100)]
Update copyright year

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7176)

6 years agoCAPI engine: add support for RSA_NO_PADDING
Richard Levitte [Tue, 11 Sep 2018 09:00:30 +0000 (11:00 +0200)]
CAPI engine: add support for RSA_NO_PADDING

Since the SSL code started using RSA_NO_PADDING, the CAPI engine became
unusable.  This change fixes that.

Fixes #7131

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7174)

6 years agoCheck the return value from ASN1_INTEGER_set
Matt Caswell [Mon, 10 Sep 2018 15:23:14 +0000 (16:23 +0100)]
Check the return value from ASN1_INTEGER_set

Found by Coverity

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7169)

6 years agoValidate the SM2 digest len before use
Matt Caswell [Mon, 10 Sep 2018 15:53:17 +0000 (16:53 +0100)]
Validate the SM2 digest len before use

Fixes a Coverity complaint.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7170)

6 years agoDon't cast an int * to a size_t *
Matt Caswell [Mon, 10 Sep 2018 15:03:14 +0000 (16:03 +0100)]
Don't cast an int * to a size_t *

If sizeof(int) != sizeof(size_t) this may not work correctly.

Fixes a Coverity issue.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7168)

6 years agoMore updates to CHANGES and NEWS for the 1.1.1 release
Matt Caswell [Mon, 10 Sep 2018 13:44:04 +0000 (14:44 +0100)]
More updates to CHANGES and NEWS for the 1.1.1 release

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7167)

6 years agoUpdates NEWS for the 1.1.1 release
Matt Caswell [Mon, 10 Sep 2018 10:51:30 +0000 (11:51 +0100)]
Updates NEWS for the 1.1.1 release

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7164)

6 years agoUpdate the pyca-cryptography submodule
Matt Caswell [Mon, 10 Sep 2018 10:33:40 +0000 (11:33 +0100)]
Update the pyca-cryptography submodule

Hopefully this will resolve spurious travis failures.

[extended tests]

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7163)

6 years agoAdd a sentence in CHANGES to note SM2 support
Paul Yang [Mon, 10 Sep 2018 05:42:00 +0000 (13:42 +0800)]
Add a sentence in CHANGES to note SM2 support

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7160)

6 years agotest/evp_extra_test.c: fix null pointer dereference
Dr. Matthias St. Pierre [Sun, 9 Sep 2018 22:20:12 +0000 (00:20 +0200)]
test/evp_extra_test.c: fix null pointer dereference

It's actually not a real issue but caused by the absence of the default case
which does not occur in reality but which makes coverity see a code path where
pkey remains unassigned.

Reported by Coverity Scan (CID 1423323)
[extended tests]

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7158)

6 years agocrypto/rsa/rsa_pss.c: silence coverity warning
Dr. Matthias St. Pierre [Sun, 9 Sep 2018 14:33:12 +0000 (16:33 +0200)]
crypto/rsa/rsa_pss.c: silence coverity warning

Reported by Coverity Scan (CID 1439138)
[extended tests]

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7156)

6 years agotest/dhtest.c: fix resource leak
Dr. Matthias St. Pierre [Sun, 9 Sep 2018 14:19:19 +0000 (16:19 +0200)]
test/dhtest.c: fix resource leak

Reported by Coverity Scan (CID 1439136)
[extended tests]

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7155)

6 years agoASN.1 DER: Make INT32 / INT64 types read badly encoded LONG zeroes
Richard Levitte [Thu, 6 Sep 2018 20:09:11 +0000 (22:09 +0200)]
ASN.1 DER: Make INT32 / INT64 types read badly encoded LONG zeroes

The deprecated ASN.1 type LONG / ZLONG (incorrectly) produced zero
length INTEGER encoding for zeroes.  For the sake of backward
compatibility, we allow those to be read without fault when using the
replacement types INT32 / UINT32 / INT64 / UINT64.

Fixes #7134

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7144)

6 years agoTESTS: add test of decoding of invalid zero length ASN.1 INTEGER zero
Richard Levitte [Sat, 8 Sep 2018 08:09:32 +0000 (10:09 +0200)]
TESTS: add test of decoding of invalid zero length ASN.1 INTEGER zero

Confirms #7134

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7153)

6 years agoSipHash: add separate setter for the hash size
Richard Levitte [Thu, 6 Sep 2018 20:52:38 +0000 (22:52 +0200)]
SipHash: add separate setter for the hash size

This was originally part of SipHash_Init.  However, there are cases
where there isn't any key material to initialize from when setting the
hash size, and we do allow doing so with a EVP_PKEY control.  The
solution is to provide a separate hash_size setter and to use it in
the corresponding EVP_PKEY_METHOD.

Fixes #7143

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7145)

6 years agoTESTS: add SipHash tests with digestsize controls
Richard Levitte [Sat, 8 Sep 2018 21:19:39 +0000 (23:19 +0200)]
TESTS: add SipHash tests with digestsize controls

Confirms #7143

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7154)

6 years agoSipHash: make it possible to control the hash size through string controls
Richard Levitte [Sat, 8 Sep 2018 21:19:06 +0000 (23:19 +0200)]
SipHash: make it possible to control the hash size through string controls

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7154)

6 years agotest/evp_test.c: make it possible to use controls with MAC tests
Richard Levitte [Sat, 8 Sep 2018 21:16:55 +0000 (23:16 +0200)]
test/evp_test.c: make it possible to use controls with MAC tests

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7154)

6 years agoDo not reset SNI data in SSL_do_handshake()
Matt Caswell [Fri, 7 Sep 2018 14:17:34 +0000 (15:17 +0100)]
Do not reset SNI data in SSL_do_handshake()

PR #3783 introduce coded to reset the server side SNI state in
SSL_do_handshake() to ensure any erroneous config time SNI changes are
cleared. Unfortunately SSL_do_handshake() can be called mid-handshake
multiple times so this is the wrong place to do this and can mean that
any SNI data is cleared later on in the handshake too.

Therefore move the code to a more appropriate place.

Fixes #7014

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/7149)

6 years agoSimplify SSL_get_servername() to avoid session references
Ben Kaduk [Tue, 4 Sep 2018 17:30:00 +0000 (12:30 -0500)]
Simplify SSL_get_servername() to avoid session references

Ideally, SSL_get_servername() would do exactly as it is documented
and return exactly what the client sent (i.e., what we currently
are stashing in the SSL's ext.hostname), without needing to refer
to an SSL_SESSION object.  For historical reasons, including the
parsed SNI value from the ClientHello originally being stored in the
SSL_SESSION's ext.hostname field, we have had references to the
SSL_SESSION in this function.  We cannot fully excise them due to
the interaction between user-supplied callbacks and TLS 1.2 resumption
flows, where we call all callbacks but the client did not supply an
SNI value.  Existing callbacks expect to receive a valid SNI value
in this case, so we must fake one up from the resumed session in
order to avoid breakage.

Otherwise, greatly simplify the implementation and just return the
value in the SSL, as sent by the client.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7115)

6 years agoRestore historical SSL_get_servername() behavior
Ben Kaduk [Tue, 4 Sep 2018 16:44:07 +0000 (11:44 -0500)]
Restore historical SSL_get_servername() behavior

Commit 1c4aa31d79821dee9be98e915159d52cc30d8403 modified the state machine
to clean up stale ext.hostname values from SSL objects in the case when
SNI was not negotiated for the current handshake.  This is natural from
the TLS perspective, since this information is an extension that the client
offered but we ignored, and since we ignored it we do not need to keep it
around for anything else.

However, as documented in https://github.com/openssl/openssl/issues/7014 ,
there appear to be some deployed code that relies on retrieving such an
ignored SNI value from the client, after the handshake has completed.
Because the 1.1.1 release is on a stable branch and should preserve the
published ABI, restore the historical behavior by retaining the ext.hostname
value sent by the client, in the SSL structure, for subsequent retrieval.

[extended tests]

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7115)

6 years agoEnsure certificate callbacks work correctly in TLSv1.3
Matt Caswell [Thu, 6 Sep 2018 14:53:25 +0000 (15:53 +0100)]
Ensure certificate callbacks work correctly in TLSv1.3

The is_tls13_capable() function should not return 0 if no certificates
are configured directly because a certificate callback is present.

Fixes #7140

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7141)

6 years agoRemove a reference to SSL_force_post_handshake_auth()
Matt Caswell [Thu, 6 Sep 2018 14:21:42 +0000 (15:21 +0100)]
Remove a reference to SSL_force_post_handshake_auth()

That function was removed in favour of SSL_set_post_handshake_auth().
Update the docs accordingly.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7139)

6 years agoTest that we can handle a PHA CertificateRequest after we sent close_notify
Matt Caswell [Thu, 6 Sep 2018 11:06:24 +0000 (12:06 +0100)]
Test that we can handle a PHA CertificateRequest after we sent close_notify

Even though we already sent close_notify the server may not have recieved
it yet and could issue a CertificateRequest to us. Since we've already
sent close_notify we can't send any reasonable response so we just ignore
it.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7114)

6 years agoTest that we can process a KeyUpdate received after we sent close_notify
Kurt Roeckx [Tue, 4 Sep 2018 12:39:41 +0000 (13:39 +0100)]
Test that we can process a KeyUpdate received after we sent close_notify

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7114)

6 years agoProcess KeyUpdate and NewSessionTicket messages after a close_notify
Matt Caswell [Tue, 4 Sep 2018 12:36:55 +0000 (13:36 +0100)]
Process KeyUpdate and NewSessionTicket messages after a close_notify

If we've sent a close_notify then we are restricted about what we can do
in response to handshake messages that we receive. However we can sensibly
process NewSessionTicket messages. We can also process a KeyUpdate message
as long as we also ignore any request for us to update our sending keys.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7114)

6 years agoAdd missing SM2err and fix doc nits
Paul Yang [Thu, 6 Sep 2018 02:36:11 +0000 (10:36 +0800)]
Add missing SM2err and fix doc nits

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7113)

6 years agoAllow EVP_MD_CTX_set_pkey_ctx to accept NULL pctx
Paul Yang [Wed, 5 Sep 2018 14:01:33 +0000 (22:01 +0800)]
Allow EVP_MD_CTX_set_pkey_ctx to accept NULL pctx

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7113)

6 years agoAdd a SM2(7) man page
Paul Yang [Wed, 5 Sep 2018 12:20:33 +0000 (20:20 +0800)]
Add a SM2(7) man page

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7113)

6 years agoUpdate document for SM2 stuffs
Paul Yang [Wed, 5 Sep 2018 07:19:17 +0000 (15:19 +0800)]
Update document for SM2 stuffs

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7113)

6 years agoAdd test case for SM2 evp verification
Jack Lloyd [Tue, 4 Sep 2018 15:25:29 +0000 (23:25 +0800)]
Add test case for SM2 evp verification

This test case is originally submitted in #6757, by Jack Lloyd. The test
case has been modified to use the a different method to set the ID when
computing the Z hash of SM2 signature.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
(Merged from https://github.com/openssl/openssl/pull/7113)

6 years agoSupport setting SM2 ID
Paul Yang [Tue, 4 Sep 2018 09:21:10 +0000 (17:21 +0800)]
Support setting SM2 ID

zero-length ID is allowed, but it's not allowed to skip the ID.

Fixes: #6534

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7113)

6 years agoMake SM2 ID stick to specification
Paul Yang [Mon, 3 Sep 2018 17:24:55 +0000 (01:24 +0800)]
Make SM2 ID stick to specification

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7113)

6 years agoSupport pmeth->digest_custom
Paul Yang [Mon, 3 Sep 2018 16:51:04 +0000 (00:51 +0800)]
Support pmeth->digest_custom

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7113)

6 years agoIntroduce EVP_MD_CTX_set_pkey_ctx
Paul Yang [Mon, 3 Sep 2018 15:56:41 +0000 (23:56 +0800)]
Introduce EVP_MD_CTX_set_pkey_ctx

Thus users can use this function to set customized EVP_PKEY_CTX to
EVP_MD_CTX structure.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7113)

6 years agoRemove unnecessary sm2_za.c
Paul Yang [Mon, 3 Sep 2018 14:08:17 +0000 (22:08 +0800)]
Remove unnecessary sm2_za.c

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7113)