Compare commits

..

No commits in common. "master" and "gpgme-1.9-branch" have entirely different histories.

787 changed files with 14623 additions and 75290 deletions

46
.gitignore vendored
View File

@ -1,55 +1,13 @@
# GnuPG exclusions
/aclocal.m4
/autom4te.cache
/config.h.in
/configure
/config.h
/config.log
/config.status
/conf/config.h.in
/conf/config.h
/libtool
/VERSION
Makefile.in
Makefile
stamp-h1
*.o
*.lo
# Hidden files
*~
# Byte compiled Python
*.py[cod]
__pycache__
# C extensions
*.so
# Packages
*.egg
*.egg-info
build
eggs
parts
develop-eggs
.installed.cfg
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
nosetests.xml
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# Assorted Apple crap
default.profraw
.DS_Store
._.DS_Store

53
AUTHORS
View File

@ -1,49 +1,21 @@
Package: gpgme
Homepage: https://gnupg.org/software/gpgme/
Download: https://gnupg.org/ftp/gcrypt/gpgme/
Homepage: https://gnupg.org/related_software/gpgme/
Download: ftp://ftp.gnupg.org/gcrypt/gpgme/
Repository: git://git.gnupg.org/gpgme.git
Maintainer: Werner Koch <wk@gnupg.org>
Bug reports: https://bugs.gnupg.org
Bug reports: https://bugs.gnupg.org (use category "gpgme")
Security related bug reports: security@gnupg.org
License (software): LGPL-2.1-or-later
License (manual+tools): GPL-3.0-or-later
License (software): LGPLv2.1+
License (manual+tools): GPLv3+
GPGME is free software. See the files COPYING.LESSER and COPYING for
copying conditions, , and LICENSES for notices about contributions
that require these additional notices to be distributed. License
copyright years may be listed using range notation, e.g., 2000-2013,
indicating that every year in the range, inclusive, is a copyrightable
year that would otherwise be listed individually.
List of Copyright holders
=========================
Copyright (C) 1991-2013 Free Software Foundation, Inc.
Copyright (C) 2000-2001 Werner Koch
Copyright (C) 2001-2023 g10 Code GmbH
Copyright (C) 2002 Klarälvdalens Datakonsult AB
Copyright (C) 2004-2008 Igor Belyi
Copyright (C) 2002 John Goerzen
Copyright (c) 2009 Dave Gamble
Copyright (C) 2014, 2015 Martin Albrecht
Copyright (C) 2015, 2018 Ben McGinnes
Copyright (C) 2015, 2016, 2018
Bundesamt für Sicherheit in der Informationstechnik
Copyright (C) 2016 Intevation GmbH
Authors info
============
FSF <gnu@gnu.org>
- Code taken from GnuPG 1.0: src/w32-util.c.
- Other from FSF projects: src/setenv.c, src/vasprintf.c,
src/stpcpy.c, src/w32-ce.c.
g10 Code GmbH <code@g10code.com>
- All stuff since mid March 2001.
- All stuff since mid march 2001.
Werner Koch <wk@gnupg.org>
- Design and most stuff.
@ -58,20 +30,7 @@ Authors with a DCO
Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2014-09-24:878ul9w4j8.fsf@alice.fifthhorseman.net:
Colin Watson <cjwatson@debian.org>
2017-09-16:20170916031428.uypfrdojquvjteor@riva.ucam.org:
Tobias Mueller <muelli@cryptobitch.de>
2016-11-23:1479937342.11180.3.camel@cryptobitch.de:
Ben McGinnes <ben@adversary.org>
2017-12-16:20171216002102.l6aejk5xdp6xhtfi@adversary.org:
Jacob Adams <tookmund@gmail.com>
2018-06-03:ad5141df-b6cc-6c2a-59df-b2f18f7160fd@gmail.com:
Guillaume LE VAILLANT <glv@posteo.net>
2018-10-11:20181011113825.76f9752a@yamatai:
Copyright 2001, 2002, 2012, 2013 g10 Code GmbH

View File

@ -1,38 +0,0 @@
Additional license notices for GPGME. -*- org -*-
This file contains the copying permission notices for various files in
the GPGME distribution which are not covered by the GNU Lesser
General Public License (LGPL) or the GNU General Public License (GPL).
These notices all require that a copy of the notice be included
in the accompanying documentation and be distributed with binary
distributions of the code, so be sure to include this file along
with any binary distributions derived from the GNU C Library.
* MIT License
For files:
- cJSON.c, cJSON.h
#+begin_quote
Copyright (c) 2009 Dave Gamble
Permission is hereby granted, free of charge, to any person obtaining
a opy of this software and associated documentation files (the
"Software"), to eal in the Software without restriction, including
without limitation the ights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING ROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#+end_quote

View File

@ -15,32 +15,17 @@
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see <https://gnu.org/licenses/>.
# SPDX-License-Identifier: LGPL-2.1-or-later
# License along with this program; if not, see <https://www.gnu.org/licenses/>.
## Process this file with automake to produce Makefile.in
# Location of the released tarball archives. This is prefixed by
# the variable RELEASE_ARCHIVE in ~/.gnupg-autogen.rc. For example:
# RELEASE_ARCHIVE=user@host:archive/tarballs
RELEASE_ARCHIVE_SUFFIX = gpgme
# The variable RELEASE_SIGNKEY in ~/.gnupg-autogen.rc is used
# to specify the key for signing. For example:
# RELEASE_SIGNKEY=D8692123C4065DEA5E0F3AB5249B39D24F25E3B6
# Autoconf flags
ACLOCAL_AMFLAGS = -I m4
DISTCHECK_CONFIGURE_FLAGS =
EXTRA_DIST = autogen.sh autogen.rc gpgme.spec.in \
ChangeLog-2011 m4/ChangeLog-2011 \
build-aux/libtool-patch.sed \
conf/whatisthis VERSION LICENSES
EXTRA_DIST = autogen.sh autogen.rc gpgme.spec.in \
ChangeLog-2011 m4/ChangeLog-2011 contrib/ChangeLog-2011
# This artificial line is to put a dependency to conf/config.h for 'all'
BUILT_SOURCES = conf/config.h
if RUN_GPG_TESTS
tests = tests
@ -50,11 +35,13 @@ endif
SUBDIRS = src ${tests} doc lang
# Fix the version of the spec file.
# Fix the version of the spec file and create a file named VERSION
# to be used for patch's Prereq: feature.
dist-hook: gen-ChangeLog
@set -e; \
sed -e 's/@pkg_version@/$(PACKAGE_VERSION)/g' \
$(top_srcdir)/gpgme.spec.in > $(distdir)/gpgme.spec
echo "$(PACKAGE_VERSION)" > $(distdir)/VERSION
distcheck-hook:
set -e; ( \
@ -70,9 +57,9 @@ distcheck-hook:
esac;\
done ) | tee $(distdir).swdb
.PHONY: gen-ChangeLog release sign-release
gen_start_date = 2011-12-01T00:00:00
.PHONY: gen-ChangeLog
gen-ChangeLog:
if test -d $(top_srcdir)/.git; then \
(cd $(top_srcdir) && \
@ -83,62 +70,3 @@ gen-ChangeLog:
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
fi
# Macro to help the release target.
RELEASE_NAME = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
release:
+(set -e;\
if [ "$(abs_top_builddir)" = "$(abs_top_srcdir)" ]; then \
echo "error: build directory must not be the source directory" >&2;\
exit 2;\
fi ;\
echo "/* Build started at $$(date -uIseconds) */" ;\
cd $(top_srcdir); \
./autogen.sh --force; \
cd $(abs_top_builddir); \
rm -rf dist; mkdir dist ; cd dist ; \
$(abs_top_srcdir)/configure --enable-maintainer-mode; \
$(MAKE) distcheck; \
echo "/* Build finished at $$(date -uIseconds) */" ;\
echo "/*" ;\
echo " * Please run the final step interactively:" ;\
echo " * make sign-release" ;\
echo " */" ;\
) 2>&1 | tee "$(RELEASE_NAME).buildlog"
sign-release:
+(set -e; \
test $$(pwd | sed 's,.*/,,') = dist || cd dist; \
x=$$(grep '^RELEASE_ARCHIVE=' $$HOME/.gnupg-autogen.rc|cut -d= -f2);\
if [ -z "$$x" ]; then \
echo "error: RELEASE_ARCHIVE missing in ~/.gnupg-autogen.rc">&2; \
exit 2;\
fi;\
myarchive="$$x/$(RELEASE_ARCHIVE_SUFFIX)";\
x=$$(grep '^RELEASE_SIGNKEY=' $$HOME/.gnupg-autogen.rc|cut -d= -f2);\
if [ -z "$$x" ]; then \
echo "error: RELEASE_SIGNKEY missing in ~/.gnupg-autogen.rc">&2; \
exit 2;\
fi;\
mysignkey="$$x";\
files1="$(RELEASE_NAME).tar.bz2" ;\
files2="$(RELEASE_NAME).tar.bz2.sig \
$(RELEASE_NAME).swdb \
$(RELEASE_NAME).buildlog" ;\
echo "/* Signing the source tarball ..." ;\
gpg -sbu $$mysignkey $(RELEASE_NAME).tar.bz2 ;\
cat $(RELEASE_NAME).swdb >swdb.snippet;\
echo >>swdb.snippet ;\
sha1sum $${files1} >>swdb.snippet ;\
cat "../$(RELEASE_NAME).buildlog" swdb.snippet \
| gzip >$(RELEASE_NAME).buildlog ;\
echo "Copying to local archive ..." ;\
scp -p $${files1} $${files2} $$myarchive/ || true;\
echo "Uploading documentation ..." ;\
$(MAKE) -C doc online; \
echo '/*' ;\
echo ' * All done; for checksums see dist/swdb.snippet' ;\
echo ' */' ;\
)

957
NEWS

File diff suppressed because it is too large Load Diff

41
README
View File

@ -1,7 +1,7 @@
GPGME - GnuPG Made Easy
---------------------------
Copyright 2001-2023 g10 Code GmbH
Copyright 2001-2017 g10 Code GmbH
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
@ -22,10 +22,10 @@ to public key crypto engines like GnuPG or GpgSM easier for
applications. GPGME provides a high-level crypto API for encryption,
decryption, signing, signature verification and key management.
GPGME comes with language bindings for Common Lisp, C++, QT, Python2,
GPGME comes with language bindings for Common Lisp, C++, QT, Python2
and Python 3.
GPGME uses GnuPG as its backend to support OpenPGP and the
GPGME uses GnuPG and GpgSM as its backends to support OpenPGP and the
Cryptographic Message Syntax (CMS).
See the files COPYING, COPYING.LESSER, and each file for copyright and
@ -41,14 +41,16 @@ See the file INSTALL for generic installation instructions.
Check that you have unmodified sources. See below on how to do this.
Don't skip it - this is an important step!
To build GPGME, you need to install libgpg-error (>= 1.36) and
Libassuan (>= 2.4.2).
To build GPGME, you need to install libgpg-error (>= 1.11) and
Libassuan (>= 2.0.2).
For support of the OpenPGP and the CMS protocols, you should use at
least GnuPG version 2.2.41 or 2.4.3, available at:
https://gnupg.org/ftp/gcrypt/gnupg/.
For support of the OpenPGP protocol (default), you should use the
latest version of GnuPG (>= 1.4) , available at:
ftp://ftp.gnupg.org/gcrypt/gnupg/. For support of the CMS
(Cryptographic Message Syntax) protocol and lot of other features, you
need a GnuPG version >= 2.0.
For building the Git version of GPGME please see the file README.GIT
For building the GIT version of GPGME please see the file README.GIT
for more information.
@ -66,25 +68,34 @@ a) If you have a trusted Version of GnuPG installed, you can simply check
This checks that the detached signature gpgme-x.y.z.tar.gz.sig is
indeed a a signature of gpgme-x.y.z.tar.gz. The key used to create
this signature is at least one of:
this signature is either of:
rsa2048 2011-01-12 [expires: 2019-12-31]
rsa2048/4F25E3B6 2011-01-12 [expires: 2019-12-31]
Key fingerprint = D869 2123 C406 5DEA 5E0F 3AB5 249B 39D2 4F25 E3B6
Werner Koch (dist sig)
rsa2048 2014-10-29 [expires: 2019-12-31]
rsa2048/E0856959 2014-10-29 [expires: 2019-12-31]
Key fingerprint = 46CC 7308 65BB 5C78 EBAB ADCF 0437 6F3E E085 6959
David Shaw (GnuPG Release Signing Key) <dshaw 'at' jabberwocky.com>
rsa2048 2014-10-29 [expires: 2020-10-30]
rsa2048/33BD3F06 2014-10-29 [expires: 2016-10-28]
Key fingerprint = 031E C253 6E58 0D8E A286 A9F2 2071 B08A 33BD 3F06
NIIBE Yutaka (GnuPG Release Key) <gniibe 'at' fsij.org>
rsa3072 2017-03-17 [expires: 2027-03-15]
rsa2048/7EFD60D9 2014-10-19 [expires: 2020-12-31]
Key fingerprint = D238 EA65 D64C 67ED 4C30 73F2 8A86 1B1C 7EFD 60D9
Werner Koch (Release Signing Key)
rsa3072/4B092E28 2017-03-17 [expires: 2027-03-15]
Key fingerprint = 5B80 C575 4298 F0CB 55D8 ED6A BCEF 7E29 4B09 2E28
Andre Heinecke (Release Signing Key)
The keys are available at <https://gnupg.org/signature_key.html>
You may retrieve these files from the keyservers using this command
gpg --recv-keys 249B39D24F25E3B6 04376F3EE0856959 \
2071B08A33BD3F06 8A861B1C7EFD60D9 BCEF7E294B092E28
The keys are also available at https://gnupg.org/signature_key.html
and in released GnuPG tarballs in the file g10/distsigkey.gpg .
You have to make sure that these are really the desired keys and
not faked one. You should do this by comparing the fingerprints

522
TODO
View File

@ -1,254 +1,58 @@
#+TITLE: TODO List
Hey Emacs, this is -*- org -*- mode!
* IMPORTANT!
:PROPERTIES:
:CUSTOM_ID: dev-gnupg-org
:END:
There was a nine year gap (2009 to 2018) between edits of this file,
so it is likely that much of the old information in it is wrong or
no longer applicable.
Bugs, feature requests and other development related work will be
tracked through the [[https://dev.gnupg.org/][dev.gnupg.org]] site.
* Documentation
:PROPERTIES:
:CUSTOM_ID: documentation
:END:
** Document all the new stuff.
:PROPERTIES:
:CUSTOM_ID: more-docs-is-better
:END:
*** TODO Fix this TODO list.
:PROPERTIES:
:CUSTOM_ID: fix-todo
:END:
Clean up the current TODO list. Include properties as relevant (so
if someone does make a PDF or HTML version the TOC will work).
Also check to see if some of these ancient things can be removed
(e.g. do we really need to fix things that were broken in GPG
1.3.x? I'm thinking not so much).
**** DONE fix TODO items
CLOSED: [2018-03-04 Sun 08:55]
:PROPERTIES:
:CUSTOM_ID: fix-todo-items
:END:
Adjust todo items so each can now be referenced by custom-id and
checked off as necessary.
** TODO Document validity and trust issues.
:PROPERTIES:
:CUSTOM_ID: valid-trust-issues
:END:
** In gpgme.texi: Register callbacks under the right letter in the index.
:PROPERTIES:
:CUSTOM_ID: gpgme-texi
:END:
* Document all the new stuff.
* Fix the remaining UI Server problems:
:PROPERTIES:
:CUSTOM_ID: ui-server-fix
:END:
** VERIFY --silent support.
:PROPERTIES:
:CUSTOM_ID: verify-silent
:END:
** ENCRYPT/DECRYPT/VERIFY/SIGN reset the engine, shouldn't be done with UISERVER?
:PROPERTIES:
:CUSTOM_ID: reset-engine-not-ui
:END:
* IMPORTANT
:PROPERTIES:
:CUSTOM_ID: important-stuff-really
:END:
** When using descriptor passing, we need to set the fd to blocking before
:PROPERTIES:
:CUSTOM_ID: set-fd-blocking
:END:
issuing simple commands, because we are mixing synchronous
issueing simple commands, because we are mixing synchronous
commands into potentially asynchronous operations.
** Might want to implement nonblock for w32 native backend!
:PROPERTIES:
:CUSTOM_ID: nonblock-win32
:END:
Right now we block reading the next line with assuan.
** Might want to implement nonblock for w32 native backend! Right now,
we block reading the next line with assuan.
* Before release:
:PROPERTIES:
:CUSTOM_ID: pre-release
:END:
** CANCELLED Some gpg tests fail with gpg 1.3.4-cvs (gpg/t-keylist-sig)
CLOSED: [2018-03-09 Fri 08:16]
:PROPERTIES:
:CUSTOM_ID: gpg-1-3-4-really
:END:
- State "CANCELLED" from "TODO" [2018-03-09 Fri 08:16] \\
WON'T FIX — too old or no longer applies.
** Some gpg tests fail with gpg 1.3.4-cvs (gpg/t-keylist-sig)
The test is currently disabled there and in gpg/t-import.
** When gpg supports it, write binary subpackets directly,
:PROPERTIES:
:CUSTOM_ID: binary-subpackets
:END:
and parse SUBPACKET status lines.
* ABI's to break:
:PROPERTIES:
:CUSTOM_ID: abi-breakage-apparently-on-purpose
:END:
** Old opassuan interface.
:PROPERTIES:
:CUSTOM_ID: old-opassuan
:END:
** Implementation: Remove support for old style error codes in
:PROPERTIES:
:CUSTOM_ID: remove-old-error-codes
:END:
conversion.c::_gpgme_map_gnupg_error.
** gpgme_edit_cb_t: Add "processed" return argument
:PROPERTIES:
:CUSTOM_ID: add-processed-return
:END:
(see edit.c::command_handler).
** I/O and User Data could be made extensible. But this can be done
:PROPERTIES:
:CUSTOM_ID: add-io-user-data
:END:
without breaking the ABI hopefully.
** All enums should be replaced by ints and simple macros for
:PROPERTIES:
:CUSTOM_ID: enums-should-be-ints
:END:
maximum compatibility.
** Compatibility interfaces that can be removed in future versions:
:PROPERTIES:
:CUSTOM_ID: compat-interfaces-to-go
:END:
*** gpgme_data_new_from_filepart
:PROPERTIES:
:CUSTOM_ID: gpgme-data-new-from-filepart
:END:
*** gpgme_data_new_from_file
:PROPERTIES:
:CUSTOM_ID: gpgme-data-new-from-file
:END:
*** gpgme_data_new_with_read_cb
:PROPERTIES:
:CUSTOM_ID: gpgme-data-new-with-read-cb
:END:
*** gpgme_data_rewind
:PROPERTIES:
:CUSTOM_ID: gpgme-data-rewind
:END:
*** gpgme_op_import_ext
:PROPERTIES:
:CUSTOM_ID: gpgme-op-import-ext
:END:
*** gpgme_get_sig_key
:PROPERTIES:
:CUSTOM_ID: gpgme-get-sig-key
:END:
*** gpgme_get_sig_ulong_attr
:PROPERTIES:
:CUSTOM_ID: gpgme-get-sig-ulong-attr
:END:
*** gpgme_get_sig_string_attr
:PROPERTIES:
:CUSTOM_ID: gpgme-get-sig-string-attr
:END:
*** GPGME_SIG_STAT_*
:PROPERTIES:
:CUSTOM_ID: gpgme-sig-stat
:END:
*** gpgme_get_sig_status
:PROPERTIES:
:CUSTOM_ID: gpgme-get-sig-status
:END:
*** gpgme_trust_item_release
:PROPERTIES:
:CUSTOM_ID: gpgme-trust-item-release
:END:
*** gpgme_trust_item_get_string_attr
:PROPERTIES:
:CUSTOM_ID: gpgme-trust-item-get-string-attr
:END:
*** gpgme_trust_item_get_ulong_attr
:PROPERTIES:
:CUSTOM_ID: gpgme-trust-item-get-ulong-attr
:END:
*** gpgme_attr_t
:PROPERTIES:
:CUSTOM_ID: gpgme-attr-t
:END:
*** All Gpgme* typedefs.
:PROPERTIES:
:CUSTOM_ID: all-gpgme-typedefs
:END:
* Thread support:
:PROPERTIES:
:CUSTOM_ID: threads
:END:
** When GNU Pth supports sendmsg/recvmsg, wrap them properly.
:PROPERTIES:
:CUSTOM_ID: wrap-oth
:END:
** Without timegm (3) support our ISO time parser is not thread safe.
:PROPERTIES:
:CUSTOM_ID: time-threads
:END:
There is a configure time warning, though.
* New features:
:PROPERTIES:
:CUSTOM_ID: new-features
:END:
** Flow control for data objects.
:PROPERTIES:
:CUSTOM_ID: flow-control-is-not-a-euphemism-for-an-s-bend
:END:
Currently, gpgme_data_t objects are assumed to be blocking. To
break this assumption, we need either (A) a way for an user I/O
callback to store the current operation in a continuation that can
@ -257,99 +61,49 @@ Hey Emacs, this is -*- org -*- mode!
respective event loop. or (B) a way for gpgme data objects to be
associated with a waitable object, that can be registered with the
user event loop. Neither is particularly simple.
** Extended notation support. When gpg supports arbitrary binary
:PROPERTIES:
:CUSTOM_ID: extended-notation
:END:
notation data, provide a user interface for that.
** notification system
:PROPERTIES:
:CUSTOM_ID: notification-system
:END:
We need a simple notification system, probably a simple callback
with a string and some optional arguments. This is for example
required to notify an application of a changed smartcard, The
application can then do whatever is required. There are other
usages too. This notification system should be independent of any
usages too. This notfication system should be independent of any
contextes of course.
Not sure whether this is still required. GPGME_PROTOCOL_ASSUAN is
sufficient for this.
** --learn-code support
:PROPERTIES:
:CUSTOM_ID: learn-code
:END:
This might be integrated with import. we still need to work out how
to learn a card when gpg and gpgsm have support for smartcards. In
GPA we currently invoke gpg directly.
** Might need a stat() for data objects and use it for length param to gpg.
:PROPERTIES:
:CUSTOM_ID: stat-data
:END:
** Implement support for photo ids.
:PROPERTIES:
:CUSTOM_ID: photo-id
:END:
** Allow selection of subkeys
:PROPERTIES:
:CUSTOM_ID: subkey-selection
:END:
** Allow to return time stamps in ISO format
:PROPERTIES:
:CUSTOM_ID: iso-format-datetime
:END:
This allows us to handle years later than 2037 properly. With the
time_t interface they are all mapped to 2037-12-31
This allows us to handle years later than 2037 properly. With the
time_t interface they are all mapped to 2037-12-31
** New features requested by our dear users, but rejected or left for
:PROPERTIES:
:CUSTOM_ID: feature-requests
:END:
later consideration:
*** Allow to export secret keys.
:PROPERTIES:
:CUSTOM_ID: export-secret-keys
:END:
Rejected because this is conceptually flawed. Secret keys on a
smart card can not be exported, for example.
May eventually e supproted with a keywrapping system.
*** Selecting the key ring, setting the version or comment in output.
:PROPERTIES:
:CUSTOM_ID: select-keyring-version
:END:
Rejected because the naive implementation is engine specific, the
configuration is part of the engine's configuration or readily
worked around in a different way
*** Selecting the symmetric cipher.
:PROPERTIES:
:CUSTOM_ID: symmetric-cipher-selection
:END:
*** Exchanging keys with key servers.
:PROPERTIES:
:CUSTOM_ID: key-server-exchange
:END:
* Documentation
** Document validity and trust issues.
** In gpgme.texi: Register callbacks under the right letter in the index.
* Engines
:PROPERTIES:
:CUSTOM_ID: engines
:END:
** Do not create/destroy engines, but create engine and then reset it.
:PROPERTIES:
:CUSTOM_ID: reset-engine-is-not-quite-just-ignition
:END:
Internally the reset operation still spawns a new engine process,
but this can be replaced with a reset later. Also, be very sure to
release everything properly at a reset and at an error. Think hard
@ -358,255 +112,85 @@ Hey Emacs, this is -*- org -*- mode!
Note that we need support in gpgsm to set include-certs to default
as RESET does not reset it, also for no_encrypt_to and probably
other options.
** Optimize the case where a data object has an underlying fd we can pass
:PROPERTIES:
:CUSTOM_ID: optimus-data-cousin-of-optimus-prime
:END:
directly to the engine. This will be automatic with socket I/O and
descriptor passing.
** Move code common to all engines up from gpg to engine.
:PROPERTIES:
:CUSTOM_ID: move-code-common-to-engines-out-of-gpg
:END:
** engine operations can return General Error on unknown protocol
:PROPERTIES:
:CUSTOM_ID: general-error-looking-to-be-court-martialled
:END:
(it's an internal error, as select_protocol checks already).
** When server mode is implemented properly, more care has to be taken to
:PROPERTIES:
:CUSTOM_ID: server-mode
:END:
release all resources on error (for example to free assuan_cmd).
** op_import_keys and op_export_keys have a limit in the number of keys.
:PROPERTIES:
:CUSTOM_ID: import-export-problems
:END:
** op_import_keys and op_export_keys have a limit ion the number of keys.
This is because we pass them in gpg via the command line and gpgsm
via an assuan control line. We should pipe them instead and maybe
change gpg/gpgsm to not put them in memory.
* GPG breakage:
:PROPERTIES:
:CUSTOM_ID: gpg-breakage
:END:
** CANCELLED gpg 1.4.2 lacks error reporting if sign/encrypt with revoked key.
CLOSED: [2018-03-09 Fri 08:19]
:PROPERTIES:
:CUSTOM_ID: gpg-classic-lacks-stuff
:END:
- State "CANCELLED" from "TODO" [2018-03-09 Fri 08:19] \\
WON'T FIX.
** CANCELLED gpg 1.4.2 does crappy error reporting (namely none at all) when
CLOSED: [2018-03-09 Fri 08:20]
:PROPERTIES:
:CUSTOM_ID: gpg-classic-problems-but-do-we-care
:END:
- State "CANCELLED" from "TODO" [2018-03-09 Fri 08:20] \\
WON'T FIX.
** gpg 1.4.2 lacks error reporting if sign/encrypt with revoked key.
** gpg 1.4.2 does crappy error reporting (namely none at all) when
smart card is missing for sign operation:
[GNUPG:] CARDCTRL 4
gpg: selecting openpgp failed: ec=6.110
gpg: signing failed: general error
[GNUPG:] BEGIN_ENCRYPTION 2 10
gpg: test: sign+encrypt failed: general error
** DONE Without agent and with wrong passphrase, gpg 1.4.2 enters into an
CLOSED: [2018-03-09 Fri 08:20]
:PROPERTIES:
:CUSTOM_ID: recursive-gpg-classic
:END:
- State "DONE" from "TODO" [2018-03-09 Fri 08:20] \\
Must have been fixed in a subsequent release.
** Without agent and with wrong passphrase, gpg 1.4.2 enters into an
infinite loop.
** CANCELLED Use correct argv[0]
CLOSED: [2018-03-09 Fri 08:24]
:PROPERTIES:
:CUSTOM_ID: correct-argv
:END:
- State "CANCELLED" from "TODO" [2018-03-09 Fri 08:24] \\
WON'T FIX.
Also, there is no rungpg.c file in GPGME (or in GPG or most, if not
all of the rest of the libs and packages; I suspect there hasn't been
for a very long time).
** Use correct argv[0]
In rungpg.c:build_argv we use
argv[argc] = strdup ("gpg"); /* argv[0] */
This should be changed to take the real file name used in account.
* Operations
:PROPERTIES:
:CUSTOM_ID: operations-are-not-surgical
:END:
** Include cert values -2, -1, 0 and 1 should be defined as macros.
:PROPERTIES:
:CUSTOM_ID: certified-macros
:END:
** If an operation failed, make sure that the result functions don't return
:PROPERTIES:
:CUSTOM_ID: operation-failure
:END:
corrupt partial information. !!!
NOTE: The EOF status handler is not called in this case !!!
** Verify must not fail on NODATA premature if auto-key-retrieval failed.
:PROPERTIES:
:CUSTOM_ID: autobot-key-retrieval
:END:
It should not fail silently if it knows there is an error. !!!
** All operations: Better error reporting. !!
:PROPERTIES:
:CUSTOM_ID: better-reporting-not-like-fox-news
:END:
** Export status handler need much more work. !!!
:PROPERTIES:
:CUSTOM_ID: export-status-handler
:END:
** Import should return a useful error when one happened.
:PROPERTIES:
:CUSTOM_ID: import-useful-stuff-even-wrong-stuff
:END:
*** Import does not take notice of NODATA status report.
:PROPERTIES:
:CUSTOM_ID: import-no-data
:END:
*** When GPGSM does issue IMPORT_OK status reports, make sure to check for
:PROPERTIES:
:CUSTOM_ID: gpgsm-import-ok
:END:
them in tests/gpgs m/t-import.c.
** Verify can include info about version/algo/class, but currently
:PROPERTIES:
:CUSTOM_ID: verify-class
:END:
this is only available for gpg, not gpgsm.
** Return ENC_TO output in verify result. Again, this is not available
:PROPERTIES:
:CUSTOM_ID: return-to-enc
:END:
for gpgsm.
** Genkey should return something more useful than General_Error.
:PROPERTIES:
:CUSTOM_ID: general-key-assumed-command-from-general-error
:END:
** If possible, use --file-setsize to set the file size for proper progress
:PROPERTIES:
:CUSTOM_ID: file-setsize
:END:
callback handling. Write data interface for file size.
** Optimize the file descriptor list, so the number of open fds is
:PROPERTIES:
:CUSTOM_ID: optimus-descriptus-younger-brother-of-optimus-prime
:END:
always known easily.
** Encryption: It should be verified that the behaviour for partially untrusted
:PROPERTIES:
:CUSTOM_ID: only-mostly-dead-means-partially-alive
:END:
recipients is correct.
** When GPG issues INV_something for invalid signers, catch them.
:PROPERTIES:
:CUSTOM_ID: invalid-sig
:END:
* Error Values
:PROPERTIES:
:CUSTOM_ID: error-value
:END:
** Map ASSUAN/GpgSM ERR error values in a better way than is done now. !!
:PROPERTIES:
:CUSTOM_ID: map-ass-error
:END:
** Some error values should identify the source more correctly (mostly error
:PROPERTIES:
:CUSTOM_ID: source-errors
:END:
values derived from status messages).
** In rungpg.c we need to check the version of the engine
:PROPERTIES:
:CUSTOM_ID: rungpg-c-engine-ver
:END:
This requires a way to get the cached version number from the
engine layer.
* Tests
:PROPERTIES:
:CUSTOM_ID: tests
:END:
** TODO Write a fake gpg-agent so that we can supply known passphrases to
:PROPERTIES:
:CUSTOM_ID: test-fake-gpg-agent
:END:
** Write a fake gpg-agent so that we can supply known passphrases to
gpgsm and setup the configuration files to use the agent. Without
this we are testing a currently running gpg-agent which is not a
clever idea. !
** t-data
:PROPERTIES:
:CUSTOM_ID: test-data
:END:
*** Test gpgme_data_release_and_get_mem.
:PROPERTIES:
:CUSTOM_ID: test-gpgme-data-release-mem
:END:
*** Test gpgme_data_seek for invalid types.
:PROPERTIES:
:CUSTOM_ID: test-gpgme-data-seek
:END:
** t-keylist
:PROPERTIES:
:CUSTOM_ID: test-keylist
:END:
Write a test for ext_keylist.
** Test reading key signatures.
:PROPERTIES:
:CUSTOM_ID: test-key-sig
:END:
* Debug
:PROPERTIES:
:CUSTOM_ID: debug
:END:
** Tracepoints should be added at: Every public interface enter/leave,
:PROPERTIES:
:CUSTOM_ID: tracepoint-pub-int
:END:
before and in every callback, at major decision points, at every
internal data point which might easily be observed by the outside
(system handles). We also trace handles and I/O support threads in
@ -618,83 +202,21 @@ Hey Emacs, this is -*- org -*- mode!
decrypt-verify.c delete.c edit.c encrypt.c encrypt-sign.c export.c
genkey.c import.c key.c keylist.c passphrase.c progress.c signers.c
sig-notation.c trust-item.c trustlist.c verify.c
** TODO Handle malloc and vasprintf errors. But decide first if they should be
:PROPERTIES:
:CUSTOM_ID: malloc-vasprintf
:END:
** Handle malloc and vasprintf errors. But decide first if they should be
ignored (and logged with 255?!), or really be assertions. !
* Build suite
:PROPERTIES:
:CUSTOM_ID: build-suite
:END:
** TODO Make sure everything is cleaned correctly (esp. test area).
:PROPERTIES:
:CUSTOM_ID: clean-tests
:END:
** TODO Enable AC_CONFIG_MACRO_DIR and bump up autoconf version requirement.
:PROPERTIES:
:CUSTOM_ID: autoconf-macros
:END:
** Make sure everything is cleaned correctly (esp. test area).
** Enable AC_CONFIG_MACRO_DIR and bump up autoconf version requirement.
(To fix "./autogen.sh; ./configure --enable-maintainer-mode; touch
configure.ac; make"). Currently worked around with ACLOCAL_AMFLAGS???
* Error checking
:PROPERTIES:
:CUSTOM_ID: error-checking
:END:
** TODO engine-gpgsm, with-validation
:PROPERTIES:
:CUSTOM_ID: gpgsm-validation
:END:
** engine-gpgsm, with-validation
Add error checking some time after releasing a new gpgsm.
* Language bindings and related components
:PROPERTIES:
:CUSTOM_ID: language-bindings-and-related-stuff
:END:
** TODO Emacs and elisp binding
:PROPERTIES:
:CUSTOM_ID: emacs-and-elisp
:END:
Currently GNU Emacs uses EPA and EPG to provide GnuPG support. EPG
does this by calling the GPG executable and wrapping the commands
with elisp functions. A more preferable solution would be to
implement an epgme.el which integrated with GPGME, then if it could
not to attempt calling the gpgme-tool and only if those failed to
fall back to the current epg.el and calling the command line
binaries.
** TODO API of an API
:PROPERTIES:
:CUSTOM_ID: api-squared
:END:
See the more detailed notes on this in the [[lang/python/docs/TODO.org][python TODO]].
** TODO GPGME installation and package management guide
:PROPERTIES:
:CUSTOM_ID: package-management
:END:
Write a guide/best practices for maintainers of GPGME packages with
third party package management systems.
* Copyright 2004, 2005, 2018 g10 Code GmbH
:PROPERTIES:
:CUSTOM_ID: copyright-and-license
:END:
Copyright 2004, 2005 g10 Code GmbH
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without

View File

@ -60,7 +60,7 @@ AC_DEFUN([GNUPG_CHECK_VA_COPY],
])
dnl LIST_MEMBER()
dnl Check whether an element ist contained in a list. Set `found' to
dnl Check wether an element ist contained in a list. Set `found' to
dnl `1' if the element is found in the list, to `0' otherwise.
AC_DEFUN([LIST_MEMBER],
[

View File

@ -2,13 +2,19 @@
case "$myhost" in
w32)
configure_opts=""
configure_opts="
--with-gpg-error-prefix=@SYSROOT@
--with-libassuan-prefix=@SYSROOT@
"
;;
amd64)
configure_opts=""
configure_opts="
--with-gpg-error-prefix=@SYSROOT@
--with-libassuan-prefix=@SYSROOT@
"
;;
esac
final_info="mkdir build && cd build && ../configure --enable-maintainer-mode && make"
final_info="./configure --enable-maintainer-mode && make"

View File

@ -1,6 +1,6 @@
#! /bin/sh
# autogen.sh
# Copyright (C) 2003, 2014, 2017, 2018, 2022 g10 Code GmbH
# Copyright (C) 2003, 2014 g10 Code GmbH
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
@ -15,7 +15,7 @@
# configure it for the respective package. It is maintained as part of
# GnuPG and source copied by other packages.
#
# Version: 2023-03-15
# Version: 2014-01-10
configure_ac="configure.ac"
@ -41,7 +41,7 @@ fatal () {
info () {
if [ -z "${SILENT}" ]; then
echo "autogen.sh:" "$*" >&2
echo "autogen.sh:" "$*"
fi
}
@ -70,8 +70,6 @@ MSGMERGE=${GETTEXT_PREFIX}${MSGMERGE:-msgmerge}${GETTEXT_SUFFIX}
DIE=no
FORCE=
SILENT=
PRINT_HOST=no
PRINT_BUILD=no
tmp=$(dirname "$0")
tsdir=$(cd "${tmp}"; pwd)
@ -79,18 +77,7 @@ if [ -n "${AUTOGEN_SH_SILENT}" ]; then
SILENT=" --silent"
fi
if test x"$1" = x"--help"; then
echo "usage: ./autogen.sh [OPTIONS] [ARGS]"
echo " Options:"
echo " --silent Silent operation"
echo " --force Pass --force to autoconf"
echo " --find-version Helper for configure.ac"
echo " --git-build Run all commands to build from a Git"
echo " --print-host Print only the host triplet"
echo " --print-build Print only the build platform triplet"
echo " --build-TYPE Configure to cross build for TYPE"
echo ""
echo " ARGS are passed to configure in --build-TYPE mode."
echo " Configuration for this script is expected in autogen.rc"
echo "usage: ./autogen.sh [--silent] [--force] [--build-TYPE] [ARGS]"
exit 0
fi
if test x"$1" = x"--silent"; then
@ -101,14 +88,6 @@ if test x"$1" = x"--force"; then
FORCE=" --force"
shift
fi
if test x"$1" = x"--print-host"; then
PRINT_HOST=yes
shift
fi
if test x"$1" = x"--print-build"; then
PRINT_BUILD=yes
shift
fi
# Reject unsafe characters in $HOME, $tsdir and cwd. We consider spaces
@ -137,6 +116,8 @@ extraoptions=
# List of optional variables sourced from autogen.rc and ~/.gnupg-autogen.rc
w32_toolprefixes=
w32_extraoptions=
w32ce_toolprefixes=
w32ce_extraoptions=
w64_toolprefixes=
w64_extraoptions=
amd64_toolprefixes=
@ -144,6 +125,7 @@ amd64_toolprefixes=
# What follows are variables which are sourced but default to
# environment variables or lacking them hardcoded values.
#w32root=
#w32ce_root=
#w64root=
#amd64root=
@ -151,19 +133,15 @@ amd64_toolprefixes=
myhost=""
myhostsub=""
case "$1" in
--find-version)
myhost="find-version"
SILENT=" --silent"
shift
;;
--git-build)
myhost="git-build"
shift
;;
--build-w32)
myhost="w32"
shift
;;
--build-w32ce)
myhost="w32"
myhostsub="ce"
shift
;;
--build-w64)
myhost="w32"
myhostsub="64"
@ -183,25 +161,6 @@ esac
die_p
# **** GIT BUILD ****
# This is a helper to build from git.
if [ "$myhost" = "git-build" ]; then
tmp="$(pwd)"
cd "$tsdir" || fatal "error cd-ing to $tsdir"
./autogen.sh || fatal "error running ./autogen.sh"
cd "$tmp" || fatal "error cd-ing back to $tmp"
die_p
"$tsdir"/configure || fatal "error running $tsdir/configure"
die_p
make || fatal "error running make"
die_p
make check || fatal "error running make check"
die_p
exit 0
fi
# **** end GIT BUILD ****
# Source our configuration
if [ -f "${tsdir}/autogen.rc" ]; then
. "${tsdir}/autogen.rc"
@ -213,90 +172,23 @@ if [ -f "$HOME/.gnupg-autogen.rc" ]; then
. "$HOME/.gnupg-autogen.rc"
fi
# **** FIND VERSION ****
# This is a helper for the configure.ac M4 magic
# Called
# ./autogen.sh --find-version PACKAGE MAJOR MINOR [MICRO]
# returns a complete version string with automatic beta numbering.
if [ "$myhost" = "find-version" ]; then
package="$1"
major="$2"
minor="$3"
micro="$4"
if [ -z "$package" -o -z "$major" -o -z "$minor" ]; then
echo "usage: ./autogen.sh --find-version PACKAGE MAJOR MINOR [MICRO]" >&2
exit 1
fi
if [ -z "$micro" ]; then
matchstr1="$package-$major.[0-9]*"
matchstr2="$package-$major-base"
matchstr3=""
vers="$major.$minor"
else
matchstr1="$package-$major.$minor.[0-9]*"
matchstr2="$package-$major.[0-9]*-base"
matchstr3="$package-$major-base"
vers="$major.$minor.$micro"
fi
beta=no
if [ -e .git ]; then
ingit=yes
tmp=$(git describe --match "${matchstr1}" --long 2>/dev/null)
if [ -n "$tmp" ]; then
tmp=$(echo "$tmp" | sed s/^"$package"// \
| awk -F- '$3!=0 && $3 !~ /^beta/ {print"-beta"$3}')
else
# (due tof "-base" in the tag we need to take the 4th field)
tmp=$(git describe --match "${matchstr2}" --long 2>/dev/null)
if [ -n "$tmp" ]; then
tmp=$(echo "$tmp" | sed s/^"$package"// \
| awk -F- '$4!=0 && $4 !~ /^beta/ {print"-beta"$4}')
elif [ -n "${matchstr3}" ]; then
tmp=$(git describe --match "${matchstr3}" --long 2>/dev/null)
if [ -n "$tmp" ]; then
tmp=$(echo "$tmp" | sed s/^"$package"// \
| awk -F- '$4!=0 && $4 !~ /^beta/ {print"-beta"$4}')
fi
fi
fi
[ -n "$tmp" ] && beta=yes
rev=$(git rev-parse --short HEAD | tr -d '\n\r')
rvd=$((0x$(echo ${rev} | dd bs=1 count=4 2>/dev/null)))
else
ingit=no
beta=yes
tmp="-unknown"
rev="0000000"
rvd="0"
fi
echo "$package-$vers$tmp:$beta:$ingit:$vers$tmp:$vers:$tmp:$rev:$rvd:"
exit 0
fi
# **** end FIND VERSION ****
if [ ! -f "$tsdir/build-aux/config.guess" ]; then
fatal "$tsdir/build-aux/config.guess not found"
exit 1
fi
build=`$tsdir/build-aux/config.guess`
if [ $PRINT_BUILD = yes ]; then
echo "$build"
exit 0
fi
# ******************
# W32 build script
# ******************
if [ "$myhost" = "w32" ]; then
if [ ! -f "$tsdir/build-aux/config.guess" ]; then
fatal "$tsdir/build-aux/config.guess not found"
exit 1
fi
build=`$tsdir/build-aux/config.guess`
case $myhostsub in
ce)
w32root="$w32ce_root"
[ -z "$w32root" ] && w32root="$HOME/w32ce_root"
toolprefixes="$w32ce_toolprefixes arm-mingw32ce"
extraoptions="$extraoptions $w32ce_extraoptions"
;;
64)
w32root="$w64root"
[ -z "$w32root" ] && w32root="$HOME/w64root"
@ -330,10 +222,6 @@ if [ "$myhost" = "w32" ]; then
fi
die_p
fi
if [ $PRINT_HOST = yes ]; then
echo "$host"
exit 0
fi
if [ -f "$tsdir/config.log" ]; then
if ! head $tsdir/config.log | grep "$host" >/dev/null; then
@ -344,8 +232,7 @@ if [ "$myhost" = "w32" ]; then
$tsdir/configure --enable-maintainer-mode ${SILENT} \
--prefix=${w32root} \
--host=${host} --build=${build} SYSROOT=${w32root} \
PKG_CONFIG_LIBDIR=${w32root}/lib/pkgconfig \
--host=${host} --build=${build} \
${configure_opts} ${extraoptions} "$@"
rc=$?
exit $rc
@ -355,6 +242,13 @@ fi
# ***** AMD64 cross build script *******
# Used to cross-compile for AMD64 (for testing)
if [ "$myhost" = "amd64" ]; then
shift
if [ ! -f $tsdir/build-aux/config.guess ]; then
echo "$tsdir/build-aux/config.guess not found" >&2
exit 1
fi
build=`$tsdir/build-aux/config.guess`
[ -z "$amd64root" ] && amd64root="$HOME/amd64root"
info "Using $amd64root as standard install directory"
replace_sysroot
@ -375,10 +269,6 @@ if [ "$myhost" = "amd64" ]; then
echo "Stop." >&2
exit 1
fi
if [ $PRINT_HOST = yes ]; then
echo "$host"
exit 0
fi
if [ -f "$tsdir/config.log" ]; then
if ! head $tsdir/config.log | grep "$host" >/dev/null; then
@ -451,11 +341,8 @@ fi
# Check the git setup.
if [ -d .git ]; then
CP="cp -p"
# If we have a GNU cp we can add -v
if cp --version >/dev/null 2>/dev/null; then
[ -z "${SILENT}" ] && CP="$CP -v"
fi
CP="cp -a"
[ -z "${SILENT}" ] && CP="$CP -v"
if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then
[ -z "${SILENT}" ] && cat <<EOF
*** Activating trailing whitespace git pre-commit hook. ***
@ -484,10 +371,6 @@ EOF
EOF
$CP build-aux/git-hooks/commit-msg .git/hooks/commit-msg
chmod +x .git/hooks/commit-msg
if [ x"${display_name}" != x ]; then
git config format.subjectPrefix "PATCH ${display_name}"
git config sendemail.to "${patches_to}"
fi
fi
fi

View File

@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a

1614
build-aux/config.guess vendored

File diff suppressed because it is too large Load Diff

2911
build-aux/config.sub vendored

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@ scriptversion=2013-05-30.07; # UTC
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a

View File

@ -1,68 +0,0 @@
#
# This is a sed script to patch the generated libtool,
# which works well against both of libtool 2.4.2 and 2.4.7.
#
# You may use this work under the terms of a Creative Commons CC0 1.0
# License/Waiver.
#
# CC0 Public Domain Dedication
# https://creativecommons.org/publicdomain/zero/1.0/
#
# This sed script applys two hunks of the patch:
#
# Part1: after the comment "# bleh windows"
# Part2: after the comment "#extension on DOS 8.3..."
#
# Only when those two parts are patched correctly, it exits with 0 or
# else, it exits with 1
#
# Find the part 1, by the comment
/^[ \t]*# bleh windows$/b part1_start
# Not found the part1, raise an error
$ q1
b
:part1_start
n
# The first line in the part 1 must be the begining of the case statement.
/^[ \t]*case \$host in$/! q1
n
# Insert the entry for x86_64-*mingw32*, for modified versuffix.
i\
x86_64-*mingw32*)
i\
func_arith $current - $age
i\
major=$func_arith_result
i\
versuffix="6-$major"
i\
;;
:part1_0
# Find the end of the case statement
/^[ \t]*esac$/b find_part2
# Not found the end of the case statement, raise an error
$ q1
n
b part1_0
:find_part2
/^[ \t]*# extension on DOS 8.3 file.*systems.$/b part2_process
# Not found the part2, raise an error
$ q1
n
b find_part2
:part2_process
$ q1
s/^[ \t]*\(versuffix=\)\(.*\)\(-$major\)\(.*\)$/\t case \$host in\n\t x86_64-*mingw32*)\n\t \1\26\3\4\n\t ;;\n\t *)\n\t \1\2\3\4\n\t ;;\n\t esac/
t part2_done
n
b part2_process
:part2_done
$ q0
n
b part2_done

View File

@ -24,7 +24,7 @@
#
# You should have received a copy of the GNU General Public License
# along with GNU Libtool; see the file COPYING. If not, a copy
# can be downloaded from https://www.gnu.org/licenses/gpl.html,
# can be downloaded from http://www.gnu.org/licenses/gpl.html,
# or obtained by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@ -75,8 +75,8 @@
# autoconf: $autoconf_version
#
# Report bugs to <bug-libtool@gnu.org>.
# GNU libtool home page: <https://www.gnu.org/software/libtool/>.
# General help using GNU software: <https://www.gnu.org/gethelp/>.
# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
# General help using GNU software: <http://www.gnu.org/gethelp/>.
PROGRAM=libtool
PACKAGE=libtool

View File

@ -18,7 +18,7 @@ scriptversion=2010-08-21.06; # UTC
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a

View File

@ -17,7 +17,7 @@ scriptversion=2013-10-28.13; # UTC
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@ -103,7 +103,7 @@ fi
perl_URL=http://www.perl.org/
flex_URL=http://flex.sourceforge.net/
gnu_software_URL=https://www.gnu.org/software
gnu_software_URL=http://www.gnu.org/software
program_details ()
{

View File

@ -20,7 +20,7 @@
% General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <https://www.gnu.org/licenses/>.
% along with this program. If not, see <http://www.gnu.org/licenses/>.
%
% As a special exception, when this file is read by TeX when processing
% a Texinfo source document, you may use the result without
@ -31,7 +31,7 @@
% reports; you can get the latest version from:
% http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
% http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
% https://www.gnu.org/software/texinfo/ (the Texinfo home page)
% http://www.gnu.org/software/texinfo/ (the Texinfo home page)
% The texinfo.tex in any given distribution could well be out
% of date, so if that's what you're using, please check.
%
@ -55,7 +55,7 @@
% extent. You can get the existing language-specific files from the
% full Texinfo distribution.
%
% The GNU Texinfo home page is https://www.gnu.org/software/texinfo.
% The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
\message{Loading texinfo [version \texinfoversion]:}
@ -482,7 +482,7 @@
% \def\foo{\parsearg\Xfoo}
% \def\Xfoo#1{...}
%
% Actually, I use \csname\string\foo\endcsname, i.e. \\foo, as it is my
% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
% favourite TeX trick. --kasal, 16nov03
\def\parseargdef#1{%

View File

@ -1,2 +0,0 @@
Configuration files may go here. Note that config.h.in is
auto-generated so that this file is not in git.

View File

@ -1,6 +1,7 @@
# configure.ac for GPGME
# Copyright (C) 2000 Werner Koch (dd9jn)
# Copyright (C) 2001-2021 g10 Code GmbH
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
# 2009, 2010, 2011, 2012, 2013, 2014, 2015 g10 Code GmbH
#
# This file is part of GPGME.
#
@ -14,90 +15,81 @@
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see <https://gnu.org/licenses/>.
# SPDX-License-Identifier: LGPL-2.1-or-later
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <https://www.gnu.org/licenses/>.
# (Process this file with autoconf to produce a configure script.)
AC_PREREQ([2.69])
AC_PREREQ(2.59)
min_automake_version="1.14"
# To build a release you need to create a tag with the version number
# "gpgme-n.m.k" and run "./autogen.sh --force". Please bump the
# version number immediately after the release and do another commit
# and push so that the git magic is able to work. If you start a new
# series by bumping the minor (m) remember to also create a tag named
# "gpgme-n.m-base" as the start point for beta numbering. See below
# (git tag -s gpgme-n.m.k) and run "./autogen.sh --force". Please
# bump the version number immediately after the release and do another
# commit and push so that the git magic is able to work. See below
# for the LT versions.
m4_define([mym4_package],[gpgme])
m4_define([mym4_major], [1])
m4_define([mym4_minor], [24])
m4_define([mym4_micro], [0])
m4_define(mym4_version_major, [1])
m4_define(mym4_version_minor, [9])
m4_define(mym4_version_micro, [1])
# Below is m4 magic to extract and compute the git revision number,
# the decimalized short revision number, a beta version string and a
# flag indicating a development version (mym4_isbeta). Note that the
# m4 processing is done by autoconf and not during the configure run.
m4_define([mym4_verslist], m4_split(m4_esyscmd([./autogen.sh --find-version] \
mym4_package mym4_major mym4_minor mym4_micro),[:]))
m4_define([mym4_isbeta], m4_argn(2, mym4_verslist))
m4_define([mym4_version], m4_argn(4, mym4_verslist))
m4_define([mym4_revision], m4_argn(7, mym4_verslist))
m4_define([mym4_revision_dec], m4_argn(8, mym4_verslist))
m4_esyscmd([echo ]mym4_version[>VERSION])
AC_INIT([mym4_package],[mym4_version],[https://bugs.gnupg.org])
# Below is m4 magic to extract and compute the revision number, the
# decimalized short revision number, a beta version string, and a flag
# indicating a development version (mym4_isgit). Note that the m4
# processing is done by autoconf and not during the configure run.
m4_define(mym4_version,
[mym4_version_major.mym4_version_minor.mym4_version_micro])
m4_define([mym4_revision],
m4_esyscmd([git rev-parse --short HEAD | tr -d '\n\r']))
m4_define([mym4_revision_dec],
m4_esyscmd_s([echo $((0x$(echo ]mym4_revision[|head -c 4)))]))
m4_define([mym4_betastring],
m4_esyscmd_s([git describe --match 'gpgme-[0-9].*[0-9]' --long|\
awk -F- '$3!=0{print"-beta"$3}']))
m4_define([mym4_isgit],m4_if(mym4_betastring,[],[no],[yes]))
m4_define([mym4_full_version],[mym4_version[]mym4_betastring])
AC_INIT([gpgme],[mym4_full_version],[http://bugs.gnupg.org])
# LT Version numbers, remember to change them just *before* a release.
# (Code changed: REVISION++)
# (Interfaces added/removed/changed: CURRENT++, REVISION=0)
# (Interfaces added: AGE++)
# (Interfaces removed: AGE=0)
# (Interfaces removed/changed: AGE=0)
#
LIBGPGME_LT_CURRENT=43
LIBGPGME_LT_AGE=32
LIBGPGME_LT_REVISION=1
LIBGPGME_LT_CURRENT=29
LIBGPGME_LT_AGE=18
LIBGPGME_LT_REVISION=0
# If there is an ABI break in gpgmepp or qgpgme also bump the
# version in IMPORTED_LOCATION in the GpgmeppConfig-w32.cmake.in.in
LIBGPGMEPP_LT_CURRENT=26
LIBGPGMEPP_LT_AGE=20
LIBGPGMEPP_LT_REVISION=1
LIBGPGMEPP_LT_CURRENT=10
LIBGPGMEPP_LT_AGE=4
LIBGPGMEPP_LT_REVISION=0
LIBQGPGME_LT_CURRENT=20
LIBQGPGME_LT_AGE=5
LIBQGPGME_LT_REVISION=1
################################################
AC_SUBST(LIBGPGME_LT_CURRENT)
AC_SUBST(LIBGPGME_LT_AGE)
AC_SUBST(LIBGPGME_LT_REVISION)
AC_SUBST(LIBGPGMEPP_LT_CURRENT)
AC_SUBST(LIBGPGMEPP_LT_AGE)
AC_SUBST(LIBGPGMEPP_LT_REVISION)
AC_SUBST(LIBQGPGME_LT_CURRENT)
AC_SUBST(LIBQGPGME_LT_AGE)
AC_SUBST(LIBQGPGME_LT_REVISION)
LIBQGPGME_LT_CURRENT=9
LIBQGPGME_LT_AGE=2
LIBQGPGME_LT_REVISION=0
# If the API is changed in an incompatible way: increment the next counter.
GPGME_CONFIG_API_VERSION=1
##############################################
NEED_GPG_ERROR_VERSION=1.47
NEED_GPG_ERROR_VERSION=1.17
NEED_LIBASSUAN_API=2
NEED_LIBASSUAN_VERSION=2.4.2
NEED_LIBASSUAN_VERSION=2.0.2
VERSION_MAJOR=mym4_major
VERSION_MINOR=mym4_minor
VERSION_MICRO=mym4_micro
PACKAGE=$PACKAGE_NAME
VERSION=$PACKAGE_VERSION
VERSION_MAJOR=mym4_version_major
VERSION_MINOR=mym4_version_minor
VERSION_MICRO=mym4_version_micro
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/gpgme.h.in])
AC_CONFIG_HEADERS([conf/config.h])
AC_CONFIG_SRCDIR(src/gpgme.h.in)
AC_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([serial-tests dist-bzip2 no-dist-gzip])
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
@ -105,42 +97,7 @@ AM_SILENT_RULES
AC_ARG_VAR(SYSROOT,[locate config scripts also below that directory])
# Enable GNU extensions on systems that have them.
AC_USE_SYSTEM_EXTENSIONS
# Taken from mpfr-4.0.1, then modified for LDADD_FOR_TESTS_KLUDGE
dnl Under Linux, make sure that the old dtags are used if LD_LIBRARY_PATH
dnl is defined. The issue is that with the new dtags, LD_LIBRARY_PATH has
dnl the precedence over the run path, so that if a compatible MPFR library
dnl is installed in some directory from $LD_LIBRARY_PATH, then the tested
dnl MPFR library will be this library instead of the MPFR library from the
dnl build tree. Other OS with the same issue might be added later.
dnl
dnl References:
dnl https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859732
dnl http://lists.gnu.org/archive/html/libtool/2017-05/msg00000.html
dnl
dnl We need to check whether --disable-new-dtags is supported as alternate
dnl linkers may be used (e.g., with tcc: CC=tcc LD=tcc).
dnl
case $host in
*-*-linux*)
if test -n "$LD_LIBRARY_PATH"; then
saved_LDFLAGS="$LDFLAGS"
LDADD_FOR_TESTS_KLUDGE="-Wl,--disable-new-dtags"
LDFLAGS="$LDFLAGS $LDADD_FOR_TESTS_KLUDGE"
AC_MSG_CHECKING(whether --disable-new-dtags is supported by the linker)
AC_LINK_IFELSE([AC_LANG_SOURCE([[
int main (void) { return 0; }
]])],
[AC_MSG_RESULT(yes (use it since LD_LIBRARY_PATH is set))],
[AC_MSG_RESULT(no)
LDADD_FOR_TESTS_KLUDGE=""
])
LDFLAGS="$saved_LDFLAGS"
fi
;;
esac
AC_SUBST([LDADD_FOR_TESTS_KLUDGE])
AC_GNU_SOURCE
AH_VERBATIM([_REENTRANT],
[/* To allow the use of GPGME in multithreaded programs we have to use
@ -152,18 +109,30 @@ AH_VERBATIM([_REENTRANT],
#endif])
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
# Note: A suitable gitlog-to-changelog script can be found in GnuPG master.
AC_CHECK_PROGS(GITLOG_TO_CHANGELOG, gitlog-to-changelog, [gitlog-to-changelog])
AC_SUBST(LIBGPGME_LT_CURRENT)
AC_SUBST(LIBGPGME_LT_AGE)
AC_SUBST(LIBGPGME_LT_REVISION)
AC_SUBST(LIBGPGMEPP_LT_CURRENT)
AC_SUBST(LIBGPGMEPP_LT_AGE)
AC_SUBST(LIBGPGMEPP_LT_REVISION)
AC_SUBST(LIBQGPGME_LT_CURRENT)
AC_SUBST(LIBQGPGME_LT_AGE)
AC_SUBST(LIBQGPGME_LT_REVISION)
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR)
AC_SUBST(VERSION_MICRO)
VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x%02x" mym4_major \
mym4_minor mym4_micro)
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x%02x" mym4_version_major \
mym4_version_minor mym4_version_micro)
AC_SUBST(VERSION_NUMBER)
# We need to compile and run a program on the build machine. A
@ -198,7 +167,7 @@ case "${host}" in
have_ld_version_script=yes
;;
*-apple-darwin*)
AC_DEFINE(_DARWIN_C_SOURCE, 1,
AC_DEFINE(_DARWIN_C_SOURCE, 900000L,
Expose all libc features (__DARWIN_C_FULL).)
AC_DEFINE(_XOPEN_SOURCE, 500, Activate POSIX interface on MacOS X)
;;
@ -206,44 +175,6 @@ esac
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
#
# Specify how we support our local modification of libtool for Windows
# 64-bit. Options are:
#
# (1) apply: when appying patch fails, it results failure of entire build
# (2) never: never apply the patch (no try)
# (3) try: use patched if it goes well, use original if fails
#
AC_ARG_WITH([libtool-modification],
AS_HELP_STRING([--with-libtool-modification=apply|never|try],
[how to handle libtool modification (default=never)]),
build_libtool_modification=$withval,
build_libtool_modification=never)
#
# Apply a patch (locally maintained one of ours) to libtool
#
case $host in
x86_64-*mingw32*)
AC_CONFIG_COMMANDS([libtool-patch],[[
if test "$build_selection" = never; then
echo "patch not applied"
elif (mv -f libtool libtool.orig; \
sed -f $srcdir/build-aux/libtool-patch.sed libtool.orig >libtool); then
echo "applied successfully"
elif test "$build_selection" = try; then
mv -f libtool.orig libtool
echo "patch failed, thus, using original"
else
echo "patch failed"
as_fn_exit 1
fi
]],[build_selection=$build_libtool_modification])
;;
*)
;;
esac
GPG_DEFAULT=no
GPGSM_DEFAULT=no
GPGCONF_DEFAULT=no
@ -256,12 +187,15 @@ have_w64_system=no
have_macos_system=no
build_w32_glib=no
build_w32_qt=no
available_languages="cl cpp python qt qt5 qt6"
default_languages="cl cpp python qt5 qt6"
available_languages="cl cpp python python2 python3 qt"
default_languages="cl cpp python qt"
case "${host}" in
x86_64-*mingw32*)
have_w64_system=yes
;;
*-mingw32ce*)
have_w32ce_system=yes
;;
*-linux-androideabi)
have_android_system=yes
;;
@ -270,7 +204,7 @@ case "${host}" in
;;
esac
case "${host}" in
*-mingw32*)
*-mingw32ce*|*-mingw32*)
have_dosish_system=yes
have_w32_system=yes
GPG_DEFAULT='c:\\gnupg\\gpg.exe'
@ -281,7 +215,7 @@ case "${host}" in
AM_PATH_GLIB_2_0
AC_ARG_ENABLE(w32-glib,
AS_HELP_STRING([--enable-w32-glib],[build GPGME Glib for W32]),
AC_HELP_STRING([--enable-w32-glib], [build GPGME Glib for W32]),
build_w32_glib=$enableval)
;;
*)
@ -314,6 +248,12 @@ if test "$have_w64_system" = yes; then
fi
AM_CONDITIONAL(HAVE_W64_SYSTEM, test "$have_w64_system" = yes)
if test "$have_w32ce_system" = yes; then
AC_DEFINE(HAVE_W32CE_SYSTEM,1,
[Defined if we run on a W32 CE API based system])
fi
AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
if test "$have_android_system" = yes; then
AC_DEFINE(HAVE_ANDROID_SYSTEM,1, [Defined if we build for an Android system])
fi
@ -329,7 +269,7 @@ AM_CONDITIONAL(BUILD_W32_GLIB, test "$build_w32_glib" = yes)
AC_ARG_ENABLE([fixed-path],
AS_HELP_STRING([--enable-fixed-path=PATH],
AC_HELP_STRING([--enable-fixed-path=PATH],
[locate binaries only via this PATH]),
[fixed_search_path="$enableval"],
[fixed_search_path=""])
@ -338,44 +278,12 @@ if test x$fixed_search_path != x ; then
[Locate binaries only via this PATH])
fi
# Option --enable-reduce-relocations
#
# Allow building the Qt 6 bindings explicitly with -fPIC if the automatic
# detection fails. Note: We assume that this flag is always available (unless
# we built for Windows).
AC_ARG_ENABLE([reduce-relocations],
AS_HELP_STRING([--enable-reduce-relocations],
[build Qt 6 bindings with -fPIC (default is
auto)]),
[use_reduce_relocations="$enableval"],
[use_reduce_relocations=""])
# Option --enable-no-direct-extern-access
#
# Some distributions build Qt 6 with -mno-direct-extern-access. Libraries and
# applications using Qt then must also be build with this flag. As workaround
# for a bug in Qt's pkgconfig files which don't have this flag we allow
# building with this flag explicitly.
AC_LANG_PUSH(C++)
AX_CHECK_COMPILE_FLAG([-mno-direct-extern-access],
[have_no_direct_extern_access="yes"],
[have_no_direct_extern_access="no"],
[-Werror])
AC_LANG_POP()
AC_ARG_ENABLE([no-direct-extern-access],
AS_HELP_STRING([--enable-no-direct-extern-access],
[build Qt 6 bindings with
-mno-direct-extern-access (default is auto)]),
[use_no_direct_extern_access="$enableval"],
[use_no_direct_extern_access=""])
# Note: You need to declare all possible languages also in
# Note: You need to declare all possible langauges also in
# lang/Makefile.am's DIST_SUBDIRS.
AC_ARG_ENABLE([languages],
AS_HELP_STRING([--enable-languages=languages],
[enable only specific language bindings:
cl cpp python qt5 qt6]),
AC_HELP_STRING([--enable-languages=languages],
[enable only specific language bindings]),
[enabled_languages=`echo $enableval | \
tr ',:' ' ' | tr '[A-Z]' '[a-z]' | \
sed 's/c++/cpp/'`],
@ -401,182 +309,69 @@ for language in $enabled_languages; do
fi
done
# Check whether qt5 and/or qt6 are enabled
want_qt5="no"
LIST_MEMBER("qt5", $enabled_languages)
if test "$found" = "1"; then
if test "$explicit_languages" = "1"; then
want_qt5="yes"
else
want_qt5="maybe"
fi
# Remove qt5; further down qt will be added
enabled_languages=$(echo $enabled_languages | sed 's/qt5//')
fi
want_qt6="no"
LIST_MEMBER("qt6", $enabled_languages)
if test "$found" = "1"; then
if test "$explicit_languages" = "1"; then
want_qt6="yes"
else
want_qt6="maybe"
fi
# Remove qt6; further down qt will be added
enabled_languages=$(echo $enabled_languages | sed 's/qt6//')
fi
# Check whether qt is enabled; if yes then it has been enabled explicitly
want_qt="no"
LIST_MEMBER("qt", $enabled_languages)
if test "$found" = "1"; then
# Ignore qt if specified together with qt5 or qt6
if test "$want_qt5" = "no" -a "$want_qt6" = "no"; then
want_qt="yes"
fi
# Remove qt
enabled_languages=$(echo $enabled_languages | sed 's/qt//')
AC_MSG_WARN([[
***
*** Language binding "qt" is deprecated and will be removed in a future version.
*** Use "qt5" and/or "qt6" instead.
***]])
fi
# Ensure that pkg-config is available for all calls of FIND_QT5/FIND_QT6
PKG_PROG_PKG_CONFIG
# Check for Qt 5 (if qt5 or qt is enabled)
if test "$want_qt" = "yes"; then
want_qt5="maybe"
fi
if test "$want_qt5" != "no"; then
FIND_QT5
if test "$have_qt5_libs" = "yes"; then
want_qt5="yes"
elif test "$want_qt5" = "yes"; then
AC_MSG_ERROR([[
***
*** Qt5 (Qt5Core) is required for the Qt 5 binding.
***]])
else
want_qt5="no"
fi
fi
# Check for Qt 6 (if qt6 is enabled or if qt is enabled and Qt 5 wasn't found)
if test "$want_qt" = "yes" -a "$have_qt5_libs" != "yes"; then
want_qt6="maybe"
fi
if test "$want_qt6" != "no"; then
FIND_QT6
if test "$have_qt6_libs" = "yes"; then
want_qt6="yes";
elif test "$want_qt6" = "yes"; then
AC_MSG_ERROR([[
***
*** Qt6 (Qt6Core) is required for the Qt 6 binding.
***]])
else
want_qt6="no"
fi
fi
# Check if any Qt was found (if qt is enabled)
if test "$want_qt" = "yes" -a "$have_qt5_libs" != "yes" -a "$have_qt6_libs" != "yes"; then
AC_MSG_ERROR([[
***
*** Qt5 (Qt5Core) or Qt6 (Qt6Core) is required for the Qt bindings.
***]])
fi
# Check that cpp is enabled if qt5 or qt6 is enabled and was found
if test "$want_qt5" = "yes" -o "$want_qt6" = "yes"; then
LIST_MEMBER("cpp", $enabled_languages)
if test "$found" = "0"; then
AC_MSG_ERROR([[
***
*** The Qt bindings depend on the C++ binding.
***]])
fi
fi
# Enable C++ 17 if qt6 is requested
if test "$want_qt6" = "yes"; then
AX_CXX_COMPILE_STDCXX(17, noext, optional)
if test "$HAVE_CXX17" != "1"; then
if test "$explicit_languages" = "1"; then
AC_MSG_ERROR([[
***
*** A compiler with c++17 support is required for the Qt 6 binding.
***]])
else
want_qt6="no"
AC_MSG_WARN([[
***
*** No c++17 support detected. Qt 6 binding will be disabled.
***]])
fi
fi
fi
# Enable C++ 11 if cpp is requested (unless C++ 17 was already enabled)
# Enable C++ 11 if cpp language is requested
LIST_MEMBER("cpp", $enabled_languages)
if test "$found" = "1" -a "$HAVE_CXX17" != "1"; then
if test "$found" = "1"; then
AX_CXX_COMPILE_STDCXX(11, noext, optional)
if test "$HAVE_CXX11" != "1"; then
if test "$explicit_languages" = "1"; then
AC_MSG_ERROR([[
***
*** A compiler with c++11 support is required for the C++ binding.
*** A compiler with c++11 support is required for the c++ binding.
***]])
else
enabled_languages=$(echo $enabled_languages | sed 's/cpp//')
want_qt5="no"
enabled_languages=$(echo $enabled_languages | sed 's/qt//')
AC_MSG_WARN([[
***
*** No c++11 support detected. C++ and Qt 5 bindings will be disabled.
*** No c++11 support detected. C++ and Qt bindings will be disabled.
***]])
fi
fi
fi
# Now append qt to the list of language bindings (to enable the subdir in lang)
if test "$want_qt5" = "yes" -o "$want_qt6" = "yes"; then
enabled_languages=$(echo $enabled_languages qt)
fi
# Check whether compiler supports visibility attribute (if cpp language is enabled)
LIST_MEMBER("cpp", $enabled_languages)
# Check that if qt is enabled cpp also is enabled
LIST_MEMBER("qt", $enabled_languages)
if test "$found" = "1"; then
AX_GCC_FUNC_ATTRIBUTE(visibility)
if test "$ax_cv_have_func_attribute_visibility" = "yes"; then
GPGME_CPP_CFLAGS="$GPGME_CPP_CFLAGS -fvisibility=hidden"
if test "$want_qt5" = "yes"; then
GPGME_QT5_CFLAGS="$GPGME_QT5_CFLAGS -fvisibility=hidden"
# We need to ensure that in the langauge order qt comes after cpp
# so we remove qt first and explicitly add it as last list member.
enabled_languages=$(echo $enabled_languages | sed 's/qt//')
LIST_MEMBER("cpp", $enabled_languages)
if test "$found" = "0"; then
AC_MSG_ERROR([[
***
*** Qt language binding depends on cpp binding.
***]])
fi
FIND_QT
if test "$have_qt5_libs" != "yes"; then
if test "$explicit_languages" = "1"; then
AC_MSG_ERROR([[
***
*** Qt5 (Qt5Core) is required for Qt binding.
***]])
else
AC_MSG_WARN([[
***
*** Qt5 (Qt5Core) not found Qt Binding will be disabled.
***]])
fi
if test "$want_qt6" = "yes"; then
GPGME_QT6_CFLAGS="$GPGME_QT6_CFLAGS -fvisibility=hidden"
else
enabled_languages=`echo $enabled_languages qt`
AC_CHECK_PROGS([DOXYGEN], [doxygen])
if test -z "$DOXYGEN";
# This is not highlighted becase it's not really important.
then AC_MSG_WARN([Doxygen not found - Qt binding doc will not be built.])
fi
AC_CHECK_PROGS([GRAPHVIZ], [dot])
if test -z "$GRAPHVIZ";
then AC_MSG_WARN([Graphviz not found - Qt binding doc will not have diagrams.])
fi
fi
fi
AC_SUBST(GPGME_CPP_CFLAGS)
AM_CONDITIONAL(WANT_QT5, test "$want_qt5" = yes)
AM_CONDITIONAL(WANT_QT6, test "$want_qt6" = yes)
# Check for tools for building the Qt binding docs
if test "$want_qt5" = "yes" -o "$want_qt6" = "yes"; then
AC_CHECK_PROGS([DOXYGEN], [doxygen])
if test -z "$DOXYGEN"; then
# This is not highlighted because it's not really important.
AC_MSG_WARN([Doxygen not found - Qt binding doc will not be built.])
fi
AC_CHECK_PROGS([GRAPHVIZ], [dot])
if test -z "$GRAPHVIZ"; then
AC_MSG_WARN([Graphviz not found - Qt binding doc will not have diagrams.])
fi
fi
AM_CONDITIONAL([HAVE_DOXYGEN],
[test -n "$DOXYGEN"])
if test -n "$GRAPHVIZ"; then
@ -587,9 +382,13 @@ fi
AC_SUBST(HAVE_DOT)
# Python bindings.
LIST_MEMBER("python2", $enabled_languages)
found_py2=$found
LIST_MEMBER("python3", $enabled_languages)
found_py3=$found
LIST_MEMBER("python", $enabled_languages)
found_py=$found
if test "$found_py" = "1"; then
if test "$found_py" = "1" -o "$found_py2" = "1" -o "$found_py3" = "1"; then
AX_PKG_SWIG
if test -z "$SWIG"; then
if test "$explicit_languages" = "1"; then
@ -601,19 +400,39 @@ if test "$found_py" = "1"; then
enabled_languages=$(echo $enabled_languages | sed 's/python//')
fi
else
# Reset the version collecting vars.
# Reset all the stuff, just to be sure.
PYTHONS=
PYTHON_VERSIONS=
unset PYTHON
unset PYTHON_VERSION
unset PYTHON_CPPFLAGS
unset PYTHON_LDFLAGS
unset PYTHON_SITE_PKG
unset PYTHON_EXTRA_LIBS
unset PYTHON_EXTRA_LDFLAGS
unset ac_cv_path_PYTHON
unset am_cv_pathless_PYTHON
unset am_cv_python_version
unset am_cv_python_platform
unset am_cv_python_pythondir
unset am_cv_python_pyexecdir
if test "$found_py" = "1" -o "$found_py2" = "1"; then
AM_PATH_PYTHON([2.7], [
AX_PYTHON_DEVEL
if test "$PYTHON_VERSION"; then
PYTHONS="$(echo $PYTHONS $PYTHON)"
PYTHON_VERSIONS="$(echo $PYTHON_VERSIONS $PYTHON_VERSION)"
fi
], :)
fi
if test "$found_py" = "1" -o "$found_py3" = "1"; then
# Reset everything, so that we can look for another Python.
m4_foreach([mym4pythonver],
[[2.7],[3.6],[3.8],[3.9],[3.10],[3.11],[3.12],[all]],
[unset PYTHON
# Reset everything, so that we can look for another Python.
unset PYTHON
unset PYTHON_VERSION
unset PYTHON_CPPFLAGS
unset PYTHON_LDFLAGS
unset PYTHON_LIBS
unset PYTHON_SITE_PKG
unset PYTHON_EXTRA_LIBS
unset PYTHON_EXTRA_LDFLAGS
@ -623,14 +442,13 @@ if test "$found_py" = "1"; then
unset am_cv_python_platform
unset am_cv_python_pythondir
unset am_cv_python_pyexecdir
AM_PATH_PYTHON(mym4pythonver, [
AX_PYTHON_DEVEL([], [true])
AM_PATH_PYTHON([3.4], [
AX_PYTHON_DEVEL
if test "$PYTHON_VERSION"; then
PYTHONS="$(echo $PYTHONS $PYTHON)"
PYTHON_VERSIONS="$(echo $PYTHON_VERSIONS $PYTHON_VERSION)"
fi
], :, m4_if([mym4pythonver],[all],[],[python]mym4pythonver))
])
], :)
fi
# Recover some values lost in the second attempt to find Python.
@ -656,6 +474,7 @@ if test "$found_py" = "1"; then
fi
AC_SUBST(PYTHONS, $PYTHONS)
AC_SUBST(PYTHON_VERSIONS, $PYTHON_VERSIONS)
fi
fi
@ -670,15 +489,13 @@ AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
[GIT commit id revision used to build this package])
changequote(,)dnl
BUILD_VERSION=`echo "$PACKAGE_VERSION" | sed 's/\([0-9.]*\).*/\1./'`
BUILD_FILEVERSION=`echo "$PACKAGE_VERSION"|sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
changequote([,])dnl
BUILD_VERSION="${BUILD_VERSION}mym4_revision_dec"
BUILD_FILEVERSION=`echo "${BUILD_VERSION}" | tr . ,`
AC_SUBST(BUILD_VERSION)
BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec"
AC_SUBST(BUILD_FILEVERSION)
AC_ARG_ENABLE([build-timestamp],
AS_HELP_STRING([--enable-build-timestamp],
AC_HELP_STRING([--enable-build-timestamp],
[set an explicit build timestamp for reproducibility.
(default is the current time in ISO-8601 format)]),
[if test "$enableval" = "yes"; then
@ -697,51 +514,41 @@ AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
#
run_gpgconf_test="yes"
AC_ARG_ENABLE(gpgconf-test,
AS_HELP_STRING([--disable-gpgconf-test],[disable GPGCONF regression test]),
AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF regression test]),
run_gpgconf_test=$enableval)
AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
run_gpg_test="yes"
AC_ARG_ENABLE(gpg-test,
AS_HELP_STRING([--disable-gpg-test],[disable GPG regression test]),
AC_HELP_STRING([--disable-gpg-test], [disable GPG regression test]),
run_gpg_test=$enableval)
AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
run_gpgsm_test="yes"
AC_ARG_ENABLE(gpgsm-test,
AS_HELP_STRING([--disable-gpgsm-test],[disable GPGSM regression test]),
AC_HELP_STRING([--disable-gpgsm-test], [disable GPGSM regression test]),
run_gpgsm_test=$enableval)
AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
run_g13_test="yes"
AC_ARG_ENABLE(g13-test,
AS_HELP_STRING([--disable-g13-test],[disable G13 regression test]),
AC_HELP_STRING([--disable-g13-test], [disable G13 regression test]),
run_g13_test=$enableval)
AM_CONDITIONAL(RUN_G13_TESTS, test "$run_g13_test" = "yes")
# Checks for header files.
AC_CHECK_HEADERS_ONCE([locale.h sys/select.h sys/uio.h argp.h stdint.h
unistd.h poll.h sys/time.h sys/types.h sys/stat.h])
AC_CHECK_HEADERS_ONCE([locale.h sys/select.h sys/uio.h argp.h
unistd.h sys/time.h sys/types.h sys/stat.h])
# Type checks.
AC_C_INLINE
AC_C_FLEXIBLE_ARRAY_MEMBER
AC_CHECK_SIZEOF(unsigned int)
AC_SYS_LARGEFILE
AC_TYPE_OFF_T
AC_TYPE_UINTPTR_T
# We require uint64_t
if test "$ac_cv_header_stdint_h" != yes; then
AC_MSG_ERROR([[
***
*** No stdint.h and thus no uint64_t type. Can't build this library.
***]])
fi
# A simple compile time check in gpgme.h for GNU/Linux systems that
# prevents a file offset bits mismatch between gpgme and the application.
NEED__FILE_OFFSET_BITS=0
@ -786,30 +593,24 @@ AM_SUBST_NOTMAKE(API__SSIZE_T)
# Checks for compiler features.
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
CFLAGS="$CFLAGS -Wno-format-y2k"
# If -Wno-missing-field-initializers is supported we can expect a
# a larger set of warning options.
AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
_gcc_cflags_save=$CFLAGS
CFLAGS="-Wno-missing-field-initializers"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
AC_MSG_RESULT($_gcc_wopt)
CFLAGS=$_gcc_cflags_save;
if test x"$_gcc_wopt" = xyes ; then
CFLAGS="$CFLAGS -Wno-missing-field-initializers"
CFLAGS="$CFLAGS -Wno-sign-compare"
CFLAGS="$CFLAGS -Wno-format-zero-length"
CFLAGS="$CFLAGS -Wno-format-truncation"
CFLAGS="$CFLAGS -Wno-sizeof-pointer-div"
fi
if test "$USE_MAINTAINER_MODE" = "yes"; then
CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
# If -Wno-missing-field-initializers is supported we can enable a
# a bunch of really useful warnings.
AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
_gcc_cflags_save=$CFLAGS
CFLAGS="-Wno-missing-field-initializers"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
AC_MSG_RESULT($_gcc_wopt)
CFLAGS=$_gcc_cflags_save;
if test x"$_gcc_wopt" = xyes ; then
CFLAGS="$CFLAGS -W -Wextra -Wbad-function-cast"
CFLAGS="$CFLAGS -Wwrite-strings"
CFLAGS="$CFLAGS -Wdeclaration-after-statement"
CFLAGS="$CFLAGS -Wno-missing-field-initializers"
CFLAGS="$CFLAGS -Wno-sign-compare"
fi
CFLAGS="$CFLAGS -Wformat -Wformat-security"
CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wno-shadow"
AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
@ -855,7 +656,7 @@ fi
# Try to find a thread-safe version of getenv().
have_thread_safe_getenv=no
jm_GLIBC21
if test $GLIBC21 = yes -o $have_w32_system = yes; then
if test $GLIBC21 = yes; then
have_thread_safe_getenv=yes
fi
if test $have_thread_safe_getenv = yes; then
@ -890,9 +691,6 @@ AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
[The default error source for GPGME.])
AM_CONDITIONAL(USE_GPGRT_CONFIG, [test -n "$GPGRT_CONFIG" \
-a "$ac_cv_path_GPG_ERROR_CONFIG" = no])
# And for libassuan.
have_libassuan=no
AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
@ -908,7 +706,7 @@ fi
#
# Check for getgid etc
AC_CHECK_FUNCS(getgid getegid closefrom nanosleep)
AC_CHECK_FUNCS(getgid getegid closefrom)
# Replacement functions.
@ -938,7 +736,7 @@ AC_CHECK_MEMBER(struct cmsghdr.cmsg_len,
use_descriptor_passing=yes
AC_ARG_ENABLE(fd-passing,
AS_HELP_STRING([--disable-fd-passing],[do not use FD passing]),
AC_HELP_STRING([--disable-fd-passing], [do not use FD passing]),
use_descriptor_passing=$enableval)
if test "$supports_descriptor_passing" != "yes"; then
@ -964,28 +762,7 @@ fi
AM_CONDITIONAL(HAVE_UISERVER, test "$uiserver" != "no")
# Option --disable-linux-getdents
#
# By default we use SYS_getdents on Linux to optimize fd closing
# before an exec. This option allows to switch this optimization off.
use_linux_getdents=yes
AC_ARG_ENABLE(linux-getdents,
AS_HELP_STRING([--disable-linux-getdents],
[do not use SYS_getdents on Linux]),
use_linux_getdents=$enableval)
if test "$use_linux_getdents" = "yes"; then
case "${host}" in
*-*-linux*)
AC_DEFINE(USE_LINUX_GETDENTS,1,
[Defined if SYS_getdents can be used on Linux])
;;
esac
fi
#
# Add a few constants to help porting to W32
#
AH_VERBATIM([SEPCONSTANTS],
[
/* Separators as used in $PATH and file name. */
@ -1008,56 +785,19 @@ AH_BOTTOM([
# define GPGME_GCC_A_PURE
#endif
/* Under Windows we use the gettext code from gpgrt. */
#define GPG_ERR_ENABLE_GETTEXT_MACROS 1
/* Under WindowsCE we need gpg-error's strerror macro. */
#define GPG_ERR_ENABLE_ERRNO_MACROS 1
#define CRIGHTBLURB "Copyright (C) 2000 Werner Koch\n" \
"Copyright (C) 2001--2021 g10 Code GmbH\n"
"Copyright (C) 2001--2017 g10 Code GmbH\n"
])
# Substitution used for gpgme-config and gpgme.pc
# Substitution used for gpgme-config
GPGME_CONFIG_LIBS="-lgpgme"
GPGME_CONFIG_CFLAGS=""
GPGME_CONFIG_HOST="$host"
GPGME_CONFIG_AVAIL_LANG="$enabled_languages"
case "$includedir" in
/usr/include|/include) ;;
'${prefix}/include')
if test "$prefix" != / -a "$prefix" != /usr; then
if test -z "$GPGME_CONFIG_CFLAGS"; then
GPGME_CONFIG_CFLAGS="-I\${includedir}"
else
GPGME_CONFIG_CFLAGS="-I\${includedir} $GPGME_CONFIG_CFLAGS"
fi
fi
;;
*)
if test -z "$GPGME_CONFIG_CFLAGS"; then
GPGME_CONFIG_CFLAGS="-I\${includedir}"
else
GPGME_CONFIG_CFLAGS="-I\${includedir} $GPGME_CONFIG_CFLAGS"
fi
;;
esac
case "$libdir" in
/usr/lib|/usr/lib64|/lib|/lib64) ;;
'${exec_prefix}/lib'|'${exec_prefix}/lib64')
if test "$exec_prefix" = "NONE"; then
if test "$prefix" != / -a "$prefix" != /usr; then
GPGME_CONFIG_LIBS="-L\${libdir} $GPGME_CONFIG_LIBS"
fi
elif test "$exec_prefix" != / -a "$exec_prefix" != /usr; then
GPGME_CONFIG_LIBS="-L\${libdir} $GPGME_CONFIG_LIBS"
fi
;;
*) GPGME_CONFIG_LIBS="-L\${libdir} $GPGME_CONFIG_LIBS" ;;
esac
AC_SUBST(GPGME_CONFIG_API_VERSION)
AC_SUBST(GPGME_CONFIG_LIBS)
AC_SUBST(GPGME_CONFIG_CFLAGS)
@ -1090,7 +830,7 @@ if test "$have_gpg_error" = "no"; then
***
*** You need libgpg-error to build this program.
** This library is for example available at
*** https://www.gnupg.org/ftp/gcrypt/libgpg-error/
*** ftp://ftp.gnupg.org/gcrypt/libgpg-error
*** (at least version $NEED_GPG_ERROR_VERSION is required.)
***]])
fi
@ -1100,7 +840,7 @@ if test "$have_libassuan" = "no"; then
***
*** You need libassuan to build this program.
*** This library is for example available at
*** https://www.gnupg.org/ftp/gcrypt/libassuan/
*** ftp://ftp.gnupg.org/gcrypt/libassuan/
*** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
***]])
fi
@ -1122,55 +862,30 @@ AC_CONFIG_FILES(Makefile src/Makefile
tests/gpg/Makefile
tests/gpgsm/Makefile
tests/opassuan/Makefile
tests/json/Makefile
doc/Makefile
src/versioninfo.rc
src/gpgme.pc
src/gpgme-glib.pc
src/gpgme.h)
AC_CONFIG_FILES(src/gpgme-config, chmod +x src/gpgme-config)
AC_CONFIG_FILES(lang/cpp/Makefile lang/cpp/src/Makefile)
AC_CONFIG_FILES(lang/cpp/tests/Makefile)
AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfig-w32.cmake.in)
AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfig.cmake.in)
AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfigVersion.cmake)
AC_CONFIG_FILES(lang/cpp/src/gpgmepp_version.h)
AC_CONFIG_FILES(lang/qt/Makefile lang/qt/src/Makefile)
if test "$want_qt5" = "yes"; then
AC_CONFIG_FILES(lang/qt/src/QGpgmeConfig-w32.cmake.in)
AC_CONFIG_FILES(lang/qt/src/QGpgmeConfig.cmake.in)
AC_CONFIG_FILES(lang/qt/src/QGpgmeConfigVersion.cmake)
fi
if test "$want_qt6" = "yes"; then
AC_CONFIG_FILES(lang/qt/src/QGpgmeQt6Config-w32.cmake.in)
AC_CONFIG_FILES(lang/qt/src/QGpgmeQt6Config.cmake.in)
AC_CONFIG_FILES(lang/qt/src/QGpgmeQt6ConfigVersion.cmake)
fi
AC_CONFIG_FILES(lang/qt/src/QGpgmeConfig-w32.cmake.in)
AC_CONFIG_FILES(lang/qt/src/QGpgmeConfig.cmake.in)
AC_CONFIG_FILES(lang/qt/src/QGpgmeConfigVersion.cmake)
AC_CONFIG_FILES(lang/qt/tests/Makefile)
AC_CONFIG_FILES(lang/qt/src/qgpgme_version.h)
AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd])
AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([lang/qt/doc/Doxyfile])])
AC_CONFIG_FILES([lang/js/Makefile lang/js/src/Makefile
lang/js/BrowserTestExtension/Makefile
lang/js/DemoExtension/Makefile])
AC_CONFIG_FILES(lang/qt/doc/Makefile)
AC_CONFIG_FILES([lang/python/Makefile
lang/python/version.py
lang/python/tests/Makefile
lang/python/src/Makefile
lang/python/examples/Makefile
lang/python/doc/Makefile])
lang/python/gpg/version.py
lang/python/tests/Makefile])
AC_CONFIG_FILES([lang/python/setup.py], [chmod a+x lang/python/setup.py])
AC_OUTPUT
if test "$want_qt5" = "yes" -a "$want_qt6" = "yes"; then
enabled_languages_v=$(echo ${enabled_languages_v:-$enabled_languages} | sed "s/qt/qt (Qt 5, Qt 6)/")
elif test "$want_qt5" = "yes"; then
enabled_languages_v=$(echo ${enabled_languages_v:-$enabled_languages} | sed "s/qt/qt (Qt 5)/")
elif test "$want_qt6" = "yes"; then
enabled_languages_v=$(echo ${enabled_languages_v:-$enabled_languages} | sed "s/qt/qt (Qt 6)/")
fi
echo "
GPGME v${VERSION} has been configured as follows:

49
contrib/ChangeLog-2011 Normal file
View File

@ -0,0 +1,49 @@
2011-12-02 Werner Koch <wk@g10code.com>
NB: ChangeLog files are no longer manually maintained. Starting
on December 1st, 2011 we put change information only in the GIT
commit log, and generate a top-level ChangeLog file from logs at
"make dist". See doc/HACKING for details.
2010-11-15 Marcus Brinkmann <mb@g10code.com>
* conf-w32ce-msc/fcntl.h: New file.
* conf-w32ce-msc/build.mk (conf_sources): Add fnctl.h.
(sources): Remove memrchr.c.
* conf-w32ce-msc/io.h: New file.
* conf-w32ce-msc/build.mk (conf_sources): Add io.h.
* conf-w32ce-msc/stdint.h: New file.
* conf-w32ce-msc/build.mk (conf_sources): Add stdint.h.
* conf-w32ce-msc/build.mk (copy-static-source): Revert last change.
2010-11-15 Werner Koch <wk@g10code.com>
* conf-w32ce-msc/build.mk (copy-static-source): Create stdint.h.
(all): Add ws2.lib
(clean): New.
2010-11-04 Werner Koch <wk@g10code.com>
* conf-w32ce-msc/build.mk (copy-built-source): Revert last
change. Does not work with W32CE where MSC defines it in except.h.
2010-11-03 Werner Koch <wk@g10code.com>
* conf-w32ce-msc/build.mk (copy-built-source): Create dummy sehmap.h.
2010-11-01 Werner Koch <wk@g10code.com>
* conf-w32ce-msc/config.h: New.
* conf-w32ce-msc/build.mk: New.
Copyright (C) 2010 g10 Code GmbH
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
modifications, as long as this notice is preserved.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

256
contrib/conf-w32ce-msc/build.mk Executable file
View File

@ -0,0 +1,256 @@
# build.mk - Makefile to build libgpg-error using Visual-C
# Copyright 2010 g10 Code GmbH
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This file is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# This is a helper make script to build libgpg-error for WindowsCE
# using the Microsoft Visual C compiler.
targetdir = /home/smb/xppro-gnu/src/gpgme/src
# The target build directory where we run the Visual C compiler/ This
# needs to be an absolute directory name. Further we expect this
# structure of the tree:
#
# TARGET/src - Source directories: One directory for each project
# /bin - Installed DLLs
# /lib - Installed import libs.
# /include - Instaled header files.
targetdir = /home/smb/xppro-gnu
targetsrc = $(targetdir)/src
# Install directories (relative)
bindir = ../../../bin
libdir = ../../../lib
incdir = ../../../include
help:
@echo "Run "
@echo " make -f ../contrib/conf-w32ce-msc/build.mk copy-source"
@echo "on the POSIX system and then"
@echo " nmake -f build.mk all"
@echo " nmake -f build.mk install"
@echo "on the Windows system"
ce_defines = -DWINCE -D_WIN32_WCE=0x502 -DUNDER_CE \
-DWIN32_PLATFORM_PSPC -D_UNICODE -DUNICODE \
-D_CONSOLE -DARM -D_ARM_
#-D_DEBUG -DDEBUG
CFLAGS = -nologo -W3 -fp:fast -Os $(ce_defines) \
-DHAVE_CONFIG_H -DDLL_EXPORT -D_CRT_SECURE_NO_WARNINGS \
-I. -I$(incdir) -I$(incdir)/gpg-extra
LDFLAGS =
# Standard source files
sources = \
assuan-support.c \
ath-pth.c \
ath-pthread.c \
ath.c \
ath.h \
context.h \
conversion.c \
data-compat.c \
data-fd.c \
data-mem.c \
data-stream.c \
data-user.c \
data.c \
data.h \
debug.c \
debug.h \
decrypt-verify.c \
decrypt.c \
delete.c \
dirinfo.c \
edit.c \
encrypt-sign.c \
encrypt.c \
engine-assuan.c \
engine-backend.h \
engine-g13.c \
engine-gpg.c \
engine-gpgconf.c \
engine-gpgsm.c \
engine-uiserver.c \
engine.c \
engine.h \
error.c \
export.c \
funopen.c \
genkey.c \
get-env.c \
getauditlog.c \
gpgconf.c \
gpgme-tool.c \
gpgme-w32spawn.c \
gpgme.c \
import.c \
isascii.c \
kdpipeiodevice.h \
key.c \
keylist.c \
op-support.c \
opassuan.c \
ops.h \
passphrase.c \
passwd.c \
priv-io.h \
progress.c \
putc_unlocked.c \
sema.h \
setenv.c \
sig-notation.c \
sign.c \
signers.c \
stpcpy.c \
trust-item.c \
trustlist.c \
ttyname_r.c \
util.h \
vasprintf.c \
verify.c \
version.c \
vfs-create.c \
vfs-mount.c \
w32-ce.c \
w32-ce.h \
w32-glib-io.c \
w32-io.c \
w32-sema.c \
w32-util.c \
wait-global.c \
wait-private.c \
wait-user.c \
wait.c \
wait.h \
gpgme.def
# The object files we need to create from sources.
objs = \
conversion.obj \
get-env.obj \
data.obj \
data-fd.obj \
data-stream.obj \
data-mem.obj \
data-user.obj \
data-compat.obj \
signers.obj \
sig-notation.obj \
wait.obj \
wait-global.obj \
wait-private.obj \
wait-user.obj \
op-support.obj \
encrypt.obj \
encrypt-sign.obj \
decrypt.obj \
decrypt-verify.obj \
verify.obj \
sign.obj \
passphrase.obj \
progress.obj \
key.obj \
keylist.obj \
trust-item.obj \
trustlist.obj \
import.obj \
export.obj \
genkey.obj \
delete.obj \
edit.obj \
getauditlog.obj \
opassuan.obj \
passwd.obj \
engine.obj \
engine-gpg.obj \
engine-gpgsm.obj \
assuan-support.obj \
engine-assuan.obj \
engine-gpgconf.obj \
engine-g13.obj \
vfs-mount.obj \
vfs-create.obj \
gpgconf.obj \
w32-ce.obj \
w32-util.obj \
w32-sema.obj \
w32-io.obj \
dirinfo.obj \
debug.obj \
gpgme.obj \
version.obj \
error.obj \
ath.obj \
vasprintf.obj \
ttyname_r.obj \
stpcpy.obj \
setenv.obj
# Sources files in this directory inclduing this Makefile
conf_sources = \
build.mk \
config.h \
stdint.h io.h fcntl.h
# Source files built by running the standard build system.
built_sources = \
gpgme.h \
status-table.h
copy-static-source:
@if [ ! -f ./gpgme.c ]; then \
echo "Please cd to the src/ directory first"; \
exit 1; \
fi
cp -t $(targetsrc)/gpgme/src $(sources);
cd ../contrib/conf-w32ce-msc ; \
cp -t $(targetsrc)/gpgme/src $(conf_sources)
copy-built-source:
@if [ ! -f ./gpgme.h ]; then \
echo "Please build using ./autogen.sh --build-w32ce first"; \
exit 1; \
fi
cp -t $(targetsrc)/gpgme/src $(built_sources)
copy-source: copy-static-source copy-built-source
.c.obj:
$(CC) $(CFLAGS) -c $<
all: $(sources) $(conf_sources) $(built_sources) $(objs)
link /DLL /IMPLIB:libgpgme-11-msc.lib \
/OUT:libgpgme-11-msc.dll \
/DEF:gpgme.def /NOLOGO /MANIFEST:NO \
/NODEFAULTLIB:"oldnames.lib" /DYNAMICBASE:NO \
$(objs) \
$(libdir)/libgpg-error-0-msc.lib \
$(libdir)/libassuan-0-msc.lib \
coredll.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib \
commctrl.lib ws2.lib /subsystem:windowsce,5.02
# Note that we don't need to create the install directories because
# libgpg-error must have been build and installed prior to this
# package.
install: all
copy /y gpgme.h $(incdir:/=\)
copy /y libgpgme-11-msc.dll $(bindir:/=\)
copy /y libgpgme-11-msc.lib $(libdir:/=\)
clean:
del *.obj libgpgme-11-msc.lib libgpgme-11-msc.dll libgpgme-11-msc.exp

View File

@ -0,0 +1,314 @@
/* config.h for building with Visual-C for WindowsCE.
* Copyright 2010 g10 Code GmbH
*
* This file is free software; as a special exception the author gives
* unlimited permission to copy and/or distribute it, with or without
* modifications, as long as this notice is preserved.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/* This file was originally created by running
* ./autogen.sh --build-w32ce
* on svn revision 1495 (gpgme 1.3.1-svn1495) and then adjusted to work
* with Visual-C.
*/
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.3.1-svn1495-msc1"
/* Name of this package */
#define PACKAGE "gpgme"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "bug-gpgme@gnupg.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "gpgme"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "gpgme " PACKAGE_VERSION
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "gpgme"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Whether Assuan support is enabled */
#define ENABLE_ASSUAN 1
/* Whether G13 support is enabled */
#define ENABLE_G13 1
/* Whether GPGCONF support is enabled */
#define ENABLE_GPGCONF 1
/* Whether GPGSM support is enabled */
#define ENABLE_GPGSM 1
/* Defined if we are building with uiserver support. */
/* #undef ENABLE_UISERVER */
/* Path to the G13 binary. */
#define G13_PATH "c:\\gnupg\\g13.exe"
/* Path to the GPGCONF binary. */
#define GPGCONF_PATH "c:\\gnupg\\gpgconf.exe"
/* version of the libassuan library */
#define GPGME_LIBASSUAN_VERSION "2.0.2-svn381"
/* Path to the GPGSM binary. */
#define GPGSM_PATH "c:\\gnupg\\gpgsm.exe"
/* The default error source for GPGME. */
#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GPGME
/* Path to the GnuPG binary. */
#define GPG_PATH "c:\\gnupg\\gpg.exe"
/* Define to 1 if you have the <dlfcn.h> header file. */
/* #undef HAVE_DLFCN_H */
/* Defined if we run on some of the PCDOS like systems (DOS, Windoze. OS/2)
with special properties like no file modes */
#define HAVE_DOSISH_SYSTEM 1
/* Define to 1 if the system has the type `error_t'. */
/* #undef HAVE_ERROR_T */
/* Define to 1 if you have the `fopencookie' function. */
/* #undef HAVE_FOPENCOOKIE */
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
/* #undef HAVE_FSEEKO */
/* Define to 1 if you have the `funopen' function. */
/* #undef HAVE_FUNOPEN */
/* Define to 1 if you have the `getegid' function. */
/* #undef HAVE_GETEGID */
/* Define to 1 if you have the `getenv_r' function. */
/* #undef HAVE_GETENV_R */
/* Define to 1 if you have the `getgid' function. */
/* #undef HAVE_GETGID */
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <locale.h> header file. */
/* #undef HAVE_LOCALE_H */
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define if we have Pth. */
/* #undef HAVE_PTH */
/* Define if we have pthread. */
/* #undef HAVE_PTHREAD */
/* Define to 1 if you have the `setenv' function. */
/* #undef HAVE_SETENV */
/* Define to 1 if you have the `setlocale' function. */
/* #undef HAVE_SETLOCALE */
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `stpcpy' function. */
/* #undef HAVE_STPCPY */
/* Define to 1 if you have the <strings.h> header file. */
/* #undef HAVE_STRINGS_H */
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
/* #undef HAVE_SYS_SELECT_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
/* #undef HAVE_SYS_STAT_H */
/* Define to 1 if you have the <sys/types.h> header file. */
/* #undef HAVE_SYS_TYPES_H */
/* Define to 1 if you have the <sys/uio.h> header file. */
/* #undef HAVE_SYS_UIO_H */
/* Define if getenv() is thread-safe */
/* #undef HAVE_THREAD_SAFE_GETENV */
/* Define to 1 if you have the `timegm' function. */
/* #undef HAVE_TIMEGM */
/* Define if __thread is supported */
/* #define HAVE_TLS 1 */
/* Define to 1 if you have the `ttyname_r' function. */
/* #undef HAVE_TTYNAME_R */
/* Define to 1 if the system has the type `uintptr_t'. */
#define HAVE_UINTPTR_T 1
/* Define to 1 if you have the <unistd.h> header file. */
/* #define HAVE_UNISTD_H 1 */
/* Define to 1 if you have the `vasprintf' function. */
/* #undef HAVE_VASPRINTF */
/* Defined if we run on a W32 CE API based system */
#define HAVE_W32CE_SYSTEM 1
/* Defined if we run on a W32 API based system */
#define HAVE_W32_SYSTEM 1
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* used to implement the va_copy macro */
/* #undef MUST_COPY_VA_BYVAL */
/* Min. needed G13 version. */
#define NEED_G13_VERSION "2.1.0"
/* Min. needed GPGCONF version. */
#define NEED_GPGCONF_VERSION "2.0.4"
/* Min. needed GPGSM version. */
#define NEED_GPGSM_VERSION "1.9.6"
/* Min. needed GnuPG version. */
#define NEED_GPG_VERSION "1.4.0"
/* Separators as used in $PATH. */
#ifdef HAVE_DOSISH_SYSTEM
#define PATHSEP_C ';'
#else
#define PATHSEP_C ':'
#endif
/* The size of `unsigned int', as computed by sizeof. */
#define SIZEOF_UNSIGNED_INT 4
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Defined if descriptor passing is enabled and supported */
/* #undef USE_DESCRIPTOR_PASSING */
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif
/* Version of this package */
#define VERSION PACKAGE_VERSION
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
/* #undef _LARGEFILE_SOURCE */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Define to 1 if on MINIX. */
/* #undef _MINIX */
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
/* #undef _POSIX_1_SOURCE */
/* Define to 1 if you need to in order for `stat' and other things to work. */
/* #undef _POSIX_SOURCE */
/* To allow the use of GPGME in multithreaded programs we have to use
special features from the library.
IMPORTANT: gpgme is not yet fully reentrant and you should use it
only from one thread. */
#ifndef _REENTRANT
# define _REENTRANT 1
#endif
/* Activate POSIX interface on MacOS X */
/* #undef _XOPEN_SOURCE */
/* Define to a type to use for `error_t' if it is not otherwise available. */
#define error_t int
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#define inline __inline
#endif
/* Define to `long int' if <sys/types.h> does not define. */
/* #undef off_t */
/* Define to the type of an unsigned integer type wide enough to hold a
pointer, if such a type exists, and if the system does not define it. */
/* #undef uintptr_t */
/* Definition of GCC specific attributes. */
#if __GNUC__ > 2
# define GPGME_GCC_A_PURE __attribute__ ((__pure__))
#else
# define GPGME_GCC_A_PURE
#endif
/* Under WindowsCE we need gpg-error's strerror macro. */
#define GPG_ERR_ENABLE_ERRNO_MACROS 1
/* snprintf is not part of oldnames.lib thus we redefine it here. */
#define snprintf _snprintf
/* We don't want warnings like this:
warning C4996: e.g. "The POSIX name for this item is
deprecated. Instead, use the ISO C++ conformant name: _fileno"
warning C4018: '<' : signed/unsigned mismatch
warning C4244: '=' : conversion from 'time_t' to
'unsigned long', possible loss of data
*/
#pragma warning(disable:4996 4018 4244)

1
contrib/conf-w32ce-msc/fcntl.h Executable file
View File

@ -0,0 +1 @@
/* Dummy fcntl.h header. */

2
contrib/conf-w32ce-msc/io.h Executable file
View File

@ -0,0 +1,2 @@
/* Dummy io.h header. */

View File

@ -0,0 +1,9 @@
typedef unsigned long long uint64_t;
typedef long long int64_t;
typedef unsigned int uint32_t;
typedef int int32_t;
typedef unsigned short uint16_t;
typedef short int16_t;
typedef unsigned int uintptr_t;
typedef int intptr_t;

View File

@ -700,7 +700,7 @@
2002-05-26 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi: Some typographical corrections throughout.
* gpgme.texi: Some typographical correctons throughout.
2002-05-09 Marcus Brinkmann <marcus@g10code.de>
@ -720,7 +720,7 @@
* gpgme.texi (Manipulating Data Buffers): Changed some data types
to void*.
(Protocol Selection): Added gpgme_get_protocol.
(Verify): Updated to include the new attribute functions and
(Verify): Updated to include the new attribute fucntions and
status codes.
2002-04-27 Werner Koch <wk@gnupg.org>
@ -839,7 +839,7 @@
2002-01-29 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Run Control): New section.
(Verify): Document gpgme_get_notation.
(Verify): Docuent gpgme_get_notation.
(More Information): New section describing gpgme_get_op_info.
2002-01-22 Marcus Brinkmann <marcus@g10code.de>
@ -865,7 +865,7 @@
* gpgme.texi (Top): Complete detailmenu.
* gpgme.texi: Convert embarrassing cruft to the real thing.
* gpgme.texi: Convert embarassing cruft to the real thing.
2002-01-16 Marcus Brinkmann <marcus@g10code.de>

View File

@ -14,8 +14,8 @@
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see <https://gnu.org/licenses/>.
# SPDX-License-Identifier: LGPL-2.1-or-later
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
## Process this file with automake to produce Makefile.in
@ -23,8 +23,7 @@ DISTCLEANFILES = gpgme.tmp
CLEANFILES = mkdefsinc defs.inc
EXTRA_DIST = module-overview.sk HACKING DCO ChangeLog-2011 \
mkdefsinc.c defsincdate \
examples/gpgme-mozilla.json examples/gpgme-chrome.json
mkdefsinc.c defsincdate
BUILT_SOURCES = defsincdate defs.inc
@ -34,9 +33,9 @@ gpgme_TEXINFOS = uiserver.texi lesser.texi gpl.texi
gpgme.texi : defs.inc
mkdefsinc: mkdefsinc.c Makefile $(top_builddir)/conf/config.h
$(CC_FOR_BUILD) -I. -I$(top_builddir)/conf -I$(srcdir) \
$(AM_CPPFLAGS) -o $@ $(srcdir)/mkdefsinc.c
mkdefsinc: mkdefsinc.c Makefile ../config.h
$(CC_FOR_BUILD) -I. -I.. -I$(srcdir) $(AM_CPPFLAGS) \
-o $@ $(srcdir)/mkdefsinc.c
dist-hook: defsincdate
@ -60,3 +59,4 @@ online: gpgme.html gpgme.pdf
(cd gpgme.html && rsync -vr --exclude='.svn' . \
$${user}@ftp.gnupg.org:webspace/manuals/gpgme/ ); \
rsync -v gpgme.pdf $${user}@ftp.gnupg.org:webspace/manuals/

View File

@ -1,9 +0,0 @@
{
"name": "gpgmejson",
"description": "Integration with GnuPG",
"path": "/usr/bin/gpgme-json",
"type": "stdio",
"allowed_origins": [
"chrome-extension://kajibbejlbohfaggdiogboambcijhkke/"
]
}

View File

@ -1,9 +0,0 @@
{
"name": "gpgmejson",
"description": "Integration with GnuPG",
"path": "/usr/bin/gpgme-json",
"type": "stdio",
"allowed_extensions": [
"jid1-AQqSMBYb0a8ADg@jetpack"
]
}

View File

@ -1,4 +1,4 @@
/* show-group-options.c - Example code to retrieve the group option.
/* show-group-options.c - Example code to retriev the group option.
Copyright (C) 2008 g10 Code GmbH
This file is part of GPGME.
@ -14,7 +14,7 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, see <https://www.gnu.org/licenses/>.
License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>

File diff suppressed because it is too large Load Diff

View File

@ -460,7 +460,7 @@
\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
% Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
% Each occurence of `\^^M' or `<space>\^^M' is replaced by a single space.
%
% \argremovec might leave us with trailing space, e.g.,
% @end itemize @c foo
@ -485,7 +485,7 @@
% to get _exactly_ the rest of the line, we had to prevent such situation.
% We prepended an \empty token at the very beginning and we expand it now,
% just before passing the control to \argtorun.
% (Similarly, we have to think about #3 of \argcheckspacesY above: it is
% (Similarily, we have to think about #3 of \argcheckspacesY above: it is
% either the null string, or it ends with \^^M---thus there is no danger
% that a pair of braces would be stripped.
%
@ -498,7 +498,7 @@
% \def\foo{\parsearg\Xfoo}
% \def\Xfoo#1{...}
%
% Actually, I use \csname\string\foo\endcsname, i.e. \\foo, as it is my
% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
% favourite TeX trick. --kasal, 16nov03
\def\parseargdef#1{%
@ -542,7 +542,7 @@
% used to check whether the current environment is the one expected.
%
% Non-false conditionals (@iftex, @ifset) don't fit into this, so they
% are not treated as environments; they don't open a group. (The
% are not treated as enviroments; they don't open a group. (The
% implementation of @end takes care not to call \endgroup in this
% special case.)
@ -565,7 +565,7 @@
\fi
}
% Environment mismatch, #1 expected:
% Evironment mismatch, #1 expected:
\def\badenverr{%
\errhelp = \EMsimple
\errmessage{This command can appear only \inenvironment\temp,
@ -7317,7 +7317,7 @@ end
% In case a @footnote appears in a vbox, save the footnote text and create
% the real \insert just after the vbox finished. Otherwise, the insertion
% would be lost.
% Similarly, if a @footnote appears inside an alignment, save the footnote
% Similarily, if a @footnote appears inside an alignment, save the footnote
% text to a box and make the \insert when a row of the table is finished.
% And the same can be done for other insert classes. --kasal, 16nov03.

View File

@ -484,7 +484,7 @@ First, the input files need to be specified by one or more
@code{FILE} commands. Afterwards, the actual operation is requested:
@deffn Command CHECKSUM_CREATE_FILES --nohup
Request that checksums are created for the files specified by
Request that checksums are created for the files specifed by
@code{FILE}. The choice of checksum algorithm and the destination
storage and format for the created checksums depend on the preferences
of the user and the functionality provided by the UI server. For
@ -499,7 +499,7 @@ promptly, and completes the operation asynchronously.
@deffn Command CHECKSUM_VERIFY_FILES --nohup
Request that checksums are created for the files specified by
Request that checksums are created for the files specifed by
@code{FILE} and verified against previously created and stored
checksums. The choice of checksum algorithm and the source storage
and format for previously created checksums depend on the preferences
@ -564,7 +564,7 @@ do this it uses the Assuan command:
@deffn Command START_KEYMANAGER
The server shall pop up the main window of the key manager (aka
certificate manager). The client expects that the key manager is brought
into the foregound and that this command immediately returns (does not
into the foregound and that this command immediatley returns (does not
wait until the key manager has been fully brought up).
@end deffn
@ -575,7 +575,7 @@ do this it uses the Assuan command:
@deffn Command START_CONFDIALOG
The server shall pop up its configuration dialog. The client expects
that this dialog is brought into the foregound and that this command
immediately returns (i.e. it does not wait until the dialog has been
immediatley returns (i.e. it does not wait until the dialog has been
fully brought up).
@end deffn

View File

@ -4,7 +4,7 @@ Name: gpgme
Version: @pkg_version@
Release: 1
URL: https://gnupg.org/gpgme.html
Source: https://www.gnupg.org/ftp/gcrypt/gpgme/%{name}-%{version}.tar.gz
Source: ftp://ftp.gnupg.org/gcrypt/alpha/gpgme/%{name}-%{version}.tar.gz
Group: Development/Libraries
Copyright: GPL
BuildRoot: %{_tmppath}/%{name}-%{version}
@ -38,12 +38,10 @@ make distclean
%post
/sbin/ldconfig
/sbin/install-info %{_infodir}/gpgme.info.gz %{_infodir}/dir
/sbin/install-info %{_infodir}/gpgme-python-howto.info.gz %{_infodir}/dir
%preun
if [ "$1" = 0 ]; then
/sbin/install-info --delete %{_infodir}/gpgme.info.gz %{_infodir}/dir
/sbin/install-info --delete %{_infodir}/gpgme-python-howto.info.gz %{_infodir}/dir
fi
%postun
@ -59,7 +57,6 @@ fi
%{_includedir}/gpgme.h
%{_datadir}/aclocal/gpgme.m4
%{_infodir}/gpgme.info*
%{_infodir}/gpgme-python-howto.info*
%changelog
* Sat Aug 30 2003 Robert Schiele <rschiele@uni-mannheim.de>

View File

@ -35,9 +35,9 @@ support OpenPGP and the Cryptographic Message Syntax.
%%GNU: no
%%web-page: https://www.gnupg.org/gpgme.html
%%web-page: http://www.gnupg.org/gpgme.html
%%support: paid extension/consulting from https://www.g10code.com
%%support: paid extension/consulting from http://www.g10code.com
%%doc: English programmer reference in Texinfo, Postscript, HTML included
@ -47,13 +47,13 @@ support OpenPGP and the Cryptographic Message Syntax.
%%sponsors:
%%source: https://www.gnupg.org/ftp/gcrypt/gpgme/
%%source: ftp://ftp.gnupg.org/gcrypt/gpgme/
%%debian:
%%redhat:
%%repository: See https://dev.gnupg.org/source/gpgme/
%%repository: See http://www.gnupg.org/cvs-access.html
%%related:

View File

@ -14,10 +14,10 @@
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see <https://gnu.org/licenses/>.
# SPDX-License-Identifier: LGPL-2.1-or-later
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
SUBDIRS = $(ENABLED_LANGUAGES)
DIST_SUBDIRS = cl cpp qt python js
DIST_SUBDIRS = cl cpp qt python
EXTRA_DIST = README

View File

@ -13,4 +13,3 @@ cl Common Lisp
cpp C++
qt Qt-Framework API
python Python 2 and 3 (module name: gpg)
js Native messaging client for the gpgme-json server.

View File

@ -13,11 +13,12 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see <https://gnu.org/licenses/>.
# SPDX-License-Identifier: LGPL-2.1-or-later
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA
clfiles = gpgme.asd gpgme-package.lisp gpgme-grovel.lisp gpgme.lisp
clfiles = gpgme.asd gpgme-package.lisp gpgme.lisp
# FIXME: Should be configurable.
clfilesdir = $(datadir)/common-lisp/source/gpgme

View File

@ -3,50 +3,33 @@ Common Lisp Support for GPGME
Requirements:
ASDF Packaging Support
CFFI Foreign Function Interface
trivial-garbage Finalizers
gpg-error GPG Error Codes
ASDF Packaging Support
CFFI Foreign Function Interface
gpg-error GPG Error Codes
Use with:
> (asdf:load-system "gpgme")
> (asdf:operate 'asdf:load-op ':gpgme)
Examples
--------
(with-open-file (out "/tmp/myout"
:direction :output
:if-exists :supersede
:element-type '(unsigned-byte 8))
(with-open-file (stream "/tmp/myout" :direction :output
:if-exists :supersede :element-type '(unsigned-byte 8))
(with-context (ctx)
(setf (armorp ctx) t)
(setf (armor-p ctx) t)
(op-export ctx "DEADBEEF" out)))
(with-context (ctx)
(with-output-to-string (out)
(setf (armorp ctx) t)
(setf (armor-p ctx) t)
(op-export ctx "McTester" out)))
(gpgme:with-context (ctx :armor t)
(with-output-to-string (out)
(gpgme:op-export ctx "McTester" out)))
(gpgme:with-context (ctx :armor t)
(let ((recipient1 (gpgme:get-key ctx "DEADBEEF"))
(recipient2 (gpgme:get-key ctx "Alice"))
(message "Hello, world!"))
(with-output-to-string (out)
(with-input-from-string (in message)
(gpgme:op-encrypt ctx (vector recipient1 recipient2) in out)))))
(gpgme:with-context (ctx :armor t)
(let ((message "Hello, world!"))
(with-output-to-string (out)
(with-input-from-string (in message)
(gpgme:op-sign ctx in out)))))
TODO
----

View File

@ -1,31 +0,0 @@
;;;; gpgme-grovel.lisp
;;; This file is part of GPGME-CL.
;;;
;;; GPGME-CL is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2 of the License, or
;;; (at your option) any later version.
;;;
;;; GPGME-CL is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; Lesser General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GPGME; if not, write to the Free Software Foundation,
;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
(in-package :gpgme)
(include "errno.h" "sys/types.h")
(constant (+ebadf+ "EBADF"))
(ctype off-t "off_t")
(ctype size-t "size_t")
(ctype ssize-t "ssize_t")
(cvar ("errno" *errno*) :int)

View File

@ -26,8 +26,7 @@
(defpackage #:gpgme
(:use #:common-lisp #:cffi #:gpg-error)
(:import-from #:trivial-garbage
#:finalize)
(:export #:check-version
#:*version*
#:context

View File

@ -25,14 +25,11 @@
(in-package #:gpgme-system)
(defsystem gpgme
:description "GnuPG Made Easy."
:author "g10 Code GmbH"
:version "@VERSION@"
:licence "GPL"
:defsystem-depends-on ("cffi-grovel")
:depends-on ("cffi" "gpg-error" "trivial-garbage")
:components ((:file "gpgme-package")
(:cffi-grovel-file "gpgme-grovel"
:depends-on ("gpgme-package"))
(:file "gpgme"
:depends-on ("gpgme-package" "gpgme-grovel"))))
:description "GnuPG Made Easy."
:author "g10 Code GmbH"
:version "@VERSION@"
:licence "GPL"
:depends-on ("cffi" "gpg-error")
:components ((:file "gpgme-package")
(:file "gpgme"
:depends-on ("gpgme-package"))))

View File

@ -24,12 +24,6 @@
(in-package :gpgme)
(deftype byte-array ()
'(simple-array (unsigned-byte 8) (*)))
(deftype character-array ()
'(simple-array character (*)))
;;; Debugging.
(defvar *debug* nil "If debugging output should be given or not.")
@ -44,15 +38,23 @@
;;; System dependencies.
; Access to ERRNO.
; FIXME: Use cffi-grovel? cffi-unix?
(defctype size-t :unsigned-int "The system size_t type.")
(defctype ssize-t :int "The system ssize_t type.")
; FIXME: Ouch. Grovel? Helper function?
(defconstant +seek-set+ 0)
(defconstant +seek-cur+ 1)
(defconstant +seek-end+ 2)
(defctype off-t :long-long "The system off_t type.")
(defcfun ("strerror" c-strerror) :string
(err :int))
(defun get-errno ()
*errno*)
(defun set-errno (errno)
(setf *errno* errno))
; Access to ERRNO.
; FIXME: Ouch. Should be grovel + helper function.
(define-condition system-error (error)
((errno :initarg :errno :reader system-error-errno))
@ -62,6 +64,14 @@
(c-strerror (system-error-errno c)))))
(:documentation "Signalled when an errno is encountered."))
(defconstant +ebadf+ 1)
; Ouch.
(defun get-errno ()
+ebadf+)
;;; More about errno below.
; Needed to write passphrases.
(defcfun ("write" c-write) ssize-t
(fd :int)
@ -73,6 +83,14 @@
(when (< res 0) (error 'system-error :errno (get-errno)))
res))
;;; More about errno here.
(defun set-errno (errno)
(cond
; Works on GNU/Linux.
((eql errno +ebadf+) (system-write -1 (null-pointer) 0))
(t (error 'invalid-errno :errno errno))))
;;;
;;; C Interface Definitions
;;;
@ -82,39 +100,22 @@
;;; Some new data types used for easier translation.
;;; The number of include certs. Translates to NIL for default.
(defctype cert-int-t
(:wrapper :int
:from-c translate-cert-int-t-from-foreign
:to-c translate-cert-int-t-to-foreign))
(defctype cert-int-t :int)
;;; A string that may be NIL to indicate a null pointer.
(defctype string-or-nil-t
(:wrapper :string
:to-c translate-string-or-nil-t-to-foreign))
(defctype string-or-nil-t :string)
;;; Some opaque data types used by GPGME.
(defctype gpgme-ctx-t
(:wrapper :pointer
:to-c translate-gpgme-ctx-t-to-foreign)
"The GPGME context type.")
(defctype gpgme-ctx-t :pointer "The GPGME context type.")
(defctype gpgme-data-t
(:wrapper :pointer
:to-c translate-gpgme-data-t-to-foreign)
"The GPGME data object type.")
(defctype gpgme-data-t :pointer "The GPGME data object type.")
;;; Wrappers for the libgpg-error library.
(defctype gpgme-error-t
(:wrapper gpg-error::gpg-error-t
:from-c translate-gpgme-error-t-from-foreign
:to-c translate-gpgme-error-t-to-foreign)
"The GPGME error type.")
(defctype gpgme-error-t gpg-error::gpg-error-t "The GPGME error type.")
(defctype gpgme-error-no-signal-t
(:wrapper gpg-error::gpg-error-t
:from-c translate-gpgme-error-no-signal-t-from-foreign)
(defctype gpgme-error-no-signal-t gpg-error::gpg-error-t
"The GPGME error type (this version does not signal conditions in translation.")
(defctype gpgme-err-code-t gpg-error::gpg-err-code-t
@ -140,11 +141,11 @@
(gpg-err-source err))
(defun gpgme-strerror (err)
"Return a string containing a description of the error code."
"Return a string containig a description of the error code."
(gpg-strerror err))
(defun gpgme-strsource (err)
"Return a string containing a description of the error source."
"Return a string containig a description of the error source."
(gpg-strsource err))
(defun gpgme-err-code-from-errno (err)
@ -170,11 +171,7 @@
(:none 0)
(:binary 1)
(:base64 2)
(:armor 3)
(:url 4)
(:urlesc 5)
(:url0 6)
(:mime 7))
(:armor 3))
;;;
@ -185,11 +182,7 @@
(:rsa-s 3)
(:elg-e 16)
(:dsa 17)
(:ecc 18)
(:elg 20)
(:ecdsa 301)
(:ecdh 302)
(:eddsa 303))
(:elg 20))
(defcenum gpgme-hash-algo-t
"Hash algorithms from libgcrypt."
@ -203,7 +196,6 @@
(:sha256 8)
(:sha384 9)
(:sha512 10)
(:sha224 11)
(:md4 301)
(:crc32 302)
(:crc32-rfc1510 303)
@ -233,14 +225,7 @@
(defcenum gpgme-protocol-t
"The available protocols."
(:openpgp 0)
(:cms 1)
(:gpgconf 2)
(:assuan 3)
(:g13 4)
(:uiserver 5)
(:spawn 6)
(:default 254)
(:unknown 255))
(:cms 1))
;;;
@ -249,10 +234,6 @@
(:local 1)
(:extern 2)
(:sigs 4)
(:sig-notations)
(:with-secret 16)
(:with-tofu 32)
(:ephemeral 128)
(:validate 256))
;;;
@ -262,12 +243,10 @@
(:human-readable 1)
(:critical 2))
(defctype gpgme-sig-notation-t
(:wrapper :pointer
:from-c translate-gpgme-sig-notation-t-from-foreign)
(defctype gpgme-sig-notation-t :pointer
"Signature notation pointer type.")
;; FIXME: Doesn't this depend on endianness?
;; FIXME: Doesn't this depend on endianess?
(defbitfield (gpgme-sig-notation-bitfield :unsigned-int)
(:human-readable 1)
(:critical 2))
@ -284,115 +263,15 @@
;;;
;; FIXME: Add status codes.
(defcenum gpgme-status-code-t
"The possible status codes for the edit operation."
(:eof 0)
(:enter 1)
(:leave 2)
(:abort 3)
(:goodsig 4)
(:badsig 5)
(:errsig 6)
(:badarmor 7)
(:rsa-or-idea 8)
(:keyexpired 9)
(:keyrevoked 10)
(:trust-undefined 11)
(:trust-never 12)
(:trust-marginal 13)
(:trust-fully 14)
(:trust-ultimate 15)
(:shm-info 16)
(:shm-get 17)
(:shm-get-bool 18)
(:shm-get-hidden 19)
(:need-passphrase 20)
(:validsig 21)
(:sig-id 22)
(:enc-to 23)
(:nodata 24)
(:bad-passphrase 25)
(:no-pubkey 26)
(:no-seckey 27)
(:need-passphrase-sym 28)
(:decryption-failed 29)
(:decryption-okay 30)
(:missing-passphrase 31)
(:good-passphrase 32)
(:goodmdc 33)
(:badmdc 34)
(:errmdc 35)
(:imported 36)
(:import-ok 37)
(:import-problem 38)
(:import-res 39)
(:file-start 40)
(:file-done 41)
(:file-error 42)
(:begin-decryption 43)
(:end-decryption 44)
(:begin-encryption 45)
(:end-encryption 46)
(:delete-problem 47)
(:get-bool 48)
(:get-line 49)
(:get-hidden 50)
(:got-it 51)
(:progress 52)
(:sig-created 53)
(:session-key 54)
(:notation-name 55)
(:notation-data 56)
(:policy-url 57)
(:begin-stream 58)
(:end-stream 59)
(:key-created 60)
(:userid-hint 61)
(:unexpected 62)
(:inv-recp 63)
(:no-recp 64)
(:already-signed 65)
(:sigexpired 66)
(:expsig 67)
(:expkeysig 68)
(:truncated 69)
(:error 70)
(:newsig 71)
(:revkeysig 72)
(:sig-subpacket 73)
(:need-passphrase-pin 74)
(:sc-op-failure 75)
(:sc-op-success 76)
(:cardctrl 77)
(:backup-key-created 78)
(:pka-trust-bad 79)
(:pka-trust-good 80)
(:plaintext 81)
(:inv-sgnr 82)
(:no-sgnr 83)
(:success 84)
(:decryption-info 85)
(:plaintext-length 86)
(:mountpoint 87)
(:pinentry-launched 88)
(:attribute 89)
(:begin-signing 90)
(:key-not-created 91)
(:inquire-maxlen 92)
(:failure 93)
(:key-considered 94)
(:tofu-user 95)
(:tofu-stats 96)
(:tofu-stats-long 97)
(:notation-flags 98)
(:decryption-compliance-mode 99)
(:verification-compliance-mode 100))
(:enter 1))
;;;
(defctype gpgme-engine-info-t
(:wrapper :pointer
:from-c translate-gpgme-engine-info-t-to-foreign)
(defctype gpgme-engine-info-t :pointer
"The engine information structure pointer type.")
(defcstruct gpgme-engine-info
@ -406,12 +285,9 @@
;;;
(defctype gpgme-subkey-t
(:wrapper :pointer
:from-c translate-gpgme-subkey-t-from-foreign)
"A subkey from a key.")
(defctype gpgme-subkey-t :pointer "A subkey from a key.")
;; FIXME: Doesn't this depend on endianness?
;; FIXME: Doesn't this depend on endianess?
(defbitfield (gpgme-subkey-bitfield :unsigned-int)
"The subkey bitfield."
(:revoked 1)
@ -423,9 +299,7 @@
(:can-certify 64)
(:secret 128)
(:can-authenticate 256)
(:is-qualified 512)
(:is-cardkey 1024)
(:is-de-vs 2048))
(:is-qualified 512))
(defcstruct gpgme-subkey
"Subkey from a key."
@ -440,12 +314,10 @@
(expires :long))
(defctype gpgme-key-sig-t
(:wrapper :pointer
:from-c translate-gpgme-key-sig-t-from-foreign)
(defctype gpgme-key-sig-t :pointer
"A signature on a user ID.")
;; FIXME: Doesn't this depend on endianness?
;; FIXME: Doesn't this depend on endianess?
(defbitfield (gpgme-key-sig-bitfield :unsigned-int)
"The key signature bitfield."
(:revoked 1)
@ -471,12 +343,10 @@
(sig-class :unsigned-int))
(defctype gpgme-user-id-t
(:wrapper :pointer
:from-c translate-gpgme-user-id-t-from-foreign)
(defctype gpgme-user-id-t :pointer
"A user ID from a key.")
;; FIXME: Doesn't this depend on endianness?
;; FIXME: Doesn't this depend on endianess?
(defbitfield (gpgme-user-id-bitfield :unsigned-int)
"The user ID bitfield."
(:revoked 1)
@ -495,13 +365,10 @@
(-last-keysig gpgme-key-sig-t))
(defctype gpgme-key-t
(:wrapper :pointer
:from-c translate-gpgme-key-t-from-foreign
:to-c translate-gpgme-key-t-to-foreign)
(defctype gpgme-key-t :pointer
"A key from the keyring.")
;; FIXME: Doesn't this depend on endianness?
;; FIXME: Doesn't this depend on endianess?
(defbitfield (gpgme-key-bitfield :unsigned-int)
"The key bitfield."
(:revoked 1)
@ -826,9 +693,7 @@
;;;
(defctype gpgme-invalid-key-t
(:wrapper :pointer
:from-c translate-gpgme-invalid-key-t-from-foreign)
(defctype gpgme-invalid-key-t :pointer
"An invalid key structure.")
(defcstruct gpgme-invalid-key
@ -843,9 +708,7 @@
"Encryption result structure."
(invalid-recipients gpgme-invalid-key-t))
(defctype gpgme-op-encrypt-result-t
(:wrapper :pointer
:from-c translate-gpgme-op-encrypt-result-t-from-foreign)
(defctype gpgme-op-encrypt-result-t :pointer
"An encryption result structure.")
(defcfun ("gpgme_op_encrypt_result" c-gpgme-op-encrypt-result)
@ -853,15 +716,7 @@
(ctx gpgme-ctx-t))
(defbitfield gpgme-encrypt-flags-t
(:always-trust 1)
(:no-encrypt-to 2)
(:prepare 4)
(:expect-sign 8)
(:no-compress 16)
(:symmetric 32)
(:throw-keyids 64)
(:wrap 128)
(:want-address 256))
(:always-trust 1))
(defcfun ("gpgme_op_encrypt_start" c-gpgme-op-encrypt-start) gpgme-error-t
(ctx gpgme-ctx-t)
@ -894,9 +749,7 @@
;;; Decryption.
(defctype gpgme-recipient-t
(:wrapper :pointer
:from-c translate-gpgme-recipient-t-from-foreign)
(defctype gpgme-recipient-t :pointer
"A recipient structure.")
(defcstruct gpgme-recipient
@ -909,9 +762,7 @@
(defbitfield gpgme-op-decrypt-result-bitfield
"Decryption result structure bitfield."
(:wrong-key-usage 1)
(:is-de-vs 2)
(:is-mine 4))
(:wrong-key-usage 1))
(defcstruct gpgme-op-decrypt-result
"Decryption result structure."
@ -920,9 +771,7 @@
(recipients gpgme-recipient-t)
(file-name :string))
(defctype gpgme-op-decrypt-result-t
(:wrapper :pointer
:from-c translate-gpgme-op-decrypt-result-t-from-foreign)
(defctype gpgme-op-decrypt-result-t :pointer
"A decryption result structure.")
(defcfun ("gpgme_op_decrypt_result" c-gpgme-op-decrypt-result)
@ -952,9 +801,7 @@
;;; Signing.
(defctype gpgme-new-signature-t
(:wrapper :pointer
:from-c translate-gpgme-new-signature-t-from-foreign)
(defctype gpgme-new-signature-t :pointer
"A new signature structure.")
(defcstruct gpgme-new-signature
@ -974,9 +821,7 @@
(invalid-signers gpgme-invalid-key-t)
(signatures gpgme-new-signature-t))
(defctype gpgme-op-sign-result-t
(:wrapper :pointer
:from-c translate-gpgme-op-sign-result-t-from-foreign)
(defctype gpgme-op-sign-result-t :pointer
"A signing result structure.")
(defcfun ("gpgme_op_sign_result" c-gpgme-op-sign-result)
@ -1009,21 +854,15 @@
(:crl-missing #x0100)
(:crl-too-old #x0200)
(:bad-policy #x0400)
(:sys-error #x0800)
(:tofu-conflict #x1000))
(:sys-error #x0800))
(defctype gpgme-signature-t
(:wrapper :pointer
:from-c translate-gpgme-signature-t-from-foreign)
(defctype gpgme-signature-t :pointer
"A signature structure.")
;; FIXME: Doesn't this depend on endianness?
;; FIXME: Doesn't this depend on endianess?
(defbitfield (gpgme-signature-bitfield :unsigned-int)
"The signature bitfield."
(:wrong-key-usage 1)
(:pka-trust 2)
(:chain-model 4)
(:is-de-vs 8))
(:wrong-key-usage 1))
(defcstruct gpgme-signature
"Signature structure."
@ -1045,9 +884,7 @@
(signatures gpgme-signature-t)
(file-name :string))
(defctype gpgme-op-verify-result-t
(:wrapper :pointer
:from-c translate-gpgme-op-verify-result-t-from-foreign)
(defctype gpgme-op-verify-result-t :pointer
"A verify result structure.")
(defcfun ("gpgme_op_verify_result" c-gpgme-op-verify-result)
@ -1076,9 +913,7 @@
(:subkey #x0008)
(:secret #x0010))
(defctype gpgme-import-status-t
(:wrapper :pointer
:from-c translate-gpgme-import-status-t-from-foreign)
(defctype gpgme-import-status-t :pointer
"An import status structure.")
(defcstruct gpgme-import-status
@ -1106,9 +941,7 @@
(not-imported :int)
(imports gpgme-import-status-t))
(defctype gpgme-op-import-result-t
(:wrapper :pointer
:from-c translate-gpgme-op-import-result-t-from-foreign)
(defctype gpgme-op-import-result-t :pointer
"An import status result structure.")
(defcfun ("gpgme_op_import_result" c-gpgme-op-import-result)
@ -1144,8 +977,7 @@
(defbitfield (gpgme-genkey-flags-t :unsigned-int)
"Flags used for the key generation result bitfield."
(:primary #x0001)
(:sub #x0002)
(:uid #x0004))
(:sub #x0002))
(defcstruct gpgme-op-genkey-result
"Key generation result structure."
@ -1246,20 +1078,21 @@
;;; cert-int-t is a helper type that takes care of representing the
;;; default number of certs as NIL.
(defun translate-cert-int-t-from-foreign (value)
(defmethod translate-from-foreign (value (type (eql 'cert-int-t)))
(cond
((eql value +include-certs-default+) nil)
(t value)))
(defun translate-cert-int-t-to-foreign (value)
(defmethod translate-to-foreign (value (type (eql 'cert-int-t)))
(cond
(value value)
(t +include-certs-default+)))
;;; string-or-nil-t translates a null pointer to NIL and vice versa.
;;; Translation from foreign null pointer already works as expected.
;;; FIXME: May the "to foreign" conversion problem be a bug in CFFI?
(defun translate-string-or-nil-t-to-foreign (value)
(defmethod translate-to-foreign (value (type (eql 'string-or-nil-t)))
(cond
(value value)
(t (null-pointer))))
@ -1276,12 +1109,12 @@
;;; FIXME: Should we use a hash table (or struct, or clos) instead of
;;; property list, as recommended by the Lisp FAQ?
(defun translate-gpgme-engine-info-t-from-foreign (value)
(defmethod translate-from-foreign (value (type (eql 'gpgme-engine-info-t)))
(cond
((null-pointer-p value) nil)
(t (with-foreign-slots
((next protocol file-name version req-version home-dir)
value (:struct gpgme-engine-info))
value gpgme-engine-info)
(append (list protocol (list
:file-name file-name
:version version
@ -1289,53 +1122,55 @@
:home-dir home-dir))
next)))))
(defun translate-gpgme-invalid-key-t-from-foreign (value)
(defmethod translate-from-foreign (value (type (eql 'gpgme-invalid-key-t)))
(cond
((null-pointer-p value) nil)
(t (with-foreign-slots
((next fpr reason)
value (:struct gpgme-invalid-key))
value gpgme-invalid-key)
(append (list (list :fpr fpr
:reason reason))
next)))))
(defun translate-gpgme-op-encrypt-result-t-from-foreign (value)
(defmethod translate-from-foreign (value
(type (eql 'gpgme-op-encrypt-result-t)))
(cond
((null-pointer-p value) nil)
(t (with-foreign-slots
((invalid-recipients)
value (:struct gpgme-op-encrypt-result))
value gpgme-op-encrypt-result)
(list :encrypt
(list :invalid-recipients invalid-recipients))))))
(defun translate-gpgme-recipient-t-from-foreign (value)
(defmethod translate-from-foreign (value (type (eql 'gpgme-recipient-t)))
(cond
((null-pointer-p value) nil)
(t (with-foreign-slots
((next keyid pubkey-algo status)
value (:struct gpgme-recipient))
value gpgme-recipient)
(append (list (list :keyid keyid
:pubkey-algo pubkey-algo
:status status))
next)))))
(defun translate-gpgme-op-decrypt-result-t-from-foreign (value)
(defmethod translate-from-foreign (value
(type (eql 'gpgme-op-decrypt-result-t)))
(cond
((null-pointer-p value) nil)
(t (with-foreign-slots
((unsupported-algorithm bitfield recipients file-name)
value (:struct gpgme-op-decrypt-result))
value gpgme-op-decrypt-result)
(list :decrypt (list :unsupported-algorithm unsupported-algorithm
:bitfield bitfield
:recipients recipients
:file-name file-name))))))
(defun translate-gpgme-new-signature-t-from-foreign (value)
(defmethod translate-from-foreign (value (type (eql 'gpgme-new-signature-t)))
(cond
((null-pointer-p value) nil)
(t (with-foreign-slots
((next type pubkey-algo hash-algo timestamp fpr sig-class)
value (:struct gpgme-new-signature))
value gpgme-new-signature)
(append (list (list :type type
:pubkey-algo pubkey-algo
:hash-algo hash-algo
@ -1344,23 +1179,24 @@
:sig-class sig-class))
next)))))
(defun translate-gpgme-op-sign-result-t-from-foreign (value)
(defmethod translate-from-foreign (value
(type (eql 'gpgme-op-sign-result-t)))
(cond
((null-pointer-p value) nil)
(t (with-foreign-slots
((invalid-signers signatures)
value (:struct gpgme-op-sign-result))
value gpgme-op-sign-result)
(list :sign (list :invalid-signers invalid-signers
:signatures signatures))))))
(defun translate-gpgme-signature-t-from-foreign (value)
(defmethod translate-from-foreign (value (type (eql 'gpgme-signature-t)))
(cond
((null-pointer-p value) nil)
(t (with-foreign-slots
((next summary fpr status notations timestamp
exp-timestamp bitfield validity validity-reason
pubkey-algo hash-algo)
value (:struct gpgme-signature))
value gpgme-signature)
(append (list (list :summary summary
:fpr fpr
:status status
@ -1373,27 +1209,29 @@
:pubkey-algo pubkey-algo))
next)))))
(defun translate-gpgme-op-verify-result-t-from-foreign (value)
(defmethod translate-from-foreign (value
(type (eql 'gpgme-op-verify-result-t)))
(cond
((null-pointer-p value) nil)
(t (with-foreign-slots
((signatures file-name)
value (:struct gpgme-op-verify-result))
value gpgme-op-verify-result)
(list :verify (list :signatures signatures
:file-name file-name))))))
(defun translate-gpgme-import-status-t-from-foreign (value)
(defmethod translate-from-foreign (value (type (eql 'gpgme-import-status-t)))
(cond
((null-pointer-p value) nil)
(t (with-foreign-slots
((next fpr result status)
value (:struct gpgme-import-status))
value gpgme-import-status)
(append (list (list :fpr fpr
:result result
:status status))
next)))))
(defun translate-gpgme-op-import-result-t-from-foreign (value)
(defmethod translate-from-foreign (value
(type (eql 'gpgme-op-import-result-t)))
(cond
((null-pointer-p value) nil)
(t (with-foreign-slots
@ -1402,7 +1240,7 @@
new-revocations secret-read secret-imported
secret-unchanged skipped-new-keys not-imported
imports)
value (:struct gpgme-op-import-result))
value gpgme-op-import-result)
(list :verify (list :considered considered
:no-user-id no-user-id
:imported imported
@ -1434,19 +1272,19 @@
(gpgme-strsource (gpgme-error-value c)))))
(:documentation "Signalled when a GPGME function returns an error."))
(defun translate-gpgme-error-t-from-foreign (value)
(defmethod translate-from-foreign (value (name (eql 'gpgme-error-t)))
"Raise a GPGME-ERROR if VALUE is non-zero."
(when (not (eql (gpgme-err-code value) :gpg-err-no-error))
(error 'gpgme-error :gpgme-error value))
(gpg-err-canonicalize value))
(defun translate-gpgme-error-t-to-foreign (value)
(defmethod translate-to-foreign (value (name (eql 'gpgme-error-t)))
"Canonicalize the error value."
(if (eql (gpgme-err-code value) :gpg-err-no-error)
0
(gpg-err-as-value value)))
(defun translate-gpgme-error-no-signal-t-from-foreign (value)
(defmethod translate-from-foreign (value (name (eql 'gpgme-error-no-signal-t)))
"Canonicalize the error value."
(gpg-err-canonicalize value))
@ -1683,75 +1521,68 @@
;;; The release callback removes the stream from the *data-handles*
;;; hash and releases the CBS structure that is used as the key in
;;; that hash. It is implicitly invoked (through GPGME) by
;;; that hash. It is implicitely invoked (through GPGME) by
;;; gpgme-data-release.
(defcallback data-release-cb :void ((handle :pointer))
(unwind-protect (remhash (pointer-address handle) *data-handles*)
(when (not (null-pointer-p handle)) (foreign-free handle))))
(defcallback data-read-cb ssize-t ((handle :pointer) (buffer :pointer)
(size size-t))
(size size-t))
(when *debug* (format t "DEBUG: gpgme-data-read-cb: want ~A~%" size))
(let ((stream (gethash (pointer-address handle) *data-handles*)))
(cond
(stream
(let* ((stream-type (stream-element-type stream))
(seq (make-array size :element-type stream-type))
(read (read-sequence seq stream)))
(cond
((equal stream-type '(unsigned-byte 8))
(dotimes (i read)
(setf (mem-aref buffer :unsigned-char i)
(aref (the byte-array seq) i))))
((eql stream-type 'character)
(dotimes (i read)
(setf (mem-aref buffer :unsigned-char i)
(char-code (aref (the character-array seq) i)))))
(t
(dotimes (i read)
(setf (mem-aref buffer :unsigned-char i)
(coerce (aref seq i) '(unsigned-byte 8))))))
(when *debug* (format t "DEBUG: gpgme-data-read-cb: read ~A~%" read))
read))
(t
(set-errno +ebadf+)
-1))))
(seq (make-array size :element-type stream-type))
(read (read-sequence seq stream)))
(loop for i from 0 to (- read 1)
do (setf (mem-aref buffer :unsigned-char i)
;;; FIXME: This is a half-assed attempt at
;;; supporting character streams.
(cond
((eql stream-type 'character)
(char-code (elt seq i)))
(t (coerce (elt seq i) stream-type)))))
(when *debug* (format t "DEBUG: gpgme-data-read-cb: read ~A~%" read))
read))
(t (set-errno +ebadf+)
-1))))
(defcallback data-write-cb ssize-t ((handle :pointer) (buffer :pointer)
(size size-t))
(size size-t))
(when *debug* (format t "DEBUG: gpgme-data-write-cb: want ~A~%" size))
(let ((stream (gethash (pointer-address handle) *data-handles*)))
(cond
(stream
(let* ((stream-type (stream-element-type stream))
(seq (make-array size :element-type stream-type)))
(cond
((equal stream-type '(unsigned-byte 8))
(dotimes (i size)
(setf (aref (the byte-array seq) i)
(mem-aref buffer :unsigned-char i))))
((eql stream-type 'character)
(dotimes (i size)
(setf (aref (the character-array seq) i)
(code-char (mem-aref buffer :unsigned-char i)))))
(t
(dotimes (i size)
(setf (aref seq i)
(coerce (mem-aref buffer :unsigned-char i) stream-type)))))
(write-sequence seq stream)
size))
(t
(set-errno +ebadf+)
-1))))
(seq (make-array size :element-type stream-type)))
(loop for i from 0 to (- size 1)
do (setf (elt seq i)
;;; FIXME: This is a half-assed attempt at
;;; supporting character streams.
(cond
((eql stream-type 'character)
(code-char (mem-aref buffer :unsigned-char i)))
(t (coerce (mem-aref buffer :unsigned-char i)
stream-type)))))
(write-sequence seq stream)
;;; FIXME: What about write errors?
size))
(t (set-errno +ebadf+)
-1))))
;;; This little helper macro allows us to swallow the cbs structure by
;;; simply setting it to a null pointer, but still protect against
;;; conditions.
(defmacro with-cbs-swallowed ((cbs) &body body)
`(let ((,cbs (foreign-alloc '(:struct gpgme-data-cbs))))
`(let ((,cbs (foreign-alloc 'gpgme-data-cbs)))
(unwind-protect (progn ,@body)
(when (not (null-pointer-p ,cbs)) (foreign-free ,cbs)))))
;;; FIXME: Wrap the object and attach to it a finalizer. Requires new
;;; CFFI. Should we use an OO interface, ie make-instance? For now,
;;; we do not provide direct access to data objects.
(defun gpgme-data-new (stream &key encoding file-name)
"Allocate a new GPGME data object for STREAM."
(with-foreign-object (dh-p 'gpgme-data-t)
@ -1761,14 +1592,12 @@
;;; unique C pointer as handle anyway to look up the stream in the
;;; callback. This is a convenient one to use.
(with-cbs-swallowed (cbs)
(setf (foreign-slot-value cbs '(:struct gpgme-data-cbs) 'read)
(callback data-read-cb))
(setf (foreign-slot-value cbs '(:struct gpgme-data-cbs) 'write)
(callback data-write-cb))
(setf (foreign-slot-value cbs '(:struct gpgme-data-cbs) 'seek)
(null-pointer))
(setf (foreign-slot-value cbs '(:struct gpgme-data-cbs) 'release)
(callback data-release-cb))
(setf
(foreign-slot-value cbs 'gpgme-data-cbs 'read) (callback data-read-cb)
(foreign-slot-value cbs 'gpgme-data-cbs 'write) (callback data-write-cb)
(foreign-slot-value cbs 'gpgme-data-cbs 'seek) (null-pointer)
(foreign-slot-value cbs 'gpgme-data-cbs 'release) (callback
data-release-cb))
(c-gpgme-data-new-from-cbs dh-p cbs cbs)
(let ((dh (mem-ref dh-p 'gpgme-data-t)))
(when encoding (gpgme-data-set-encoding dh encoding))
@ -1783,40 +1612,19 @@
(when *debug* (format t "DEBUG: gpgme-data-new: ~A~%" dh))
dh))))
;;; This function releases a GPGME data object. It implicitly
;;; This function releases a GPGME data object. It implicitely
;;; invokes the data-release-cb function to clean up associated junk.
(defun gpgme-data-release (dh)
"Release a GPGME data object."
(when *debug* (format t "DEBUG: gpgme-data-release: ~A~%" dh))
(c-gpgme-data-release dh))
(defclass data ()
(c-data) ; The C data object pointer
(:documentation "The GPGME data type."))
(defmethod initialize-instance :after ((data data) &key streamspec
&allow-other-keys)
(let ((c-data (if (listp streamspec)
(apply #'gpgme-data-new streamspec)
(gpgme-data-new streamspec)))
(cleanup t))
(unwind-protect
(progn
(setf (slot-value data 'c-data) c-data)
(finalize data (lambda () (gpgme-data-release c-data)))
(setf cleanup nil))
(if cleanup (gpgme-data-release c-data)))))
(defun translate-gpgme-data-t-to-foreign (value)
;; Allow a pointer to be passed directly for the finalizer to work.
(cond
((null value) (null-pointer))
((pointerp value) value)
(t (slot-value value 'c-data))))
(defmacro with-gpgme-data ((dh streamspec) &body body)
`(let ((,dh (make-instance 'data :streamspec ,streamspec)))
,@body))
`(let ((,dh (if (listp ,streamspec)
(apply 'gpgme-data-new ,streamspec)
(gpgme-data-new ,streamspec))))
(unwind-protect (progn ,@body)
(when (not (null-pointer-p ,dh)) (gpgme-data-release ,dh)))))
(defun gpgme-data-get-encoding (dh)
"Get the encoding associated with the data object DH."
@ -1885,7 +1693,7 @@
(setf cleanup nil))
(if cleanup (gpgme-release c-ctx)))))
(defun translate-gpgme-ctx-t-to-foreign (value)
(defmethod translate-to-foreign (value (type (eql 'gpgme-ctx-t)))
;; Allow a pointer to be passed directly for the finalizer to work.
(if (pointerp value) value (slot-value value 'c-ctx)))
@ -1907,7 +1715,7 @@
(:documentation "Set the protocol of CONTEXT to PROTOCOL."))
;;; FIXME: Adjust translator to reject invalid protocols. Currently,
;;; specifying an invalid protocol throws a "NIL is not 32 signed int"
;;; specifing an invalid protocol throws a "NIL is not 32 signed int"
;;; error. This is suboptimal.
(defmethod (setf protocol) (protocol (ctx context))
(gpgme-set-protocol ctx protocol))
@ -2040,11 +1848,11 @@
(setf (slot-value key 'c-key) c-key)
(finalize key (lambda () (gpgme-key-unref c-key))))
(defun translate-gpgme-key-t-from-foreign (value)
(defmethod translate-from-foreign (value (type (eql 'gpgme-key-t)))
(when *debug* (format t "DEBUG: import key: ~A~%" value))
(make-instance 'key :c-key value))
(defun translate-gpgme-key-t-to-foreign (value)
(defmethod translate-to-foreign (value (type (eql 'gpgme-key-t)))
;; Allow a pointer to be passed directly for the finalizer to work.
(if (pointerp value) value (slot-value value 'c-key)))
@ -2059,12 +1867,12 @@
;;; and zero length value (omit?) and human-readable (convert to string).
;;; FIXME: Turn binary data into sequence or vector or what it should be.
;;; FIXME: Turn the whole thing into a hash?
(defun translate-gpgme-sig-notation-t-from-foreign (value)
(defmethod translate-from-foreign (value (type (eql 'gpgme-sig-notation-t)))
(cond
((null-pointer-p value) nil)
(t (with-foreign-slots
((next name value name-len value-len flags bitfield)
value (:struct gpgme-sig-notation))
value gpgme-sig-notation)
(append (list (list
:name name
:value value
@ -2075,12 +1883,12 @@
next)))))
;;; FIXME: Deal nicer with timestamps. bitfield field name?
(defun translate-gpgme-subkey-t-from-foreign (value)
(defmethod translate-from-foreign (value (type (eql 'gpgme-subkey-t)))
(cond
((null-pointer-p value) nil)
(t (with-foreign-slots
((next bitfield pubkey-algo length keyid fpr timestamp expires)
value (:struct gpgme-subkey))
value gpgme-subkey)
(append (list (list
:bitfield bitfield
:pubkey-algo pubkey-algo
@ -2091,13 +1899,13 @@
:expires expires))
next)))))
(defun translate-gpgme-key-sig-t-from-foreign (value)
(defmethod translate-from-foreign (value (type (eql 'gpgme-key-sig-t)))
(cond
((null-pointer-p value) nil)
(t (with-foreign-slots
((next bitfield pubkey-algo keyid timestamp expires status
uid name email comment sig-class)
value (:struct gpgme-key-sig))
value gpgme-key-sig)
(append (list (list
:bitfield bitfield
:pubkey-algo pubkey-algo
@ -2112,12 +1920,12 @@
:sig-class sig-class))
next)))))
(defun translate-gpgme-user-id-t-from-foreign (value)
(defmethod translate-from-foreign (value (type (eql 'gpgme-user-id-t)))
(cond
((null-pointer-p value) nil)
(t (with-foreign-slots
((next bitfield validity uid name email comment signatures)
value (:struct gpgme-user-id))
value gpgme-user-id)
(append (list (list
:bitfield bitfield
:validity validity
@ -2133,7 +1941,7 @@
(with-foreign-slots
((bitfield protocol issuer-serial issuer-name chain-id
owner-trust subkeys uids keylist-mode)
c-key (:struct gpgme-key))
c-key gpgme-key)
(list
:bitfield bitfield
:protocol protocol

View File

@ -1,6 +1,5 @@
# Makefile.am for GPGMEPP.
# Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik
# Software engineering by Intevation GmbH
# Copyright (C) 2016 Intevation GmbH
#
# This file is part of GPGMEPP.
#
@ -14,16 +13,11 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see <https://gnu.org/licenses/>.
# SPDX-License-Identifier: LGPL-2.1-or-later
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA
if RUN_GPG_TESTS
tests = tests
else
tests =
endif
SUBDIRS = src ${tests}
SUBDIRS = src
EXTRA_DIST = README

View File

@ -43,7 +43,7 @@ pattern so the documentation for GPGME itself provides a good
way to start.
The context structure in GPGME is mapped to a Context object in
GpgMEpp. Additional convenience code provides Data objects and
GpgMEpp. Additional convienience code provides Data objects and
a Dataprovider interface that can be used to implement GPGME's
data with any subclass by implementing the right callbacks.
@ -62,7 +62,7 @@ Example to set the ownertrust of a key:
Data data;
/* Start the edit on some key previously obtained. */
Error e = ctx->edit(key, std::unique_ptr<EditInteractor>(ei), data);
/* Errors provide boolean comparison */
/* Errors provide boolean comparision */
if (!e)
...
/* Delete the context */

View File

@ -97,3 +97,7 @@ unset(_IMPORT_CHECK_TARGETS)
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)
get_filename_component(QGpgme_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
# Pull in QGpgme for compatibility with KF5 variant.
find_package(QGpgme CONFIG)

View File

@ -63,7 +63,7 @@ add_library(Gpgmepp SHARED IMPORTED)
set_target_properties(Gpgmepp PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/gpgme++;@resolved_includedir@"
INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme@libsuffix@;@LIBASSUAN_LIBS@"
INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme.so;@LIBASSUAN_LIBS@"
IMPORTED_LOCATION "@resolved_libdir@/libgpgmepp@libsuffix@"
)
@ -93,3 +93,7 @@ unset(_IMPORT_CHECK_TARGETS)
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)
get_filename_component(QGpgme_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
# Pull in QGpgme for compatibility with KF5 variant.
find_package(QGpgme CONFIG)

View File

@ -1,6 +1,5 @@
# Makefile.am for GPGMEPP.
# Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik
# Software engineering by Intevation GmbH
# Copyright (C) 2016 Intevation GmbH
#
# This file is part of GPGMEPP.
#
@ -33,13 +32,9 @@ main_sources = \
engineinfo.cpp gpgsetexpirytimeeditinteractor.cpp \
gpgsetownertrusteditinteractor.cpp gpgsignkeyeditinteractor.cpp \
gpgadduserideditinteractor.cpp gpggencardkeyinteractor.cpp \
gpgaddexistingsubkeyeditinteractor.cpp \
gpgrevokekeyeditinteractor.cpp \
defaultassuantransaction.cpp \
scdgetinfoassuantransaction.cpp gpgagentgetinfoassuantransaction.cpp \
statusconsumerassuantransaction.cpp \
vfsmountresult.cpp configuration.cpp tofuinfo.cpp swdbresult.cpp \
util.cpp
vfsmountresult.cpp configuration.cpp tofuinfo.cpp swdbresult.cpp
gpgmepp_headers = \
configuration.h context.h data.h decryptionresult.h \
@ -49,11 +44,8 @@ gpgmepp_headers = \
gpgmefw.h gpgsetexpirytimeeditinteractor.h \
gpgsetownertrusteditinteractor.h gpgsignkeyeditinteractor.h \
gpggencardkeyinteractor.h \
gpgaddexistingsubkeyeditinteractor.h \
gpgrevokekeyeditinteractor.h \
importresult.h keygenerationresult.h key.h keylistresult.h \
notation.h result.h scdgetinfoassuantransaction.h signingresult.h \
statusconsumerassuantransaction.h \
trustitem.h verificationresult.h vfsmountresult.h gpgmepp_export.h \
tofuinfo.h swdbresult.h
@ -62,8 +54,7 @@ private_gpgmepp_headers = \
interface_headers= \
interfaces/assuantransaction.h interfaces/dataprovider.h \
interfaces/passphraseprovider.h interfaces/progressprovider.h \
interfaces/statusconsumer.h
interfaces/passphraseprovider.h interfaces/progressprovider.h
gpgmeppincludedir = $(includedir)/gpgme++
gpgmeppinclude_HEADERS = $(gpgmepp_headers)
@ -73,10 +64,8 @@ nodist_gpgmeppinclude_HEADERS = gpgmepp_version.h
libgpgmepp_la_SOURCES = $(main_sources) $(gpgmepp_headers) context_vanilla.cpp \
$(interface_headers) $(private_gpgmepp_headers)
AM_CPPFLAGS = -I$(top_builddir)/src \
@GPGME_CPP_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
-DBUILDING_GPGMEPP -Wsuggest-override \
-Wzero-as-null-pointer-constant
AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
-DBUILDING_GPGMEPP
libgpgmepp_la_LIBADD = ../../../src/libgpgme.la @LIBASSUAN_LIBS@
libgpgmepp_la_LDFLAGS = -no-undefined -version-info \
@ -88,14 +77,6 @@ else
libsuffix=.so
endif
copied_headers = $(gpgmepp_headers:%=gpgme++/%) $(interface_headers:%=gpgme++/%)
$(copied_headers): Makefile.am
mkdir -p $(builddir)/gpgme++/interfaces
echo -n "#include \"$(abs_srcdir)" > "$@"
echo -n "$@" | sed "s/gpgme++//" >> "$@"
echo "\"" >> "$@"
if HAVE_W32_SYSTEM
GpgmeppConfig.cmake: GpgmeppConfig-w32.cmake.in
sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \
@ -123,8 +104,5 @@ install-data-local: install-cmake-files
uninstall-local: uninstall-cmake-files
BUILT_SOURCES = $(copied_headers)
CLEANFILES = GpgmeppConfig.cmake GpgmeppConfigVersion.cmake \
gpgmepp_version.h GpgmeppConfig.cmake.in \
$(copied_headers)
gpgmepp_version.h GpgmeppConfig.cmake.in

View File

@ -1,8 +1,6 @@
/*
callbacks.cpp - callback targets for internal use:
Copyright (C) 2003,2004 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -76,7 +74,7 @@ gpgme_error_t passphrase_callback(void *opaque, const char *uid_hint, const char
PassphraseProvider *provider = static_cast<PassphraseProvider *>(opaque);
bool canceled = false;
gpgme_error_t err = GPG_ERR_NO_ERROR;
char *passphrase = provider ? provider->getPassphrase(uid_hint, desc, prev_was_bad, canceled) : nullptr ;
char *passphrase = provider ? provider->getPassphrase(uid_hint, desc, prev_was_bad, canceled) : 0 ;
if (canceled) {
err = make_error(GPG_ERR_CANCELED);
} else {

View File

@ -1,8 +1,6 @@
/*
callbacks.h - callback targets for internal use:
Copyright (C) 2003 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.

View File

@ -1,8 +1,6 @@
/*
configuration.cpp - wraps gpgme configuration components
Copyright (C) 2010 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -64,7 +62,7 @@ std::vector<Component> Component::load(Error &returnedError)
//
// 1. get a context:
//
gpgme_ctx_t ctx_native = nullptr;
gpgme_ctx_t ctx_native = 0;
if (const gpgme_error_t err = gpgme_new(&ctx_native)) {
returnedError = Error(err);
return std::vector<Component>();
@ -74,7 +72,7 @@ std::vector<Component> Component::load(Error &returnedError)
//
// 2. load the config:
//
gpgme_conf_comp_t conf_list_native = nullptr;
gpgme_conf_comp_t conf_list_native = 0;
if (const gpgme_error_t err = gpgme_op_conf_load(ctx_native, &conf_list_native)) {
returnedError = Error(err);
return std::vector<Component>();
@ -94,7 +92,7 @@ std::vector<Component> Component::load(Error &returnedError)
}
// now prevent double-free of next.get() and following:
head->next = nullptr;
head->next = 0;
// now add a new Component to 'result' (may throw):
result.resize(result.size() + 1);
@ -115,7 +113,7 @@ Error Component::save() const
//
// 1. get a context:
//
gpgme_ctx_t ctx_native = nullptr;
gpgme_ctx_t ctx_native = 0;
if (const gpgme_error_t err = gpgme_new(&ctx_native)) {
return Error(err);
}
@ -129,22 +127,22 @@ Error Component::save() const
const char *Component::name() const
{
return comp ? comp->name : nullptr;
return comp ? comp->name : 0 ;
}
const char *Component::description() const
{
return comp ? comp->description : nullptr ;
return comp ? comp->description : 0 ;
}
const char *Component::programName() const
{
return comp ? comp->program_name : nullptr ;
return comp ? comp->program_name : 0 ;
}
Option Component::option(unsigned int idx) const
{
gpgme_conf_opt_t opt = nullptr;
gpgme_conf_opt_t opt = 0;
if (comp) {
opt = comp->options;
}
@ -160,7 +158,7 @@ Option Component::option(unsigned int idx) const
Option Component::option(const char *name) const
{
gpgme_conf_opt_t opt = nullptr;
gpgme_conf_opt_t opt = 0;
if (comp) {
opt = comp->options;
}
@ -177,7 +175,7 @@ Option Component::option(const char *name) const
unsigned int Component::numOptions() const
{
unsigned int result = 0;
for (gpgme_conf_opt_t opt = comp ? comp->options : nullptr ; opt ; opt = opt->next) {
for (gpgme_conf_opt_t opt = comp ? comp->options : 0 ; opt ; opt = opt->next) {
++result;
}
return result;
@ -186,7 +184,7 @@ unsigned int Component::numOptions() const
std::vector<Option> Component::options() const
{
std::vector<Option> result;
for (gpgme_conf_opt_t opt = comp ? comp->options : nullptr ; opt ; opt = opt->next) {
for (gpgme_conf_opt_t opt = comp ? comp->options : 0 ; opt ; opt = opt->next) {
result.push_back(Option(comp, opt));
}
return result;
@ -194,17 +192,17 @@ std::vector<Option> Component::options() const
static gpgme_conf_arg_t mygpgme_conf_arg_copy(gpgme_conf_arg_t other, gpgme_conf_type_t type)
{
gpgme_conf_arg_t result = nullptr, last = nullptr;
gpgme_conf_arg_t result = 0, last = 0;
for (gpgme_conf_arg_t a = other ; a ; a = a->next) {
gpgme_conf_arg_t arg = nullptr;
gpgme_conf_arg_t arg = 0;
const gpgme_error_t err
= gpgme_conf_arg_new(&arg, type,
a->no_arg ? nullptr :
a->no_arg ? 0 :
type == GPGME_CONF_STRING ? a->value.string :
/* else */ static_cast<void *>(&a->value));
if (err) {
gpgme_conf_arg_release(result, type);
return nullptr;
return 0;
}
assert(arg);
if (result) {
@ -234,17 +232,17 @@ Level Option::level() const
const char *Option::name() const
{
return isNull() ? nullptr : opt->name ;
return isNull() ? 0 : opt->name ;
}
const char *Option::description() const
{
return isNull() ? nullptr : opt->description ;
return isNull() ? 0 : opt->description ;
}
const char *Option::argumentName() const
{
return isNull() ? nullptr : opt->argname ;
return isNull() ? 0 : opt->argname ;
}
Type Option::type() const
@ -257,6 +255,158 @@ Type Option::alternateType() const
return isNull() ? NoType : static_cast<Type>(opt->alt_type) ;
}
#if 0
static Option::Variant argument_to_variant(gpgme_conf_type_t type, bool list, gpgme_conf_arg_t arg)
{
assert(arg);
switch (type) {
case GPGME_CONF_NONE:
if (list) {
// return the count (number of times set):
return arg->value.count;
} else {
return none;
}
case GPGME_CONF_INT32:
if (list) {
std::vector<int> result;
for (gpgme_conf_arg_t a = arg ; a ; a = a->next) {
result.push_back(a->value.int32);
}
return result;
} else {
return arg->value.int32;
}
case GPGME_CONF_UINT32:
if (list) {
std::vector<unsigned int> result;
for (gpgme_conf_arg_t a = arg ; a ; a = a->next) {
result.push_back(a->value.uint32);
}
return result;
} else {
return arg->value.uint32;
}
case GPGME_CONF_FILENAME:
case GPGME_CONF_LDAP_SERVER:
case GPGME_CONF_KEY_FPR:
case GPGME_CONF_PUB_KEY:
case GPGME_CONF_SEC_KEY:
case GPGME_CONF_ALIAS_LIST:
// these should not happen in alt_type, but fall through
case GPGME_CONF_STRING:
if (list) {
std::vector<const char *> result;
for (gpgme_conf_arg_t a = arg ; a ; a = a->next) {
result.push_back(a->value.string);
}
return result;
} else {
return arg->value.string;
}
}
assert(!"Option: unknown alt_type!");
return Option::Variant();
}
namespace
{
inline const void *to_void_star(const char *s)
{
return s;
}
inline const void *to_void_star(const std::string &s)
{
return s.c_str();
}
inline const void *to_void_star(const int &i)
{
return &i; // const-&: sic!
}
inline const void *to_void_star(const unsigned int &i)
{
return &i; // const-&: sic!
}
struct VariantToArgumentVisitor : boost::static_visitor<gpgme_conf_arg_t> {
static gpgme_conf_arg_t make_argument(gpgme_conf_type_t type, const void *value)
{
gpgme_conf_arg_t arg = 0;
#ifdef HAVE_GPGME_CONF_ARG_NEW_WITH_CONST_VALUE
if (const gpgme_error_t err = gpgme_conf_arg_new(&arg, type, value)) {
return 0;
}
#else
if (const gpgme_error_t err = gpgme_conf_arg_new(&arg, type, const_cast<void *>(value))) {
return 0;
}
#endif
else {
return arg;
}
}
gpgme_conf_arg_t operator()(bool v) const
{
return v ? make_argument(0) : 0 ;
}
gpgme_conf_arg_t operator()(const char *s) const
{
return make_argument(s ? s : "");
}
gpgme_conf_arg_t operator()(const std::string &s) const
{
return operator()(s.c_str());
}
gpgme_conf_arg_t operator()(int i) const
{
return make_argument(&i);
}
gpgme_conf_arg_t operator()(unsigned int i) const
{
return make_argument(&i);
}
template <typename T>
gpgme_conf_arg_t operator()(const std::vector<T> &value) const
{
gpgme_conf_arg_t result = 0;
gpgme_conf_arg_t last = 0;
for (typename std::vector<T>::const_iterator it = value.begin(), end = value.end() ; it != end ; ++it) {
if (gpgme_conf_arg_t arg = make_argument(to_void_star(*it))) {
if (last) {
last = last->next = arg;
} else {
result = last = arg;
}
}
}
return result;
}
};
}
static gpgme_conf_arg_t variant_to_argument(const Option::Variant &value)
{
VariantToArgumentVisitor v;
return apply_visitor(v, value);
}
optional<Option::Variant> Option::defaultValue() const
{
if (isNull()) {
return optional<Variant>();
} else {
return argument_to_variant(opt->alt_type, opt->flags & GPGME_CONF_LIST, opt->default_value);
}
}
#endif
Argument Option::defaultValue() const
{
if (isNull()) {
@ -268,7 +418,7 @@ Argument Option::defaultValue() const
const char *Option::defaultDescription() const
{
return isNull() ? nullptr : opt->default_description ;
return isNull() ? 0 : opt->default_description ;
}
Argument Option::noArgumentValue() const
@ -282,7 +432,7 @@ Argument Option::noArgumentValue() const
const char *Option::noArgumentDescription() const
{
return isNull() ? nullptr : opt->no_arg_description ;
return isNull() ? 0 : opt->no_arg_description ;
}
Argument Option::activeValue() const
@ -349,7 +499,7 @@ Error Option::resetToActiveValue()
if (isNull()) {
return Error(make_error(GPG_ERR_INV_ARG));
} else {
return Error(gpgme_conf_opt_change(opt, 1, nullptr));
return Error(gpgme_conf_opt_change(opt, 1, 0));
}
}
@ -358,15 +508,15 @@ Error Option::resetToDefaultValue()
if (isNull()) {
return Error(make_error(GPG_ERR_INV_ARG));
} else {
return Error(gpgme_conf_opt_change(opt, 0, nullptr));
return Error(gpgme_conf_opt_change(opt, 0, 0));
}
}
static gpgme_conf_arg_t make_argument(gpgme_conf_type_t type, const void *value)
{
gpgme_conf_arg_t arg = nullptr;
gpgme_conf_arg_t arg = 0;
if (const gpgme_error_t err = gpgme_conf_arg_new(&arg, type, value)) {
return nullptr;
return 0;
} else {
return arg;
}
@ -442,8 +592,8 @@ const void *to_void_star(const unsigned int &i)
template <typename T>
gpgme_conf_arg_t make_argument(gpgme_conf_type_t type, const std::vector<T> &value)
{
gpgme_conf_arg_t result = nullptr;
gpgme_conf_arg_t last = nullptr;
gpgme_conf_arg_t result = 0;
gpgme_conf_arg_t last = 0;
for (typename std::vector<T>::const_iterator it = value.begin(), end = value.end() ; it != end ; ++it) {
if (gpgme_conf_arg_t arg = make_argument(type, to_void_star(*it))) {
if (last) {
@ -541,14 +691,14 @@ unsigned int Argument::numElements() const
const char *Argument::stringValue(unsigned int idx) const
{
if (isNull() || opt->alt_type != GPGME_CONF_STRING) {
return nullptr;
return 0;
}
gpgme_conf_arg_t a = arg;
while (a && idx) {
a = a->next;
--idx;
}
return a ? a->value.string : nullptr ;
return a ? a->value.string : 0 ;
}
int Argument::intValue(unsigned int idx) const

View File

@ -1,8 +1,6 @@
/*
configuration.h - wraps gpgme configuration components
Copyright (C) 2010 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -95,10 +93,11 @@ class GPGMEPP_EXPORT Component
{
public:
Component() : comp() {}
explicit Component(const shared_gpgme_conf_comp_t &gpgme_comp)
: comp(gpgme_comp) {}
explicit Component(const shared_gpgme_conf_comp_t &comp)
: comp(comp) {}
// copy ctor is ok
Component(const Component &other) = default;
const Component &operator=(const Component &other)
{
if (this != &other) {
@ -144,11 +143,10 @@ private:
class GPGMEPP_EXPORT Option
{
public:
Option() : comp(), opt(nullptr) {}
Option(const shared_gpgme_conf_comp_t &gpgme_comp, gpgme_conf_opt_t gpgme_opt)
: comp(gpgme_comp), opt(gpgme_opt) {}
Option() : comp(), opt(0) {}
Option(const shared_gpgme_conf_comp_t &comp, gpgme_conf_opt_t opt)
: comp(comp), opt(opt) {}
Option(const Option &other) = default;
const Option &operator=(const Option &other)
{
if (this != &other) {
@ -190,7 +188,7 @@ public:
/*! The value that is in the config file (or null, if it's not set). */
Argument activeValue() const;
/*! The value that is in this object, i.e. either activeValue(), newValue(), or defaultValue() */
/*! The value that is in this object, ie. either activeValue(), newValue(), or defaultValue() */
Argument currentValue() const;
Argument newValue() const;
@ -228,7 +226,7 @@ class GPGMEPP_EXPORT Argument
friend class ::GpgME::Configuration::Option;
Argument(const shared_gpgme_conf_comp_t &comp, gpgme_conf_opt_t opt, gpgme_conf_arg_t arg, bool owns);
public:
Argument() : comp(), opt(nullptr), arg(nullptr) {}
Argument() : comp(), opt(0), arg(0) {}
//Argument( const shared_gpgme_conf_comp_t & comp, gpgme_conf_opt_t opt, gpgme_conf_arg_t arg );
Argument(const Argument &other);
~Argument();

File diff suppressed because it is too large Load Diff

View File

@ -27,11 +27,9 @@
#include "global.h"
#include "error.h"
#include "key.h"
#include "verificationresult.h" // for Signature::Notation
#include <memory>
#include <string>
#include <vector>
#include <utility>
#include <iosfwd>
@ -39,6 +37,7 @@
namespace GpgME
{
class Key;
class Data;
class TrustItem;
class ProgressProvider;
@ -64,25 +63,12 @@ class GPGMEPP_EXPORT Context
public:
//using GpgME::Protocol;
/// RAII-style class for saving/restoring the key list mode.
class GPGMEPP_EXPORT KeyListModeSaver
{
public:
explicit KeyListModeSaver(Context *ctx);
~KeyListModeSaver();
private:
Context *mCtx;
unsigned int mKeyListMode;
};
//
// Creation and destruction:
//
static Context *createForProtocol(Protocol proto);
/** Same as above but returning a unique ptr. */
static std::unique_ptr<Context> create(Protocol proto);
static std::unique_ptr<Context> createForEngine(Engine engine, Error *err = nullptr);
static std::unique_ptr<Context> createForEngine(Engine engine, Error *err = 0);
virtual ~Context();
//
@ -100,9 +86,6 @@ public:
void setOffline(bool useOfflineMode);
bool offline() const;
const char *getFlag(const char *name) const;
Error setFlag(const char *name, const char *value);
enum CertificateInclusion {
DefaultCertificates = -256,
AllCertificatesExceptRoot = -2,
@ -173,7 +156,7 @@ public:
// Key Listing
//
GpgME::Error startKeyListing(const char *pattern = nullptr, bool secretOnly = false);
GpgME::Error startKeyListing(const char *pattern = 0, bool secretOnly = false);
GpgME::Error startKeyListing(const char *patterns[], bool secretOnly = false);
Key nextKey(GpgME::Error &e);
@ -194,42 +177,11 @@ public:
//
// Key Export
//
enum ExportMode {
ExportDefault = 0,
ExportExtern = 2,
ExportMinimal = 4,
ExportSecret = 16,
ExportRaw = 32,
ExportPKCS12 = 64,
ExportNoUID = 128, // obsolete; has no effect
ExportSSH = 256,
ExportSecretSubkey = 512,
};
GpgME::Error exportPublicKeys(const char *pattern, Data &keyData);
GpgME::Error exportPublicKeys(const char *pattern, Data &keyData, unsigned int mode);
GpgME::Error exportPublicKeys(const char *pattern[], Data &keyData);
GpgME::Error exportPublicKeys(const char *pattern[], Data &keyData, unsigned int mode);
GpgME::Error startPublicKeyExport(const char *pattern, Data &keyData);
GpgME::Error startPublicKeyExport(const char *pattern, Data &keyData, unsigned int mode);
GpgME::Error startPublicKeyExport(const char *pattern[], Data &keyData);
GpgME::Error startPublicKeyExport(const char *pattern[], Data &keyData, unsigned int mode);
GpgME::Error exportSecretKeys(const char *pattern, Data &keyData, unsigned int mode = ExportSecret);
GpgME::Error exportSecretKeys(const char *pattern[], Data &keyData, unsigned int mode = ExportSecret);
GpgME::Error startSecretKeyExport(const char *pattern, Data &keyData, unsigned int mode = ExportSecret);
GpgME::Error startSecretKeyExport(const char *pattern[], Data &keyData, unsigned int mode = ExportSecret);
GpgME::Error exportSecretSubkeys(const char *pattern, Data &keyData, unsigned int mode = ExportSecretSubkey);
GpgME::Error exportSecretSubkeys(const char *pattern[], Data &keyData, unsigned int mode = ExportSecretSubkey);
GpgME::Error startSecretSubkeyExport(const char *pattern, Data &keyData, unsigned int mode = ExportSecretSubkey);
GpgME::Error startSecretSubkeyExport(const char *pattern[], Data &keyData, unsigned int mode = ExportSecretSubkey);
// generic export functions; prefer using the specific public/secret key export functions
GpgME::Error exportKeys(const char *pattern, Data &keyData, unsigned int mode = ExportDefault);
GpgME::Error exportKeys(const char *pattern[], Data &keyData, unsigned int mode = ExportDefault);
GpgME::Error startKeyExport(const char *pattern, Data &keyData, unsigned int mode = ExportDefault);
GpgME::Error startKeyExport(const char *pattern[], Data &keyData, unsigned int mode = ExportDefault);
//
// Key Import
@ -237,10 +189,8 @@ public:
ImportResult importKeys(const Data &data);
ImportResult importKeys(const std::vector<Key> &keys);
ImportResult importKeys(const std::vector<std::string> &keyIds);
GpgME::Error startKeyImport(const Data &data);
GpgME::Error startKeyImport(const std::vector<Key> &keys);
GpgME::Error startKeyImport(const std::vector<std::string> &keyIds);
ImportResult importResult() const;
//
@ -264,69 +214,12 @@ public:
GpgME::Error edit(const Key &key, std::unique_ptr<EditInteractor> function, Data &out);
GpgME::Error startEditing(const Key &key, std::unique_ptr<EditInteractor> function, Data &out);
//
// Modern Interface actions. Require 2.1.x
//
Error startCreateKey (const char *userid,
const char *algo,
unsigned long reserved,
unsigned long expires,
const Key &certkey,
unsigned int flags);
Error createKey (const char *userid,
const char *algo,
unsigned long reserved,
unsigned long expires,
const Key &certkey,
unsigned int flags);
// Same as create key but returning a result
GpgME::KeyGenerationResult createKeyEx (const char *userid,
const char *algo,
unsigned long reserved,
unsigned long expires,
const Key &certkey,
unsigned int flags);
Error addUid(const Key &key, const char *userid);
Error startAddUid(const Key &key, const char *userid);
Error revUid(const Key &key, const char *userid);
Error startRevUid(const Key &key, const char *userid);
Error setPrimaryUid(const Key &key, const char *userid);
Error startSetPrimaryUid(const Key &key, const char *userid);
Error createSubkey(const Key &key, const char *algo,
unsigned long reserved = 0,
unsigned long expires = 0,
unsigned int flags = 0);
Error startCreateSubkey(const Key &key, const char *algo,
unsigned long reserved = 0,
unsigned long expires = 0,
unsigned int flags = 0);
enum SetExpireFlags {
SetExpireDefault = 0,
SetExpireAllSubkeys = 1
};
Error setExpire(const Key &k, unsigned long expires,
const std::vector<Subkey> &subkeys = std::vector<Subkey>(),
const SetExpireFlags flags = SetExpireDefault);
Error startSetExpire(const Key &k, unsigned long expires,
const std::vector<Subkey> &subkeys = std::vector<Subkey>(),
const SetExpireFlags flags = SetExpireDefault);
Error revokeSignature(const Key &key, const Key &signingKey,
const std::vector<UserID> &userIds = std::vector<UserID>());
Error startRevokeSignature(const Key &key, const Key &signingKey,
const std::vector<UserID> &userIds = std::vector<UserID>());
Error addAdsk(const Key &k, const char *adsk);
Error startAddAdsk(const Key &k, const char *adsk);
// using TofuInfo::Policy
Error setTofuPolicy(const Key &k, unsigned int policy);
Error setTofuPolicyStart(const Key &k, unsigned int policy);
@ -373,7 +266,6 @@ public:
// Keep in line with core's flags
DecryptNone = 0,
DecryptVerify = 1,
DecryptArchive = 2,
DecryptUnwrap = 128,
DecryptMaxValue = 0x80000000
};
@ -451,10 +343,7 @@ public:
NoCompress = 16,
Symmetric = 32,
ThrowKeyIds = 64,
EncryptWrap = 128,
WantAddress = 256,
EncryptArchive = 512,
EncryptFile = 1024
EncryptWrap = 128
};
EncryptionResult encrypt(const std::vector<Key> &recipients, const Data &plainText, Data &cipherText, EncryptionFlags flags);
GpgME::Error encryptSymmetrically(const Data &plainText, Data &cipherText);
@ -475,9 +364,7 @@ public:
//
//
enum AuditLogFlags {
DefaultAuditLog = 0,
HtmlAuditLog = 1,
DiagnosticAuditLog = 2,
AuditLogWithHelp = 128
};
GpgME::Error startGetAuditLog(Data &output, unsigned int flags = 0);
@ -495,8 +382,7 @@ public:
enum SpawnFlags {
SpawnNone = 0,
SpawnDetached = 1,
SpawnAllowSetFg = 2,
SpawnShowWindow = 4
SpawnAllowSetFg = 2
};
/** Spwan the process \a file with arguments \a argv.
*
@ -530,7 +416,6 @@ public:
GpgME::Error wait();
GpgME::Error lastError() const;
GpgME::Error cancelPendingOperation();
GpgME::Error cancelPendingOperationImmediately();
class Private;
const Private *impl() const
@ -541,7 +426,6 @@ public:
{
return d;
}
private:
// Helper functions that need to be context because they rely
// on the "Friendlyness" of context to access the gpgme types.

View File

@ -1,7 +1,6 @@
/*
statusconsumer.h - Interface for status callbacks
Copyright (c) 2020 g10 Code GmbH
Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
context_glib.cpp - wraps a gpgme key context, gpgme-glib-specific functions
Copyright (C) 2007 Klarälvdalens Datakonsult AB
This file is part of GPGME++.
@ -21,22 +20,20 @@
Boston, MA 02110-1301, USA.
*/
#ifndef __GPGMEPP_INTERFACES_STATUSCONSUMER_H__
#define __GPGMEPP_INTERFACES_STATUSCONSUMER_H__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "../gpgmepp_export.h"
#include <global.h>
namespace GpgME
extern "C" GIOChannel *gpgme_get_fdptr(int);
GIOChannel *GpgME::getGIOChannel(int fd)
{
return gpgme_get_fdptr(fd);
}
class GPGMEPP_EXPORT StatusConsumer
QIODevice *GpgME::getQIODevice(int fd)
{
public:
virtual ~StatusConsumer() {}
virtual void status(const char *status, const char *details) = 0;
};
} // namespace GpgME
#endif // __GPGMEPP_INTERFACES_STATUSCONSUMER_H__
return 0;
}

View File

@ -1,8 +1,6 @@
/*
context_p.h - wraps a gpgme context (private part)
Copyright (C) 2003, 2007 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -53,7 +51,6 @@ public:
KeyGen = 0x080,
KeyList = 0x100,
KeyListWithImport = KeyList | Import, // gpgme_keylist_result_t and gpgme_import_result_t
TrustList = 0x200, // no gpgme_trustlist_result_t, but nevertheless...
Edit = 0x400, // no gpgme_edit_result_t, but nevertheless...
@ -70,7 +67,7 @@ public:
EndMarker
};
Private(gpgme_ctx_t c = nullptr);
Private(gpgme_ctx_t c = 0);
~Private();
gpgme_ctx_t ctx;

View File

@ -1,7 +1,6 @@
/*
util.cpp - some internal helpers
Copyright (c) 2022 g10 Code GmbH
Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
context_qt.cpp - wraps a gpgme key context, gpgme-qt-specific functions
Copyright (C) 2007 Klarälvdalens Datakonsult AB
This file is part of GPGME++.
@ -25,23 +24,16 @@
#include "config.h"
#endif
#include "util.h"
#include <global.h>
#include <functional>
extern "C" QIODevice *gpgme_get_fdptr(int);
StringsToCStrings::StringsToCStrings(const std::vector<std::string>& v)
: m_strings{v}
GIOChannel *GpgME::getGIOChannel(int)
{
return 0;
}
const char **StringsToCStrings::c_strs() const
QIODevice *GpgME::getQIODevice(int fd)
{
if (m_cstrings.empty()) {
m_cstrings.reserve(m_strings.size() + 1);
std::transform(std::begin(m_strings), std::end(m_strings),
std::back_inserter(m_cstrings),
std::mem_fn(&std::string::c_str));
m_cstrings.push_back(nullptr);
}
return m_cstrings.data();
return gpgme_get_fdptr(fd);
}

View File

@ -1,8 +1,6 @@
/*
context_vanilla.cpp - wraps a gpgme key context, gpgme (vanilla)-specific functions
Copyright (C) 2007 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -30,10 +28,10 @@
GIOChannel *GpgME::getGIOChannel(int)
{
return nullptr;
return 0;
}
QIODevice *GpgME::getQIODevice(int)
{
return nullptr;
return 0;
}

View File

@ -48,11 +48,11 @@ GpgME::Data::Data()
{
gpgme_data_t data;
const gpgme_error_t e = gpgme_data_new(&data);
d.reset(new Private(e ? nullptr : data));
d.reset(new Private(e ? 0 : data));
}
GpgME::Data::Data(const Null &)
: d(new Private(nullptr))
: d(new Private(0))
{
}
@ -70,14 +70,14 @@ GpgME::Data::Data(const char *buffer, size_t size, bool copy)
std::string sizestr = std::to_string(size);
// Ignore errors as this is optional
gpgme_data_set_flag(data, "size-hint", sizestr.c_str());
d.reset(new Private(e ? nullptr : data));
d.reset(new Private(e ? 0 : data));
}
GpgME::Data::Data(const char *filename)
{
gpgme_data_t data;
const gpgme_error_t e = gpgme_data_new(&data);
d.reset(new Private(e ? nullptr : data));
d.reset(new Private(e ? 0 : data));
if (!e) {
setFileName(filename);
}
@ -86,29 +86,29 @@ GpgME::Data::Data(const char *filename)
GpgME::Data::Data(const char *filename, off_t offset, size_t length)
{
gpgme_data_t data;
const gpgme_error_t e = gpgme_data_new_from_filepart(&data, filename, nullptr, offset, length);
d.reset(new Private(e ? nullptr : data));
const gpgme_error_t e = gpgme_data_new_from_filepart(&data, filename, 0, offset, length);
d.reset(new Private(e ? 0 : data));
}
GpgME::Data::Data(FILE *fp)
{
gpgme_data_t data;
const gpgme_error_t e = gpgme_data_new_from_stream(&data, fp);
d.reset(new Private(e ? nullptr : data));
d.reset(new Private(e ? 0 : data));
}
GpgME::Data::Data(FILE *fp, off_t offset, size_t length)
{
gpgme_data_t data;
const gpgme_error_t e = gpgme_data_new_from_filepart(&data, nullptr, fp, offset, length);
d.reset(new Private(e ? nullptr : data));
const gpgme_error_t e = gpgme_data_new_from_filepart(&data, 0, fp, offset, length);
d.reset(new Private(e ? 0 : data));
}
GpgME::Data::Data(int fd)
{
gpgme_data_t data;
const gpgme_error_t e = gpgme_data_new_from_fd(&data, fd);
d.reset(new Private(e ? nullptr : data));
d.reset(new Private(e ? 0 : data));
}
GpgME::Data::Data(DataProvider *dp)
@ -118,20 +118,20 @@ GpgME::Data::Data(DataProvider *dp)
return;
}
if (!dp->isSupported(DataProvider::Read)) {
d->cbs.read = nullptr;
d->cbs.read = 0;
}
if (!dp->isSupported(DataProvider::Write)) {
d->cbs.write = nullptr;
d->cbs.write = 0;
}
if (!dp->isSupported(DataProvider::Seek)) {
d->cbs.seek = nullptr;
d->cbs.seek = 0;
}
if (!dp->isSupported(DataProvider::Release)) {
d->cbs.release = nullptr;
d->cbs.release = 0;
}
const gpgme_error_t e = gpgme_data_new_from_cbs(&d->data, &d->cbs, dp);
if (e) {
d->data = nullptr;
d->data = 0;
}
if (dp->isSupported(DataProvider::Seek)) {
off_t size = seek(0, SEEK_END);
@ -217,11 +217,6 @@ GpgME::Error GpgME::Data::setFileName(const char *name)
return Error(gpgme_data_set_file_name(d->data, name));
}
GpgME::Error GpgME::Data::setFileName(const std::string &name)
{
return Error(gpgme_data_set_file_name(d->data, name.c_str()));
}
ssize_t GpgME::Data::read(void *buffer, size_t length)
{
return gpgme_data_read(d->data, buffer, length);
@ -237,11 +232,6 @@ off_t GpgME::Data::seek(off_t offset, int whence)
return gpgme_data_seek(d->data, offset, whence);
}
GpgME::Error GpgME::Data::rewind()
{
return Error(gpgme_data_rewind(d->data));
}
std::vector<GpgME::Key> GpgME::Data::toKeys(Protocol proto) const
{
std::vector<GpgME::Key> ret;
@ -261,33 +251,6 @@ std::vector<GpgME::Key> GpgME::Data::toKeys(Protocol proto) const
while (!gpgme_op_keylist_next (ctx->impl()->ctx, &key)) {
ret.push_back(GpgME::Key(key, false));
}
gpgme_data_seek (d->data, 0, SEEK_SET);
delete ctx;
return ret;
}
std::string GpgME::Data::toString()
{
std::string ret;
char buf[4096];
size_t nread;
seek (0, SEEK_SET);
while ((nread = read (buf, 4096)) > 0)
{
ret += std::string (buf, nread);
}
seek (0, SEEK_SET);
return ret;
}
GpgME::Error GpgME::Data::setFlag(const char *name, const char *value)
{
return Error(gpgme_data_set_flag(d->data, name, value));
}
GpgME::Error GpgME::Data::setSizeHint(uint64_t size)
{
const std::string val = std::to_string(size);
return Error(gpgme_data_set_flag(d->data, "size-hint", val.c_str()));
}

View File

@ -27,7 +27,6 @@
#include "key.h"
#include <sys/types.h> // for size_t, off_t
#include <cstdint> // unit64_t
#include <cstdio> // FILE
#include <algorithm>
#include <memory>
@ -61,7 +60,6 @@ public:
static const Null null;
Data(const Data &other) = default;
const Data &operator=(Data other)
{
swap(other);
@ -107,28 +105,15 @@ public:
char *fileName() const;
Error setFileName(const char *name);
Error setFileName(const std::string &name);
ssize_t read(void *buffer, size_t length);
ssize_t write(const void *buffer, size_t length);
off_t seek(off_t offset, int whence);
/* Convenience function to do a seek (0, SEEK_SET). */
Error rewind();
/** Try to parse the data to a key object using the
* Protocol proto. Returns an empty list on error.*/
std::vector<Key> toKeys(const Protocol proto = Protocol::OpenPGP) const;
/** Return a copy of the data as std::string. Sets seek pos to 0 */
std::string toString();
/** See gpgme_data_set_flag */
Error setFlag(const char *name, const char *value);
/** Set a size hint for this data e.g. for progress calculations. */
Error setSizeHint(uint64_t size);
class Private;
Private *impl()
{

View File

@ -1,8 +1,6 @@
/*
data_p.h - wraps a gpgme data object, private part -*- c++ -*-
Copyright (C) 2003,2004 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -31,7 +29,7 @@
class GpgME::Data::Private
{
public:
explicit Private(gpgme_data_t d = nullptr)
explicit Private(gpgme_data_t d = 0)
: data(d), cbs(data_provider_callbacks) {}
~Private();

View File

@ -1,8 +1,6 @@
/*
decryptionresult.cpp - wraps a gpgme keygen result
Copyright (C) 2004 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -51,30 +49,23 @@ public:
if (res.file_name) {
res.file_name = strdup(res.file_name);
}
if (res.symkey_algo) {
res.symkey_algo = strdup(res.symkey_algo);
}
//FIXME: copying gpgme_recipient_t objects invalidates the keyid member,
//thus we use _keyid for now (internal API)
for (gpgme_recipient_t r = res.recipients ; r ; r = r->next) {
recipients.push_back(*r);
}
res.recipients = nullptr;
res.recipients = 0;
}
~Private()
{
if (res.unsupported_algorithm) {
std::free(res.unsupported_algorithm);
}
res.unsupported_algorithm = nullptr;
res.unsupported_algorithm = 0;
if (res.file_name) {
std::free(res.file_name);
}
res.file_name = nullptr;
if (res.symkey_algo) {
std::free(res.symkey_algo);
}
res.symkey_algo = nullptr;
res.file_name = 0;
}
_gpgme_op_decrypt_result res;
@ -109,7 +100,7 @@ make_standard_stuff(DecryptionResult)
const char *GpgME::DecryptionResult::unsupportedAlgorithm() const
{
return d ? d->res.unsupported_algorithm : nullptr ;
return d ? d->res.unsupported_algorithm : 0 ;
}
bool GpgME::DecryptionResult::isWrongKeyUsage() const
@ -117,19 +108,9 @@ bool GpgME::DecryptionResult::isWrongKeyUsage() const
return d && d->res.wrong_key_usage;
}
bool GpgME::DecryptionResult::isDeVs() const
{
return d && d->res.is_de_vs;
}
bool GpgME::DecryptionResult::isMime() const
{
return d && d->res.is_mime;
}
const char *GpgME::DecryptionResult::fileName() const
{
return d ? d->res.file_name : nullptr ;
return d ? d->res.file_name : 0 ;
}
unsigned int GpgME::DecryptionResult::numRecipients() const
@ -167,21 +148,6 @@ std::vector<GpgME::DecryptionResult::Recipient> GpgME::DecryptionResult::recipie
return result;
}
const char *GpgME::DecryptionResult::sessionKey() const
{
return d ? d->res.session_key : nullptr;
}
const char *GpgME::DecryptionResult::symkeyAlgo() const
{
return d ? d->res.symkey_algo : nullptr;
}
bool GpgME::DecryptionResult::isLegacyCipherNoMDC() const
{
return d && d->res.legacy_cipher_nomdc;
}
class GpgME::DecryptionResult::Recipient::Private : public _gpgme_recipient
{
public:
@ -213,7 +179,7 @@ const char *GpgME::DecryptionResult::Recipient::keyID() const
if (d) {
return d->_keyid;
}
return nullptr;
return 0;
}
const char *GpgME::DecryptionResult::Recipient::shortKeyID() const
@ -222,7 +188,7 @@ const char *GpgME::DecryptionResult::Recipient::shortKeyID() const
if (d) {
return d->_keyid + 8;
}
return nullptr;
return 0;
}
unsigned int GpgME::DecryptionResult::Recipient::publicKeyAlgorithm() const
@ -238,7 +204,7 @@ const char *GpgME::DecryptionResult::Recipient::publicKeyAlgorithmAsString() con
if (d) {
return gpgme_pubkey_algo_name(d->pubkey_algo);
}
return nullptr;
return 0;
}
GpgME::Error GpgME::DecryptionResult::Recipient::status() const
@ -257,9 +223,6 @@ std::ostream &GpgME::operator<<(std::ostream &os, const DecryptionResult &result
<< "\n fileName: " << protect(result.fileName())
<< "\n unsupportedAlgorithm: " << protect(result.unsupportedAlgorithm())
<< "\n isWrongKeyUsage: " << result.isWrongKeyUsage()
<< "\n isDeVs " << result.isDeVs()
<< "\n legacyCipherNoMDC " << result.isLegacyCipherNoMDC()
<< "\n symkeyAlgo: " << protect(result.symkeyAlgo())
<< "\n recipients:\n";
const std::vector<DecryptionResult::Recipient> recipients = result.recipients();
std::copy(recipients.begin(), recipients.end(),

View File

@ -1,8 +1,6 @@
/*
decryptionresult.h - wraps a gpgme keygen result
Copyright (C) 2004 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -47,7 +45,6 @@ public:
DecryptionResult(gpgme_ctx_t ctx, const Error &err);
explicit DecryptionResult(const Error &err);
DecryptionResult(const DecryptionResult &other) = default;
const DecryptionResult &operator=(DecryptionResult other)
{
swap(other);
@ -74,23 +71,15 @@ public:
return isWrongKeyUsage();
}
bool isWrongKeyUsage() const;
bool isDeVs() const;
bool isMime() const;
const char *fileName() const;
const char *sessionKey() const;
const char *symkeyAlgo() const;
class Recipient;
unsigned int numRecipients() const;
Recipient recipient(unsigned int idx) const;
std::vector<Recipient> recipients() const;
bool isLegacyCipherNoMDC() const;
private:
class Private;
void init(gpgme_ctx_t ctx);
@ -105,7 +94,6 @@ public:
Recipient();
explicit Recipient(gpgme_recipient_t reci);
Recipient(const Recipient &other) = default;
const Recipient &operator=(Recipient other)
{
swap(other);

View File

@ -1,8 +1,6 @@
/*
defaultassuantransaction.cpp - default Assuan Transaction that just stores data and status lines
Copyright (C) 2009 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -30,6 +28,8 @@
#include "error.h"
#include "data.h"
#include <sstream>
using namespace GpgME;
DefaultAssuanTransaction::DefaultAssuanTransaction()

View File

@ -1,8 +1,6 @@
/*
defaultassuantransaction.h - default Assuan Transaction that just stores data and status lines
Copyright (C) 2009 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -25,7 +23,7 @@
#ifndef __GPGMEPP_DEFAULTASSUANTRANSACTION_H__
#define __GPGMEPP_DEFAULTASSUANTRANSACTION_H__
#include "interfaces/assuantransaction.h"
#include <interfaces/assuantransaction.h>
#include <string>
#include <vector>
@ -53,9 +51,9 @@ public:
}
private:
Error data(const char *data, size_t datalen) override;
Data inquire(const char *name, const char *args, Error &err) override;
Error status(const char *status, const char *args) override;
/* reimp */ Error data(const char *data, size_t datalen);
/* reimp */ Data inquire(const char *name, const char *args, Error &err);
/* reimp */ Error status(const char *status, const char *args);
private:
std::vector< std::pair<std::string, std::string> > m_status;

View File

@ -1,8 +1,6 @@
/*
editinteractor.cpp - Interface for edit interactors
Copyright (C) 2007 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -29,7 +27,6 @@
#include "editinteractor.h"
#include "callbacks.h"
#include "error.h"
#include "util.h"
#include <gpgme.h>
@ -42,7 +39,6 @@
#include <cerrno>
#include <cstring>
#include <cstdlib>
#ifndef GPG_ERR_ALREADY_SIGNED
# define GPG_ERR_ALREADY_SIGNED GPG_ERR_USER_1
@ -52,7 +48,6 @@ using namespace GpgME;
static const char *status_to_string(unsigned int status);
static Error status_to_error(unsigned int status);
static Error parse_sc_op_failure(const char *args);
class EditInteractor::Private
{
@ -64,10 +59,9 @@ public:
~Private();
private:
unsigned int state = StartState;
unsigned int state;
Error error;
std::FILE *debug = nullptr;
bool debugNeedsClosing = false;
std::FILE *debug;
};
class GpgME::CallbackHelper
@ -97,24 +91,12 @@ public:
// advance to next state based on input:
const unsigned int oldState = ei->state;
if (ei->q->needsNoResponse(status)) {
// keep state
} else if (status == GPGME_STATUS_ERROR) {
err = ei->q->parseStatusError(args);
ei->state = EditInteractor::ErrorState;
} else if (status == GPGME_STATUS_SC_OP_FAILURE) {
err = parse_sc_op_failure(args);
ei->state = EditInteractor::ErrorState;
} else {
ei->state = ei->q->nextState(status, args, err);
}
ei->state = ei->q->nextState(status, args, err);
if (ei->debug) {
std::fprintf(ei->debug, "EditInteractor: %u -> nextState( %s, %s ) -> %u\n",
oldState, status_to_string(status), args ? args : "<null>", ei->state);
}
if (err || err.isCanceled()) {
if (err) {
ei->state = oldState;
goto error;
}
@ -138,7 +120,7 @@ public:
if (writeAll(fd, result, len) != len) {
err = Error::fromSystemError();
if (ei->debug) {
std::fprintf(ei->debug, "EditInteractor: Could not write to fd %d (%s)\n", fd, err.asStdString().c_str());
std::fprintf(ei->debug, "EditInteractor: Could not write to fd %d (%s)\n", fd, err.asString());
}
goto error;
}
@ -147,7 +129,7 @@ public:
if (writeAll(fd, "\n", 1) != 1) {
err = Error::fromSystemError();
if (ei->debug) {
std::fprintf(ei->debug, "EditInteractor: Could not write to fd %d (%s)\n", fd, err.asStdString().c_str());
std::fprintf(ei->debug, "EditInteractor: Could not write to fd %d (%s)\n", fd, err.asString());
}
goto error;
}
@ -167,7 +149,7 @@ public:
}
error:
if (err || err.isCanceled()) {
if (err) {
ei->error = err;
ei->state = EditInteractor::ErrorState;
}
@ -189,28 +171,15 @@ static gpgme_error_t edit_interactor_callback(void *opaque, gpgme_status_code_t
const gpgme_edit_cb_t GpgME::edit_interactor_callback = ::edit_interactor_callback;
EditInteractor::Private::Private(EditInteractor *qq)
: q(qq)
: q(qq),
state(StartState),
error(),
debug(0)
{
const char *debug_env = std::getenv("GPGMEPP_INTERACTOR_DEBUG");
if (!debug_env) {
return;
}
if (!strcmp(debug_env, "stdout")) {
debug = stdout;
} else if (!strcmp(debug_env, "stderr")) {
debug = stderr;
} else if (debug_env) {
debug = std::fopen(debug_env, "a+");
debugNeedsClosing = true;
}
}
EditInteractor::Private::~Private()
{
if (debug && debugNeedsClosing) {
std::fclose(debug);
}
}
EditInteractor::Private::~Private() {}
EditInteractor::EditInteractor()
: d(new Private(this))
@ -270,52 +239,6 @@ void EditInteractor::setDebugChannel(std::FILE *debug)
d->debug = debug;
}
GpgME::Error EditInteractor::parseStatusError(const char *args)
{
Error err;
const auto fields = split(args, ' ');
if (fields.size() >= 2) {
err = Error{static_cast<unsigned int>(std::stoul(fields[1]))};
} else {
err = Error::fromCode(GPG_ERR_GENERAL);
}
return err;
}
static Error sc_op_failure_to_error(unsigned int status)
{
switch (status) {
case 1:
// GPG_ERR_CANCELED or GPG_ERR_FULLY_CANCELED
return Error::fromCode(GPG_ERR_CANCELED);
case 2:
// GPG_ERR_BAD_PIN or GPG_ERR_BAD_RESET_CODE [sic]
return Error::fromCode(GPG_ERR_BAD_PIN);
case 3:
return Error::fromCode(GPG_ERR_PIN_BLOCKED);
case 4:
return Error::fromCode(GPG_ERR_NO_RESET_CODE);
}
return Error::fromCode(GPG_ERR_CARD);
}
// static
Error parse_sc_op_failure(const char *args)
{
Error err;
const auto fields = split(args, ' ');
if (fields.size() >= 1) {
err = sc_op_failure_to_error(static_cast<unsigned int>(std::stoul(fields[0])));
} else {
err = Error::fromCode(GPG_ERR_CARD);
}
return err;
}
static const char *const status_strings[] = {
"EOF",
/* mkstatus processing starts here */

View File

@ -1,8 +1,6 @@
/*
editinteractor.h - Interface for edit interactors
Copyright (C) 2007 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -60,9 +58,6 @@ public:
void setDebugChannel(std::FILE *file);
protected:
Error parseStatusError(const char *args);
private:
class Private;
Private *const d;

View File

@ -1,8 +1,6 @@
/*
encryptionresult.cpp - wraps a gpgme verify result
Copyright (C) 2004 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -53,7 +51,7 @@ public:
if (ik->fpr) {
copy->fpr = strdup(ik->fpr);
}
copy->next = nullptr;
copy->next = 0;
invalid.push_back(copy);
}
}
@ -61,7 +59,7 @@ public:
{
for (std::vector<gpgme_invalid_key_t>::iterator it = invalid.begin() ; it != invalid.end() ; ++it) {
std::free((*it)->fpr);
delete *it; *it = nullptr;
delete *it; *it = 0;
}
}
@ -132,7 +130,7 @@ bool GpgME::InvalidRecipient::isNull() const
const char *GpgME::InvalidRecipient::fingerprint() const
{
return isNull() ? nullptr : d->invalid[idx]->fpr ;
return isNull() ? 0 : d->invalid[idx]->fpr ;
}
GpgME::Error GpgME::InvalidRecipient::reason() const

View File

@ -1,8 +1,6 @@
/*
encryptionresult.h - wraps a gpgme sign result
Copyright (C) 2004 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -48,7 +46,6 @@ public:
EncryptionResult(gpgme_ctx_t ctx, const Error &error);
EncryptionResult(const Error &err);
EncryptionResult(const EncryptionResult &other) = default;
const EncryptionResult &operator=(EncryptionResult other)
{
swap(other);
@ -84,7 +81,6 @@ class GPGMEPP_EXPORT InvalidRecipient
public:
InvalidRecipient();
InvalidRecipient(const InvalidRecipient &other) = default;
const InvalidRecipient &operator=(InvalidRecipient other)
{
swap(other);

View File

@ -1,8 +1,6 @@
/*
engineinfo.h
Copyright (C) 2004 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -33,10 +31,10 @@
class GpgME::EngineInfo::Private
{
public:
Private(gpgme_engine_info_t engine = nullptr) : info(engine) {}
Private(gpgme_engine_info_t engine = 0) : info(engine) {}
~Private()
{
info = nullptr;
info = 0;
}
gpgme_engine_info_t info;
@ -70,12 +68,12 @@ GpgME::Protocol GpgME::EngineInfo::protocol() const
const char *GpgME::EngineInfo::fileName() const
{
return isNull() ? nullptr : d->info->file_name;
return isNull() ? 0 : d->info->file_name;
}
const char *GpgME::EngineInfo::version() const
{
return isNull() ? nullptr : d->info->version;
return isNull() ? 0 : d->info->version;
}
GpgME::EngineInfo::Version GpgME::EngineInfo::engineVersion() const
@ -85,10 +83,10 @@ GpgME::EngineInfo::Version GpgME::EngineInfo::engineVersion() const
const char *GpgME::EngineInfo::requiredVersion() const
{
return isNull() ? nullptr : d->info->req_version;
return isNull() ? 0 : d->info->req_version;
}
const char *GpgME::EngineInfo::homeDirectory() const
{
return isNull() ? nullptr : d->info->home_dir;
return isNull() ? 0 : d->info->home_dir;
}

View File

@ -1,8 +1,6 @@
/*
engineinfo.h
Copyright (C) 2004 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -69,85 +67,15 @@ public:
}
}
bool operator < (const Version& other) const
{
if (major > other.major ||
(major == other.major && minor > other.minor) ||
(major == other.major && minor == other.minor && patch > other.patch) ||
(major >= other.major && minor >= other.minor && patch >= other.patch)) {
return false;
}
return true;
}
bool operator < (const char* other) const
{
return operator<(Version(other));
}
bool operator <= (const Version &other) const
{
return !operator>(other);
}
bool operator <= (const char *other) const
{
return operator<=(Version(other));
}
bool operator > (const char* other) const
{
return operator>(Version(other));
}
bool operator > (const Version & other) const
{
return !operator<(other) && !operator==(other);
}
bool operator >= (const Version &other) const
{
return !operator<(other);
}
bool operator >= (const char *other) const
{
return operator>=(Version(other));
}
bool operator == (const Version& other) const
{
return major == other.major
&& minor == other.minor
&& patch == other.patch;
}
bool operator == (const char* other) const
{
return operator==(Version(other));
}
bool operator != (const Version &other) const
{
return !operator==(other);
}
bool operator != (const char *other) const
{
return operator!=(Version(other));
}
// the non-const overloads of the comparison operators are kept for
// binary compatibility
bool operator < (const Version& other)
{
if (major > other.major ||
(major == other.major && minor > other.minor) ||
(major == other.major && minor == other.minor && patch > other.patch) ||
(major >= other.major && minor >= other.minor && patch >= other.patch)) {
return false;
}
return true;
if (major < other.major)
return true;
if (minor < other.minor)
return true;
if (patch < other.patch)
return true;
return false;
}
bool operator < (const char* other)
@ -155,36 +83,6 @@ public:
return operator<(Version(other));
}
bool operator <= (const Version &other)
{
return !operator>(other);
}
bool operator <= (const char *other)
{
return operator<=(Version(other));
}
bool operator > (const char* other)
{
return operator>(Version(other));
}
bool operator > (const Version & other)
{
return !operator<(other) && !operator==(other);
}
bool operator >= (const Version &other)
{
return !operator<(other);
}
bool operator >= (const char *other)
{
return operator>=(Version(other));
}
bool operator == (const Version& other)
{
return major == other.major
@ -197,16 +95,6 @@ public:
return operator==(Version(other));
}
bool operator != (const Version &other)
{
return !operator==(other);
}
bool operator != (const char *other)
{
return operator!=(Version(other));
}
friend std::ostream& operator << (std::ostream& stream, const Version& ver)
{
stream << ver.major;
@ -221,7 +109,6 @@ public:
EngineInfo();
explicit EngineInfo(gpgme_engine_info_t engine);
EngineInfo(const EngineInfo &other) = default;
const EngineInfo &operator=(EngineInfo other)
{
swap(other);

View File

@ -1,8 +1,6 @@
/*
error.h - wraps a gpgme error
Copyright (C) 2003, 2007 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -47,11 +45,7 @@ public:
explicit Error(unsigned int e) : mErr(e), mMessage() {}
const char *source() const;
/* This function is deprecated. Use asStdString() instead. asString() may
* return wrongly encoded (i.e. not UTF-8) results on Windows for the main
* thread if the function was first called from a secondary thread. */
GPGMEPP_DEPRECATED const char *asString() const;
std::string asStdString() const;
const char *asString() const;
int code() const;
int sourceID() const;

View File

@ -1,8 +1,6 @@
/*
eventloopinteractor.cpp
Copyright (C) 2003,2004 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -77,10 +75,10 @@ public:
const gpgme_io_cbs EventLoopInteractor::Private::iocbs = {
&EventLoopInteractor::Private::registerIOCb,
nullptr,
0,
&EventLoopInteractor::Private::removeIOCb,
&EventLoopInteractor::Private::eventIOCb,
nullptr
0
};
//
@ -114,7 +112,7 @@ void EventLoopInteractor::Private::removeIOCb(void *tag)
it != instance()->d->mCallbacks.end() ; ++it) {
if (*it == tag) {
instance()->unregisterWatcher((*it)->externalTag);
delete *it; *it = nullptr;
delete *it; *it = 0;
instance()->d->mCallbacks.erase(it);
return;
}
@ -159,7 +157,7 @@ void EventLoopInteractor::Private::eventIOCb(void *data, gpgme_event_io_t type,
// EventLoopInteractor Implementation
//
EventLoopInteractor *EventLoopInteractor::mSelf = nullptr;
EventLoopInteractor *EventLoopInteractor::mSelf = 0;
EventLoopInteractor::EventLoopInteractor() : d(new Private)
{
@ -170,7 +168,7 @@ EventLoopInteractor::EventLoopInteractor() : d(new Private)
EventLoopInteractor::~EventLoopInteractor()
{
// warn if there are still callbacks registered
mSelf = nullptr;
mSelf = 0;
delete d;
}

View File

@ -1,8 +1,6 @@
/*
eventloopinteractor.h
Copyright (C) 2003,2004 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.

View File

@ -1,8 +1,6 @@
/*
exception.cpp - exception wrapping a gpgme error
Copyright (C) 2007 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.

View File

@ -1,8 +1,6 @@
/*
exception.h - exception wrapping a gpgme error
Copyright (C) 2007 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.

View File

@ -1,8 +1,6 @@
/*
global.h - global gpgme functions and enums
Copyright (C) 2003, 2007 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -60,34 +58,14 @@ enum Engine { GpgEngine, GpgSMEngine, GpgConfEngine, UnknownEngine, AssuanEngine
enum KeyListMode {
Local = 0x1,
Extern = 0x2,
Locate = Local|Extern,
Signatures = 0x4,
SignatureNotations = 0x8,
Validate = 0x10,
Ephemeral = 0x20,
WithTofu = 0x40,
WithKeygrip = 0x80,
WithSecret = 0x100,
ForceExtern = 0x200,
LocateExternal = Locate|ForceExtern,
KeyListModeMask = 0x3ff
WithTofu = 0x40
};
enum SignatureMode {
NormalSignatureMode = 0,
Detached = 1,
Clearsigned = 2,
SignArchive = 4,
SignFile = 8,
};
enum class RevocationReason {
Unspecified = 0,
Compromised = 1,
Superseded = 2,
NoLongerUsed = 3
};
enum SignatureMode { NormalSignatureMode, Detached, Clearsigned };
GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, Protocol proto);
GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, Engine eng);
@ -108,8 +86,7 @@ GPGMEPP_EXPORT EngineInfo engineInfo(Engine engine);
homedir, sysconfdir, bindir, libexecdir, libdir,
datadir, localedir, agent-socket, agent-ssh-socket,
dirmngr-socket, uiserver-socket, gpgconf-name, gpg-name,
gpgsm-name, g13-name, keyboxd-name, agent-name, scdaemon-name,
dirmngr-name, pinentry-name, socketdir, gpg-wks-client-name, gpgtar-name.
gpgsm-name, g13-name
This may be extended in the future.
*/
@ -118,9 +95,6 @@ GPGMEPP_EXPORT const char *dirInfo(const char *what);
GPGMEPP_EXPORT Error checkEngine(Protocol proto);
GPGMEPP_EXPORT Error checkEngine(Engine engine);
/* Wrapper for gpgme_set_global_flag */
GPGMEPP_EXPORT int setGlobalFlag(const char *name, const char *value);
GPGMEPP_EXPORT GIOChannel *getGIOChannel(int fd);
GPGMEPP_EXPORT QIODevice *getQIODevice(int fd);
@ -188,7 +162,7 @@ GPGMEPP_EXPORT bool hasFeature(unsigned long feature, unsigned long feature2);
struct __safe_bool_dummy__ { void nonnull() {} }; \
typedef void ( __safe_bool_dummy__::*unspecified_bool_type )(); \
public: \
operator unspecified_bool_type() const { return ( Cond ) ? &__safe_bool_dummy__::nonnull : nullptr; }
operator unspecified_bool_type() const { return ( Cond ) ? &__safe_bool_dummy__::nonnull : 0 ; }
# endif
inline int _gpgmepp_strcmp(const char *s1, const char *s2)

View File

@ -1,205 +0,0 @@
/*
gpgaddexistingsubkeyeditinteractor.cpp - Edit Interactor to add an existing subkey to an OpenPGP key
Copyright (c) 2022 g10 Code GmbH
Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
This file is part of GPGME++.
GPGME++ is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
GPGME++ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with GPGME++; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gpgaddexistingsubkeyeditinteractor.h"
#include "error.h"
#include <gpgme.h>
// avoid conflict (msvc)
#ifdef ERROR
# undef ERROR
#endif
using namespace GpgME;
class GpgAddExistingSubkeyEditInteractor::Private
{
enum {
START = EditInteractor::StartState,
COMMAND,
ADD_EXISTING_KEY,
KEYGRIP,
FLAGS,
VALID,
KEY_CREATED,
QUIT,
SAVE,
ERROR = EditInteractor::ErrorState
};
GpgAddExistingSubkeyEditInteractor *const q = nullptr;
public:
Private(GpgAddExistingSubkeyEditInteractor *q, const std::string &keygrip)
: q{q}
, keygrip{keygrip}
{
}
const char *action(Error &err) const;
unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const;
std::string keygrip;
std::string expiry;
};
const char *GpgAddExistingSubkeyEditInteractor::Private::action(Error &err) const
{
switch (q->state()) {
case COMMAND:
return "addkey";
case ADD_EXISTING_KEY:
return "keygrip";
case KEYGRIP:
return keygrip.c_str();
case FLAGS:
return "Q"; // do not toggle any usage flags
case VALID:
return expiry.empty() ? "0" : expiry.c_str();
case QUIT:
return "quit";
case SAVE:
return "Y";
case START:
case KEY_CREATED:
case ERROR:
return nullptr;
default:
err = Error::fromCode(GPG_ERR_GENERAL);
return nullptr;
}
}
unsigned int GpgAddExistingSubkeyEditInteractor::Private::nextState(unsigned int status, const char *args, Error &err) const
{
using std::strcmp;
static const Error GENERAL_ERROR = Error::fromCode(GPG_ERR_GENERAL);
static const Error NO_KEY_ERROR = Error::fromCode(GPG_ERR_NO_KEY);
static const Error INV_TIME_ERROR = Error::fromCode(GPG_ERR_INV_TIME);
switch (q->state()) {
case START:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "keyedit.prompt") == 0) {
return COMMAND;
}
err = GENERAL_ERROR;
return ERROR;
case COMMAND:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "keygen.algo") == 0) {
return ADD_EXISTING_KEY;
}
err = GENERAL_ERROR;
return ERROR;
case ADD_EXISTING_KEY:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "keygen.keygrip") == 0) {
return KEYGRIP;
}
err = GENERAL_ERROR;
return ERROR;
case KEYGRIP:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "keygen.flags") == 0) {
return FLAGS;
} else if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "keygen.keygrip") == 0) {
err = NO_KEY_ERROR;
return ERROR;
}
err = GENERAL_ERROR;
return ERROR;
case FLAGS:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "keygen.valid") == 0) {
return VALID;
}
err = GENERAL_ERROR;
return ERROR;
case VALID:
if (status == GPGME_STATUS_KEY_CREATED) {
return KEY_CREATED;
}
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "keyedit.prompt") == 0) {
return QUIT;
} else if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "keygen.valid") == 0) {
err = INV_TIME_ERROR;
return ERROR;
}
err = GENERAL_ERROR;
return ERROR;
case KEY_CREATED:
return QUIT;
case QUIT:
if (status == GPGME_STATUS_GET_BOOL &&
strcmp(args, "keyedit.save.okay") == 0) {
return SAVE;
}
err = GENERAL_ERROR;
return ERROR;
case ERROR:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "keyedit.prompt") == 0) {
return QUIT;
}
err = q->lastError();
return ERROR;
default:
err = GENERAL_ERROR;
return ERROR;
}
}
GpgAddExistingSubkeyEditInteractor::GpgAddExistingSubkeyEditInteractor(const std::string &keygrip)
: EditInteractor{}
, d{new Private{this, keygrip}}
{
}
GpgAddExistingSubkeyEditInteractor::~GpgAddExistingSubkeyEditInteractor() = default;
void GpgAddExistingSubkeyEditInteractor::setExpiry(const std::string &timeString)
{
d->expiry = timeString;
}
const char *GpgAddExistingSubkeyEditInteractor::action(Error &err) const
{
return d->action(err);
}
unsigned int GpgAddExistingSubkeyEditInteractor::nextState(unsigned int status, const char *args, Error &err) const
{
return d->nextState(status, args, err);
}

View File

@ -1,59 +0,0 @@
/*
gpgaddexistingsubkeyeditinteractor.h - Edit Interactor to add an existing subkey to an OpenPGP key
Copyright (c) 2022 g10 Code GmbH
Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
This file is part of GPGME++.
GPGME++ is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
GPGME++ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with GPGME++; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __GPGMEPP_GPGADDEXISTINGSUBKEYEDITINTERACTOR_H__
#define __GPGMEPP_GPGADDEXISTINGSUBKEYEDITINTERACTOR_H__
#include "editinteractor.h"
#include <memory>
namespace GpgME
{
class GPGMEPP_EXPORT GpgAddExistingSubkeyEditInteractor : public EditInteractor
{
public:
/** Edit interactor to add the existing subkey with keygrip \a keygrip
* to the key a key edit operation is working on.
**/
explicit GpgAddExistingSubkeyEditInteractor(const std::string &keygrip);
~GpgAddExistingSubkeyEditInteractor() override;
/** Sets the validity period of the added subkey. Use "0" for no expiration
* or a simplified ISO date string ("yyyymmddThhmmss") for setting an
* expiration date. */
void setExpiry(const std::string &timeString);
private:
const char *action(Error &err) const override;
unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const override;
private:
class Private;
const std::unique_ptr<Private> d;
};
} // namespace GpgME
#endif // __GPGMEPP_GPGADDEXISTINGSUBKEYEDITINTERACTOR_H__

View File

@ -1,8 +1,6 @@
/*
gpgadduserideditinteractor.cpp - Edit Interactor to add a new UID to an OpenPGP key
Copyright (C) 2008 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -105,10 +103,10 @@ const char *GpgAddUserIDEditInteractor::action(Error &err) const
return "Y";
case START:
case ERROR:
return nullptr;
return 0;
default:
err = Error::fromCode(GPG_ERR_GENERAL);
return nullptr;
return 0;
}
}
@ -120,6 +118,10 @@ unsigned int GpgAddUserIDEditInteractor::nextState(unsigned int status, const ch
static const Error INV_EMAIL_ERROR = Error::fromCode(GPG_ERR_INV_USER_ID);
static const Error INV_COMMENT_ERROR = Error::fromCode(GPG_ERR_INV_USER_ID);
if (needsNoResponse(status)) {
return state();
}
using namespace GpgAddUserIDEditInteractor_Private;
switch (state()) {

View File

@ -1,8 +1,6 @@
/*
gpgadduserideditinteractor.h - Edit Interactor to add a new UID to an OpenPGP key
Copyright (C) 2008 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -25,7 +23,7 @@
#ifndef __GPGMEPP_GPGADDUSERIDEDITINTERACTOR_H__
#define __GPGMEPP_GPGADDUSERIDEDITINTERACTOR_H__
#include "editinteractor.h"
#include <editinteractor.h>
#include <string>
@ -57,8 +55,8 @@ public:
}
private:
const char *action(Error &err) const override;
unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const override;
/* reimp */ const char *action(Error &err) const;
/* reimp */ unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const;
private:
std::string m_name, m_email, m_comment;

View File

@ -1,8 +1,6 @@
/*
gpgagentgetinfoassuantransaction.cpp - Assuan Transaction to get information from gpg-agent
Copyright (C) 2009 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -33,6 +31,8 @@
#include <assert.h>
#include <sstream>
using namespace GpgME;
GpgAgentGetInfoAssuanTransaction::GpgAgentGetInfoAssuanTransaction(InfoItem item)

View File

@ -1,8 +1,6 @@
/*
gpgagentgetinfoassuantransaction.h - Assuan Transaction to get information from gpg-agent
Copyright (C) 2009 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -25,7 +23,7 @@
#ifndef __GPGMEPP_GPGAGENTGETINFOASSUANTRANSACTION_H__
#define __GPGMEPP_GPGAGENTGETINFOASSUANTRANSACTION_H__
#include "interfaces/assuantransaction.h"
#include <interfaces/assuantransaction.h>
#include <string>
#include <vector>
@ -56,10 +54,10 @@ public:
std::string sshSocketName() const;
private:
const char *command() const;
Error data(const char *data, size_t datalen) override;
Data inquire(const char *name, const char *args, Error &err) override;
Error status(const char *status, const char *args) override;
/* reimp */ const char *command() const;
/* reimp */ Error data(const char *data, size_t datalen);
/* reimp */ Data inquire(const char *name, const char *args, Error &err);
/* reimp */ Error status(const char *status, const char *args);
private:
void makeCommand() const;

View File

@ -1,7 +1,6 @@
/*
gpggencardkeyinteractor.cpp - Edit Interactor to generate a key on a card
Copyright (C) 2017 by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
Copyright (C) 2017 Intevation GmbH
This file is part of GPGME++.
@ -36,17 +35,16 @@ using namespace GpgME;
class GpgGenCardKeyInteractor::Private
{
public:
Private() : keysize("2048")
Private() : keysize(2048), backup(false)
{
}
std::string name, email, backupFileName, expiry, serial, keysize;
bool backup = false;
Algo algo = RSA;
std::string curve;
}
std::string name, email, backupFileName, expiry, serial;
int keysize;
bool backup;
};
GpgGenCardKeyInteractor::~GpgGenCardKeyInteractor() = default;
GpgGenCardKeyInteractor::~GpgGenCardKeyInteractor() {}
GpgGenCardKeyInteractor::GpgGenCardKeyInteractor(const std::string &serial):
d(new Private)
@ -71,7 +69,7 @@ void GpgGenCardKeyInteractor::setDoBackup(bool value)
void GpgGenCardKeyInteractor::setKeySize(int value)
{
d->keysize = std::to_string(value);
d->keysize = value;
}
void GpgGenCardKeyInteractor::setExpiry(const std::string &timeStr)
@ -84,20 +82,6 @@ std::string GpgGenCardKeyInteractor::backupFileName() const
return d->backupFileName;
}
void GpgGenCardKeyInteractor::setAlgo(Algo algo)
{
d->algo = algo;
}
void GpgGenCardKeyInteractor::setCurve(Curve curve)
{
if (curve == DefaultCurve) {
d->curve.clear();
} else if (curve >= 1 && curve <= LastCurve) {
d->curve = std::to_string(static_cast<int>(curve));
}
}
namespace GpgGenCardKeyInteractor_Private
{
enum {
@ -120,14 +104,6 @@ enum {
QUIT,
SAVE,
KEY_ATTR,
KEY_ALGO1,
KEY_ALGO2,
KEY_ALGO3,
KEY_CURVE1,
KEY_CURVE2,
KEY_CURVE3,
ERROR = EditInteractor::ErrorState
};
}
@ -142,16 +118,6 @@ const char *GpgGenCardKeyInteractor::action(Error &err) const
return "admin";
case COMMAND:
return "generate";
case KEY_ATTR:
return "key-attr";
case KEY_ALGO1:
case KEY_ALGO2:
case KEY_ALGO3:
return d->algo == RSA ? "1" : "2";
case KEY_CURVE1:
case KEY_CURVE2:
case KEY_CURVE3:
return d->curve.empty() ? "1" : d->curve.c_str(); // default is Curve25519
case NAME:
return d->name.c_str();
case EMAIL:
@ -165,7 +131,7 @@ const char *GpgGenCardKeyInteractor::action(Error &err) const
case SIZE:
case SIZE2:
case SIZE3:
return d->keysize.c_str();
return std::to_string(d->keysize).c_str();
case COMMENT:
return "";
case SAVE:
@ -177,10 +143,10 @@ const char *GpgGenCardKeyInteractor::action(Error &err) const
case GOT_SERIAL:
case BACKUP_KEY_CREATED:
case ERROR:
return nullptr;
return 0;
default:
err = Error::fromCode(GPG_ERR_GENERAL);
return nullptr;
return 0;
}
}
@ -192,6 +158,10 @@ unsigned int GpgGenCardKeyInteractor::nextState(unsigned int status, const char
static const Error INV_EMAIL_ERROR = Error::fromCode(GPG_ERR_INV_USER_ID);
static const Error INV_COMMENT_ERROR = Error::fromCode(GPG_ERR_INV_USER_ID);
if (needsNoResponse(status)) {
return state();
}
using namespace GpgGenCardKeyInteractor_Private;
switch (state()) {
@ -221,92 +191,12 @@ unsigned int GpgGenCardKeyInteractor::nextState(unsigned int status, const char
err = GENERAL_ERROR;
return ERROR;
case DO_ADMIN:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.prompt") == 0) {
return KEY_ATTR;
}
err = GENERAL_ERROR;
return ERROR;
// Handling for key-attr subcommand
case KEY_ATTR:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.prompt") == 0) {
// Happens if key attr is not yet supported.
return COMMAND;
}
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.genkeys.algo") == 0) {
return KEY_ALGO1;
}
err = GENERAL_ERROR;
return ERROR;
case KEY_ALGO1:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.genkeys.size") == 0) {
return SIZE;
}
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "keygen.curve") == 0) {
return KEY_CURVE1;
}
err = GENERAL_ERROR;
return ERROR;
case KEY_ALGO2:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.genkeys.size") == 0) {
return SIZE2;
}
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "keygen.curve") == 0) {
return KEY_CURVE2;
}
err = GENERAL_ERROR;
return ERROR;
case KEY_ALGO3:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.genkeys.size") == 0) {
return SIZE3;
}
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "keygen.curve") == 0) {
return KEY_CURVE3;
}
err = GENERAL_ERROR;
return ERROR;
case KEY_CURVE1:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.genkeys.algo") == 0) {
return KEY_ALGO2;
}
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.prompt") == 0) {
return COMMAND;
}
err = GENERAL_ERROR;
return ERROR;
case KEY_CURVE2:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.genkeys.algo") == 0) {
return KEY_ALGO3;
}
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.prompt") == 0) {
return COMMAND;
}
err = GENERAL_ERROR;
return ERROR;
case KEY_CURVE3:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.genkeys.algo") == 0) {
return KEY_ALGO3;
}
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.prompt") == 0) {
return COMMAND;
}
err = GENERAL_ERROR;
return ERROR;
// End key-attr handling
case COMMAND:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.genkeys.backup_enc") == 0) {
@ -323,21 +213,14 @@ unsigned int GpgGenCardKeyInteractor::nextState(unsigned int status, const char
strcmp(args, "cardedit.genkeys.size") == 0) {
return SIZE;
}
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "keygen.valid") == 0) {
return EXPIRE;
}
err = GENERAL_ERROR;
return ERROR;
case REPLACE:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.genkeys.size") == 0) {
printf("Moving to SIZE\n");
return SIZE;
}
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "keygen.valid") == 0) {
return EXPIRE;
}
err = GENERAL_ERROR;
return ERROR;
case SIZE:
@ -349,14 +232,6 @@ unsigned int GpgGenCardKeyInteractor::nextState(unsigned int status, const char
strcmp(args, "keygen.valid") == 0) {
return EXPIRE;
}
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.genkeys.algo") == 0) {
return KEY_ALGO2;
}
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.prompt") == 0) {
return COMMAND;
}
err = GENERAL_ERROR;
return ERROR;
case SIZE2:
@ -368,14 +243,6 @@ unsigned int GpgGenCardKeyInteractor::nextState(unsigned int status, const char
strcmp(args, "keygen.valid") == 0) {
return EXPIRE;
}
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.genkeys.algo") == 0) {
return KEY_ALGO3;
}
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.prompt") == 0) {
return COMMAND;
}
err = GENERAL_ERROR;
return ERROR;
case SIZE3:
@ -383,10 +250,6 @@ unsigned int GpgGenCardKeyInteractor::nextState(unsigned int status, const char
strcmp(args, "keygen.valid") == 0) {
return EXPIRE;
}
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "cardedit.prompt") == 0) {
return COMMAND;
}
err = GENERAL_ERROR;
return ERROR;
case EXPIRE:

View File

@ -1,7 +1,6 @@
/*
gpggencardkeyinteractor.h - Edit Interactor to generate a key on a card
Copyright (C) 2017 by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
Copyright (C) 2017 Intevation GmbH
This file is part of GPGME++.
@ -24,7 +23,7 @@
#ifndef __GPGMEPP_GPGGENCARDKEYEDITINTERACTOR_H__
#define __GPGMEPP_GPGGENCARDKEYEDITINTERACTOR_H__
#include "editinteractor.h"
#include <editinteractor.h>
#include <string>
#include <memory>
@ -56,34 +55,11 @@ public:
void setDoBackup(bool value);
void setExpiry(const std::string &timeString);
enum Algo {
RSA = 1,
ECC = 2,
};
void setAlgo(Algo algo);
// the enum values minus 1 have to match the indexes of the curves used by
// ask_curve() in gnupg's g10/keygen.c
enum Curve {
DefaultCurve = 0, // currently Curve25519
Curve25519 = 1,
Curve448,
NISTP256,
NISTP384,
NISTP521,
BrainpoolP256,
BrainpoolP384,
BrainpoolP512,
Secp256k1,
LastCurve = Secp256k1,
};
void setCurve(Curve curve);
std::string backupFileName() const;
private:
const char *action(Error &err) const override;
unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const override;
/* reimp */ const char *action(Error &err) const;
/* reimp */ unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const;
private:
class Private;

View File

@ -1,8 +1,6 @@
/*
gpgmefw.h - Forwards declarations for gpgme (0.3 and 0.4)
Copyright (C) 2004 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -75,7 +73,4 @@ typedef struct _gpgme_tofu_info *gpgme_tofu_info_t;
struct _gpgme_op_query_swdb_result;
typedef struct _gpgme_op_query_swdb_result *gpgme_query_swdb_result_t;
struct _gpgme_revocation_key;
typedef struct _gpgme_revocation_key *gpgme_revocation_key_t;
#endif // __GPGMEPP_GPGMEFW_H__

View File

@ -1,6 +1,5 @@
/*gpgmepp_export.h - Export macros for gpgmepp
Copyright (C) 2016, by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
Copyright (C) 2016, Intevation GmbH
This file is part of GPGME++.

View File

@ -1,207 +0,0 @@
/*
gpgrevokekeyeditinteractor.cpp - Edit Interactor to revoke own OpenPGP keys
Copyright (c) 2022 g10 Code GmbH
Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
This file is part of GPGME++.
GPGME++ is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
GPGME++ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with GPGME++; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gpgrevokekeyeditinteractor.h"
#include "error.h"
#include <gpgme.h>
#include <vector>
// avoid conflict (msvc)
#ifdef ERROR
# undef ERROR
#endif
using namespace GpgME;
class GpgRevokeKeyEditInteractor::Private
{
enum {
START = EditInteractor::StartState,
COMMAND,
CONFIRM_REVOKING_ENTIRE_KEY,
REASON_CODE,
REASON_TEXT,
// all these free slots belong to REASON_TEXT, too; we increase state()
// by one for each line of text, so that action() is called
REASON_TEXT_DONE = REASON_TEXT + 1000,
CONFIRM_REASON,
QUIT,
CONFIRM_SAVE,
ERROR = EditInteractor::ErrorState
};
GpgRevokeKeyEditInteractor *const q = nullptr;
public:
Private(GpgRevokeKeyEditInteractor *q)
: q{q}
, reasonCode{"0"}
{
}
const char *action(Error &err) const;
unsigned int nextState(unsigned int statusCode, const char *args, Error &err);
std::string reasonCode;
std::vector<std::string> reasonLines;
int nextLine = -1;
};
const char *GpgRevokeKeyEditInteractor::Private::action(Error &err) const
{
switch (const auto state = q->state()) {
case COMMAND:
return "revkey";
case CONFIRM_REVOKING_ENTIRE_KEY:
return "Y";
case REASON_CODE:
return reasonCode.c_str();
case REASON_TEXT_DONE:
return "";
case CONFIRM_REASON:
return "Y";
case QUIT:
return "quit";
case CONFIRM_SAVE:
return "Y";
case START:
return nullptr;
default:
if (state >= REASON_TEXT && state < REASON_TEXT_DONE) {
return reasonLines[nextLine].c_str();
}
// fall through
case ERROR:
err = Error::fromCode(GPG_ERR_GENERAL);
return nullptr;
}
}
unsigned int GpgRevokeKeyEditInteractor::Private::nextState(unsigned int status, const char *args, Error &err)
{
using std::strcmp;
static const Error GENERAL_ERROR = Error::fromCode(GPG_ERR_GENERAL);
switch (const auto state = q->state()) {
case START:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "keyedit.prompt") == 0) {
return COMMAND;
}
err = GENERAL_ERROR;
return ERROR;
case COMMAND:
if (status == GPGME_STATUS_GET_BOOL &&
strcmp(args, "keyedit.revoke.subkey.okay") == 0) {
return CONFIRM_REVOKING_ENTIRE_KEY;
}
err = GENERAL_ERROR;
return ERROR;
case CONFIRM_REVOKING_ENTIRE_KEY:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "ask_revocation_reason.code") == 0) {
return REASON_CODE;
}
err = GENERAL_ERROR;
return ERROR;
case REASON_CODE:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "ask_revocation_reason.text") == 0) {
nextLine++;
return static_cast<std::size_t>(nextLine) < reasonLines.size() ? REASON_TEXT : REASON_TEXT_DONE;
}
err = GENERAL_ERROR;
return ERROR;
default:
if (state >= REASON_TEXT && state < REASON_TEXT_DONE) {
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "ask_revocation_reason.text") == 0) {
nextLine++;
return static_cast<std::size_t>(nextLine) < reasonLines.size() ? state + 1 : REASON_TEXT_DONE;
}
}
err = GENERAL_ERROR;
return ERROR;
case REASON_TEXT_DONE:
if (status == GPGME_STATUS_GET_BOOL &&
strcmp(args, "ask_revocation_reason.okay") == 0) {
return CONFIRM_REASON;
}
err = GENERAL_ERROR;
return ERROR;
case CONFIRM_REASON:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "keyedit.prompt") == 0) {
return QUIT;
}
err = GENERAL_ERROR;
return ERROR;
case QUIT:
if (status == GPGME_STATUS_GET_BOOL &&
strcmp(args, "keyedit.save.okay") == 0) {
return CONFIRM_SAVE;
}
err = GENERAL_ERROR;
return ERROR;
case ERROR:
if (status == GPGME_STATUS_GET_LINE &&
strcmp(args, "keyedit.prompt") == 0) {
return QUIT;
}
err = q->lastError();
return ERROR;
}
}
GpgRevokeKeyEditInteractor::GpgRevokeKeyEditInteractor()
: EditInteractor{}
, d{new Private{this}}
{
}
GpgRevokeKeyEditInteractor::~GpgRevokeKeyEditInteractor() = default;
void GpgRevokeKeyEditInteractor::setReason(RevocationReason reason, const std::vector<std::string> &description)
{
d->reasonCode = std::to_string(static_cast<int>(reason));
d->reasonLines = description;
}
const char *GpgRevokeKeyEditInteractor::action(Error &err) const
{
return d->action(err);
}
unsigned int GpgRevokeKeyEditInteractor::nextState(unsigned int status, const char *args, Error &err) const
{
return d->nextState(status, args, err);
}

View File

@ -1,62 +0,0 @@
/*
gpgrevokekeyeditinteractor.h - Edit Interactor to revoke own OpenPGP keys
Copyright (c) 2022 g10 Code GmbH
Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
This file is part of GPGME++.
GPGME++ is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
GPGME++ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with GPGME++; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __GPGMEPP_GPGREVOKEKEYEDITINTERACTOR_H__
#define __GPGMEPP_GPGREVOKEKEYEDITINTERACTOR_H__
#include "editinteractor.h"
#include "global.h"
#include <memory>
#include <vector>
namespace GpgME
{
/** Edit interactor to revoke the key a key edit operation is working on.
* Supports revocation of own keys only. */
class GPGMEPP_EXPORT GpgRevokeKeyEditInteractor : public EditInteractor
{
public:
GpgRevokeKeyEditInteractor();
~GpgRevokeKeyEditInteractor() override;
/** Sets the reason for the revocation. The reason defaults to \c Unspecified.
* \a description can be used for adding a comment for the revocation. The
* individual elements of \a description must be non-empty strings and they
* must not contain any endline characters.
*/
void setReason(RevocationReason reason, const std::vector<std::string> &description = {});
private:
const char *action(Error &err) const override;
unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const override;
private:
class GPGMEPP_NO_EXPORT Private;
const std::unique_ptr<Private> d;
};
} // namespace GpgME
#endif // __GPGMEPP_GPGREVOKEKEYEDITINTERACTOR_H__

View File

@ -1,8 +1,6 @@
/*
gpgsetexpirytimeeditinteractor.cpp - Edit Interactor to change the expiry time of an OpenPGP key
Copyright (C) 2007 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -81,10 +79,10 @@ const char *GpgSetExpiryTimeEditInteractor::action(Error &err) const
return "Y";
case START:
case ERROR:
return nullptr;
return 0;
default:
err = Error::fromCode(GPG_ERR_GENERAL);
return nullptr;
return 0;
}
}
@ -94,6 +92,10 @@ unsigned int GpgSetExpiryTimeEditInteractor::nextState(unsigned int status, cons
static const Error GENERAL_ERROR = Error::fromCode(GPG_ERR_GENERAL);
static const Error INV_TIME_ERROR = Error::fromCode(GPG_ERR_INV_TIME);
if (needsNoResponse(status)) {
return state();
}
using namespace GpgSetExpiryTimeEditInteractor_Private;
switch (state()) {

View File

@ -1,8 +1,6 @@
/*
gpgsetexpirytimeeditinteractor.h - Edit Interactor to change the expiry time of an OpenPGP key
Copyright (C) 2007 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -25,7 +23,7 @@
#ifndef __GPGMEPP_GPGSETEXPIRYTIMEEDITINTERACTOR_H__
#define __GPGMEPP_GPGSETEXPIRYTIMEEDITINTERACTOR_H__
#include "editinteractor.h"
#include <editinteractor.h>
#include <string>
@ -39,8 +37,8 @@ public:
~GpgSetExpiryTimeEditInteractor();
private:
const char *action(Error &err) const override;
unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const override;
/* reimp */ const char *action(Error &err) const;
/* reimp */ unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const;
private:
const std::string m_strtime;

View File

@ -1,8 +1,6 @@
/*
gpgsetownertrusteditinteractor.cpp - Edit Interactor to change the expiry time of an OpenPGP key
Copyright (C) 2007 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -85,10 +83,10 @@ const char *GpgSetOwnerTrustEditInteractor::action(Error &err) const
return "Y";
case START:
case ERROR:
return nullptr;
return 0;
default:
err = Error::fromCode(GPG_ERR_GENERAL);
return nullptr;
return 0;
}
}
@ -98,6 +96,10 @@ unsigned int GpgSetOwnerTrustEditInteractor::nextState(unsigned int status, cons
static const Error GENERAL_ERROR = Error::fromCode(GPG_ERR_GENERAL);
//static const Error INV_TIME_ERROR = Error::fromCode( GPG_ERR_INV_TIME );
if (needsNoResponse(status)) {
return state();
}
using namespace GpgSetOwnerTrustEditInteractor_Private;
switch (state()) {

View File

@ -1,8 +1,6 @@
/*
gpgsetownertrusteditinteractor.h - Edit Interactor to change the owner trust of an OpenPGP key
Copyright (C) 2007 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -25,8 +23,8 @@
#ifndef __GPGMEPP_GPGSETOWNERTRUSTEDITINTERACTOR_H__
#define __GPGMEPP_GPGSETOWNERTRUSTEDITINTERACTOR_H__
#include "editinteractor.h"
#include "key.h"
#include <editinteractor.h>
#include <key.h>
#include <string>
@ -40,8 +38,8 @@ public:
~GpgSetOwnerTrustEditInteractor();
private:
const char *action(Error &err) const override;
unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const override;
/* reimp */ const char *action(Error &err) const;
/* reimp */ unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const;
private:
const Key::OwnerTrust m_ownertrust;

View File

@ -1,8 +1,6 @@
/*
gpgsignkeyeditinteractor.cpp - Edit Interactor to change the expiry time of an OpenPGP key
Copyright (C) 2007 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -64,13 +62,6 @@ public:
std::vector<unsigned int> userIDs;
std::vector<unsigned int>::const_iterator currentId, nextId;
unsigned int checkLevel;
bool dupeOk;
Key key;
struct {
TrustSignatureTrust trust;
std::string depth;
std::string scope;
} trustSignature;
const char *command() const
{
@ -133,9 +124,7 @@ GpgSignKeyEditInteractor::Private::Private()
userIDs(),
currentId(),
nextId(),
checkLevel(0),
dupeOk(false),
trustSignature{TrustSignatureTrust::None, "0", {}}
checkLevel(0)
{
}
@ -167,10 +156,6 @@ enum SignKeyState {
SET_TRUST_DEPTH,
SET_TRUST_REGEXP,
CONFIRM,
CONFIRM2,
DUPE_OK,
DUPE_OK2,
REJECT_SIGN_EXPIRED,
QUIT,
SAVE,
ERROR = EditInteractor::ErrorState
@ -194,43 +179,28 @@ static GpgSignKeyEditInteractor_Private::TransitionMap makeTable()
#define addEntry( s1, status, str, s2 ) tab[std::make_tuple( s1, status, str)] = s2
addEntry(START, GET_LINE, "keyedit.prompt", COMMAND);
addEntry(COMMAND, GET_BOOL, "keyedit.sign_all.okay", UIDS_ANSWER_SIGN_ALL);
addEntry(COMMAND, GET_BOOL, "sign_uid.expired_okay", REJECT_SIGN_EXPIRED);
addEntry(COMMAND, GET_BOOL, "sign_uid.okay", CONFIRM);
addEntry(COMMAND, GET_BOOL, "sign_uid.local_promote_okay", CONFIRM2);
addEntry(COMMAND, GET_BOOL, "sign_uid.dupe_okay", DUPE_OK);
addEntry(COMMAND, GET_LINE, "trustsig_prompt.trust_value", SET_TRUST_VALUE);
addEntry(UIDS_ANSWER_SIGN_ALL, GET_BOOL, "sign_uid.okay", CONFIRM);
addEntry(UIDS_ANSWER_SIGN_ALL, GET_BOOL, "sign_uid.dupe_okay", DUPE_OK);
addEntry(UIDS_ANSWER_SIGN_ALL, GET_LINE, "sign_uid.expire", SET_EXPIRE);
addEntry(UIDS_ANSWER_SIGN_ALL, GET_LINE, "sign_uid.class", SET_CHECK_LEVEL);
addEntry(UIDS_ANSWER_SIGN_ALL, GET_LINE, "trustsig_prompt.trust_value", SET_TRUST_VALUE);
addEntry(SET_TRUST_VALUE, GET_LINE, "trustsig_prompt.trust_depth", SET_TRUST_DEPTH);
addEntry(SET_TRUST_DEPTH, GET_LINE, "trustsig_prompt.trust_regexp", SET_TRUST_REGEXP);
addEntry(SET_TRUST_REGEXP, GET_BOOL, "sign_uid.okay", CONFIRM);
addEntry(SET_TRUST_VALUE, GET_LINE, "trustsign_prompt.trust_depth", SET_TRUST_DEPTH);
addEntry(SET_TRUST_DEPTH, GET_LINE, "trustsign_prompt.trust_regexp", SET_TRUST_REGEXP);
addEntry(SET_TRUST_REGEXP, GET_LINE, "sign_uid.okay", CONFIRM);
addEntry(SET_CHECK_LEVEL, GET_BOOL, "sign_uid.okay", CONFIRM);
addEntry(SET_EXPIRE, GET_BOOL, "sign_uid.class", SET_CHECK_LEVEL);
addEntry(CONFIRM, GET_BOOL, "sign_uid.local_promote_okay", CONFIRM);
addEntry(DUPE_OK, GET_BOOL, "sign_uid.okay", CONFIRM);
addEntry(DUPE_OK2, GET_BOOL, "sign_uid.okay", CONFIRM);
addEntry(DUPE_OK, GET_LINE, "trustsig_prompt.trust_value", SET_TRUST_VALUE);
addEntry(DUPE_OK2, GET_LINE, "trustsig_prompt.trust_value", SET_TRUST_VALUE);
addEntry(CONFIRM, GET_BOOL, "sign_uid.okay", CONFIRM);
addEntry(CONFIRM2, GET_BOOL, "sign_uid.okay", CONFIRM);
addEntry(CONFIRM, GET_LINE, "keyedit.prompt", COMMAND);
addEntry(CONFIRM, GET_LINE, "trustsig_prompt.trust_value", SET_TRUST_VALUE);
addEntry(CONFIRM, GET_LINE, "trustsign_prompt.trust_value", SET_TRUST_VALUE);
addEntry(CONFIRM, GET_LINE, "sign_uid.expire", SET_EXPIRE);
addEntry(CONFIRM, GET_LINE, "sign_uid.class", SET_CHECK_LEVEL);
addEntry(UIDS_LIST_SEPARATELY_DONE, GET_BOOL, "sign_uid.local_promote_okay", CONFIRM);
addEntry(UIDS_LIST_SEPARATELY_DONE, GET_LINE, "keyedit.prompt", COMMAND);
addEntry(UIDS_LIST_SEPARATELY_DONE, GET_LINE, "trustsig_prompt.trust_value", SET_TRUST_VALUE);
addEntry(UIDS_LIST_SEPARATELY_DONE, GET_LINE, "trustsign_prompt.trust_value", SET_TRUST_VALUE);
addEntry(UIDS_LIST_SEPARATELY_DONE, GET_LINE, "sign_uid.expire", SET_EXPIRE);
addEntry(UIDS_LIST_SEPARATELY_DONE, GET_LINE, "sign_uid.class", SET_CHECK_LEVEL);
addEntry(UIDS_LIST_SEPARATELY_DONE, GET_BOOL, "sign_uid.okay", CONFIRM);
addEntry(UIDS_LIST_SEPARATELY_DONE, GET_BOOL, "sign_uid.dupe_okay", DUPE_OK);
addEntry(DUPE_OK, GET_BOOL, "sign_uid.dupe_okay", DUPE_OK2);
addEntry(DUPE_OK2, GET_BOOL, "sign_uid.dupe_okay", DUPE_OK);
addEntry(CONFIRM, GET_LINE, "keyedit.prompt", QUIT);
addEntry(REJECT_SIGN_EXPIRED, GET_LINE, "keyedit.prompt", QUIT);
addEntry(ERROR, GET_LINE, "keyedit.prompt", QUIT);
addEntry(QUIT, GET_BOOL, "keyedit.save.okay", SAVE);
#undef addEntry
@ -253,22 +223,16 @@ const char *GpgSignKeyEditInteractor::action(Error &err) const
case SET_EXPIRE:
return answer(true);
case SET_TRUST_VALUE:
return d->trustSignature.trust == TrustSignatureTrust::Partial ? "1" : "2";
// TODO
case SET_TRUST_DEPTH:
return d->trustSignature.depth.c_str();
//TODO
case SET_TRUST_REGEXP:
return d->trustSignature.scope.c_str();
//TODO
return 0;
case SET_CHECK_LEVEL:
return check_level_strings[d->checkLevel];
case DUPE_OK:
case DUPE_OK2:
return answer(d->dupeOk);
case CONFIRM2:
case CONFIRM:
return answer(true);
case REJECT_SIGN_EXPIRED:
err = Error::fromCode(GPG_ERR_KEY_EXPIRED);
return answer(false);
case QUIT:
return "quit";
case SAVE:
@ -276,24 +240,14 @@ const char *GpgSignKeyEditInteractor::action(Error &err) const
default:
if (st >= UIDS_LIST_SEPARATELY && st < UIDS_LIST_SEPARATELY_DONE) {
std::stringstream ss;
auto nextID = d->nextUserID();
const char *hash;
assert (nextID);
if (!d->key.isNull() && (hash = d->key.userID(nextID - 1).uidhash())) {
/* Prefer uidhash if it is available as it might happen
* that uidattrs break the ordering of the uids in the
* edit-key interface */
ss << "uid " << hash;
} else {
ss << nextID;
}
ss << d->nextUserID();
d->scratch = ss.str();
return d->scratch.c_str();
}
// fall through
case ERROR:
err = Error::fromCode(GPG_ERR_GENERAL);
return nullptr;
return 0;
}
}
@ -304,6 +258,9 @@ unsigned int GpgSignKeyEditInteractor::nextState(unsigned int status, const char
static const Error GENERAL_ERROR = Error::fromCode(GPG_ERR_GENERAL);
//static const Error INV_TIME_ERROR = Error::fromCode( GPG_ERR_INV_TIME );
static const TransitionMap table(makeTable());
if (needsNoResponse(status)) {
return state();
}
using namespace GpgSignKeyEditInteractor_Private;
@ -342,10 +299,6 @@ unsigned int GpgSignKeyEditInteractor::nextState(unsigned int status, const char
err = GENERAL_ERROR;
return ERROR;
}
void GpgSignKeyEditInteractor::setKey(const Key &key)
{
d->key = key;
}
void GpgSignKeyEditInteractor::setCheckLevel(unsigned int checkLevel)
{
@ -367,29 +320,3 @@ void GpgSignKeyEditInteractor::setSigningOptions(int options)
assert(!d->started);
d->options = options;
}
void GpgSignKeyEditInteractor::setDupeOk(bool value)
{
assert(!d->started);
d->dupeOk = value;
}
void GpgSignKeyEditInteractor::setTrustSignatureTrust(GpgME::TrustSignatureTrust trust)
{
assert(!d->started);
assert(trust != TrustSignatureTrust::None);
d->trustSignature.trust = trust;
}
void GpgSignKeyEditInteractor::setTrustSignatureDepth(unsigned short depth)
{
assert(!d->started);
assert(depth <= 255);
d->trustSignature.depth = std::to_string(depth);
}
void GpgSignKeyEditInteractor::setTrustSignatureScope(const std::string &scope)
{
assert(!d->started);
d->trustSignature.scope = scope;
}

View File

@ -1,8 +1,6 @@
/*
gpgsignkeyeditinteractor.h - Edit Interactor to change the owner trust of an OpenPGP key
Copyright (C) 2008 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -25,7 +23,7 @@
#ifndef __GPGMEPP_GPGSIGNKEYEDITINTERACTOR_H__
#define __GPGMEPP_GPGSIGNKEYEDITINTERACTOR_H__
#include "editinteractor.h"
#include <editinteractor.h>
#include <string>
#include <vector>
@ -35,7 +33,6 @@ namespace GpgME
class Key;
class UserID;
enum class TrustSignatureTrust : char;
class GPGMEPP_EXPORT GpgSignKeyEditInteractor : public EditInteractor
{
@ -51,21 +48,11 @@ public:
void setCheckLevel(unsigned int checkLevel);
void setUserIDsToSign(const std::vector<unsigned int> &userIDsToSign);
void setKey(const Key &key);
void setSigningOptions(int options);
/* Set this if it is ok to overwrite an existing signature. In that
* case the context has to have the flag "extended-edit" set to 1 through
* Context::setFlag before calling edit.*/
void setDupeOk(bool value);
void setTrustSignatureTrust(TrustSignatureTrust trust);
void setTrustSignatureDepth(unsigned short depth);
void setTrustSignatureScope(const std::string &scope);
private:
const char *action(Error &err) const override;
unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const override;
/* reimp */ const char *action(Error &err) const;
/* reimp */ unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const;
private:
class Private;

View File

@ -1,8 +1,6 @@
/*
importresult.cpp - wraps a gpgme import result
Copyright (C) 2004 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -35,9 +33,6 @@
#include <cstring>
#include <string.h>
#include <strings.h>
#include <istream>
#include <iterator>
class GpgME::ImportResult::Private
{
@ -48,19 +43,17 @@ public:
// We just need to handle the pointers in the structs:
for (gpgme_import_status_t is = r.imports ; is ; is = is->next) {
gpgme_import_status_t copy = new _gpgme_import_status(*is);
if (is->fpr) {
copy->fpr = strdup(is->fpr);
}
copy->next = nullptr;
copy->fpr = strdup(is->fpr);
copy->next = 0;
imports.push_back(copy);
}
res.imports = nullptr;
res.imports = 0;
}
~Private()
{
for (std::vector<gpgme_import_status_t>::iterator it = imports.begin() ; it != imports.end() ; ++it) {
std::free((*it)->fpr);
delete *it; *it = nullptr;
delete *it; *it = 0;
}
}
@ -94,131 +87,6 @@ void GpgME::ImportResult::init(gpgme_ctx_t ctx)
make_standard_stuff(ImportResult)
void GpgME::ImportResult::mergeWith(const ImportResult &other)
{
if (other.isNull()) {
return;
}
if (isNull()) { // just assign
operator=(other);
return;
}
// Add the numbers of considered keys; the number will be corrected when
// merging the imports to account for duplicates
d->res.considered += other.d->res.considered;
// Add the numbers of keys without user ID; may count duplicates
d->res.no_user_id += other.d->res.no_user_id;
// Add the numbers of imported keys
d->res.imported += other.d->res.imported;
// Add the numbers of imported RSA keys
d->res.imported_rsa += other.d->res.imported_rsa;
// Add the numbers of unchanged keys; the number will be corrected when
// merging the imports to account for keys changed by this import
d->res.unchanged += other.d->res.unchanged;
// Add the numbers of new user IDs
d->res.new_user_ids += other.d->res.new_user_ids;
// Add the numbers of new subkeys
d->res.new_sub_keys += other.d->res.new_sub_keys;
// Add the numbers of new signatures
d->res.new_signatures += other.d->res.new_signatures;
// Add the numbers of new revocations
d->res.new_revocations += other.d->res.new_revocations;
// Add the numbers of considered secret keys; the number will be corrected when
// merging the imports to account for duplicates
d->res.secret_read += other.d->res.secret_read;
// Add the numbers of imported secret keys
d->res.secret_imported += other.d->res.secret_imported;
// Add the numbers of unchanged secret keys; the number will be corrected when
// merging the imports to account for keys changed by this import
d->res.secret_unchanged += other.d->res.secret_unchanged;
// Add the numbers of new keys that were skipped; may count duplicates
d->res.skipped_new_keys += other.d->res.skipped_new_keys;
// Add the numbers of keys that were not imported; may count duplicates
d->res.not_imported += other.d->res.not_imported;
// Add the numbers of v3 keys that were skipped; may count duplicates
d->res.skipped_v3_keys += other.d->res.skipped_v3_keys;
// Look at the list of keys for which an import was attempted during the
// other import to correct some of the consolidated numbers
for (auto it = std::begin(other.d->imports), end = std::end(other.d->imports); it != end; ++it) {
const char *fpr = (*it)->fpr;
if (!fpr || !*fpr) {
// we cannot derive any useful information about an import if the
// fingerprint is null or empty
continue;
}
// was this key also considered during the first import
const auto consideredInFirstImports =
std::any_of(std::begin(d->imports), std::end(d->imports), [fpr](const gpgme_import_status_t i) {
return i->fpr && !strcmp(i->fpr, fpr);
});
// did we see this key already in the list of keys of the other import
const auto consideredInPreviousOtherImports =
std::any_of(std::begin(other.d->imports), it, [fpr](const gpgme_import_status_t i) {
return i->fpr && !strcmp(i->fpr, fpr);
});
// was anything added to this key during the other import
const auto changedInOtherImports =
std::any_of(std::begin(other.d->imports), std::end(other.d->imports), [fpr](const gpgme_import_status_t i) {
return i->fpr && !strcmp(i->fpr, fpr) && (i->status != 0);
});
if (consideredInFirstImports && !consideredInPreviousOtherImports) {
// key was also considered during first import, but not before in the list of other imports
d->res.considered -= 1;
if (!changedInOtherImports) {
// key was (most likely) counted as unchanged in the second import;
// this needs to be corrected (regardless of whether it was changed in the first import)
d->res.unchanged -= 1;
}
}
// now do the same for the secret key counts
const auto secretKeyConsideredInFirstImports =
std::any_of(std::begin(d->imports), std::end(d->imports), [fpr](const gpgme_import_status_t i) {
return i->fpr && !strcmp(i->fpr, fpr) && (i->status & GPGME_IMPORT_SECRET);
});
const auto secretKeyConsideredInPreviousOtherImports =
std::any_of(std::begin(other.d->imports), it, [fpr](const gpgme_import_status_t i) {
return i->fpr && !strcmp(i->fpr, fpr) && (i->status & GPGME_IMPORT_SECRET);
});
const auto secretKeyChangedInOtherImports =
std::any_of(std::begin(other.d->imports), std::end(other.d->imports), [fpr](const gpgme_import_status_t i) {
return i->fpr && !strcmp(i->fpr, fpr) && (i->status & GPGME_IMPORT_SECRET) && (i->status != GPGME_IMPORT_SECRET);
});
if (secretKeyConsideredInFirstImports && !secretKeyConsideredInPreviousOtherImports) {
// key was also considered during first import, but not before in the list of other imports
d->res.secret_read -= 1;
if (!secretKeyChangedInOtherImports) {
// key was (most likely) counted as unchanged in the second import;
// this needs to be corrected (regardless of whether it was changed in the first import)
d->res.secret_unchanged -= 1;
}
}
}
// Now append the list of keys for which an import was attempted during the
// other import
d->imports.reserve(d->imports.size() + other.d->imports.size());
std::transform(std::begin(other.d->imports), std::end(other.d->imports),
std::back_inserter(d->imports),
[](const gpgme_import_status_t import) {
gpgme_import_status_t copy = new _gpgme_import_status{*import};
if (import->fpr) {
copy->fpr = strdup(import->fpr);
}
copy->next = nullptr; // should already be null, but better safe than sorry
return copy;
});
// Finally, merge the error if there was none yet
if (!bool(error())) {
Result::operator=(other);
}
}
int GpgME::ImportResult::numConsidered() const
{
return d ? d->res.considered : 0 ;
@ -284,11 +152,6 @@ int GpgME::ImportResult::notImported() const
return d ? d->res.not_imported : 0 ;
}
int GpgME::ImportResult::numV3KeysSkipped() const
{
return d ? d->res.skipped_v3_keys : 0 ;
}
GpgME::Import GpgME::ImportResult::import(unsigned int idx) const
{
return Import(d, idx);
@ -322,7 +185,7 @@ bool GpgME::Import::isNull() const
const char *GpgME::Import::fingerprint() const
{
return isNull() ? nullptr : d->imports[idx]->fpr ;
return isNull() ? 0 : d->imports[idx]->fpr ;
}
GpgME::Error GpgME::Import::error() const
@ -354,42 +217,3 @@ GpgME::Import::Status GpgME::Import::status() const
}
return static_cast<Status>(result);
}
std::ostream &GpgME::operator<<(std::ostream &os,
const GpgME::ImportResult &result)
{
os << "GpgME::ImportResult(";
if (!result.isNull()) {
os << "\n considered: " << result.numConsidered()
<< "\n without UID: " << result.numKeysWithoutUserID()
<< "\n imported: " << result.numImported()
<< "\n RSA Imported: " << result.numRSAImported()
<< "\n unchanged: " << result.numUnchanged()
<< "\n newUserIDs: " << result.newUserIDs()
<< "\n newSubkeys: " << result.newSubkeys()
<< "\n newSignatures: " << result.newSignatures()
<< "\n newRevocations: " << result.newRevocations()
<< "\n numSecretKeysConsidered: " << result.numSecretKeysConsidered()
<< "\n numSecretKeysImported: " << result.numSecretKeysImported()
<< "\n numSecretKeysUnchanged: " << result.numSecretKeysUnchanged()
<< "\n"
<< "\n notImported: " << result.notImported()
<< "\n numV3KeysSkipped: " << result.numV3KeysSkipped()
<< "\n imports:\n";
const std::vector<Import> imp = result.imports();
std::copy(imp.begin(), imp.end(),
std::ostream_iterator<Import>(os, "\n"));
}
return os << ')';
}
std::ostream &GpgME::operator<<(std::ostream &os, const GpgME::Import &imp)
{
os << "GpgME::Import(";
if (!imp.isNull()) {
os << "\n fpr: " << (imp.fingerprint() ? imp.fingerprint() : "null")
<< "\n status: " << imp.status()
<< "\n err: " << imp.error();
}
return os << ')';
}

View File

@ -1,8 +1,6 @@
/*
importresult.h - wraps a gpgme import result
Copyright (C) 2004 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
@ -47,7 +45,6 @@ public:
ImportResult(gpgme_ctx_t ctx, const Error &error);
explicit ImportResult(const Error &error);
ImportResult(const ImportResult &other) = default;
const ImportResult &operator=(ImportResult other)
{
swap(other);
@ -61,16 +58,6 @@ public:
swap(this->d, other.d);
}
/**
* Merges the result @p other into this result (and all of its copies).
*
* @note The merge algorithm assumes that @p other is the result of an
* import that was performed after the import of this result.
* @note Some numbers cannot be consolidated reliably, e.g. the number of
* keys without user ID.
*/
void mergeWith(const ImportResult &other);
bool isNull() const;
int numConsidered() const;
@ -89,7 +76,6 @@ public:
int numSecretKeysUnchanged() const;
int notImported() const;
int numV3KeysSkipped() const;
Import import(unsigned int idx) const;
std::vector<Import> imports() const;
@ -107,7 +93,6 @@ class GPGMEPP_EXPORT Import
public:
Import();
Import(const Import &other) = default;
const Import &operator=(Import other)
{
swap(other);
@ -141,10 +126,7 @@ private:
unsigned int idx;
};
GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const ImportResult &irs);
GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const Import &imp);
} // namespace GpgME
}
GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(ImportResult)
GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(Import)

View File

@ -1,8 +1,6 @@
/*
assuantransaction.h - Interface for ASSUAN transactions
Copyright (C) 2009 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH <info@kdab.com>
Copyright (C) 2009 Klarälvdalens Datakonsult AB <info@kdab.com>
Author: Marc Mutz <marc@kdab.com>
This file is part of GPGME++.
@ -26,7 +24,7 @@
#ifndef __GPGMEPP_INTERFACES_ASSUANTRANSACTION_H__
#define __GPGMEPP_INTERFACES_ASSUANTRANSACTION_H__
#include "../gpgmepp_export.h"
#include "gpgmepp_export.h"
#include <stddef.h>

Some files were not shown because too many files have changed in this diff Show More