1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

1240 Commits

Author SHA1 Message Date
NIIBE Yutaka
768d365b0f
w32: Fix spawn functions to support Windows Xp.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-05-03 09:18:56 +09:00
NIIBE Yutaka
b9e65faa5d
w32: Fix inheriting HANDLEs.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-05-02 22:21:53 +09:00
NIIBE Yutaka
b674a704e9
Rename the enum constant to GNUPG_PROCESS_GET_PROC_ID.
And use GetProcessId on Windows in the implementation.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-05-02 14:53:44 +09:00
NIIBE Yutaka
7cadbf4e18
Merge branch 'master' into gniibe/t6275 2023-05-01 12:04:18 +09:00
NIIBE Yutaka
698caf30b9
common: Fix parsing ECC key.
* common/sexputil.c (get_ecc_q_from_canon_sexp): Initialize ECC_Q_LEN.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-05-01 11:38:20 +09:00
NIIBE Yutaka
4459d759fd
spawn: Introduce *_KEEP, removing *_NULL.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-04-20 14:36:08 +09:00
NIIBE Yutaka
5d4c3b79ee
exechelp: Clean up macros.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-04-20 13:54:34 +09:00
Werner Koch
80d4ae1215
Use keyboxd on a fresh install also on Windows.
* common/homedir.c (gnupg_maybe_make_homedir): Factor some code out to
...
(create_common_conf): new.
(standard_homedir): Call it also from here.
--

Fixes-commit: d9e7488b17fdc617eec735e2c0485b69285ba511
2023-04-19 11:05:42 +02:00
Werner Koch
ba67fea5b9
gpgtar: Read common.conf for the log-file option.
* common/util.h (GNUPG_MODULE_NAME_GPGTAR): New.
* common/homedir.c (gnupg_module_name): Add it.
* tools/gpgtar.c: Include comopt.h.
(enum cmd_and_opt_values): Add oDebug.
(opts): Add --debug.
(any_debug): New.
(main): Parse common.conf.
--

Having a way to see the output of gpgtar is often useful for
debugging.  The only effect of the debug option is to show whether
common.conf was read.
2023-04-18 08:04:48 +02:00
NIIBE Yutaka
5717d9ec1e
Remove old API implementation for spawn functions.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-04-17 14:14:16 +09:00
NIIBE Yutaka
df357a0335
Fix use of GNUPG_PROCESS_DETACHED.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-04-17 14:10:00 +09:00
NIIBE Yutaka
5d8648e12d
w32: Fix asshelp.c for Windows use case.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-04-17 11:44:42 +09:00
NIIBE Yutaka
cd13428a22
Fix requirement for _WIN32_WINNT to use process related functions.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-04-13 14:34:57 +09:00
NIIBE Yutaka
8dcfb5e4d0
Merge branch 'master' into gniibe/t6275 2023-04-13 14:08:27 +09:00
Werner Koch
d965ee8d65
gpg: Curvenames may now compared case insensitive.
* common/openpgp-oid.c (openpgp_curve_to_oid): Repalce strmcp by
ascii_strcasecmp.
(openpgp_oid_or_name_to_curve): Ditto.
(openpgp_is_curve_supported): Ditto.
(get_keyalgo_string): Ditto.
--

It was just to hard to remember the correct capitalization of
names like brainpoolP512r1.
2023-04-12 17:10:08 +02:00
Werner Koch
c9e95b8dee
gpg: New option --assert-signer.
* g10/gpg.c (enum cmd_and_opt_values): Add oAssertSigner.
(opts): Add "assert-signer".
(main): Set option.
(assert_signer_true): New var.
(g10_exit): Evaluate new var.
* g10/main.h (assert_signer_true): Declare new var.
* common/status.h (STATUS_ASSERT_SIGNER): New.
* g10/options.h (opt): Add field assert_signer_list.
* g10/verify.c (is_fingerprint): New.
(check_assert_signer_list): New.
* g10/mainproc.c (check_sig_and_print): Call that function.  Clear
assert_signer_true on a warning.

* g10/gpgv.c: Add dummy function and vars.
* g10/t-keydb-get-keyblock.c: Ditto.
* g10/t-keydb.c: Ditto.
* g10/t-stutter.c: Ditto.
--
2023-04-05 21:32:23 +02:00
Werner Koch
d261f5e5d0
common: Change allocation of the comopt symbol.
* common/comopt.h (struct gnupg_comopt_s): New.
* common/comopt.c (struct gnupg_comopt_s): Define here in the data
segment.
2023-04-04 16:51:58 +02:00
Werner Koch
d9e7488b17
Use the keyboxd for a fresh install
* common/homedir.c (gnupg_maybe_make_homedir): Also create a
common.conf.
* g10/keydb.c: Include comopt.h.
(maybe_create_keyring_or_box): Detect the creation of a common.conf.
* g10/gpg.c (main): Avoid adding more resources in this case.
* sm/keydb.c:  Include comopt.h.
(maybe_create_keybox): Detect the creation of a common.conf.

* common/comopt.h (comopt): Remove the conditional "extern".
2023-04-04 16:39:59 +02:00
Werner Koch
2e065b4bd2
scd,openpgp: Switch key attributes between RSA and ECC in writekey.
* common/sexputil.c (get_rsa_pk_from_canon_sexp): Also allow private
keys.
(pubkey_algo_string): Ditto.
* scd/app-openpgp.c (do_writekey): Switch key attributes
--

The scd WRITEKEY command for OpenPGP cards missed proper support to
aautomagically switch key attributes based on the new key.  We had
this only in GENKEY.

GnuPG-bug-id: 6378
2023-03-15 09:42:02 +01:00
Werner Koch
b52a0e244a
dirmngr: Distinguish between "no crl" and "crl not trusted".
* dirmngr/crlcache.h (CRL_CACHE_NOTTRUSTED): New.
* dirmngr/crlcache.c (cache_isvalid): Set this status.
(crl_cache_cert_isvalid): Map it to GPG_ERR_NOT_TRUSTED.
(crl_cache_reload_crl): Move diagnostic to ...
* dirmngr/crlfetch.c (crl_fetch): here.
* dirmngr/server.c (cmd_isvalid): Map it to GPG_ERR_NOT_TRUSTED.
* dirmngr/validate.c (check_revocations): Handle new status.  Improve
diagnostics.
* common/status.c (get_inv_recpsgnr_code): Map INV_CRL_OBJ.
* common/audit.c (proc_type_verify): Ditto.
--

This avoids repeated loading of CRLs in case of untrusted root
certificates.
2023-03-09 18:28:39 +01:00
Werner Koch
2a13f7f9dc
gpgsm: Strip trailing zeroes from detached signatures.
* common/ksba-io-support.c: Include tlv.h
(struct reader_cb_parm_s): Add new fields.
(starts_with_sequence): New.
(simple_reader_cb): Handle stripping.
* common/ksba-io-support.h (GNUPG_KSBA_IO_STRIP): New.
(gnupg_ksba_create_reader): Handle the new flag.
* sm/verify.c (gpgsm_verify): Use the new flag for detached
signatures.
--

Note that this works only if --assume-binary is given.  The use case
for the feature is PDF signature checking where the PDF specs require
that the detached signature is padded with zeroes.
2023-03-08 11:00:00 +01:00
Werner Koch
9de180c6d2
doc: Minor comment fixes.
--
2023-02-23 10:23:56 +01:00
Werner Koch
71c11c20f4
gpg: Prepare to accept shorter OIDs for ed25519 and cv25519.
* common/openpgp-oid.c (oidtable): Add them.
(oid_ed25519_v5, oid_cv25519_v5): New.
(openpgp_oidbuf_is_ed25519): Take new OID in account.
(openpgp_oidbuf_is_cv25519): Ditto.
--

ed25519 is used in GnuPG and other implementations since 2015 and thus
we can't simply switch to the shorter OIDs.  However, we have not
widely used them with v5 keys (only ed448 forced the use of v5) and
thus it might be possible to use the new OIDs with v5 keys.

Note that Libgcrypt supports the new OIDs even in 1.8.
2023-02-21 12:14:31 +01:00
NIIBE Yutaka
56446bd923
Put gnupg_spawn_helper function to W32, too.
--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-01-27 14:29:57 +09:00
Werner Koch
f35e7dbf9e
common: Slight redefinition of nvc_get_boolean.
* common/name-value.c (nvc_get_boolean): Rewrite.
--

The function may now return a positive or negative number instead of
just 1 for true.  All callers were already prepared for this.

GnuPG-bug-id: 6212
2023-01-24 10:07:02 +01:00
NIIBE Yutaka
8e2207ecb9
Merge branch 'master' into gniibe/t6275 2023-01-24 15:29:51 +09:00
Werner Koch
d98bf02a03
gpg: Replace --override-compliance-check by a real fix.
* common/compliance.c (gnupg_pk_is_allowed): Handle EdDSA.
* g10/gpg.c (oOverrideComplianceCheck): Remove.
(opts): Turn --override-compliance-check into a dummy option.
* g10/options.h (opt): Remove override_compliance_check.
* g10/sig-check.c (check_key_verify_compliance): Remove use of that
option.
--

The introduction of --override-compliance-check actually hid the real
cause for the signature verification problem in de-vs mode for the
Ed25519 key.  The real fix is to handle the EdDSA algorithm in
gnupg_pk_is_allowed.

Fixes-commit: fb26e144adfd93051501d58f5d0d4f8826ddf436
GnuPG-bug-id: 5655
2023-01-20 11:03:40 +01:00
Werner Koch
c0a6b6b2d7
doc: Update copyright notices.
--

Note that we now print Copyright g10 Code instead of FSF.
2023-01-20 09:07:20 +01:00
Werner Koch
9a50be0d05
common: Detect PNG and JPEG file formats.
* common/miscellaneous.c (is_file_compressed): Add detect code.
--

GnuPG-bug-id: 6332
2023-01-19 11:27:25 +01:00
Werner Koch
60963d98cf
gpg: Detect already compressed data also when using a pipe.
* common/iobuf.c (file_filter_ctx_t): Add fields for the peek feature.
(file_filter): Implement peeking.
(iobuf_ioctl): Add new IOBUF_IOCTL_PEEK.
* common/iobuf.h (IOBUF_IOCTL_PEEK, IOBUFCTRL_PEEK): New.
* common/miscellaneous.c (is_file_compressed): Rewrite.  Detect PDF.
* g10/encrypt.c (encrypt_simple): Peek before detecting compression.
(encrypt_crypt): Ditto.
* g10/sign.c (sign_file): Also detect already compressed data.

* g10/options.h (opt): Add explicit_compress_option.
* g10/gpg.c (main): Set opt.explicit_compress_option for -z.

--

Note that this patch also introduces a compression check for signing
which was never done in the past.

GnuPG-bug-id: 6332
2023-01-19 10:45:54 +01:00
Werner Koch
94ae43be36
common: Replace all assert by log_assert.
--
2023-01-18 12:17:02 +01:00
Werner Koch
338a5ecaa1
sm: Fix compliance checking for ECC signature verification.
* common/compliance.c (gnupg_pk_is_compliant): Also consider the
gcrypt vids for ECDSA et al.
(gnupg_pk_is_allowed): Ditto.
* sm/verify.c (gpgsm_verify): Consider the curve.  Print a compliance
notice for a non-compliant key.

* sm/certchain.c (gpgsm_validate_chain): Silence the "switching to
chain model".
2023-01-12 20:52:27 +01:00
Werner Koch
d1298fa287
w32: Make sure DEP is enabled.
* common/init.c (_init_common_subsystems): Test and set the DEP
Policy.
--

Note that this change will now definitely require Windows XP SP3.
2023-01-11 11:33:26 +01:00
Werner Koch
30a98b0b21
common: Fix translations in --help for gpgrt < 1.47
* common/mapstrings.c (map_static_macro_string): Add hack.
--
2022-12-16 17:29:12 +01:00
NIIBE Yutaka
e89d2f5a77
w32,debug: Don't emit debug output any more.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-12-08 19:35:49 +09:00
NIIBE Yutaka
e539ac83b2
Fix exechelp-w32.c.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-12-06 14:32:53 +09:00
NIIBE Yutaka
ac87fc1a9b
Merge branch 'master' into gniibe/t6275 2022-12-05 12:01:06 +09:00
NIIBE Yutaka
594c3274d6
tests: More fix for semihosted environment.
* common/all-tests.scm: Conditionalize by *win32*.
* tests/cms/Makefile.am (GPGSM): Add missing GPGSM.
* tests/pkits/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-12-01 17:09:45 +09:00
NIIBE Yutaka
f182c284fb
tests: Support semihosted environment.
* Makefile.am (check-all): Add EXEEXT.
* agent/all-tests.scm: Append EXEEXT.
* common/all-tests.scm: Likewise.
* g10/all-tests.scm: Likewise.
* g13/all-tests.scm: Likewise.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-12-01 13:59:06 +09:00
NIIBE Yutaka
8e8971403f
w32: Fix gnupg_unsetenv.
* common/sysutils.c (gnupg_unsetenv): Don't use nonstandard extension
of "NAME", but "NAME=".

--

Microsoft implementation of putenv works to remove an environment
variable by "NAME=".

POSIX doesn't say that putenv with "NAME=" has same effect.  GNU
implementation doesn't support this way for removal of environment
variable.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-11-30 15:56:03 +09:00
NIIBE Yutaka
97cbb507fa
w32: Fix spawn functions for Windows for _fd use case.
--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-11-30 11:35:41 +09:00
NIIBE Yutaka
bd062b1dbd
w32: Use call back when ASFW is needed.
--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-11-30 11:05:15 +09:00
NIIBE Yutaka
f9af139685
posix: factor out call_spawn_cb.
--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-11-30 10:03:29 +09:00
NIIBE Yutaka
236a8a3cfb
common: Support new spawn functions for Windows.
--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-11-29 19:27:15 +09:00
NIIBE Yutaka
b35c3980c1
Tweak the spawn API, again for POSIX.
--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-11-28 13:10:48 +09:00
NIIBE Yutaka
60b6cfe71f
posix: Fix for spawn_cb.
--

Fixes: 7571fd4cd02571ddd0ba84700c0a52704f0a9b5c
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-11-28 09:43:24 +09:00
NIIBE Yutaka
7571fd4cd0
Change spawn_cb semantics.
--

So that the callback can replace fds for stdin/out/err.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-11-25 20:10:31 +09:00
NIIBE Yutaka
202d7b47e7
Replace other use cases of gnupg_spawn_process_fd.
--

 by gnupg_process_spawn

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-11-25 13:18:17 +09:00
NIIBE Yutaka
62496e9f30
Support gnupg_process_spawn with R_PROC=NULL.
--

The use case of system(3) call.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-11-25 13:04:57 +09:00
NIIBE Yutaka
af4a6fff0d
Fix gnupg_process_release.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-11-25 12:04:54 +09:00