]> git.ipfire.org Git - thirdparty/gnutls.git/log
thirdparty/gnutls.git
5 years agomini-record-timing: use only async-signal-safe functions in handler
Daiki Ueno [Sun, 25 Oct 2020 07:36:57 +0000 (08:36 +0100)] 
mini-record-timing: use only async-signal-safe functions in handler

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agopsktool: encode username if it contains special character
Daiki Ueno [Sat, 24 Oct 2020 08:23:03 +0000 (10:23 +0200)] 
psktool: encode username if it contains special character

This also moves the hex encoding of key to write_key for readability
and makes file stream closing robuster.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'fix-padlock' into 'master'
Daiki Ueno [Tue, 27 Oct 2020 07:46:17 +0000 (07:46 +0000)] 
Merge branch 'fix-padlock' into 'master'

x86:add detection of instruction set on Zhaoxin CPU

Closes #1079

See merge request gnutls/gnutls!1335

5 years agobootstrap.conf: exercise more tests from Gnulib
Daiki Ueno [Mon, 26 Oct 2020 14:42:22 +0000 (15:42 +0100)] 
bootstrap.conf: exercise more tests from Gnulib

This fixes the build failure with -Werror:

  configure:53786: gcc -o conftest -O0 -Wall -Werror -g3   conftest.c  -lev >&5
  conftest.c:412: error: "GNULIB_STRERROR" redefined [-Werror]
    412 | #define GNULIB_STRERROR 1
        |
  conftest.c:305: note: this is the location of the previous definition
    305 | #define GNULIB_STRERROR IN_GNUTLS_GNULIB_TESTS
        |
  cc1: all warnings being treated as errors

as well as improves code coverage.

Suggested by Bruno Haible in:
<https://lists.gnu.org/archive/html/bug-gnulib/2020-10/msg00148.html>.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agognutls_psk_set_server_credentials_file: document the file format
Daiki Ueno [Sat, 24 Oct 2020 07:48:07 +0000 (09:48 +0200)] 
gnutls_psk_set_server_credentials_file: document the file format

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'fix-avx-detection' into 'master'
Daiki Ueno [Wed, 21 Oct 2020 15:28:49 +0000 (15:28 +0000)] 
Merge branch 'fix-avx-detection' into 'master'

x86: fix avx detection

Closes #1083

See merge request gnutls/gnutls!1334

5 years agoMerge branch 'tmp-src-fixes' into 'master'
Daiki Ueno [Mon, 19 Oct 2020 14:43:15 +0000 (14:43 +0000)] 
Merge branch 'tmp-src-fixes' into 'master'

Add extra checks on memory allocation in src/ and examples

Closes #1102

See merge request gnutls/gnutls!1344

5 years agoserv: use only async-signal-safe functions in signal handlers
Daiki Ueno [Sun, 18 Oct 2020 15:58:49 +0000 (17:58 +0200)] 
serv: use only async-signal-safe functions in signal handlers

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years ago_gnutls_asn2err: define as static inline
Daiki Ueno [Sun, 18 Oct 2020 07:50:46 +0000 (09:50 +0200)] 
_gnutls_asn2err: define as static inline

This pacifies -fanalyzer false-positive:
  common.c:552:3: warning: use of NULL '<unknown>' where non-null expected [CWE-690] [-Wanalyzer-null-argument]

Ideally, the function should be defined as 'extern inline' to avoid
code bloat by being copied across multiple translation units.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agodoc/examples/ex-ocsp-client.c: check malloc return value
Daiki Ueno [Sun, 18 Oct 2020 05:19:29 +0000 (07:19 +0200)] 
doc/examples/ex-ocsp-client.c: check malloc return value

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoserv: peer_print_info: add overflow check on realloc
Daiki Ueno [Sun, 18 Oct 2020 05:25:42 +0000 (07:25 +0200)] 
serv: peer_print_info: add overflow check on realloc

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoserv: replace our own list implementation with Gnulib's gl_list
Daiki Ueno [Sun, 18 Oct 2020 05:17:38 +0000 (07:17 +0200)] 
serv: replace our own list implementation with Gnulib's gl_list

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'tmp-kdf-tests' into 'master'
Daiki Ueno [Thu, 8 Oct 2020 16:28:18 +0000 (16:28 +0000)] 
Merge branch 'tmp-kdf-tests' into 'master'

fips: enable self-tests for KDF algorithms and CMAC

See merge request gnutls/gnutls!1341

5 years agoMerge branch 'tmp-dh-2048' into 'master'
Daiki Ueno [Thu, 8 Oct 2020 15:32:14 +0000 (15:32 +0000)] 
Merge branch 'tmp-dh-2048' into 'master'

fips: use 2048-bit prime for DH self-tests

See merge request gnutls/gnutls!1342

5 years agofips: run CMAC self-tests
Daiki Ueno [Mon, 5 Oct 2020 15:59:46 +0000 (17:59 +0200)] 
fips: run CMAC self-tests

FIPS140-2 IG D.8 mandates self-tests on CMAC.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agofips: add self-tests for TLS-PRF
Daiki Ueno [Mon, 5 Oct 2020 15:44:30 +0000 (17:44 +0200)] 
fips: add self-tests for TLS-PRF

FIPS140-2 IG D.8 mandates self-tests on approved KDF algorithms.  As
the guidance only requires to run a single instance of each KDF
mechanism, this only exercises TLS1.2 PRF with HMAC-SHA-256 as the
underlying MAC algorithm.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agofips: use larger prime for DH self-tests
Daiki Ueno [Tue, 6 Oct 2020 09:54:21 +0000 (11:54 +0200)] 
fips: use larger prime for DH self-tests

According to FIPS140-2 IG 7.5, the minimum key size of FFC through
2030 is defined as 2048 bits.  This updates the relevant self-test
using ffdhe3072 defined in RFC 7919.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agofips: add self-tests for PBKDF2
Daiki Ueno [Mon, 5 Oct 2020 14:59:50 +0000 (16:59 +0200)] 
fips: add self-tests for PBKDF2

FIPS140-2 IG D.8 mandates self-tests on approved KDF algorithms.  As
the guidance only requires running a single instance of each KDF
mechanism, this only exercises PBKDF2 with HMAC-SHA-256 as the
underlying MAC algorithm.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agofips: add self-tests for HKDF
Daiki Ueno [Mon, 5 Oct 2020 14:12:46 +0000 (16:12 +0200)] 
fips: add self-tests for HKDF

FIPS140-2 IG D.8 mandates self-test on approved KDF algorithms.  As
the guidance only requires running a single instance of each KDF
mechanism, this only exercises HKDF-Extract and HKDF-Expand operations
with HMAC-SHA-256 as the underlying MAC.

Although HKDF is non-approved, it would be sensible to do that as it
will be approved in FIPS140-3.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'tmp-sh-tests' into 'master'
Daiki Ueno [Sat, 3 Oct 2020 16:42:07 +0000 (16:42 +0000)] 
Merge branch 'tmp-sh-tests' into 'master'

tests: simplify shell-script usage

See merge request gnutls/gnutls!1337

5 years agotests: add missing ${EXEEXT}
Daiki Ueno [Sat, 3 Oct 2020 12:50:26 +0000 (14:50 +0200)] 
tests: add missing ${EXEEXT}

Pointed by Andreas Metzler.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agotests: prolong timeout in wait_for_port
Daiki Ueno [Fri, 2 Oct 2020 15:23:27 +0000 (17:23 +0200)] 
tests: prolong timeout in wait_for_port

gnutls-serv invocations in cert-tests/dsa can take long time to launch
if valgrind tests are enabled.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agotests: remove unused lock facility using lockfile-create
Daiki Ueno [Mon, 28 Sep 2020 17:05:52 +0000 (19:05 +0200)] 
tests: remove unused lock facility using lockfile-create

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agotests: create lock for tests using GETPORT
Daiki Ueno [Sat, 26 Sep 2020 09:58:17 +0000 (11:58 +0200)] 
tests: create lock for tests using GETPORT

This fixes a race condition in the timings between when a free port is
detected and when the port is actually used.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agotests: simplify program detection
Daiki Ueno [Thu, 24 Sep 2020 09:48:24 +0000 (11:48 +0200)] 
tests: simplify program detection

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agotests: rewrite launch_server using launch_bare_server
Daiki Ueno [Thu, 24 Sep 2020 08:47:30 +0000 (10:47 +0200)] 
tests: rewrite launch_server using launch_bare_server

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'tmp-verify-output' into 'master'
Daiki Ueno [Mon, 28 Sep 2020 09:22:01 +0000 (09:22 +0000)] 
Merge branch 'tmp-verify-output' into 'master'

x509: correct argument of gnutls_verify_output_function

See merge request gnutls/gnutls!1338

5 years agox509: correct argument of gnutls_verify_output_function
Daiki Ueno [Sun, 27 Sep 2020 14:11:32 +0000 (16:11 +0200)] 
x509: correct argument of gnutls_verify_output_function

This is a leftover of 52e78f1e.  We need to call
gnutls_verify_output_function with the replaced CA cert instead of the
original cert.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agotests: remove launch_pkcs11_server
Daiki Ueno [Wed, 23 Sep 2020 07:34:09 +0000 (09:34 +0200)] 
tests: remove launch_pkcs11_server

This function is only used by testpkcs11.sh.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agotests: remove unused first argument from launch_server
Daiki Ueno [Wed, 23 Sep 2020 07:12:32 +0000 (09:12 +0200)] 
tests: remove unused first argument from launch_server

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agotests: use ": ${FOO=BAR}" syntax for default handling in shell scripts
Daiki Ueno [Wed, 23 Sep 2020 07:09:45 +0000 (09:09 +0200)] 
tests: use ": ${FOO=BAR}" syntax for default handling in shell scripts

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agox86:Modify variable name
JonasZhou [Wed, 23 Sep 2020 11:22:50 +0000 (19:22 +0800)] 
x86:Modify variable name

Modify the variables _gnutls_sha_padlock and _gnutls_sha_padlock_nano.
Add a comment for detecting CPU. Modify the indentation. Delete
initialization etc.

Signed-off-by: JonasZhou <JonasZhou@zhaoxin.com>
5 years agox86:add detection of instruction set on Zhaoxin CPU
JonasZhou [Tue, 15 Sep 2020 08:36:57 +0000 (16:36 +0800)] 
x86:add detection of instruction set on Zhaoxin CPU

Add detection of extended instruction set on Zhaoxin cpu,e.g:ssse3,sha,
etc. Set the priority of the algorithm according to the benchmark
test result on Zhaoxin cpu.

Signed-off-by: JonasZhou <JonasZhou@zhaoxin.com>
5 years agox86: fix avx detection
JonasZhou [Wed, 16 Sep 2020 06:08:21 +0000 (14:08 +0800)] 
x86: fix avx detection

In the case of setting environment variables, AVX cannot be detected
correctly. Because only MOVBE is added to variable _gnutls_x86_cpuid_s,
there is no OSXSAVE. And according to the intel manual, using AVX
does not need to detect FMA.

Signed-off-by: JonasZhou <JonasZhou@zhaoxin.com>
5 years agoMerge branch 'fix-x86-padlock' into 'master'
Daiki Ueno [Wed, 23 Sep 2020 07:30:41 +0000 (07:30 +0000)] 
Merge branch 'fix-x86-padlock' into 'master'

padlock:fix exception in wrap_padlock_hmac_fast

See merge request gnutls/gnutls!1336

5 years agoMerge branch 'tmp-default-prio' into 'master'
Daiki Ueno [Wed, 23 Sep 2020 06:55:54 +0000 (06:55 +0000)] 
Merge branch 'tmp-default-prio' into 'master'

priority: add Ed448 to SECURE192 signing algorithms

See merge request gnutls/gnutls!1332

5 years agopadlock:fix exception in wrap_padlock_hmac_fast
JonasZhou [Wed, 23 Sep 2020 06:19:39 +0000 (14:19 +0800)] 
padlock:fix exception in wrap_padlock_hmac_fast

In function wrap_padlock_hmac_fast, use free to release local variables
ctx. Remove a call to wrap_padlock_hmac_deinit() to fix a crash.

Signed-off-by: JonasZhou <JonasZhou@zhaoxin.com>
5 years agoMerge branch 'tmp-clock_nanosleep' into 'master'
Daiki Ueno [Mon, 21 Sep 2020 11:25:59 +0000 (11:25 +0000)] 
Merge branch 'tmp-clock_nanosleep' into 'master'

tests: allow clock_nanosleep in seccomp tests

Closes #1086

See merge request gnutls/gnutls!1325

5 years agotestcompat-openssl: specify -sigalgs
Daiki Ueno [Mon, 14 Sep 2020 15:59:00 +0000 (17:59 +0200)] 
testcompat-openssl: specify -sigalgs

The default selection of signature schemes is also affected by the
crypto-policies, and needs to be explicitly enabled with -sigalgs.

Suggested by Tomas Mraz.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoinih: remove unused code
Daiki Ueno [Mon, 14 Sep 2020 06:31:17 +0000 (08:31 +0200)] 
inih: remove unused code

This avoids -fanalyzer false-positive in GCC 10:
https://bugzilla.redhat.com/show_bug.cgi?id=1878600
as well as the cppcheck warning:
"variableScope:lib/inih/ini.c:99,style,The scope of the variable 'start' can be reduced."

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'tmp-ametzler-1090-testsuite' into 'master'
Daiki Ueno [Mon, 21 Sep 2020 05:25:23 +0000 (05:25 +0000)] 
Merge branch 'tmp-ametzler-1090-testsuite' into 'master'

Fix inconsistent handling of $SERV environment variable in testsuite

Closes #1090

See merge request gnutls/gnutls!1331

5 years agopriority: add Ed448 to SECURE192 signing algorithms
Daiki Ueno [Sun, 20 Sep 2020 15:49:17 +0000 (17:49 +0200)] 
priority: add Ed448 to SECURE192 signing algorithms

Reported Vladimír Čunát in:
https://gitlab.com/gnutls/gnutls/-/merge_requests/984#note_349374656

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'rsa_privkey_prive' into 'master'
Daiki Ueno [Sun, 20 Sep 2020 15:34:26 +0000 (15:34 +0000)] 
Merge branch 'rsa_privkey_prive' into 'master'

Make private exponent optional in gnutls_privkey_import_rsa_raw()

See merge request gnutls/gnutls!1323

5 years agotestsuite: Fix $SERV / $GNUTLS_SERV inconsistency
Andreas Metzler [Sat, 19 Sep 2020 08:57:04 +0000 (10:57 +0200)] 
testsuite: Fix $SERV / $GNUTLS_SERV inconsistency

Some tests did not support overriding the PATH to gnutls-serv by setting
the environment variable SERV but used GNUTLS_SERV instead.

Closes #1090

Signed-off-by: Andreas Metzler <ametzler@bebt.de>
5 years agoIn testsuite scripts use "$@" instead of $*.
Andreas Metzler [Fri, 18 Sep 2020 11:55:06 +0000 (13:55 +0200)] 
In testsuite scripts use "$@" instead of $*.

Signed-off-by: Andreas Metzler <ametzler@bebt.de>
5 years agobuild: remove dead assignments
Daiki Ueno [Sun, 13 Sep 2020 15:19:32 +0000 (17:19 +0200)] 
build: remove dead assignments

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agospki: work around GCC 10 -Warray-bounds false-positive
Daiki Ueno [Tue, 8 Sep 2020 17:55:14 +0000 (19:55 +0200)] 
spki: work around GCC 10 -Warray-bounds false-positive

Suggested by Martin Sebor in:
https://bugzilla.redhat.com/show_bug.cgi?id=1876801#c1

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agotls13/session_ticket: remove _gnutls13_session_ticket_unset
Daiki Ueno [Tue, 8 Sep 2020 17:51:07 +0000 (19:51 +0200)] 
tls13/session_ticket: remove _gnutls13_session_ticket_unset

The function was not really useful because _gnutls_free_datum()
has a NULL check as in free().  This also makes GCC 10 happy if
-Warray-bounds=2 is specified:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96984

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agotests: allow clock_nanosleep in seccomp tests
Daiki Ueno [Mon, 7 Sep 2020 07:52:52 +0000 (09:52 +0200)] 
tests: allow clock_nanosleep in seccomp tests

The nanosleep wrapper in glibc has changed the implementation using
the clock_nanosleep syscall:
https://sourceware.org/git/?p=glibc.git;a=commit;h=3537ecb49cf7177274607004c562d6f9ecc99474

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years ago.gitlab-ci.yml: bump build environment to Fedora 32
Daiki Ueno [Mon, 7 Sep 2020 07:52:09 +0000 (09:52 +0200)] 
.gitlab-ci.yml: bump build environment to Fedora 32

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'max_seed' into 'master'
Daiki Ueno [Thu, 17 Sep 2020 19:37:24 +0000 (19:37 +0000)] 
Merge branch 'max_seed' into 'master'

Modifies P_hash() to hash the seed and label separately.

Closes #1013

See merge request gnutls/gnutls!1329

5 years agoMerge branch 'tmp-ametzler-1091-gost' into 'master'
Daiki Ueno [Thu, 17 Sep 2020 13:37:54 +0000 (13:37 +0000)] 
Merge branch 'tmp-ametzler-1091-gost' into 'master'

Fix and enable GOST test in tests/gnutls-cli-debug.sh

See merge request gnutls/gnutls!1328

5 years agotestsuite: Run GOST part of tests/gnutls-cli-debug.sh
Andreas Metzler [Wed, 16 Sep 2020 05:18:51 +0000 (07:18 +0200)] 
testsuite: Run GOST part of tests/gnutls-cli-debug.sh

Closes #1097

Signed-off-by: Andreas Metzler <ametzler@bebt.de>
5 years agotestsuite: Fix GOST gnutls-cli-debug test
Andreas Metzler [Wed, 16 Sep 2020 05:13:06 +0000 (07:13 +0200)] 
testsuite: Fix GOST gnutls-cli-debug test

GOST algorithms are not enabled by default, explicitely request them in
priority string.

Signed-off-by: Andreas Metzler <ametzler@bebt.de>
5 years agoModifies P_hash() to hash the seed and label separately
Sahana Prasad [Mon, 14 Sep 2020 11:09:00 +0000 (13:09 +0200)] 
Modifies P_hash() to hash the seed and label separately
Thereby not restricting the implementation of prf to MAX_SEED_SIZE
MAX_SEED_SIZE is not used anymore

Signed-off-by: Sahana Prasad <sahana@redhat.com>
5 years agoMerge branch 'tmp-gnulib' into 'master'
Daiki Ueno [Thu, 17 Sep 2020 11:26:22 +0000 (11:26 +0000)] 
Merge branch 'tmp-gnulib' into 'master'

gnulib: update git submodule

See merge request gnutls/gnutls!1330

5 years agobuild: ignore pointless -Wformat-nonliteral warning
Daiki Ueno [Thu, 17 Sep 2020 10:03:20 +0000 (12:03 +0200)] 
build: ignore pointless -Wformat-nonliteral warning

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoconfigure.ac: don't enable warning only available in decent gcc
Daiki Ueno [Thu, 17 Sep 2020 09:15:43 +0000 (11:15 +0200)] 
configure.ac: don't enable warning only available in decent gcc

-Warith-conversion is new in GCC 10.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years ago.gitlab-ci.yml: bump cache version
Daiki Ueno [Sat, 12 Sep 2020 18:29:54 +0000 (20:29 +0200)] 
.gitlab-ci.yml: bump cache version

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agobuild: ignore pointless -Wformat-y2k warning
Daiki Ueno [Sun, 13 Sep 2020 18:27:05 +0000 (20:27 +0200)] 
build: ignore pointless -Wformat-y2k warning

Printing UTCTime really needs last 2 digits of the year.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agognulib: update git submodule
Daiki Ueno [Sun, 13 Sep 2020 15:52:44 +0000 (17:52 +0200)] 
gnulib: update git submodule

This brings in the build fixes of parse-datetime module:
https://lists.gnu.org/archive/html/bug-gnulib/2020-07/msg00178.html
https://lists.gnu.org/archive/html/bug-gnulib/2020-08/msg00001.html
https://lists.gnu.org/archive/html/bug-gnulib/2020-09/msg00046.html

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMake private exponent optional in gnutls_privkey_import_rsa_raw().
Nikolay Sivov [Sun, 6 Sep 2020 20:42:33 +0000 (23:42 +0300)] 
Make private exponent optional in gnutls_privkey_import_rsa_raw().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
5 years agoUse symbols defined for RSA key parameter indices in some more places.
Nikolay Sivov [Sun, 6 Sep 2020 18:18:57 +0000 (21:18 +0300)] 
Use symbols defined for RSA key parameter indices in some more places.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
5 years agoMerge branch 'gnutls-cli-aia' into 'master'
Daiki Ueno [Fri, 4 Sep 2020 15:51:14 +0000 (15:51 +0000)] 
Merge branch 'gnutls-cli-aia' into 'master'

Dynamic downloading of missing intermediate CAs via gnutls-cli using the option 'ca-auto-retrieve'

Closes #968

See merge request gnutls/gnutls!1319

5 years agoMerge branch 'tmp-renegotiation' into 'master'
Daiki Ueno [Thu, 3 Sep 2020 17:20:25 +0000 (17:20 +0000)] 
Merge branch 'tmp-renegotiation' into 'master'

handshake: reject no_renegotiation alert if handshake is incomplete

Closes #1071

See merge request gnutls/gnutls!1320

5 years agoMerge branch 'tmp-sizeof' into 'master'
Daiki Ueno [Thu, 3 Sep 2020 16:28:34 +0000 (16:28 +0000)] 
Merge branch 'tmp-sizeof' into 'master'

Fix padlock partial PHE detection and sizeof usage

Closes #1076

See merge request gnutls/gnutls!1316

5 years agoMerge branch 'rsa_privkey_import' into 'master'
Daiki Ueno [Thu, 3 Sep 2020 16:27:56 +0000 (16:27 +0000)] 
Merge branch 'rsa_privkey_import' into 'master'

Fix optional arguments handling in gnutls_privkey_import_rsa_raw()

See merge request gnutls/gnutls!1318

5 years agohandshake: reject no_renegotiation alert if handshake is incomplete
Daiki Ueno [Sat, 22 Aug 2020 15:19:39 +0000 (17:19 +0200)] 
handshake: reject no_renegotiation alert if handshake is incomplete

If the initial handshake is incomplete and the server sends a
no_renegotiation alert, the client should treat it as a fatal error
even if its level is warning.  Otherwise the same handshake
state (e.g., DHE parameters) are reused in the next gnutls_handshake
call, if it is called in the loop idiom:

  do {
          ret = gnutls_handshake(session);
  } while (ret < 0 && gnutls_error_is_fatal(ret) == 0);

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoConsolidate optional arguments tests for RSA key import, cleanup after each import.
Nikolay Sivov [Wed, 2 Sep 2020 20:49:14 +0000 (23:49 +0300)] 
Consolidate optional arguments tests for RSA key import, cleanup after each import.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
5 years agoMove RSA key parameter counter fixup closer to exponent update helper.
Nikolay Sivov [Wed, 2 Sep 2020 20:14:14 +0000 (23:14 +0300)] 
Move RSA key parameter counter fixup closer to exponent update helper.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
5 years agosrc/cli: adds new option '--ca-auto-retrieve' that can be used with gnutls-cli to
Sahana Prasad [Tue, 1 Sep 2020 21:16:53 +0000 (23:16 +0200)] 
src/cli: adds new option '--ca-auto-retrieve' that can be used with gnutls-cli to
         automatically download missing intermediate CAs in a certificate chain
lib/cred-cert.c : adds set and get APIs to get user data in the
gnutls_x509_trust_list_set_getissuer_function() callback.

Signed-off-by: Sahana Prasad <sahana@redhat.com>
5 years agoAdd some tests for optional arguments in gnutls_privkey_import_rsa_raw().
Nikolay Sivov [Tue, 1 Sep 2020 18:00:18 +0000 (21:00 +0300)] 
Add some tests for optional arguments in gnutls_privkey_import_rsa_raw().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
5 years agoFix optional parameters counter when importing RSA private keys.
Nikolay Sivov [Tue, 1 Sep 2020 16:29:20 +0000 (19:29 +0300)] 
Fix optional parameters counter when importing RSA private keys.

Currently gnutls_privkey_import_rsa_raw() allows 3 last arguments to be omitted,
key fixup logic however checks for 3 missing arguments when updating coefficient 'u'
but then asserts when updating exponents 'e1' and 'e2' assuming only 2 parameters
are missing at that point.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
5 years agoUse symbols defined for RSA key parameter indices in more places.
Nikolay Sivov [Tue, 1 Sep 2020 16:15:02 +0000 (19:15 +0300)] 
Use symbols defined for RSA key parameter indices in more places.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
5 years agotests: fix sizeof usage in mini-record-timing
Daiki Ueno [Sun, 30 Aug 2020 12:40:13 +0000 (14:40 +0200)] 
tests: fix sizeof usage in mini-record-timing

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agopadlock: fix partial PHE detection
Daiki Ueno [Sun, 30 Aug 2020 12:35:47 +0000 (14:35 +0200)] 
padlock: fix partial PHE detection

The xsha1 instruction takes complete SHA-1 blocks (64 bytes) instead
of arbitrary length data when EAX is set to -1.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'master' into 'master'
Daiki Ueno [Sat, 29 Aug 2020 20:01:20 +0000 (20:01 +0000)] 
Merge branch 'master' into 'master'

improve gnutls-serv EOL processing

Closes #1073

See merge request gnutls/gnutls!1314

5 years agoimprove gnutls-serv EOL processing
Albrecht Dreß [Sat, 29 Aug 2020 12:33:05 +0000 (14:33 +0200)] 
improve gnutls-serv EOL processing

add option `--crlf` to gnutls-serv to disable replacing a received CRLF
by LF in echo mode (fixes #1073).

Signed-off-by: Albrecht Dreß <albrecht.dress@arcor.de>
5 years agoMerge branch 'tmp-tls12-version-checks' into 'master'
Daiki Ueno [Fri, 21 Aug 2020 06:58:42 +0000 (06:58 +0000)] 
Merge branch 'tmp-tls12-version-checks' into 'master'

handshake: check TLS version against modified server priorities

Closes #1054

See merge request gnutls/gnutls!1309

5 years agoMerge branch 'tmp-ocsp-resp-status' into 'master'
Daiki Ueno [Thu, 20 Aug 2020 13:20:49 +0000 (13:20 +0000)] 
Merge branch 'tmp-ocsp-resp-status' into 'master'

cert-session: check OCSP error responses

Closes #1062

See merge request gnutls/gnutls!1308

5 years agoMerge branch 'tmp-cipher-check-length' into 'master'
Daiki Ueno [Tue, 18 Aug 2020 09:50:11 +0000 (09:50 +0000)] 
Merge branch 'tmp-cipher-check-length' into 'master'

gnutls_aead_cipher_decrypt: check output buffer size before writing

Closes #1049

See merge request gnutls/gnutls!1312

5 years agoMerge branch 'tmp-crt-export2' into 'master'
Daiki Ueno [Tue, 18 Aug 2020 08:42:57 +0000 (08:42 +0000)] 
Merge branch 'tmp-crt-export2' into 'master'

gnutls_x509_crt_export2: return 0 instead of the length

Closes #1025

See merge request gnutls/gnutls!1311

5 years agoMerge branch 'tmp-type-limits' into 'master'
Daiki Ueno [Tue, 18 Aug 2020 08:01:50 +0000 (08:01 +0000)] 
Merge branch 'tmp-type-limits' into 'master'

minitasn1: move WARN_CFLAGS setting to configure.ac

Closes #1022

See merge request gnutls/gnutls!1307

5 years agognutls_aead_cipher_decrypt: check output buffer size before writing
Daiki Ueno [Thu, 13 Aug 2020 16:17:08 +0000 (18:17 +0200)] 
gnutls_aead_cipher_decrypt: check output buffer size before writing

While the documentation of gnutls_aead_cipher_decrypt indicates that
the inout argument ptext_len initially holds the size that
sufficiently fits the expected output size, there was no runtime check
on that.  This makes the interface robuster against misuses.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agohandshake: check TLS version against modified server priorities
Daiki Ueno [Sun, 16 Aug 2020 09:43:35 +0000 (11:43 +0200)] 
handshake: check TLS version against modified server priorities

The server needs to take into account of multiple factors when
determining the TLS protocol version actually being used:
- the legacy version
- "supported_versions" extension
- user_hello_func that may modify the server's priorities

Only after that it can check whether the TLS version is enabled in the
server's priorities.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agognutls_x509_crt_export2: return 0 instead of the length
Daiki Ueno [Sun, 16 Aug 2020 16:23:24 +0000 (18:23 +0200)] 
gnutls_x509_crt_export2: return 0 instead of the length

This aligns the behavior to the documentation.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'tmp-fix-gost-cert-nogost' into 'master'
Daiki Ueno [Sun, 16 Aug 2020 14:18:54 +0000 (14:18 +0000)] 
Merge branch 'tmp-fix-gost-cert-nogost' into 'master'

Fix parser output in tests/cert-tests/data/gost-cert-nogost.pem

Closes #1038

See merge request gnutls/gnutls!1310

5 years agoFix parser output in tests/cert-tests/data/gost-cert-nogost.pem
Fiona Klute [Sun, 16 Aug 2020 12:05:44 +0000 (14:05 +0200)] 
Fix parser output in tests/cert-tests/data/gost-cert-nogost.pem

When building without GOST support parsing a GOST certificate must
return an "error importing public key" message instead of key
details. This change makes tests/cert-tests/pem-decoding pass for
builds with --disable-gost.

Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
5 years agoMerge branch 'tmp-fips-enabled' into 'master'
Daiki Ueno [Fri, 14 Aug 2020 17:22:37 +0000 (17:22 +0000)] 
Merge branch 'tmp-fips-enabled' into 'master'

_gnutls_fips_mode_enabled: treat selftest failure as FIPS disabled

See merge request gnutls/gnutls!1306

5 years agoMerge branch 'tmp-typo-fixes' into 'master'
Daiki Ueno [Fri, 14 Aug 2020 17:21:13 +0000 (17:21 +0000)] 
Merge branch 'tmp-typo-fixes' into 'master'

doc: assorted typo fixes

See merge request gnutls/gnutls!1305

5 years agoMerge branch 'tmp-cert-invalid' into 'master'
Daiki Ueno [Fri, 14 Aug 2020 17:20:16 +0000 (17:20 +0000)] 
Merge branch 'tmp-cert-invalid' into 'master'

cert-session: ensure that invalid flag is always set

See merge request gnutls/gnutls!1304

5 years agoMerge branch 'tmp-public-header-guards' into 'master'
Daiki Ueno [Fri, 14 Aug 2020 13:33:17 +0000 (13:33 +0000)] 
Merge branch 'tmp-public-header-guards' into 'master'

Add or clean header guards in lib/includes/gnutls/

See merge request gnutls/gnutls!993

5 years agocert-session: check OCSP error responses
Daiki Ueno [Fri, 14 Aug 2020 05:27:40 +0000 (07:27 +0200)] 
cert-session: check OCSP error responses

If the OCSP responder returns an error code, such as tryLater, we
can't proceed to examine the response bytes.  In that case, just skip
the check unless the stapling is mandatory on this certificate.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'tmp-fix-cert-pass' into 'master'
Daiki Ueno [Fri, 14 Aug 2020 08:48:34 +0000 (08:48 +0000)] 
Merge branch 'tmp-fix-cert-pass' into 'master'

Fix two issues about certtool and passwords

Closes #933 and #888

See merge request gnutls/gnutls!1268

5 years agoMerge branch 'mangle-ecc_scalar_random' into 'master'
Daiki Ueno [Fri, 14 Aug 2020 08:12:09 +0000 (08:12 +0000)] 
Merge branch 'mangle-ecc_scalar_random' into 'master'

Mangle/hide GNUTLS-built ecc_scalar_random()

Closes #1016

See merge request gnutls/gnutls!1300

5 years agomangle gnutls-built ecc_scalar_random
Steve Lhomme [Wed, 15 Jul 2020 07:34:19 +0000 (09:34 +0200)] 
mangle gnutls-built ecc_scalar_random

GNUTLS builds ecc-random.c but ecc_scalar_random() is a public API. So we
mangle the internal version we build.

ecc_mod_random is unaffected as it's an internal API that is mangled by GNUTLS.

Fixes #1016

Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
5 years agominitasn1: move WARN_CFLAGS setting to configure.ac
Daiki Ueno [Thu, 13 Aug 2020 13:56:20 +0000 (15:56 +0200)] 
minitasn1: move WARN_CFLAGS setting to configure.ac

Some compilers don't support -Wno-type-limits, while they support
-Wtype-limits.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years ago_gnutls_fips_mode_enabled: treat selftest failure as FIPS disabled
Daiki Ueno [Thu, 4 Jun 2020 14:42:07 +0000 (16:42 +0200)] 
_gnutls_fips_mode_enabled: treat selftest failure as FIPS disabled

Previously gnutls_fips140_mode_enabled() returned true, even after
selftests have failed and the library state has switched to error.
While later calls to crypto operations fails, it would be more
convenient to have a function to detect that state.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agodoc: assorted typo fixes
Daiki Ueno [Wed, 12 Aug 2020 06:10:51 +0000 (08:10 +0200)] 
doc: assorted typo fixes

Spotted by codespell.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoserv, cli: ensure that invalid flag is always set
Daiki Ueno [Wed, 12 Aug 2020 05:29:30 +0000 (07:29 +0200)] 
serv, cli: ensure that invalid flag is always set

According to the documentation, the GNUTLS_CERT_INVALID flag must
always be set in case of verification failure, together with the flag
indicating the actual error cause.

Signed-off-by: Daiki Ueno <ueno@gnu.org>