From cvs at cvs.gnupg.org Thu Nov 1 03:14:30 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Thu, 01 Nov 2018 03:14:30 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.32-46-g998313b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via 998313bd321ae161ec58111ccc6c6f0921007bc5 (commit) from 5b898b8bc89c18e2fd02e6c9efd5e91cb96357cc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 998313bd321ae161ec58111ccc6c6f0921007bc5 Author: NIIBE Yutaka Date: Thu Nov 1 11:12:03 2018 +0900 gpgrt-config: It's distributed script. * src/Makefile.am (dist_bin_SCRIPTS): Add gpgrt-config. (bin_SCRIPTS): Remove gpgrt-config. -- This is the automake thing; Since gpgrt-config is not generated script, we should use dist_bin_SCRIPTS here. Signed-off-by: NIIBE Yutaka diff --git a/src/Makefile.am b/src/Makefile.am index 280a673..8e6683f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -84,7 +84,8 @@ lock_obj_pub = \ lib_LTLIBRARIES = libgpg-error.la nodist_include_HEADERS = gpg-error.h gpgrt.h -bin_SCRIPTS = gpgrt-config gpg-error-config +dist_bin_SCRIPTS = gpgrt-config +bin_SCRIPTS = gpg-error-config m4datadir = $(datadir)/aclocal m4data_DATA = gpg-error.m4 gpgrt.m4 ----------------------------------------------------------------------- Summary of changes: src/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 1 04:14:15 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Thu, 01 Nov 2018 04:14:15 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.32-47-g8f034bb Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via 8f034bb3a1bbde2fc7a8d2ada6e3d779c465895b (commit) from 998313bd321ae161ec58111ccc6c6f0921007bc5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8f034bb3a1bbde2fc7a8d2ada6e3d779c465895b Author: NIIBE Yutaka Date: Thu Nov 1 12:05:53 2018 +0900 gpg-error.m4: Unset GPGRT_CONFIG when gpgrt-config doesn't work. * src/gpg-error.m4: Unset GPGRT_CONFIG when gpgrt-config doesn't work. Signed-off-by: NIIBE Yutaka diff --git a/src/gpg-error.m4 b/src/gpg-error.m4 index 0964a26..f643307 100644 --- a/src/gpg-error.m4 +++ b/src/gpg-error.m4 @@ -73,6 +73,8 @@ AC_DEFUN([AM_PATH_GPG_ERROR], GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" use_gpgrt_config=yes gpg_error_config_version=`$GPG_ERROR_CONFIG --modversion` + else + unset GPGRT_CONFIG fi fi else @@ -101,8 +103,12 @@ AC_DEFUN([AM_PATH_GPG_ERROR], AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) if test "$GPGRT_CONFIG" != "no"; then GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir" - GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" - use_gpgrt_config=yes + if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then + GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" + use_gpgrt_config=yes + else + unset GPGRT_CONFIG + fi fi fi fi ----------------------------------------------------------------------- Summary of changes: src/gpg-error.m4 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 1 09:55:42 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 01 Nov 2018 09:55:42 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-36-g63ba09b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 63ba09b541dabbe838253926896e721cb9be564a (commit) via 338e9edfdb9239f1c9d4409f6d08d79a9d6f285b (commit) via 79fc7c0fe825014e75bb825c4966a04a22e78254 (commit) via 3c04dea3ecebed35208f6b631b2e8b04222ea432 (commit) from 2e07d4f89a26bb56a55b2743d39fb37532028ffd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 63ba09b541dabbe838253926896e721cb9be564a Author: Werner Koch Date: Thu Nov 1 09:55:24 2018 +0100 w32: Use CancelSynchronousIo in destroy_reader. * src/w32-util.c (_gpgme_w32_cancel_synchronous_io): New. * src/w32-io.c (destroy_reader): Use it here. -- This has not been tested but should on Vista and later help to fix a possible hang. Signed-off-by: Werner Koch diff --git a/src/sys-util.h b/src/sys-util.h index 094399c..6cb2224 100644 --- a/src/sys-util.h +++ b/src/sys-util.h @@ -30,6 +30,7 @@ char *_gpgme_get_gpgconf_path (void); #ifdef HAVE_W32_SYSTEM const char *_gpgme_get_inst_dir (void); +void _gpgme_w32_cancel_synchronous_io (HANDLE thread); #endif #endif /* SYS_UTIL_H */ diff --git a/src/w32-io.c b/src/w32-io.c index ad1e330..436bb7b 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -485,7 +485,7 @@ destroy_reader (struct reader_context_s *ctx) dlopen that syscall. */ if (ctx->file_hd != INVALID_HANDLE_VALUE) { - /* Fixme: Call CancelSynchronousIo (handle_of_thread). */ + _gpgme_w32_cancel_synchronous_io (ctx->thread_hd); } else if (ctx->file_sock != INVALID_SOCKET) { diff --git a/src/w32-util.c b/src/w32-util.c index 7954189..8a04c8c 100644 --- a/src/w32-util.c +++ b/src/w32-util.c @@ -99,8 +99,6 @@ static char *default_gpgconf_name; gpgme_set_global_flag and accessed by _gpgme_get_inst_dir. */ static char *override_inst_dir; -#ifdef HAVE_ALLOW_SET_FOREGROUND_WINDOW - #define RTLD_LAZY 0 static GPG_ERR_INLINE void * @@ -135,7 +133,6 @@ dlclose (void * hd) } return -1; } -#endif /* HAVE_ALLOW_SET_FOREGROUND_WINDOW */ /* Return a malloced string encoded in UTF-8 from the wide char input @@ -241,6 +238,45 @@ _gpgme_allow_set_foreground_window (pid_t pid) } +/* Wrapper around CancelSynchronousIo which is only available since + * Vista. */ +void +_gpgme_w32_cancel_synchronous_io (HANDLE thread) +{ + static int initialized; + static BOOL (WINAPI * func)(DWORD); + void *handle; + + if (!initialized) + { + /* Available since Vista; thus we dynload it. */ + initialized = 1; + handle = dlopen ("kerner32.dll", RTLD_LAZY); + if (handle) + { + func = dlsym (handle, "CancelSynchronousIo"); + if (!func) + { + dlclose (handle); + handle = NULL; + } + } + } + + if (func) + { + int rc = func (thread); + TRACE2 (DEBUG_ENGINE, "gpgme:CancelSynchronousIo", 0, + "called for thread %p; result=%d", thread, rc); + } + else + { + TRACE0 (DEBUG_ENGINE, "gpgme:CancelSynchronousIo", 0, + "function not available"); + } +} + + /* Return a string from the W32 Registry or NULL in case of error. Caller must release the return value. A NULL for root is an alias for HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE in turn. */ commit 338e9edfdb9239f1c9d4409f6d08d79a9d6f285b Author: Werner Koch Date: Thu Nov 1 09:53:48 2018 +0100 w32: Merge all the object tables of w32-io into one. * src/w32-io.c (fd_table_size): New. Used in most places instead of the MAX_SLAFD constant. (reader_table, writer_table, notify_table): Merge them into ... (fd_table): this table. Chnage all affected code to take just one lock. Signed-off-by: Werner Koch diff --git a/src/w32-io.c b/src/w32-io.c index e3201b7..ad1e330 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -43,13 +43,73 @@ #include "sys-util.h" -/* FIXME: Optimize. */ +/* The number of entries in our file table. We may eventually use a + * lower value and dynamically resize the table. */ #define MAX_SLAFD 512 +#define handle_to_fd(a) ((int)(a)) + +#define READBUF_SIZE 4096 +#define WRITEBUF_SIZE 4096 +#define PIPEBUF_SIZE 4096 + + +/* The context used by a reader thread. */ +struct reader_context_s +{ + HANDLE file_hd; + int file_sock; + HANDLE thread_hd; + int refcount; /* Bumbed if the FD has been duped and thus we have + * another FD referencinf this context. */ + + DECLARE_LOCK (mutex); + + int stop_me; + int eof; + int eof_shortcut; + int error; + int error_code; + + /* This is manually reset. */ + HANDLE have_data_ev; + /* This is automatically reset. */ + HANDLE have_space_ev; + /* This is manually reset but actually only triggered once. */ + HANDLE close_ev; + + size_t readpos, writepos; + char buffer[READBUF_SIZE]; +}; + + +/* The context used by a writer thread. */ +struct writer_context_s +{ + HANDLE file_hd; + int file_sock; + HANDLE thread_hd; + int refcount; + + DECLARE_LOCK (mutex); + + int stop_me; + int error; + int error_code; + + /* This is manually reset. */ + HANDLE have_data; + HANDLE is_empty; + HANDLE close_ev; + size_t nbytes; + char buffer[WRITEBUF_SIZE]; +}; + + /* An object to keep track of HANDLEs and sockets and map them to an * integer similar to what we use in Unix. Note that despite this * integer is often named "fd", it is not a file descriptor but really - * only an index into this table. Never ever pass such an fd to any + * only an index into this table. Never ever pass such an fd to any * other function except for those implemented here. */ static struct { @@ -75,7 +135,23 @@ static struct want to close something. Using the same handle for these duplicates works just fine. */ int dup_from; + + /* The context of an associated reader object or NULL. */ + struct reader_context_s *reader; + + /* The context of an associated writer object or NULL. */ + struct writer_context_s *writer; + + /* A notification hanlder. Noet that we current support only one + * callback per fd. */ + struct { + _gpgme_close_notify_handler_t handler; + void *value; + } notify; + } fd_table[MAX_SLAFD]; +static size_t fd_table_size = MAX_SLAFD; + DEFINE_STATIC_LOCK (fd_table_lock); @@ -89,11 +165,11 @@ new_fd (void) LOCK (fd_table_lock); - for (idx = 0; idx < MAX_SLAFD; idx++) + for (idx = 0; idx < fd_table_size; idx++) if (! fd_table[idx].used) break; - if (idx == MAX_SLAFD) + if (idx == fd_table_size) { gpg_err_set_errno (EIO); idx = -1; @@ -104,6 +180,8 @@ new_fd (void) fd_table[idx].handle = INVALID_HANDLE_VALUE; fd_table[idx].socket = INVALID_SOCKET; fd_table[idx].dup_from = -1; + fd_table[idx].notify.handler = NULL; + fd_table[idx].notify.value = NULL; } UNLOCK (fd_table_lock); @@ -117,7 +195,7 @@ new_fd (void) void release_fd (int fd) { - if (fd < 0 || fd >= MAX_SLAFD) + if (fd < 0 || fd >= fd_table_size) return; LOCK (fd_table_lock); @@ -128,99 +206,14 @@ release_fd (int fd) fd_table[fd].handle = INVALID_HANDLE_VALUE; fd_table[fd].socket = INVALID_SOCKET; fd_table[fd].dup_from = -1; + fd_table[fd].notify.handler = NULL; + fd_table[fd].notify.value = NULL; } UNLOCK (fd_table_lock); } -#define handle_to_fd(a) ((int)(a)) - -#define READBUF_SIZE 4096 -#define WRITEBUF_SIZE 4096 -#define PIPEBUF_SIZE 4096 -#define MAX_READERS 64 -#define MAX_WRITERS 64 - -static struct -{ - int inuse; - int fd; - _gpgme_close_notify_handler_t handler; - void *value; -} notify_table[MAX_SLAFD]; -DEFINE_STATIC_LOCK (notify_table_lock); - - -struct reader_context_s -{ - HANDLE file_hd; - int file_sock; - HANDLE thread_hd; - int refcount; - - DECLARE_LOCK (mutex); - - int stop_me; - int eof; - int eof_shortcut; - int error; - int error_code; - - /* This is manually reset. */ - HANDLE have_data_ev; - /* This is automatically reset. */ - HANDLE have_space_ev; - /* This is manually reset but actually only triggered once. */ - HANDLE close_ev; - - size_t readpos, writepos; - char buffer[READBUF_SIZE]; -}; - - -static struct -{ - volatile int used; - int fd; - struct reader_context_s *context; -} reader_table[MAX_READERS]; -static int reader_table_size= MAX_READERS; -DEFINE_STATIC_LOCK (reader_table_lock); - - -struct writer_context_s -{ - HANDLE file_hd; - int file_sock; - HANDLE thread_hd; - int refcount; - - DECLARE_LOCK (mutex); - - int stop_me; - int error; - int error_code; - - /* This is manually reset. */ - HANDLE have_data; - HANDLE is_empty; - HANDLE close_ev; - size_t nbytes; - char buffer[WRITEBUF_SIZE]; -}; - - -static struct -{ - volatile int used; - int fd; - struct writer_context_s *context; -} writer_table[MAX_WRITERS]; -static int writer_table_size= MAX_WRITERS; -DEFINE_STATIC_LOCK (writer_table_lock); - - static int get_desired_thread_priority (void) { @@ -241,6 +234,9 @@ get_desired_thread_priority (void) } +/* The reader thread. Created on the fly by gpgme_io_read and + * destroyed by destroy_reader. Note that this functions works with a + * copy of the value of the HANDLE variable frm the FS_TABLE. */ static DWORD CALLBACK reader (void *arg) { @@ -382,14 +378,18 @@ reader (void *arg) } +/* Create a new reader thread and return its context object. The + * input is a HANDLE or a socket SOCK. This function may not call any + * fd based functions because the caller already holds a lock on the + * fd_table. */ static struct reader_context_s * -create_reader (int fd) +create_reader (HANDLE handle, int sock) { struct reader_context_s *ctx; SECURITY_ATTRIBUTES sec_attr; DWORD tid; - TRACE_BEG (DEBUG_SYSIO, "gpgme:create_reader", fd); + TRACE_BEG (DEBUG_SYSIO, "gpgme:create_reader", handle); memset (&sec_attr, 0, sizeof sec_attr); sec_attr.nLength = sizeof sec_attr; @@ -402,17 +402,8 @@ create_reader (int fd) return NULL; } - if (fd < 0 || fd >= MAX_SLAFD || !fd_table[fd].used) - { - TRACE_SYSERR (EIO); - free (ctx); - return NULL; - } - TRACE_LOG4 ("fd=%d -> handle=%p socket=%d dupfrom=%d", - fd, fd_table[fd].handle, fd_table[fd].socket, - fd_table[fd].dup_from); - ctx->file_hd = fd_table[fd].handle; - ctx->file_sock = fd_table[fd].socket; + ctx->file_hd = handle; + ctx->file_sock = sock; ctx->refcount = 1; ctx->have_data_ev = CreateEvent (&sec_attr, TRUE, FALSE, NULL); @@ -511,37 +502,44 @@ destroy_reader (struct reader_context_s *ctx) /* Find a reader context or create a new one. Note that the reader - context will last until a _gpgme_io_close. */ + * context will last until a _gpgme_io_close. NULL is returned for a + * bad FD or for other errors. */ static struct reader_context_s * find_reader (int fd) { struct reader_context_s *rd = NULL; - int i; - LOCK (reader_table_lock); - for (i = 0; i < reader_table_size; i++) - if (reader_table[i].used && reader_table[i].fd == fd) - rd = reader_table[i].context; + TRACE_BEG0 (DEBUG_SYSIO, "gpgme:find_reader", fd, ""); - if (rd) + LOCK (fd_table_lock); + if (fd < 0 || fd >= fd_table_size || !fd_table[fd].used) { - UNLOCK (reader_table_lock); - return rd; + UNLOCK (fd_table_lock); + gpg_err_set_errno (EBADF); + TRACE_SUC0 ("EBADF"); + return NULL; } - for (i = 0; i < reader_table_size; i++) - if (!reader_table[i].used) - break; - - if (i != reader_table_size) + rd = fd_table[fd].reader; + if (rd) { - rd = create_reader (fd); - reader_table[i].fd = fd; - reader_table[i].context = rd; - reader_table[i].used = 1; + UNLOCK (fd_table_lock); + TRACE_SUC1 ("rd=%p", rd); + return rd; /* Return already initialized reader thread object. */ } - UNLOCK (reader_table_lock); + /* Create a new reader thread. */ + TRACE_LOG4 ("fd=%d -> handle=%p socket=%d dupfrom=%d creating reader", + fd, fd_table[fd].handle, fd_table[fd].socket, + fd_table[fd].dup_from); + rd = create_reader (fd_table[fd].handle, fd_table[fd].socket); + if (!rd) + gpg_err_set_errno (EIO); + else + fd_table[fd].reader = rd; + + UNLOCK (fd_table_lock); + TRACE_SUC1 ("rd=%p (new)", rd); return rd; } @@ -556,10 +554,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) ctx = find_reader (fd); if (!ctx) - { - gpg_err_set_errno (EBADF); - return TRACE_SYSRES (-1); - } + return TRACE_SYSRES (-1); if (ctx->eof_shortcut) return TRACE_SYSRES (0); @@ -734,13 +729,13 @@ writer (void *arg) static struct writer_context_s * -create_writer (int fd) +create_writer (HANDLE handle, int sock) { struct writer_context_s *ctx; SECURITY_ATTRIBUTES sec_attr; DWORD tid; - TRACE_BEG (DEBUG_SYSIO, "gpgme:create_writer", fd); + TRACE_BEG (DEBUG_SYSIO, "gpgme:create_writer", handle); memset (&sec_attr, 0, sizeof sec_attr); sec_attr.nLength = sizeof sec_attr; @@ -753,17 +748,8 @@ create_writer (int fd) return NULL; } - if (fd < 0 || fd >= MAX_SLAFD || !fd_table[fd].used) - { - TRACE_SYSERR (EIO); - free (ctx); - return NULL; - } - TRACE_LOG4 ("fd=%d -> handle=%p socket=%d dupfrom=%d", - fd, fd_table[fd].handle, fd_table[fd].socket, - fd_table[fd].dup_from); - ctx->file_hd = fd_table[fd].handle; - ctx->file_sock = fd_table[fd].socket; + ctx->file_hd = handle; + ctx->file_sock = sock; ctx->refcount = 1; ctx->have_data = CreateEvent (&sec_attr, TRUE, FALSE, NULL); @@ -840,37 +826,44 @@ destroy_writer (struct writer_context_s *ctx) /* Find a writer context or create a new one. Note that the writer - * context will last until a _gpgme_io_close. */ + * context will last until a _gpgme_io_close. NULL is returned for a + * bad FD or for other errors. */ static struct writer_context_s * find_writer (int fd) { struct writer_context_s *wt = NULL; - int i; - LOCK (writer_table_lock); - for (i = 0; i < writer_table_size; i++) - if (writer_table[i].used && writer_table[i].fd == fd) - wt = writer_table[i].context; + TRACE_BEG0 (DEBUG_SYSIO, "gpgme:find_writer", fd, ""); - if (wt) + LOCK (fd_table_lock); + if (fd < 0 || fd >= fd_table_size || !fd_table[fd].used) { - UNLOCK (writer_table_lock); - return wt; + UNLOCK (fd_table_lock); + gpg_err_set_errno (EBADF); + TRACE_SUC0 ("EBADF"); + return NULL; } - for (i = 0; i < writer_table_size; i++) - if (!writer_table[i].used) - break; - - if (i != writer_table_size) + wt = fd_table[fd].writer; + if (wt) { - wt = create_writer (fd); - writer_table[i].fd = fd; - writer_table[i].context = wt; - writer_table[i].used = 1; + UNLOCK (fd_table_lock); + TRACE_SUC1 ("wt=%p", wt); + return wt; /* Return already initialized writer thread object. */ } - UNLOCK (writer_table_lock); + /* Create a new writer thread. */ + TRACE_LOG4 ("fd=%d -> handle=%p socket=%d dupfrom=%d creating writer", + fd, fd_table[fd].handle, fd_table[fd].socket, + fd_table[fd].dup_from); + wt = create_writer (fd_table[fd].handle, fd_table[fd].socket); + if (!wt) + gpg_err_set_errno (EIO); + else + fd_table[fd].writer = wt; + + UNLOCK (fd_table_lock); + TRACE_SUC1 ("wt=%p (new)", wt); return wt; } @@ -931,7 +924,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count) ctx->nbytes = count; /* We have to reset the is_empty event early, because it is also - used by the select() implementation to probe the channel. */ + * used by the select() implementation to probe the channel. */ if (!ResetEvent (ctx->is_empty)) { TRACE_LOG1 ("ResetEvent failed: ec=%d", (int) GetLastError ()); @@ -1035,7 +1028,10 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) wh = hd; } - /* Put the HANDLEs of the new pipe into the file descriptor table. */ + /* Put the HANDLEs of the new pipe into the file descriptor table. + * Note that we don't need to lock the table because we have just + * acquired these two fresh fds and they are not known by any other + * thread. */ fd_table[rfd].handle = rh; fd_table[wfd].handle = wh; @@ -1046,22 +1042,27 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) } +/* Close out File descriptor FD. */ int _gpgme_io_close (int fd) { - int i; _gpgme_close_notify_handler_t handler = NULL; void *value = NULL; TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_close", fd); - if (fd == -1) + if (fd < 0) { gpg_err_set_errno (EBADF); return TRACE_SYSRES (-1); } - if (fd < 0 || fd >= MAX_SLAFD || !fd_table[fd].used) + + LOCK (fd_table_lock); + /* Check the size in the locked state because we may eventually add + * code to change that size. */ + if (fd >= fd_table_size || !fd_table[fd].used) { + UNLOCK (fd_table_lock); gpg_err_set_errno (EBADF); return TRACE_SYSRES (-1); } @@ -1070,48 +1071,22 @@ _gpgme_io_close (int fd) fd, fd_table[fd].handle, fd_table[fd].socket, fd_table[fd].dup_from); - LOCK (reader_table_lock); - for (i = 0; i < reader_table_size; i++) + if (fd_table[fd].reader) { - if (reader_table[i].used && reader_table[i].fd == fd) - { - destroy_reader (reader_table[i].context); - reader_table[i].context = NULL; - reader_table[i].used = 0; - break; - } + destroy_reader (fd_table[fd].reader); + fd_table[fd].reader = NULL; } - UNLOCK (reader_table_lock); - LOCK (writer_table_lock); - for (i = 0; i < writer_table_size; i++) + if (fd_table[fd].writer) { - if (writer_table[i].used && writer_table[i].fd == fd) - { - destroy_writer (writer_table[i].context); - writer_table[i].context = NULL; - writer_table[i].used = 0; - break; - } + destroy_writer (fd_table[fd].writer); + fd_table[fd].writer = NULL; } - UNLOCK (writer_table_lock); - LOCK (notify_table_lock); - for (i = 0; i < DIM (notify_table); i++) - { - if (notify_table[i].inuse && notify_table[i].fd == fd) - { - handler = notify_table[i].handler; - value = notify_table[i].value; - notify_table[i].handler = NULL; - notify_table[i].value = NULL; - notify_table[i].inuse = 0; - break; - } - } - UNLOCK (notify_table_lock); - if (handler) - handler (fd, value); + /* FIXME: The handler may not use any fd fucntion becuase the table + * is locked. Can we avoid this? */ + handler = fd_table[fd].notify.handler; + value = fd_table[fd].notify.value; if (fd_table[fd].dup_from == -1) { @@ -1122,6 +1097,7 @@ _gpgme_io_close (int fd) TRACE_LOG1 ("CloseHandle failed: ec=%d", (int) GetLastError ()); /* FIXME: Should translate the error code. */ gpg_err_set_errno (EIO); + UNLOCK (fd_table_lock); return TRACE_SYSRES (-1); } } @@ -1129,49 +1105,50 @@ _gpgme_io_close (int fd) { if (closesocket (fd_table[fd].socket)) { - TRACE_LOG1 ("closesocket failed: ec=%d", (int) WSAGetLastError ()); + TRACE_LOG1 ("closesocket failed: ec=%d", (int)WSAGetLastError ()); /* FIXME: Should translate the error code. */ gpg_err_set_errno (EIO); + UNLOCK (fd_table_lock); return TRACE_SYSRES (-1); } } } - release_fd (fd); + UNLOCK (fd_table_lock); + + /* Run the notification callback. */ + if (handler) + handler (fd, value); + + release_fd (fd); /* FIXME: We should have a release_fd_locked () */ return TRACE_SYSRES (0); } +/* Set a close notification callback which is called right after FD + * has been closed but before its slot (ie. the FD number) is beeing + * released. Tha HANDLER may thus use the provided value of the FD + * but it may not pass it to any I/O functions. Note: Only the last + * handler set for an FD is used. */ int _gpgme_io_set_close_notify (int fd, _gpgme_close_notify_handler_t handler, void *value) { - int i; TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_set_close_notify", fd, "close_handler=%p/%p", handler, value); - assert (fd != -1); - - LOCK (notify_table_lock); - for (i=0; i < DIM (notify_table); i++) - if (notify_table[i].inuse && notify_table[i].fd == fd) - break; - if (i == DIM (notify_table)) - for (i = 0; i < DIM (notify_table); i++) - if (!notify_table[i].inuse) - break; - if (i == DIM (notify_table)) - { - UNLOCK (notify_table_lock); - gpg_err_set_errno (EINVAL); - return TRACE_SYSRES (-1); + LOCK (fd_table_lock); + if (fd < 0 || fd >= fd_table_size || !fd_table[fd].used) + { + UNLOCK (fd_table_lock); + gpg_err_set_errno (EBADF); + return TRACE_SYSRES (-1);; } - notify_table[i].fd = fd; - notify_table[i].handler = handler; - notify_table[i].value = value; - notify_table[i].inuse = 1; - UNLOCK (notify_table_lock); + + fd_table[fd].notify.handler = handler; + fd_table[fd].notify.value = value; + UNLOCK (fd_table_lock); return TRACE_SYSRES (0); } @@ -1267,6 +1244,10 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, TRACE_BEG1 (DEBUG_SYSIO, "_gpgme_io_spawn", path, "path=%s", path); + + (void)atfork; + (void)atforkvalue; + i = 0; while (argv[i]) { @@ -1374,6 +1355,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, _gpgme_allow_set_foreground_window ((pid_t)pi.dwProcessId); /* Insert the inherited handles. */ + LOCK (fd_table_lock); for (i = 0; fd_list[i].fd != -1; i++) { int fd = fd_list[i].fd; @@ -1381,7 +1363,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, HANDLE hd = INVALID_HANDLE_VALUE; /* Make it inheritable for the wrapper process. */ - if (fd >= 0 && fd < MAX_SLAFD && fd_table[fd].used) + if (fd >= 0 && fd < fd_table_size && fd_table[fd].used) ohd = fd_table[fd].handle; if (!DuplicateHandle (GetCurrentProcess(), ohd, @@ -1401,6 +1383,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, /* FIXME: Should translate the error code. */ gpg_err_set_errno (EIO); + UNLOCK (fd_table_lock); return TRACE_SYSRES (-1); } /* Return the child name of this handle. */ @@ -1454,6 +1437,8 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, free (tmp_name); free (arg_string); + UNLOCK (fd_table_lock); + TRACE_LOG4 ("CreateProcess ready: hProcess=%p, hThread=%p, " "dwProcessID=%d, dwThreadId=%d", pi.hProcess, pi.hThread, @@ -1528,6 +1513,8 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) { if (fds[i].for_read) { + /* FIXME: A find_reader_locked() along with separate + * lock calls might be a better appaoched here. */ struct reader_context_s *ctx = find_reader (fds[i].fd); if (!ctx) @@ -1581,11 +1568,11 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) code = WaitForMultipleObjects (nwait, waitbuf, 0, nonblock ? 0 : 1000); if (code >= WAIT_OBJECT_0 && code < WAIT_OBJECT_0 + nwait) { - /* This WFMO is a really silly function: It does return either + /* The WFMO is a really silly function: It does return either the index of the signaled object or if 2 objects have been signalled at the same time, the index of the object with the lowest object is returned - so and how do we find out how - many objects have been signaled???. The only solution I can + many objects have been signaled?. The only solution I can imagine is to test each object starting with the returned index individually - how dull. */ any = 0; @@ -1668,13 +1655,15 @@ _gpgme_io_subsystem_init (void) } -/* Write the printable version of FD to the buffer BUF of length - BUFLEN. The printable version is the representation on the command - line that the child process expects. */ +/* Write the printable version of FD to BUFFER which has an allocated + * length of BUFLEN. The printable version is the representation on + * the command line that the child process expects. Note that this + * works closely together with the gpgme-32spawn wrapper process which + * translates these command line args to the real handles. */ int -_gpgme_io_fd2str (char *buf, int buflen, int fd) +_gpgme_io_fd2str (char *buffer, int buflen, int fd) { - return snprintf (buf, buflen, "%d", fd); + return snprintf (buffer, buflen, "%d", fd); } @@ -1684,60 +1673,47 @@ _gpgme_io_dup (int fd) int newfd; struct reader_context_s *rd_ctx; struct writer_context_s *wt_ctx; - int i; TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_dup", fd); - if (fd < 0 || fd >= MAX_SLAFD || !fd_table[fd].used) + LOCK (fd_table_lock); + if (fd < 0 || fd >= fd_table_size || !fd_table[fd].used) { - gpg_err_set_errno (EINVAL); + UNLOCK (fd_table_lock); + gpg_err_set_errno (EBADF); return TRACE_SYSRES (-1); } newfd = new_fd(); if (newfd == -1) - return TRACE_SYSRES (-1); + { + UNLOCK (fd_table_lock); + gpg_err_set_errno (EMFILE); + return TRACE_SYSRES (-1); + } fd_table[newfd].handle = fd_table[fd].handle; fd_table[newfd].socket = fd_table[fd].socket; fd_table[newfd].dup_from = fd; + UNLOCK (fd_table_lock); + rd_ctx = find_reader (fd); if (rd_ctx) { - /* No need for locking, as the only races are against the reader - thread itself, which doesn't touch refcount. */ + /* No need for locking in the context, as the only races are + * against the reader thread itself, which doesn't touch + * refcount. NEWFD initializes a freshly allocated slot and + * does not need locking either. */ rd_ctx->refcount++; - - LOCK (reader_table_lock); - for (i = 0; i < reader_table_size; i++) - if (!reader_table[i].used) - break; - /* FIXME. */ - assert (i != reader_table_size); - reader_table[i].fd = newfd; - reader_table[i].context = rd_ctx; - reader_table[i].used = 1; - UNLOCK (reader_table_lock); + fd_table[newfd].reader = rd_ctx; } wt_ctx = find_writer (fd); if (wt_ctx) { - /* No need for locking, as the only races are against the writer - thread itself, which doesn't touch refcount. */ wt_ctx->refcount++; - - LOCK (writer_table_lock); - for (i = 0; i < writer_table_size; i++) - if (!writer_table[i].used) - break; - /* FIXME. */ - assert (i != writer_table_size); - writer_table[i].fd = newfd; - writer_table[i].context = wt_ctx; - writer_table[i].used = 1; - UNLOCK (writer_table_lock); + fd_table[newfd].writer = wt_ctx; } return TRACE_SYSRES (newfd); @@ -1815,17 +1791,22 @@ int _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen) { int res; + int sock; TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_connect", fd, "addr=%p, addrlen=%i", addr, addrlen); - if (fd < 0 || fd >= MAX_SLAFD || !fd_table[fd].used) + LOCK (fd_table_lock); + if (fd < 0 || fd >= fd_table_size || !fd_table[fd].used) { gpg_err_set_errno (EBADF); + UNLOCK (fd_table_lock); return TRACE_SYSRES (-1); } + sock = fd_table[fd].socket; + UNLOCK (fd_table_lock); - res = connect (fd_table[fd].socket, addr, addrlen); + res = connect (sock, addr, addrlen); if (res) { gpg_err_set_errno (wsa2errno (WSAGetLastError ())); commit 79fc7c0fe825014e75bb825c4966a04a22e78254 Author: Werner Koch Date: Wed Oct 31 14:58:23 2018 +0100 w32: Remove unused arg from two functions. * src/w32-io.c (find_reader, find_writer): Remove unused start_it arg. It is always passed as true. Change callers. Signed-off-by: Werner Koch diff --git a/src/w32-io.c b/src/w32-io.c index bb59a5e..e3201b7 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -1,23 +1,23 @@ /* w32-io.c - W32 API I/O functions. - Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2003, 2004, 2007, 2010 g10 Code GmbH - - This file is part of GPGME. - - GPGME is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 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 - 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, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + * Copyright (C) 2000 Werner Koch (dd9jn) + * Copyright (C) 2001-2004, 2007, 2010, 2018 g10 Code GmbH + * + * This file is part of GPGME. + * + * GPGME is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 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 + * 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 . + * SPDX-License-Identifier: LGPL-2.1+ + */ #ifdef HAVE_CONFIG_H #include @@ -46,6 +46,11 @@ /* FIXME: Optimize. */ #define MAX_SLAFD 512 +/* An object to keep track of HANDLEs and sockets and map them to an + * integer similar to what we use in Unix. Note that despite this + * integer is often named "fd", it is not a file descriptor but really + * only an index into this table. Never ever pass such an fd to any + * other function except for those implemented here. */ static struct { int used; @@ -74,7 +79,9 @@ static struct DEFINE_STATIC_LOCK (fd_table_lock); -/* Returns the FD or -1 on resource limit. */ +/* Returns our FD or -1 on resource limit. The returned integer + * references a new object which has not been intialized but can be + * release with release_fd. */ int new_fd (void) { @@ -104,7 +111,9 @@ new_fd (void) return idx; } - +/* Releases our FD but it this is just this entry. No close operation + * is involved here; it must be done prior to calling this + * function. */ void release_fd (int fd) { @@ -504,7 +513,7 @@ destroy_reader (struct reader_context_s *ctx) /* Find a reader context or create a new one. Note that the reader context will last until a _gpgme_io_close. */ static struct reader_context_s * -find_reader (int fd, int start_it) +find_reader (int fd) { struct reader_context_s *rd = NULL; int i; @@ -514,7 +523,7 @@ find_reader (int fd, int start_it) if (reader_table[i].used && reader_table[i].fd == fd) rd = reader_table[i].context; - if (rd || !start_it) + if (rd) { UNLOCK (reader_table_lock); return rd; @@ -545,7 +554,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_read", fd, "buffer=%p, count=%u", buffer, count); - ctx = find_reader (fd, 1); + ctx = find_reader (fd); if (!ctx) { gpg_err_set_errno (EBADF); @@ -831,9 +840,9 @@ destroy_writer (struct writer_context_s *ctx) /* Find a writer context or create a new one. Note that the writer - context will last until a _gpgme_io_close. */ + * context will last until a _gpgme_io_close. */ static struct writer_context_s * -find_writer (int fd, int start_it) +find_writer (int fd) { struct writer_context_s *wt = NULL; int i; @@ -843,7 +852,7 @@ find_writer (int fd, int start_it) if (writer_table[i].used && writer_table[i].fd == fd) wt = writer_table[i].context; - if (wt || !start_it) + if (wt) { UNLOCK (writer_table_lock); return wt; @@ -877,7 +886,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count) if (count == 0) return TRACE_SYSRES (0); - ctx = find_writer (fd, 1); + ctx = find_writer (fd); if (!ctx) return TRACE_SYSRES (-1); @@ -958,6 +967,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) "inherit_idx=%i (GPGME uses it for %s)", inherit_idx, inherit_idx ? "reading" : "writing"); + /* Get a new empty file descriptor. */ rfd = new_fd (); if (rfd == -1) return TRACE_SYSRES (-1); @@ -968,6 +978,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) return TRACE_SYSRES (-1); } + /* Create a pipe. */ memset (&sec_attr, 0, sizeof (sec_attr)); sec_attr.nLength = sizeof (sec_attr); sec_attr.bInheritHandle = FALSE; @@ -1023,6 +1034,8 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) CloseHandle (wh); wh = hd; } + + /* Put the HANDLEs of the new pipe into the file descriptor table. */ fd_table[rfd].handle = rh; fd_table[wfd].handle = wh; @@ -1515,7 +1528,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) { if (fds[i].for_read) { - struct reader_context_s *ctx = find_reader (fds[i].fd,1); + struct reader_context_s *ctx = find_reader (fds[i].fd); if (!ctx) TRACE_LOG1 ("error: no reader for FD 0x%x (ignored)", @@ -1538,7 +1551,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) } else if (fds[i].for_write) { - struct writer_context_s *ctx = find_writer (fds[i].fd,1); + struct writer_context_s *ctx = find_writer (fds[i].fd); if (!ctx) TRACE_LOG1 ("error: no writer for FD 0x%x (ignored)", @@ -1689,7 +1702,7 @@ _gpgme_io_dup (int fd) fd_table[newfd].socket = fd_table[fd].socket; fd_table[newfd].dup_from = fd; - rd_ctx = find_reader (fd, 1); + rd_ctx = find_reader (fd); if (rd_ctx) { /* No need for locking, as the only races are against the reader @@ -1708,7 +1721,7 @@ _gpgme_io_dup (int fd) UNLOCK (reader_table_lock); } - wt_ctx = find_writer (fd, 1); + wt_ctx = find_writer (fd); if (wt_ctx) { /* No need for locking, as the only races are against the writer @@ -1737,6 +1750,7 @@ _gpgme_io_dup (int fd) void * gpgme_get_giochannel (int fd) { + (void)fd; return NULL; } @@ -1745,6 +1759,7 @@ gpgme_get_giochannel (int fd) void * gpgme_get_fdptr (int fd) { + (void)fd; return NULL; } commit 3c04dea3ecebed35208f6b631b2e8b04222ea432 Author: Werner Koch Date: Wed Oct 31 12:27:27 2018 +0100 w32: Remove all support for WindowsCE * configure.ac: Remove WindwosCE support. * contrib/: Remove all; it was only used for WindowsCE. * src/w32-ce.c, src/w32-ce.h: Remove files. * src/Makefile.am (system_components): Remove these files. * src/ath.c, src/ath.h: Remove W32CE support. * src/data-compat.c (gpgme_data_new_from_filepart): Ditto. (gpgme_data_new_from_file): Ditto. * src/debug.c (debug_init, _gpgme_debug): Ditto. * src/gpgme-tool.c (gpgme_server): Ditto. (main): Ditto. * src/priv-io.h: Do not include w32-ce.h. * src/util.h: Remove WindowsCE support. * src/w32-io.c: Ditto. * src/w32-util.c: Ditto. * src/debug.h (TRACE_SUC4): New. -- There is no more hardware to test our code, the support for Windows CE terminated along time ago. Note that our code worked only with the old WindowsCE with that overall system limit of 31 processes. Signed-off-by: Werner Koch diff --git a/Makefile.am b/Makefile.am index 1264618..7b35128 100644 --- a/Makefile.am +++ b/Makefile.am @@ -33,8 +33,8 @@ ACLOCAL_AMFLAGS = -I m4 DISTCHECK_CONFIGURE_FLAGS = -EXTRA_DIST = autogen.sh autogen.rc gpgme.spec.in \ - ChangeLog-2011 m4/ChangeLog-2011 contrib/ChangeLog-2011 \ +EXTRA_DIST = autogen.sh autogen.rc gpgme.spec.in \ + ChangeLog-2011 m4/ChangeLog-2011 \ conf/whatisthis VERSION diff --git a/configure.ac b/configure.ac index 1493554..1398993 100644 --- a/configure.ac +++ b/configure.ac @@ -186,9 +186,6 @@ case "${host}" in x86_64-*mingw32*) have_w64_system=yes ;; - *-mingw32ce*) - have_w32ce_system=yes - ;; *-linux-androideabi) have_android_system=yes ;; @@ -197,7 +194,7 @@ case "${host}" in ;; esac case "${host}" in - *-mingw32ce*|*-mingw32*) + *-mingw32*) have_dosish_system=yes have_w32_system=yes GPG_DEFAULT='c:\\gnupg\\gpg.exe' @@ -241,12 +238,6 @@ 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 diff --git a/contrib/ChangeLog-2011 b/contrib/ChangeLog-2011 deleted file mode 100644 index cfe5876..0000000 --- a/contrib/ChangeLog-2011 +++ /dev/null @@ -1,49 +0,0 @@ -2011-12-02 Werner Koch - - 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 - - * 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 - - * conf-w32ce-msc/build.mk (copy-static-source): Create stdint.h. - (all): Add ws2.lib - (clean): New. - -2010-11-04 Werner Koch - - * 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 - - * conf-w32ce-msc/build.mk (copy-built-source): Create dummy sehmap.h. - -2010-11-01 Werner Koch - - * 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. diff --git a/contrib/conf-w32ce-msc/build.mk b/contrib/conf-w32ce-msc/build.mk deleted file mode 100755 index ac3b6a3..0000000 --- a/contrib/conf-w32ce-msc/build.mk +++ /dev/null @@ -1,256 +0,0 @@ -# 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 - diff --git a/contrib/conf-w32ce-msc/config.h b/contrib/conf-w32ce-msc/config.h deleted file mode 100644 index d8ab5d7..0000000 --- a/contrib/conf-w32ce-msc/config.h +++ /dev/null @@ -1,314 +0,0 @@ -/* 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 at 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 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 header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LOCALE_H */ - -/* Define to 1 if you have the 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 header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the 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 header file. */ -/* #undef HAVE_STRINGS_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_SELECT_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_STAT_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_TYPES_H */ - -/* Define to 1 if you have the 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 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 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) - - - diff --git a/contrib/conf-w32ce-msc/fcntl.h b/contrib/conf-w32ce-msc/fcntl.h deleted file mode 100755 index 08c7415..0000000 --- a/contrib/conf-w32ce-msc/fcntl.h +++ /dev/null @@ -1 +0,0 @@ -/* Dummy fcntl.h header. */ diff --git a/contrib/conf-w32ce-msc/io.h b/contrib/conf-w32ce-msc/io.h deleted file mode 100755 index d586b8c..0000000 --- a/contrib/conf-w32ce-msc/io.h +++ /dev/null @@ -1,2 +0,0 @@ -/* Dummy io.h header. */ - diff --git a/contrib/conf-w32ce-msc/stdint.h b/contrib/conf-w32ce-msc/stdint.h deleted file mode 100755 index 0a821b7..0000000 --- a/contrib/conf-w32ce-msc/stdint.h +++ /dev/null @@ -1,9 +0,0 @@ -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; - diff --git a/src/Makefile.am b/src/Makefile.am index 1394c02..276d976 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -50,10 +50,6 @@ system_components = ath.h posix-util.c posix-io.c system_components_not_extra = endif -if HAVE_W32CE_SYSTEM -system_components += w32-ce.h w32-ce.c -endif - if HAVE_UISERVER uiserver_components = engine-uiserver.c else @@ -111,12 +107,7 @@ if HAVE_W32_SYSTEM # Windows provides us with an endless stream of Tough Love. To spawn # processes with a controlled set of inherited handles, we need a # wrapper process. -# Except on Windows CE. There nothing is inheritable anyway. -if HAVE_W32CE_SYSTEM -libexec_PROGRAMS = -else libexec_PROGRAMS = gpgme-w32spawn -endif RCCOMPILE = $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RCCOMPILE) diff --git a/src/ath.c b/src/ath.c index 6b4667e..94d5eb1 100644 --- a/src/ath.c +++ b/src/ath.c @@ -78,22 +78,14 @@ ath_self (void) gpgme_ssize_t ath_read (int fd, void *buf, size_t nbytes) { -#if defined(HAVE_W32CE_SYSTEM) && defined(_MSC_VER) - return -1; /* Not supported. */ -#else return read (fd, buf, nbytes); -#endif } gpgme_ssize_t ath_write (int fd, const void *buf, size_t nbytes) { -#if defined(HAVE_W32CE_SYSTEM) && defined(_MSC_VER) - return -1; /* Not supported. */ -#else return write (fd, buf, nbytes); -#endif } diff --git a/src/ath.h b/src/ath.h index a1be9e5..d4c1c6f 100644 --- a/src/ath.h +++ b/src/ath.h @@ -28,9 +28,6 @@ /* fixme: Check how we did it in libgcrypt. */ struct msghdr { int dummy; }; typedef int socklen_t; -# if defined(HAVE_W32CE_SYSTEM) && defined(_MSC_VER) -# include -# endif # include # include diff --git a/src/data-compat.c b/src/data-compat.c index 87eaeef..1f04c46 100644 --- a/src/data-compat.c +++ b/src/data-compat.c @@ -43,9 +43,6 @@ gpgme_error_t gpgme_data_new_from_filepart (gpgme_data_t *r_dh, const char *fname, FILE *stream, gpgme_off_t offset, size_t length) { -#if defined (HAVE_W32CE_SYSTEM) && defined (_MSC_VER) - return gpgme_error (GPG_ERR_NOT_IMPLEMENTED); -#else gpgme_error_t err; char *buf = NULL; int res; @@ -114,7 +111,6 @@ gpgme_data_new_from_filepart (gpgme_data_t *r_dh, const char *fname, (*r_dh)->data.mem.length = length; return TRACE_SUC1 ("r_dh=%p", *r_dh); -#endif } @@ -123,9 +119,6 @@ gpgme_data_new_from_filepart (gpgme_data_t *r_dh, const char *fname, gpgme_error_t gpgme_data_new_from_file (gpgme_data_t *r_dh, const char *fname, int copy) { -#if defined (HAVE_W32CE_SYSTEM) && defined (_MSC_VER) - return gpgme_error (GPG_ERR_NOT_IMPLEMENTED); -#else gpgme_error_t err; struct stat statbuf; TRACE_BEG3 (DEBUG_DATA, "gpgme_data_new_from_file", r_dh, @@ -139,7 +132,6 @@ gpgme_data_new_from_file (gpgme_data_t *r_dh, const char *fname, int copy) err = gpgme_data_new_from_filepart (r_dh, fname, NULL, 0, statbuf.st_size); return TRACE_ERR (err); -#endif } diff --git a/src/data-fd.c b/src/data-fd.c index 42d6a0d..cf17f00 100644 --- a/src/data-fd.c +++ b/src/data-fd.c @@ -33,62 +33,6 @@ #include "data.h" - -#if defined(HAVE_W32CE_SYSTEM) && !defined(__MINGW32CE__) -/* We need to provide replacements for read, write and lseek. They - are taken from the cegcc runtime files, written by Pedro Alves - in Feb 2007 and placed in the public - domain. (cf. cegcc/src/mingw/mingwex/wince/) */ - -#include - -static int -read (int fildes, void *buf, unsigned int bufsize) -{ - DWORD NumberOfBytesRead; - if (bufsize > 0x7fffffff) - bufsize = 0x7fffffff; - if (!ReadFile ((HANDLE) fildes, buf, bufsize, &NumberOfBytesRead, NULL)) - return -1; - return (int) NumberOfBytesRead; -} - -static int -write (int fildes, const void *buf, unsigned int bufsize) -{ - DWORD NumberOfBytesWritten; - if (bufsize > 0x7fffffff) - bufsize = 0x7fffffff; - if (!WriteFile ((HANDLE) fildes, buf, bufsize, &NumberOfBytesWritten, NULL)) - return -1; - return (int) NumberOfBytesWritten; -} - -static long -lseek (int fildes, long offset, int whence) -{ - DWORD mode; - switch (whence) - { - case SEEK_SET: - mode = FILE_BEGIN; - break; - case SEEK_CUR: - mode = FILE_CURRENT; - break; - case SEEK_END: - mode = FILE_END; - break; - default: - /* Specify an invalid mode so SetFilePointer catches it. */ - mode = (DWORD)-1; - } - return (long) SetFilePointer ((HANDLE) fildes, offset, NULL, mode); -} -#endif /*HAVE_W32CE_SYSTEM && !__MINGW32CE__*/ - - - static gpgme_ssize_t fd_read (gpgme_data_t dh, void *buffer, size_t size) { diff --git a/src/debug.c b/src/debug.c index 37baabb..84aa408 100644 --- a/src/debug.c +++ b/src/debug.c @@ -150,16 +150,12 @@ debug_init (void) } else { -#ifdef HAVE_W32CE_SYSTEM - e = _gpgme_w32ce_get_debug_envvar (); -#else /*!HAVE_W32CE_SYSTEM*/ err = _gpgme_getenv ("GPGME_DEBUG", &e); if (err) { UNLOCK (debug_lock); return; } -#endif /*!HAVE_W32CE_SYSTEM*/ } initialized = 1; @@ -257,15 +253,6 @@ _gpgme_debug (int level, const char *format, ...) va_start (arg_ptr, format); LOCK (debug_lock); { -#ifdef HAVE_W32CE_SYSTEM - SYSTEMTIME t; - - GetLocalTime (&t); - fprintf (errfp, "GPGME %04d-%02d-%02d %02d:%02d:%02d <0x%04llx> ", - t.wYear, t.wMonth, t.wDay, - t.wHour, t.wMinute, t.wSecond, - (unsigned long long) ath_self ()); -#else struct tm *tp; time_t atime = time (NULL); @@ -274,7 +261,6 @@ _gpgme_debug (int level, const char *format, ...) 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec, (unsigned long long) ath_self ()); -#endif } #ifdef FRAME_NR { diff --git a/src/debug.h b/src/debug.h index 6bde998..ca65d9e 100644 --- a/src/debug.h +++ b/src/debug.h @@ -211,6 +211,10 @@ _gpgme_trace_gpgme_error (gpgme_error_t err, const char *file, int line) #define TRACE_SUC2(fmt, arg1, arg2) \ _gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \ _gpgme_trace_func, arg1, arg2), _gpgme_debug_frame_end () +#define TRACE_SUC4(fmt, arg1, arg2, arg3, arg4) \ + _gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \ + _gpgme_trace_func, arg1, arg2, arg3, arg4), \ + _gpgme_debug_frame_end () #define TRACE_SUC5(fmt, arg1, arg2, arg3, arg4, arg5) \ _gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \ _gpgme_trace_func, arg1, arg2, arg3, arg4, arg5), \ diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c index e7a7a6f..5c34b0b 100644 --- a/src/gpgme-tool.c +++ b/src/gpgme-tool.c @@ -3282,15 +3282,11 @@ gpgme_server (gpgme_tool_t gt) gt->write_data_hook = &server; /* We use a pipe based server so that we can work from scripts. - assuan_init_pipe_server will automagically detect when we are - called with a socketpair and ignore FIELDES in this case. */ -#ifdef HAVE_W32CE_SYSTEM - filedes[0] = ASSUAN_STDIN; - filedes[1] = ASSUAN_STDOUT; -#else + * assuan_init_pipe_server will automagically detect when we are + * called with a socketpair and ignore FILEDES in this case. */ filedes[0] = assuan_fdopen (0); filedes[1] = assuan_fdopen (1); -#endif + err = assuan_new (&server.assuan_ctx); if (err) log_error (1, err, "can't create assuan context"); @@ -3439,10 +3435,5 @@ main (int argc, char *argv[]) if (needgt) gpgme_release (gt.ctx); -#ifdef HAVE_W32CE_SYSTEM - /* Give the buggy ssh server time to flush the output buffers. */ - Sleep (300); -#endif - return 0; } diff --git a/src/priv-io.h b/src/priv-io.h index bc9d3d5..d21f1b3 100644 --- a/src/priv-io.h +++ b/src/priv-io.h @@ -23,9 +23,6 @@ #define IO_H #ifdef HAVE_W32_SYSTEM -# ifdef HAVE_W32CE_SYSTEM -# include "w32-ce.h" -# endif # include # include #else diff --git a/src/util.h b/src/util.h index da929eb..cea5e1f 100644 --- a/src/util.h +++ b/src/util.h @@ -23,12 +23,8 @@ #define UTIL_H #ifdef HAVE_W32_SYSTEM -# ifdef HAVE_W32CE_SYSTEM -# include "w32-ce.h" -# else -# include "winsock2.h" -# include "windows.h" -# endif +# include "winsock2.h" +# include "windows.h" #endif /* For pid_t. */ @@ -208,9 +204,6 @@ const char *_gpgme_status_to_string (gpgme_status_code_t code); int _gpgme_mkstemp (int *fd, char **name); const char *_gpgme_get_w32spawn_path (void); #endif /*HAVE_W32_SYSTEM*/ -#ifdef HAVE_W32CE_SYSTEM -char *_gpgme_w32ce_get_debug_envvar (void); -#endif /*HAVE_W32CE_SYSTEM*/ diff --git a/src/w32-ce.c b/src/w32-ce.c deleted file mode 100644 index e326bfe..0000000 --- a/src/w32-ce.c +++ /dev/null @@ -1,507 +0,0 @@ -/* w32-ce.h - Copyright (C) 2010 g10 Code GmbH - Copyright (C) 1991,92,97,2000,02 Free Software Foundation, Inc. - - This file is part of GPGME. - - GPGME is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 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 - 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 . - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include - -#include - -#define _WIN32_IE 0x0400 /* Required for SHGetSpecialFolderPathW. */ - -/* We need to include the windows stuff here prior to shlobj.h so that - we get the right winsock version. This is usually done in w32-ce.h - but that header also redefines some Windows functions which we need - to avoid unless having included shlobj.h. */ -#include -#include -#include -#include - -#include "w32-ce.h" - -/* Return a malloced string encoded in UTF-8 from the wide char input - string STRING. Caller must free this value. Returns NULL and sets - ERRNO on failure. Calling this function with STRING set to NULL is - not defined. */ -char * -wchar_to_utf8 (const wchar_t *string) -{ - int n; - char *result; - - n = WideCharToMultiByte (CP_UTF8, 0, string, -1, NULL, 0, NULL, NULL); - if (n < 0) - { - gpg_err_set_errno (EINVAL); - return NULL; - } - - result = malloc (n+1); - if (!result) - return NULL; - - n = WideCharToMultiByte (CP_UTF8, 0, string, -1, result, n, NULL, NULL); - if (n < 0) - { - free (result); - gpg_err_set_errno (EINVAL); - result = NULL; - } - return result; -} - - -/* Return a malloced wide char string from an UTF-8 encoded input - string STRING. Caller must free this value. Returns NULL and sets - ERRNO on failure. Calling this function with STRING set to NULL is - not defined. */ -wchar_t * -utf8_to_wchar (const char *string) -{ - int n; - size_t nbytes; - wchar_t *result; - - n = MultiByteToWideChar (CP_UTF8, 0, string, -1, NULL, 0); - if (n < 0) - { - gpg_err_set_errno (EINVAL); - return NULL; - } - - nbytes = (size_t)(n+1) * sizeof(*result); - if (nbytes / sizeof(*result) != (n+1)) - { - gpg_err_set_errno (ENOMEM); - return NULL; - } - result = malloc (nbytes); - if (!result) - return NULL; - - n = MultiByteToWideChar (CP_UTF8, 0, string, -1, result, n); - if (n < 0) - { - free (result); - gpg_err_set_errno (EINVAL); - result = NULL; - } - return result; -} - - -#define MAX_ENV 30 - -char *environ[MAX_ENV + 1]; - -char * -getenv (const char *name) -{ - static char *past_result; - char **envp; - - if (past_result) - { - free (past_result); - past_result = NULL; - } - -#if 0 - if (! strcmp (name, "DBUS_VERBOSE")) - return past_result = get_verbose_setting (); - else if (! strcmp (name, "HOMEPATH")) - return past_result = find_my_documents_folder (); - else if (! strcmp (name, "DBUS_DATADIR")) - return past_result = find_inst_subdir ("share"); -#endif - - for (envp = environ; *envp != 0; envp++) - { - const char *varp = name; - char *ep = *envp; - - while (*varp == *ep && *varp != '\0') - { - ++ep; - ++varp; - }; - - if (*varp == '\0' && *ep == '=') - return ep + 1; - } - - return NULL; -} - - -void -GetSystemTimeAsFileTime (LPFILETIME ftp) -{ - SYSTEMTIME st; - GetSystemTime (&st); - SystemTimeToFileTime (&st, ftp); -} - - -BOOL -DeleteFileA (LPCSTR lpFileName) -{ - wchar_t *filename; - BOOL result; - int err; - - filename = utf8_to_wchar (lpFileName); - if (!filename) - return FALSE; - - result = DeleteFileW (filename); - - err = GetLastError (); - free (filename); - SetLastError (err); - return result; -} - - -HANDLE -CreateFileA (LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwSharedMode, - LPSECURITY_ATTRIBUTES lpSecurityAttributes, - DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, - HANDLE hTemplateFile) -{ - wchar_t *filename; - HANDLE result; - int err; - - filename = utf8_to_wchar (lpFileName); - if (!filename) - return INVALID_HANDLE_VALUE; - - result = CreateFileW (filename, dwDesiredAccess, dwSharedMode, - lpSecurityAttributes, dwCreationDisposition, - dwFlagsAndAttributes, hTemplateFile); - - err = GetLastError (); - free (filename); - SetLastError (err); - return result; -} - - -BOOL -CreateProcessA (LPCSTR pszImageName, LPSTR pszCmdLine, - LPSECURITY_ATTRIBUTES psaProcess, - LPSECURITY_ATTRIBUTES psaThread, BOOL fInheritHandles, - DWORD fdwCreate, PVOID pvEnvironment, LPCSTR pszCurDir, - LPSTARTUPINFOA psiStartInfo, - LPPROCESS_INFORMATION pProcInfo) -{ - wchar_t *image_name = NULL; - wchar_t *cmd_line = NULL; - BOOL result; - int err; - - assert (psaProcess == NULL); - assert (psaThread == NULL); - assert (fInheritHandles == FALSE); - assert (pvEnvironment == NULL); - assert (pszCurDir == NULL); - /* psiStartInfo is generally not NULL. */ - - if (pszImageName) - { - image_name = utf8_to_wchar (pszImageName); - if (!image_name) - return 0; - } - if (pszCmdLine) - { - cmd_line = utf8_to_wchar (pszCmdLine); - if (!cmd_line) - { - if (image_name) - free (image_name); - return 0; - } - } - - result = CreateProcessW (image_name, cmd_line, NULL, NULL, FALSE, - fdwCreate, NULL, NULL, NULL, pProcInfo); - - err = GetLastError (); - free (image_name); - free (cmd_line); - SetLastError (err); - return result; -} - - -LONG -RegOpenKeyExA (HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, - REGSAM samDesired, PHKEY phkResult) -{ - wchar_t *subkey; - LONG result; - int err; - - if (lpSubKey) - { - subkey = utf8_to_wchar (lpSubKey); - if (!subkey) - return 0; - } - else - subkey = NULL; - - result = RegOpenKeyEx (hKey, subkey, ulOptions, samDesired, phkResult); - - err = GetLastError (); - free (subkey); - SetLastError (err); - return result; -} - - -LONG WINAPI -RegQueryValueExA (HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, - LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData) -{ - wchar_t *name; - LONG err; - void *data; - DWORD data_len; - DWORD type; - - if (lpValueName) - { - name = utf8_to_wchar (lpValueName); - if (!name) - return GetLastError (); - } - else - name = NULL; - - data_len = 0; - err = RegQueryValueExW (hKey, name, lpReserved, lpType, NULL, &data_len); - if (err || !lpcbData) - { - free (name); - return err; - } - - data = malloc (data_len + sizeof (wchar_t)); - if (!data) - { - free (name); - return ERROR_NOT_ENOUGH_MEMORY; - } - - err = RegQueryValueExW (hKey, name, lpReserved, &type, data, &data_len); - if (lpType) - *lpType = type; - free (name); - /* If err is ERROR_MORE_DATA, there probably was a race condition. - We can punt this to the caller just as well. */ - if (err) - return err; - - /* NOTE: REG_MULTI_SZ and REG_EXPAND_SZ not supported, because they - are not needed in this module. */ - if (type == REG_SZ) - { - char *data_c; - int data_c_len; - - /* This is valid since we allocated one more above. */ - ((char*)data)[data_len] = '\0'; - ((char*)data)[data_len + 1] = '\0'; - - data_c = wchar_to_utf8 ((wchar_t*) data); - if (!data_c) - return GetLastError(); - - data_c_len = strlen (data_c) + 1; - assert (data_c_len <= data_len + sizeof (wchar_t)); - memcpy (data, data_c, data_c_len); - data_len = data_c_len; - free (data_c); - } - - /* DATA and DATA_LEN now contain the result. */ - if (lpData) - { - if (data_len > *lpcbData) - err = ERROR_MORE_DATA; - else - memcpy (lpData, data, data_len); - } - *lpcbData = data_len; - return err; -} - - -DWORD -GetTempPathA (DWORD nBufferLength, LPSTR lpBuffer) -{ - wchar_t dummy[1]; - DWORD len; - - len = GetTempPathW (0, dummy); - if (len == 0) - return 0; - - assert (len <= MAX_PATH); - - /* Better be safe than sorry. MSDN doesn't say if len is with or - without terminating 0. */ - len++; - - { - wchar_t *buffer_w; - DWORD len_w; - char *buffer_c; - DWORD len_c; - - buffer_w = malloc (sizeof (wchar_t) * len); - if (! buffer_w) - return 0; - - len_w = GetTempPathW (len, buffer_w); - /* Give up if we still can't get at it. */ - if (len_w == 0 || len_w >= len) - { - free (buffer_w); - return 0; - } - - /* Better be really safe. */ - buffer_w[len_w] = '\0'; - - buffer_c = wchar_to_utf8 (buffer_w); - free (buffer_w); - if (! buffer_c) - return 0; - - /* strlen is correct (not _mbstrlen), because we want storage and - not string length. */ - len_c = strlen (buffer_c) + 1; - if (len_c > nBufferLength) - return len_c; - - strcpy (lpBuffer, buffer_c); - free (buffer_c); - return len_c - 1; - } -} - - -/* The symbol is named SHGetSpecialFolderPath and not - SHGetSpecialFolderPathW but shlobj.h from cegcc redefines it to *W - which is a bug. Work around it. */ -#ifdef __MINGW32CE__ -# undef SHGetSpecialFolderPath -#endif -BOOL -SHGetSpecialFolderPathA (HWND hwndOwner, LPSTR lpszPath, int nFolder, - BOOL fCreate) -{ - wchar_t path[MAX_PATH]; - char *path_c; - BOOL result; - - path[0] = (wchar_t) 0; - result = SHGetSpecialFolderPath (hwndOwner, path, nFolder, fCreate); - /* Note: May return false even if succeeds. */ - - path[MAX_PATH - 1] = (wchar_t) 0; - path_c = wchar_to_utf8 (path); - if (! path_c) - return 0; - - strncpy (lpszPath, path_c, MAX_PATH); - free (path_c); - lpszPath[MAX_PATH - 1] = '\0'; - return result; -} - -/* Replacement for the access function. Note that we can't use fopen - here because wince might now allow to have a shared read for an - executable; it is better to to read the file attributes. - - Limitation: Only F_OK is supported. -*/ -int -_gpgme_wince_access (const char *fname, int mode) -{ - DWORD attr; - wchar_t *wfname; - - (void)mode; - - wfname = utf8_to_wchar (fname); - if (!wfname) - return -1; - - attr = GetFileAttributes (wfname); - free (wfname); - if (attr == (DWORD)(-1)) - { - gpg_err_set_errno (ENOENT); - return -1; - } - return 0; -} - - -/* Perform a binary search for KEY in BASE which has NMEMB elements - of SIZE bytes each. The comparisons are done by (*COMPAR)(). - Code taken from glibc-2.6. */ -void * -_gpgme_wince_bsearch (const void *key, const void *base, - size_t nmemb, size_t size, - int (*compar) (const void *, const void *)) -{ - size_t l, u, idx; - const void *p; - int comparison; - - l = 0; - u = nmemb; - while (l < u) - { - idx = (l + u) / 2; - p = (void *) (((const char *) base) + (idx * size)); - comparison = (*compar) (key, p); - if (comparison < 0) - u = idx; - else if (comparison > 0) - l = idx + 1; - else - return (void *) p; - } - - return NULL; -} - diff --git a/src/w32-ce.h b/src/w32-ce.h deleted file mode 100644 index c52ea99..0000000 --- a/src/w32-ce.h +++ /dev/null @@ -1,91 +0,0 @@ -/* w32-ce.h - Copyright (C) 2010 g10 Code GmbH - - This file is part of GPGME. - - GPGME is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 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 - 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, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#ifndef GPGME_W32_CE_H -#define GPGME_W32_CE_H - -#include -#include - -#ifdef _MSC_VER -typedef int pid_t; -#define strdup _strdup -#define strcasecmp _stricmp -#endif - -#include -#include /* For getaddrinfo. */ -#include - -#define getenv _gpgme_wince_getenv -char *getenv (const char *name); - -#include -#define isatty(fd) 0 - - -/* Windows CE is missing some Windows functions that we want. */ - -#define GetSystemTimeAsFileTime _gpgme_wince_GetSystemTimeAsFileTime -void GetSystemTimeAsFileTime (LPFILETIME ftp); - -#define DeleteFileA _gpgme_wince_DeleteFileA -BOOL DeleteFileA(LPCSTR); - -#define CreateFileA _gpgme_wince_CreateFileA -HANDLE CreateFileA (LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, - DWORD, DWORD, HANDLE); - -#define CreateProcessA _gpgme_wince_CreateProcessA -BOOL CreateProcessA(LPCSTR,LPSTR,LPSECURITY_ATTRIBUTES,LPSECURITY_ATTRIBUTES,BOOL,DWORD,PVOID,LPCSTR,LPSTARTUPINFOA,LPPROCESS_INFORMATION); - -#define RegOpenKeyExA _gpgme_wince_RegOpenKeyExA -LONG RegOpenKeyExA(HKEY,LPCSTR,DWORD,REGSAM,PHKEY); - -#define RegQueryValueExA _gpgme_wince_RegQueryValueExA -LONG WINAPI RegQueryValueExA(HKEY,LPCSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD); - -#define GetTempPathA _gpgme_wince_GetTempPathA -DWORD GetTempPathA(DWORD,LPSTR); - -#define SHGetSpecialFolderPathA _gpgme_wince_SHGetSpecialFolderPathA -BOOL SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL); - -int _gpgme_wince_access (const char *fname, int mode); -#define access(a,b) _gpgme_wince_access ((a), (b)) - -void *_gpgme_wince_bsearch (const void *key, const void *base, - size_t nmemb, size_t size, - int (*compar) (const void *, const void *)); -#define bsearch(a,b,c,d,e) _gpgme_wince_bsearch ((a),(b),(c),(d),(e)) - -#if defined(_MSC_VER) - /* Remove the redefined __leave keyword. It is defined by MSC for - W32 in excpt.h and not in sehmap.h as for the plain windows - version. */ -# undef leave -# define HKEY_PERFORMANCE_DATA ((HKEY)0x80000004) -# define HKEY_CURRENT_CONFIG ((HKEY)0x80000005) - /* Replace the Mingw32CE provided abort function. */ -# define abort() do { TerminateProcess (GetCurrentProcess(), 8); } while (0) -# define _IOLBF 0x40 -#endif - -#endif /* GPGME_W32_CE_H */ diff --git a/src/w32-io.c b/src/w32-io.c index aea0547..bb59a5e 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -37,16 +37,6 @@ #include #include "util.h" - -#ifdef HAVE_W32CE_SYSTEM -#include -#include -#define GPGCEDEV_IOCTL_UNBLOCK \ - CTL_CODE (FILE_DEVICE_STREAMS, 2050, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define GPGCEDEV_IOCTL_ASSIGN_RVID \ - CTL_CODE (FILE_DEVICE_STREAMS, 2051, METHOD_BUFFERED, FILE_ANY_ACCESS) -#endif - #include "sema.h" #include "priv-io.h" #include "debug.h" @@ -66,9 +56,6 @@ static struct /* If this is not INVALID_SOCKET, then it's a Windows socket. */ int socket; - /* If this is not 0, then it's a rendezvous ID for the pipe server. */ - int rvid; - /* DUP_FROM is -1 if this file descriptor was allocated by pipe or socket functions. Only then should the handle or socket be destroyed when this FD is closed. This, together with the fact @@ -109,7 +96,6 @@ new_fd (void) fd_table[idx].used = 1; fd_table[idx].handle = INVALID_HANDLE_VALUE; fd_table[idx].socket = INVALID_SOCKET; - fd_table[idx].rvid = 0; fd_table[idx].dup_from = -1; } @@ -132,7 +118,6 @@ release_fd (int fd) fd_table[fd].used = 0; fd_table[fd].handle = INVALID_HANDLE_VALUE; fd_table[fd].socket = INVALID_SOCKET; - fd_table[fd].rvid = 0; fd_table[fd].dup_from = -1; } @@ -334,8 +319,6 @@ reader (void *arg) ctx->buffer + ctx->writepos, nbytes, &nread, NULL)) { ctx->error_code = (int) GetLastError (); - /* NOTE (W32CE): Do not ignore ERROR_BUSY! Check at - least stop_me if that happens. */ if (ctx->error_code == ERROR_BROKEN_PIPE) { ctx->eof = 1; @@ -445,12 +428,7 @@ create_reader (int fd) INIT_LOCK (ctx->mutex); -#ifdef HAVE_W32CE_SYSTEM - ctx->thread_hd = CreateThread (&sec_attr, 64 * 1024, reader, ctx, - STACK_SIZE_PARAM_IS_A_RESERVATION, &tid); -#else ctx->thread_hd = CreateThread (&sec_attr, 0, reader, ctx, 0, &tid); -#endif if (!ctx->thread_hd) { @@ -497,22 +475,6 @@ destroy_reader (struct reader_context_s *ctx) SetEvent (ctx->have_space_ev); UNLOCK (ctx->mutex); -#ifdef HAVE_W32CE_SYSTEM - /* Scenario: We never create a full pipe, but already started - reading. Then we need to unblock the reader in the pipe driver - to make our reader thread notice that we want it to go away. */ - - if (ctx->file_hd != INVALID_HANDLE_VALUE) - { - if (!DeviceIoControl (ctx->file_hd, GPGCEDEV_IOCTL_UNBLOCK, - NULL, 0, NULL, 0, NULL, NULL)) - { - TRACE1 (DEBUG_SYSIO, "gpgme:destroy_reader", ctx->file_hd, - "unblock control call failed for thread %p", ctx->thread_hd); - } - } -#endif - /* The reader thread is usually blocking in recv or ReadFile. If the peer does not send an EOF or breaks the pipe the WFSO might get stuck waiting for the termination of the reader thread. This @@ -817,13 +779,7 @@ create_writer (int fd) INIT_LOCK (ctx->mutex); -#ifdef HAVE_W32CE_SYSTEM - ctx->thread_hd = CreateThread (&sec_attr, 64 * 1024, writer, ctx, - STACK_SIZE_PARAM_IS_A_RESERVATION, &tid); -#else ctx->thread_hd = CreateThread (&sec_attr, 0, writer, ctx, 0, &tid ); -#endif - if (!ctx->thread_hd) { TRACE_LOG1 ("CreateThread failed: ec=%d", (int) GetLastError ()); @@ -869,20 +825,6 @@ destroy_writer (struct writer_context_s *ctx) /* Give the writer a chance to flush the buffer. */ WaitForSingleObject (ctx->is_empty, INFINITE); -#ifdef HAVE_W32CE_SYSTEM - /* Scenario: We never create a full pipe, but already started - writing more than the pipe buffer. Then we need to unblock the - writer in the pipe driver to make our writer thread notice that - we want it to go away. */ - - if (!DeviceIoControl (ctx->file_hd, GPGCEDEV_IOCTL_UNBLOCK, - NULL, 0, NULL, 0, NULL, NULL)) - { - TRACE1 (DEBUG_SYSIO, "gpgme:destroy_writer", ctx->file_hd, - "unblock control call failed for thread %p", ctx->thread_hd); - } -#endif - /* After setting this event CTX is void. */ SetEvent (ctx->close_ev); } @@ -1008,14 +950,9 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) { int rfd; int wfd; -#ifdef HAVE_W32CE_SYSTEM - HANDLE hd; - int rvid; -#else HANDLE rh; HANDLE wh; SECURITY_ATTRIBUTES sec_attr; -#endif TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_pipe", filedes, "inherit_idx=%i (GPGME uses it for %s)", @@ -1031,32 +968,6 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) return TRACE_SYSRES (-1); } -#ifdef HAVE_W32CE_SYSTEM - hd = _assuan_w32ce_prepare_pipe (&rvid, !inherit_idx); - if (hd == INVALID_HANDLE_VALUE) - { - TRACE_LOG1 ("_assuan_w32ce_prepare_pipe failed: ec=%d", - (int) GetLastError ()); - release_fd (rfd); - release_fd (wfd); - /* FIXME: Should translate the error code. */ - gpg_err_set_errno (EIO); - return TRACE_SYSRES (-1); - } - - if (inherit_idx == 0) - { - fd_table[rfd].rvid = rvid; - fd_table[wfd].handle = hd; - } - else - { - fd_table[rfd].handle = hd; - fd_table[wfd].rvid = rvid; - } - -#else - memset (&sec_attr, 0, sizeof (sec_attr)); sec_attr.nLength = sizeof (sec_attr); sec_attr.bInheritHandle = FALSE; @@ -1114,13 +1025,11 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) } fd_table[rfd].handle = rh; fd_table[wfd].handle = wh; -#endif filedes[0] = rfd; filedes[1] = wfd; - return TRACE_SUC6 ("read=0x%x (%p/0x%x), write=0x%x (%p/0x%x)", - rfd, fd_table[rfd].handle, fd_table[rfd].rvid, - wfd, fd_table[wfd].handle, fd_table[wfd].rvid); + return TRACE_SUC4 ("read=0x%x (%p), write=0x%x (%p)", + rfd, fd_table[rfd].handle, wfd, fd_table[wfd].handle); } @@ -1213,7 +1122,6 @@ _gpgme_io_close (int fd) return TRACE_SYSRES (-1); } } - /* Nothing to do for RVIDs. */ } release_fd (fd); @@ -1263,91 +1171,6 @@ _gpgme_io_set_nonblocking (int fd) } -#ifdef HAVE_W32CE_SYSTEM -static char * -build_commandline (char **argv, int fd0, int fd0_isnull, - int fd1, int fd1_isnull, - int fd2, int fd2_isnull) -{ - int i, n; - const char *s; - char *buf, *p; - char fdbuf[3*30]; - - p = fdbuf; - *p = 0; - - if (fd0 != -1) - { - if (fd0_isnull) - strcpy (p, "-&S0=null "); - else - snprintf (p, 25, "-&S0=%d ", fd_table[fd0].rvid); - p += strlen (p); - } - if (fd1 != -1) - { - if (fd1_isnull) - strcpy (p, "-&S1=null "); - else - snprintf (p, 25, "-&S1=%d ", fd_table[fd1].rvid); - p += strlen (p); - } - if (fd2 != -1) - { - if (fd2_isnull) - strcpy (p, "-&S2=null "); - else - snprintf (p, 25, "-&S2=%d ", fd_table[fd2].rvid); - p += strlen (p); - } - strcpy (p, "-&S2=null "); - p += strlen (p); - - n = strlen (fdbuf); - for (i=0; (s = argv[i]); i++) - { - if (!i) - continue; /* Ignore argv[0]. */ - n += strlen (s) + 1 + 2; /* (1 space, 2 quoting) */ - for (; *s; s++) - if (*s == '\"') - n++; /* Need to double inner quotes. */ - } - n++; - buf = p = malloc (n); - if (! buf) - return NULL; - - p = stpcpy (p, fdbuf); - for (i = 0; argv[i]; i++) - { - if (!i) - continue; /* Ignore argv[0]. */ - if (i > 1) - p = stpcpy (p, " "); - - if (! *argv[i]) /* Empty string. */ - p = stpcpy (p, "\"\""); - else if (strpbrk (argv[i], " \t\n\v\f\"")) - { - p = stpcpy (p, "\""); - for (s = argv[i]; *s; s++) - { - *p++ = *s; - if (*s == '\"') - *p++ = *s; - } - *p++ = '\"'; - *p = 0; - } - else - p = stpcpy (p, argv[i]); - } - - return buf; -} -#else static char * build_commandline (char **argv) { @@ -1401,7 +1224,6 @@ build_commandline (char **argv) return buf; } -#endif int @@ -1419,120 +1241,6 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, }; int i; -#ifdef HAVE_W32CE_SYSTEM - int fd_in = -1; - int fd_out = -1; - int fd_err = -1; - int fd_in_isnull = 1; - int fd_out_isnull = 1; - int fd_err_isnull = 1; - char *cmdline; - HANDLE hd = INVALID_HANDLE_VALUE; - - TRACE_BEG1 (DEBUG_SYSIO, "_gpgme_io_spawn", path, - "path=%s", path); - i = 0; - while (argv[i]) - { - TRACE_LOG2 ("argv[%2i] = %s", i, argv[i]); - i++; - } - - for (i = 0; fd_list[i].fd != -1; i++) - { - int fd = fd_list[i].fd; - - TRACE_LOG3 ("fd_list[%2i] = fd %i, dup_to %i", i, fd, fd_list[i].dup_to); - if (fd < 0 || fd >= MAX_SLAFD || !fd_table[fd].used) - { - TRACE_LOG1 ("invalid fd 0x%x", fd); - gpg_err_set_errno (EBADF); - return TRACE_SYSRES (-1); - } - if (fd_table[fd].rvid == 0) - { - TRACE_LOG1 ("fd 0x%x not inheritable (not an RVID)", fd); - gpg_err_set_errno (EBADF); - return TRACE_SYSRES (-1); - } - - if (fd_list[i].dup_to == 0) - { - fd_in = fd_list[i].fd; - fd_in_isnull = 0; - } - else if (fd_list[i].dup_to == 1) - { - fd_out = fd_list[i].fd; - fd_out_isnull = 0; - } - else if (fd_list[i].dup_to == 2) - { - fd_err = fd_list[i].fd; - fd_err_isnull = 0; - } - } - - cmdline = build_commandline (argv, fd_in, fd_in_isnull, - fd_out, fd_out_isnull, fd_err, fd_err_isnull); - if (!cmdline) - { - TRACE_LOG1 ("build_commandline failed: %s", strerror (errno)); - return TRACE_SYSRES (-1); - } - - if (!CreateProcessA (path, /* Program to start. */ - cmdline, /* Command line arguments. */ - NULL, /* (not supported) */ - NULL, /* (not supported) */ - FALSE, /* (not supported) */ - (CREATE_SUSPENDED), /* Creation flags. */ - NULL, /* (not supported) */ - NULL, /* (not supported) */ - NULL, /* (not supported) */ - &pi /* Returns process information.*/ - )) - { - TRACE_LOG1 ("CreateProcess failed: ec=%d", (int) GetLastError ()); - free (cmdline); - gpg_err_set_errno (EIO); - return TRACE_SYSRES (-1); - } - - /* Create arbitrary pipe descriptor to send in ASSIGN_RVID - commands. Errors are ignored. We don't need read or write access, - as ASSIGN_RVID works without any permissions, yay! */ - hd = CreateFile (L"GPG1:", 0, 0, - NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (hd == INVALID_HANDLE_VALUE) - { - TRACE_LOG1 ("CreateFile failed (ignored): ec=%d", - (int) GetLastError ()); - } - - /* Insert the inherited handles. */ - for (i = 0; fd_list[i].fd != -1; i++) - { - /* Return the child name of this handle. */ - fd_list[i].peer_name = fd_table[fd_list[i].fd].rvid; - - if (hd != INVALID_HANDLE_VALUE) - { - DWORD data[2]; - data[0] = (DWORD) fd_table[fd_list[i].fd].rvid; - data[1] = pi.dwProcessId; - if (!DeviceIoControl (hd, GPGCEDEV_IOCTL_ASSIGN_RVID, - data, sizeof (data), NULL, 0, NULL, NULL)) - { - TRACE_LOG3 ("ASSIGN_RVID(%i, %i) failed (ignored): %i", - data[0], data[1], (int) GetLastError ()); - } - } - } - if (hd != INVALID_HANDLE_VALUE) - CloseHandle (hd); - -#else SECURITY_ATTRIBUTES sec_attr; STARTUPINFOA si; int cr_flags = CREATE_DEFAULT_ERROR_MODE; @@ -1729,7 +1437,6 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, close (tmp_fd); /* The temporary file is deleted by the gpgme-w32spawn process (hopefully). */ -#endif free (tmp_name); free (arg_string); @@ -1954,15 +1661,6 @@ _gpgme_io_subsystem_init (void) int _gpgme_io_fd2str (char *buf, int buflen, int fd) { -#ifdef HAVE_W32CE_SYSTEM - /* FIXME: For now. See above. */ - if (fd < 0 || fd >= MAX_SLAFD || !fd_table[fd].used - || fd_table[fd].rvid == 0) - fd = -1; - else - fd = fd_table[fd].rvid; -#endif - return snprintf (buf, buflen, "%d", fd); } @@ -1989,7 +1687,6 @@ _gpgme_io_dup (int fd) fd_table[newfd].handle = fd_table[fd].handle; fd_table[newfd].socket = fd_table[fd].socket; - fd_table[newfd].rvid = fd_table[fd].rvid; fd_table[newfd].dup_from = fd; rd_ctx = find_reader (fd, 1); diff --git a/src/w32-util.c b/src/w32-util.c index ef9b5f3..7954189 100644 --- a/src/w32-util.c +++ b/src/w32-util.c @@ -65,9 +65,7 @@ #include "sys-util.h" -#ifndef HAVE_W32CE_SYSTEM #define HAVE_ALLOW_SET_FOREGROUND_WINDOW 1 -#endif #ifndef F_OK # define F_OK 0 #endif @@ -303,53 +301,6 @@ read_w32_registry_string (const char *root, const char *dir, const char *name) } result[nbytes] = 0; /* Make sure it is really a string. */ -#ifndef HAVE_W32CE_SYSTEM - /* Windows CE does not have an environment. */ - if (type == REG_EXPAND_SZ && strchr (result, '%')) - { - char *tmp; - - n1 += 1000; - tmp = malloc (n1 + 1); - if (!tmp) - goto leave; - nbytes = ExpandEnvironmentStrings (result, tmp, n1); - if (nbytes && nbytes > n1) - { - free (tmp); - n1 = nbytes; - tmp = malloc (n1 + 1); - if (!tmp) - goto leave; - nbytes = ExpandEnvironmentStrings (result, tmp, n1); - if (nbytes && nbytes > n1) { - free (tmp); /* Oops - truncated, better don't expand at all. */ - goto leave; - } - tmp[nbytes] = 0; - free (result); - result = tmp; - } - else if (nbytes) /* Okay, reduce the length. */ - { - tmp[nbytes] = 0; - free (result); - result = malloc (strlen (tmp)+1); - if (!result) - result = tmp; - else - { - strcpy (result, tmp); - free (tmp); - } - } - else /* Error - don't expand. */ - { - free (tmp); - } - } -#endif - leave: RegCloseKey (key_handle); return result; @@ -652,15 +603,8 @@ _gpgme_get_conf_int (const char *key, int *value) return 1; } - -#ifdef HAVE_W32CE_SYSTEM -int -_gpgme_mkstemp (int *fd, char **name) -{ - return -1; -} -#else + /* mkstemp extracted from libc/sysdeps/posix/tempname.c. Copyright (C) 1991-1999, 2000, 2001, 2006 Free Software Foundation, Inc. @@ -794,30 +738,9 @@ _gpgme_mkstemp (int *fd, char **name) *name = tmpname; return 0; } -#endif -#ifdef HAVE_W32CE_SYSTEM -/* Return a malloced string with the replacement value for the - GPGME_DEBUG envvar. Caller must release. Returns NULL if not - set. */ -char * -_gpgme_w32ce_get_debug_envvar (void) -{ - char *tmp; - - tmp = read_w32_registry_string (NULL, "\\Software\\GNU\\gpgme", "debug"); - if (tmp && !*tmp) - { - free (tmp); - tmp = NULL; - } - return tmp; -} -#endif /*HAVE_W32CE_SYSTEM*/ - - /* Entry point called by the DLL loader. */ #ifdef DLL_EXPORT int WINAPI ----------------------------------------------------------------------- Summary of changes: Makefile.am | 4 +- configure.ac | 11 +- contrib/ChangeLog-2011 | 49 --- contrib/conf-w32ce-msc/build.mk | 256 ------------ contrib/conf-w32ce-msc/config.h | 314 -------------- contrib/conf-w32ce-msc/fcntl.h | 1 - contrib/conf-w32ce-msc/io.h | 2 - contrib/conf-w32ce-msc/stdint.h | 9 - src/Makefile.am | 9 - src/ath.c | 8 - src/ath.h | 3 - src/data-compat.c | 8 - src/data-fd.c | 56 --- src/debug.c | 14 - src/debug.h | 4 + src/gpgme-tool.c | 15 +- src/priv-io.h | 3 - src/sys-util.h | 1 + src/util.h | 11 +- src/w32-ce.c | 507 ----------------------- src/w32-ce.h | 91 ----- src/w32-io.c | 887 +++++++++++++--------------------------- src/w32-util.c | 121 ++---- 23 files changed, 343 insertions(+), 2041 deletions(-) delete mode 100644 contrib/ChangeLog-2011 delete mode 100755 contrib/conf-w32ce-msc/build.mk delete mode 100644 contrib/conf-w32ce-msc/config.h delete mode 100755 contrib/conf-w32ce-msc/fcntl.h delete mode 100755 contrib/conf-w32ce-msc/io.h delete mode 100755 contrib/conf-w32ce-msc/stdint.h delete mode 100644 src/w32-ce.c delete mode 100644 src/w32-ce.h hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 2 04:17:56 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 02 Nov 2018 04:17:56 +0100 Subject: [git] NTBTLS - branch, master, updated. ntbtls-0.1.2-16-g4b7c6a9 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Not Too Bad TLS". The branch, master has been updated via 4b7c6a91f56c2bd5baa859146298f8f20519313f (commit) from 6b4fb70b94c70ca071ae2ea20c6d25dffff06664 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4b7c6a91f56c2bd5baa859146298f8f20519313f Author: NIIBE Yutaka Date: Fri Nov 2 12:17:07 2018 +0900 build: Update *.m4 files. * m4/gpg-error.m4: Update to 2018-11-02. * m4/ksba.m4: Ditto. * m4/libgcrypt.m4: Ditto. * src/ntbtls.m4: Add AC_MSG_NOTICE. Signed-off-by: NIIBE Yutaka diff --git a/m4/gpg-error.m4 b/m4/gpg-error.m4 index 0964a26..a9d572f 100644 --- a/m4/gpg-error.m4 +++ b/m4/gpg-error.m4 @@ -9,7 +9,7 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Last-changed: 2018-10-29 +# Last-changed: 2018-11-02 dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION, @@ -64,15 +64,42 @@ AC_DEFUN([AM_PATH_GPG_ERROR], min_gpg_error_version=ifelse([$1], ,1.33,$1) ok=no - use_gpgrt_config="" - if test "$GPG_ERROR_CONFIG" = "no"; then + if test "$prefix" = NONE ; then + prefix_option_expanded=/usr/local + else + prefix_option_expanded="$prefix" + fi + if test "$exec_prefix" = NONE ; then + exec_prefix_option_expanded=$prefix_option_expanded + else + exec_prefix_option_expanded=$(prefix=$prefix_option_expanded eval echo $exec_prefix) + fi + libdir_option_expanded=$(prefix=$prefix_option_expanded exec_prefix=$exec_prefix_option_expanded eval echo $libdir) + + if test -f $libdir_option_expanded/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$libdir_option_expanded + else + if crt1_path=$(${CC:-cc} -print-file-name=crt1.o 2>/dev/null); then + if possible_libdir=$(cd ${crt1_path%/*} && pwd 2>/dev/null); then + if test -f $possible_libdir/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$possible_libdir + fi + fi + fi + fi + + if test "$GPG_ERROR_CONFIG" = "no" -a -n "$gpgrt_libdir"; then AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) - if test "$GPGRT_CONFIG" != "no"; then - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir" + if test "$GPGRT_CONFIG" = "no"; then + unset GPGRT_CONFIG + else + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" - use_gpgrt_config=yes + AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) gpg_error_config_version=`$GPG_ERROR_CONFIG --modversion` + else + unset GPGRT_CONFIG fi fi else @@ -96,13 +123,19 @@ AC_DEFUN([AM_PATH_GPG_ERROR], fi fi fi - if test -z "$GPGRT_CONFIG"; then + if test -z "$GPGRT_CONFIG" -a -n "$gpgrt_libdir"; then if test "$major" -gt 1 -o "$major" -eq 1 -a "$minor" -ge 33; then AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) - if test "$GPGRT_CONFIG" != "no"; then - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir" - GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" - use_gpgrt_config=yes + if test "$GPGRT_CONFIG" = "no"; then + unset GPGRT_CONFIG + else + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" + if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then + GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" + AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) + else + unset GPGRT_CONFIG + fi fi fi fi @@ -111,7 +144,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR], if test $ok = yes; then GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG --cflags` GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG --libs` - if test -z "$use_gpgrt_config"; then + if test -z "$GPGRT_CONFIG"; then GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG --mt --cflags 2>/dev/null` GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG --mt --libs 2>/dev/null` else @@ -122,7 +155,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR], fi AC_MSG_RESULT([yes ($gpg_error_config_version)]) ifelse([$2], , :, [$2]) - if test -z "$use_gpgrt_config"; then + if test -z "$GPGRT_CONFIG"; then gpg_error_config_host=`$GPG_ERROR_CONFIG --host 2>/dev/null || echo none` else gpg_error_config_host=`$GPG_ERROR_CONFIG --variable=host 2>/dev/null || echo none` diff --git a/m4/ksba.m4 b/m4/ksba.m4 index ee4b962..ad8de4f 100644 --- a/m4/ksba.m4 +++ b/m4/ksba.m4 @@ -46,6 +46,7 @@ AC_DEFUN([AM_PATH_KSBA], if test x"$KSBA_CONFIG" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then if $GPGRT_CONFIG ksba --exists; then KSBA_CONFIG="$GPGRT_CONFIG ksba" + AC_MSG_NOTICE([Use gpgrt-config as ksba-config]) use_gpgrt_config=yes fi fi diff --git a/m4/libgcrypt.m4 b/m4/libgcrypt.m4 index 2646e96..40ea01c 100644 --- a/m4/libgcrypt.m4 +++ b/m4/libgcrypt.m4 @@ -9,7 +9,7 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Last-changed: 2018-10-29 +# Last-changed: 2018-11-02 dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION, @@ -56,6 +56,7 @@ AC_DEFUN([AM_PATH_LIBGCRYPT], if test x"${LIBGCRYPT_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then if $GPGRT_CONFIG libgcrypt --exists; then LIBGCRYPT_CONFIG="$GPGRT_CONFIG libgcrypt" + AC_MSG_NOTICE([Use gpgrt-config as libgcrypt-config]) use_gpgrt_config=yes fi fi diff --git a/src/ntbtls.m4 b/src/ntbtls.m4 index c4e07dc..7bbd569 100644 --- a/src/ntbtls.m4 +++ b/src/ntbtls.m4 @@ -50,6 +50,7 @@ AC_DEFUN([AM_PATH_NTBTLS], if test x"${NTBTLS_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then if $GPGRT_CONFIG ntbtls --exists; then NTBTLS_CONFIG="$GPGRT_CONFIG ntbtls" + AC_MSG_NOTICE([Use gpgrt-config as ntbtls-config]) use_gpgrt_config=yes fi fi ----------------------------------------------------------------------- Summary of changes: m4/gpg-error.m4 | 59 ++++++++++++++++++++++++++++++++++++++++++++------------- m4/ksba.m4 | 1 + m4/libgcrypt.m4 | 3 ++- src/ntbtls.m4 | 1 + 4 files changed, 50 insertions(+), 14 deletions(-) hooks/post-receive -- Not Too Bad TLS http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 2 04:18:13 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 02 Nov 2018 04:18:13 +0100 Subject: [git] GCRYPT - branch, master, updated. libgcrypt-1.8.1-114-gf462868 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, master has been updated via f46286851158878d5041ac5381b2807ecec541eb (commit) from 4a4d4a284ca996df874e2534f8529c1611289943 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f46286851158878d5041ac5381b2807ecec541eb Author: NIIBE Yutaka Date: Fri Nov 2 12:06:11 2018 +0900 build: Update gpg-error.m4 and libgcrypt.m4. * m4/gpg-error.m4: Update to 2018-11-02. * src/libgrypt.m4: Add AC_MSG_NOTICE. Bump the version date. Signed-off-by: NIIBE Yutaka diff --git a/m4/gpg-error.m4 b/m4/gpg-error.m4 index 0964a26..a9d572f 100644 --- a/m4/gpg-error.m4 +++ b/m4/gpg-error.m4 @@ -9,7 +9,7 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Last-changed: 2018-10-29 +# Last-changed: 2018-11-02 dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION, @@ -64,15 +64,42 @@ AC_DEFUN([AM_PATH_GPG_ERROR], min_gpg_error_version=ifelse([$1], ,1.33,$1) ok=no - use_gpgrt_config="" - if test "$GPG_ERROR_CONFIG" = "no"; then + if test "$prefix" = NONE ; then + prefix_option_expanded=/usr/local + else + prefix_option_expanded="$prefix" + fi + if test "$exec_prefix" = NONE ; then + exec_prefix_option_expanded=$prefix_option_expanded + else + exec_prefix_option_expanded=$(prefix=$prefix_option_expanded eval echo $exec_prefix) + fi + libdir_option_expanded=$(prefix=$prefix_option_expanded exec_prefix=$exec_prefix_option_expanded eval echo $libdir) + + if test -f $libdir_option_expanded/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$libdir_option_expanded + else + if crt1_path=$(${CC:-cc} -print-file-name=crt1.o 2>/dev/null); then + if possible_libdir=$(cd ${crt1_path%/*} && pwd 2>/dev/null); then + if test -f $possible_libdir/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$possible_libdir + fi + fi + fi + fi + + if test "$GPG_ERROR_CONFIG" = "no" -a -n "$gpgrt_libdir"; then AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) - if test "$GPGRT_CONFIG" != "no"; then - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir" + if test "$GPGRT_CONFIG" = "no"; then + unset GPGRT_CONFIG + else + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" - use_gpgrt_config=yes + AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) gpg_error_config_version=`$GPG_ERROR_CONFIG --modversion` + else + unset GPGRT_CONFIG fi fi else @@ -96,13 +123,19 @@ AC_DEFUN([AM_PATH_GPG_ERROR], fi fi fi - if test -z "$GPGRT_CONFIG"; then + if test -z "$GPGRT_CONFIG" -a -n "$gpgrt_libdir"; then if test "$major" -gt 1 -o "$major" -eq 1 -a "$minor" -ge 33; then AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) - if test "$GPGRT_CONFIG" != "no"; then - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir" - GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" - use_gpgrt_config=yes + if test "$GPGRT_CONFIG" = "no"; then + unset GPGRT_CONFIG + else + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" + if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then + GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" + AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) + else + unset GPGRT_CONFIG + fi fi fi fi @@ -111,7 +144,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR], if test $ok = yes; then GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG --cflags` GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG --libs` - if test -z "$use_gpgrt_config"; then + if test -z "$GPGRT_CONFIG"; then GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG --mt --cflags 2>/dev/null` GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG --mt --libs 2>/dev/null` else @@ -122,7 +155,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR], fi AC_MSG_RESULT([yes ($gpg_error_config_version)]) ifelse([$2], , :, [$2]) - if test -z "$use_gpgrt_config"; then + if test -z "$GPGRT_CONFIG"; then gpg_error_config_host=`$GPG_ERROR_CONFIG --host 2>/dev/null || echo none` else gpg_error_config_host=`$GPG_ERROR_CONFIG --variable=host 2>/dev/null || echo none` diff --git a/src/libgcrypt.m4 b/src/libgcrypt.m4 index 2646e96..40ea01c 100644 --- a/src/libgcrypt.m4 +++ b/src/libgcrypt.m4 @@ -9,7 +9,7 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Last-changed: 2018-10-29 +# Last-changed: 2018-11-02 dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION, @@ -56,6 +56,7 @@ AC_DEFUN([AM_PATH_LIBGCRYPT], if test x"${LIBGCRYPT_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then if $GPGRT_CONFIG libgcrypt --exists; then LIBGCRYPT_CONFIG="$GPGRT_CONFIG libgcrypt" + AC_MSG_NOTICE([Use gpgrt-config as libgcrypt-config]) use_gpgrt_config=yes fi fi ----------------------------------------------------------------------- Summary of changes: m4/gpg-error.m4 | 59 +++++++++++++++++++++++++++++++++++++++++++------------- src/libgcrypt.m4 | 3 ++- 2 files changed, 48 insertions(+), 14 deletions(-) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 2 04:18:30 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 02 Nov 2018 04:18:30 +0100 Subject: [git] Assuan - branch, master, updated. libassuan-2.5.1-22-g50ed4f7 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "IPC library used by GnuPG". The branch, master has been updated via 50ed4f7d5b68e94464df7c0646c3424cee2f47de (commit) from e916b1ece87dee254ea7899b01cd5d2c2ff58021 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 50ed4f7d5b68e94464df7c0646c3424cee2f47de Author: NIIBE Yutaka Date: Fri Nov 2 10:42:34 2018 +0900 build: Update gpg-error.m4 and libassuan.m4. * m4/gpg-error.m4: Update to 2018-11-02. * src/libassuan.m4: Add AC_MSG_NOTICE. Signed-off-by: NIIBE Yutaka diff --git a/m4/gpg-error.m4 b/m4/gpg-error.m4 index 0964a26..a9d572f 100644 --- a/m4/gpg-error.m4 +++ b/m4/gpg-error.m4 @@ -9,7 +9,7 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Last-changed: 2018-10-29 +# Last-changed: 2018-11-02 dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION, @@ -64,15 +64,42 @@ AC_DEFUN([AM_PATH_GPG_ERROR], min_gpg_error_version=ifelse([$1], ,1.33,$1) ok=no - use_gpgrt_config="" - if test "$GPG_ERROR_CONFIG" = "no"; then + if test "$prefix" = NONE ; then + prefix_option_expanded=/usr/local + else + prefix_option_expanded="$prefix" + fi + if test "$exec_prefix" = NONE ; then + exec_prefix_option_expanded=$prefix_option_expanded + else + exec_prefix_option_expanded=$(prefix=$prefix_option_expanded eval echo $exec_prefix) + fi + libdir_option_expanded=$(prefix=$prefix_option_expanded exec_prefix=$exec_prefix_option_expanded eval echo $libdir) + + if test -f $libdir_option_expanded/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$libdir_option_expanded + else + if crt1_path=$(${CC:-cc} -print-file-name=crt1.o 2>/dev/null); then + if possible_libdir=$(cd ${crt1_path%/*} && pwd 2>/dev/null); then + if test -f $possible_libdir/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$possible_libdir + fi + fi + fi + fi + + if test "$GPG_ERROR_CONFIG" = "no" -a -n "$gpgrt_libdir"; then AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) - if test "$GPGRT_CONFIG" != "no"; then - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir" + if test "$GPGRT_CONFIG" = "no"; then + unset GPGRT_CONFIG + else + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" - use_gpgrt_config=yes + AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) gpg_error_config_version=`$GPG_ERROR_CONFIG --modversion` + else + unset GPGRT_CONFIG fi fi else @@ -96,13 +123,19 @@ AC_DEFUN([AM_PATH_GPG_ERROR], fi fi fi - if test -z "$GPGRT_CONFIG"; then + if test -z "$GPGRT_CONFIG" -a -n "$gpgrt_libdir"; then if test "$major" -gt 1 -o "$major" -eq 1 -a "$minor" -ge 33; then AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) - if test "$GPGRT_CONFIG" != "no"; then - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir" - GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" - use_gpgrt_config=yes + if test "$GPGRT_CONFIG" = "no"; then + unset GPGRT_CONFIG + else + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" + if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then + GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" + AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) + else + unset GPGRT_CONFIG + fi fi fi fi @@ -111,7 +144,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR], if test $ok = yes; then GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG --cflags` GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG --libs` - if test -z "$use_gpgrt_config"; then + if test -z "$GPGRT_CONFIG"; then GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG --mt --cflags 2>/dev/null` GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG --mt --libs 2>/dev/null` else @@ -122,7 +155,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR], fi AC_MSG_RESULT([yes ($gpg_error_config_version)]) ifelse([$2], , :, [$2]) - if test -z "$use_gpgrt_config"; then + if test -z "$GPGRT_CONFIG"; then gpg_error_config_host=`$GPG_ERROR_CONFIG --host 2>/dev/null || echo none` else gpg_error_config_host=`$GPG_ERROR_CONFIG --variable=host 2>/dev/null || echo none` diff --git a/src/libassuan.m4 b/src/libassuan.m4 index 52058ea..4af2d04 100644 --- a/src/libassuan.m4 +++ b/src/libassuan.m4 @@ -30,6 +30,7 @@ AC_DEFUN([_AM_PATH_LIBASSUAN_COMMON], if test x"${LIBASSUAN_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then if $GPGRT_CONFIG libassuan --exists; then LIBASSUAN_CONFIG="$GPGRT_CONFIG libassuan" + AC_MSG_NOTICE([Use gpgrt-config as libassuan-config]) use_gpgrt_config=yes fi fi ----------------------------------------------------------------------- Summary of changes: m4/gpg-error.m4 | 59 +++++++++++++++++++++++++++++++++++++++++++------------- src/libassuan.m4 | 1 + 2 files changed, 47 insertions(+), 13 deletions(-) hooks/post-receive -- IPC library used by GnuPG http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 2 04:18:46 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 02 Nov 2018 04:18:46 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.32-50-g78af09c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via 78af09ce13969b64f121ae5990e66fb7f1cd3f1d (commit) via 42413de59a063def05620d899a7fbda265b6c406 (commit) via 7ffd88b0e98af21aa61a57dde042d75f0d403839 (commit) from 8f034bb3a1bbde2fc7a8d2ada6e3d779c465895b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 78af09ce13969b64f121ae5990e66fb7f1cd3f1d Author: NIIBE Yutaka Date: Fri Nov 2 11:31:01 2018 +0900 gpgrt-config: Don't support variable reference in --libdir option. * src/gpgrt-config: Simplify --libdir support, remove variable substituion. * src/gpg-error.m4: Expand possible ${prefix}, ${exec_prefix} in libdir. Simplify invocation of gpgrt-config. * src/gpgrt.m4: Likewise. -- The --libdir option for configure can include variable reference like --libdir='${exec_prefix}/lib/x86_64-linux-gnu', and this expression should be expanded (the variable should be substituted) beforehand to determine if there is gpg-error.pc file or not. Signed-off-by: NIIBE Yutaka diff --git a/src/gpg-error.m4 b/src/gpg-error.m4 index 3bfa601..a9d572f 100644 --- a/src/gpg-error.m4 +++ b/src/gpg-error.m4 @@ -64,8 +64,20 @@ AC_DEFUN([AM_PATH_GPG_ERROR], min_gpg_error_version=ifelse([$1], ,1.33,$1) ok=no - if test -f $libdir/pkgconfig/gpg-error.pc; then - gpgrt_libdir=$libdir + if test "$prefix" = NONE ; then + prefix_option_expanded=/usr/local + else + prefix_option_expanded="$prefix" + fi + if test "$exec_prefix" = NONE ; then + exec_prefix_option_expanded=$prefix_option_expanded + else + exec_prefix_option_expanded=$(prefix=$prefix_option_expanded eval echo $exec_prefix) + fi + libdir_option_expanded=$(prefix=$prefix_option_expanded exec_prefix=$exec_prefix_option_expanded eval echo $libdir) + + if test -f $libdir_option_expanded/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$libdir_option_expanded else if crt1_path=$(${CC:-cc} -print-file-name=crt1.o 2>/dev/null); then if possible_libdir=$(cd ${crt1_path%/*} && pwd 2>/dev/null); then @@ -81,7 +93,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR], if test "$GPGRT_CONFIG" = "no"; then unset GPGRT_CONFIG else - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$gpgrt_libdir" + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) @@ -117,7 +129,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR], if test "$GPGRT_CONFIG" = "no"; then unset GPGRT_CONFIG else - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$gpgrt_libdir" + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) diff --git a/src/gpgrt-config b/src/gpgrt-config index 9ff0b3a..9aec4f6 100755 --- a/src/gpgrt-config +++ b/src/gpgrt-config @@ -417,7 +417,7 @@ sysroot () { # Show usage usage () { cat <&2 - echo "When LIBDIR has variable references for prefix and/or exec_prefix," 1>&2 - echo "you should provide --prefix=PREFIX option and/or" 1>&2 - echo "--exec-prefix=EXEC_PREFIX option, too" 1>&2 exit 1 fi diff --git a/src/gpgrt.m4 b/src/gpgrt.m4 index 912b103..55c3ff0 100644 --- a/src/gpgrt.m4 +++ b/src/gpgrt.m4 @@ -69,8 +69,20 @@ AC_DEFUN([AM_PATH_GPGRT], fi fi - if test -f $libdir/pkgconfig/gpg-error.pc; then - gpgrt_libdir=$libdir + if test "$prefix" = NONE ; then + prefix_option_expanded=/usr/local + else + prefix_option_expanded="$prefix" + fi + if test "$exec_prefix" = NONE ; then + exec_prefix_option_expanded=$prefix_option_expanded + else + exec_prefix_option_expanded=$(prefix=$prefix_option_expanded eval echo $exec_prefix) + fi + libdir_option_expanded=$(prefix=$prefix_option_expanded exec_prefix=$exec_prefix_option_expanded eval echo $libdir) + + if test -f $libdir_option_expanded/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$libdir_option_expanded else if crt1_path=$(${CC:-cc} -print-file-name=crt1.o 2>/dev/null); then if possible_libdir=$(cd ${crt1_path%/*} && pwd 2>/dev/null); then @@ -84,7 +96,7 @@ AC_DEFUN([AM_PATH_GPGRT], if test -n "$gpgrt_libdir"; then AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) if test "$GPGRT_CONFIG" != "no"; then - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$gpgrt_libdir" + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" fi fi min_gpgrt_version=ifelse([$1], ,1.33,$1) commit 42413de59a063def05620d899a7fbda265b6c406 Author: NIIBE Yutaka Date: Fri Nov 2 10:06:51 2018 +0900 gpg-error.m4: Emit message when using gpgrt-config. * src/gpg-error.m4: Add AC_MSG_NOTICE. Signed-off-by: NIIBE Yutaka diff --git a/src/gpg-error.m4 b/src/gpg-error.m4 index 5d5cdf9..3bfa601 100644 --- a/src/gpg-error.m4 +++ b/src/gpg-error.m4 @@ -84,6 +84,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR], GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$gpgrt_libdir" if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" + AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) gpg_error_config_version=`$GPG_ERROR_CONFIG --modversion` else unset GPGRT_CONFIG @@ -119,6 +120,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR], GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$gpgrt_libdir" if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" + AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) else unset GPGRT_CONFIG fi commit 7ffd88b0e98af21aa61a57dde042d75f0d403839 Author: NIIBE Yutaka Date: Fri Nov 2 09:49:27 2018 +0900 gpg-error.m4: Find gpgrt_libdir by CC. * src/gpg-error.m4 (gpgrt_libdir): New. Bump the version date. * src/gpgrt.m4: Likewise. -- Locating gpg-error.pc file, when it's not found at target's $libdir, try system libdir defined by CC, assuming CC supports gcc compatible -print-file-name option. GnuPG-bug-id: 4239 Signed-off-by: NIIBE Yutaka diff --git a/src/gpg-error.m4 b/src/gpg-error.m4 index f643307..5d5cdf9 100644 --- a/src/gpg-error.m4 +++ b/src/gpg-error.m4 @@ -9,7 +9,7 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Last-changed: 2018-10-29 +# Last-changed: 2018-11-02 dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION, @@ -64,14 +64,26 @@ AC_DEFUN([AM_PATH_GPG_ERROR], min_gpg_error_version=ifelse([$1], ,1.33,$1) ok=no - use_gpgrt_config="" - if test "$GPG_ERROR_CONFIG" = "no"; then + if test -f $libdir/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$libdir + else + if crt1_path=$(${CC:-cc} -print-file-name=crt1.o 2>/dev/null); then + if possible_libdir=$(cd ${crt1_path%/*} && pwd 2>/dev/null); then + if test -f $possible_libdir/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$possible_libdir + fi + fi + fi + fi + + if test "$GPG_ERROR_CONFIG" = "no" -a -n "$gpgrt_libdir"; then AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) - if test "$GPGRT_CONFIG" != "no"; then - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir" + if test "$GPGRT_CONFIG" = "no"; then + unset GPGRT_CONFIG + else + GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$gpgrt_libdir" if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" - use_gpgrt_config=yes gpg_error_config_version=`$GPG_ERROR_CONFIG --modversion` else unset GPGRT_CONFIG @@ -98,14 +110,15 @@ AC_DEFUN([AM_PATH_GPG_ERROR], fi fi fi - if test -z "$GPGRT_CONFIG"; then + if test -z "$GPGRT_CONFIG" -a -n "$gpgrt_libdir"; then if test "$major" -gt 1 -o "$major" -eq 1 -a "$minor" -ge 33; then AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) - if test "$GPGRT_CONFIG" != "no"; then - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir" + if test "$GPGRT_CONFIG" = "no"; then + unset GPGRT_CONFIG + else + GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$gpgrt_libdir" if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" - use_gpgrt_config=yes else unset GPGRT_CONFIG fi @@ -117,7 +130,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR], if test $ok = yes; then GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG --cflags` GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG --libs` - if test -z "$use_gpgrt_config"; then + if test -z "$GPGRT_CONFIG"; then GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG --mt --cflags 2>/dev/null` GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG --mt --libs 2>/dev/null` else @@ -128,7 +141,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR], fi AC_MSG_RESULT([yes ($gpg_error_config_version)]) ifelse([$2], , :, [$2]) - if test -z "$use_gpgrt_config"; then + if test -z "$GPGRT_CONFIG"; then gpg_error_config_host=`$GPG_ERROR_CONFIG --host 2>/dev/null || echo none` else gpg_error_config_host=`$GPG_ERROR_CONFIG --variable=host 2>/dev/null || echo none` diff --git a/src/gpgrt.m4 b/src/gpgrt.m4 index 7f92a22..912b103 100644 --- a/src/gpgrt.m4 +++ b/src/gpgrt.m4 @@ -10,7 +10,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # SPDX-License-Identifier: FSFULLR # -# Last-changed: 2018-10-29 +# Last-changed: 2018-11-02 # Note: This is a kind of duplicate of gpg-error.m4 with uses the # future name of libgpg-error to prepare for a smooth migration in # some distant time. @@ -69,15 +69,28 @@ AC_DEFUN([AM_PATH_GPGRT], fi fi - AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) - if test "$GPGRT_CONFIG" != "no"; then - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir" + if test -f $libdir/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$libdir + else + if crt1_path=$(${CC:-cc} -print-file-name=crt1.o 2>/dev/null); then + if possible_libdir=$(cd ${crt1_path%/*} && pwd 2>/dev/null); then + if test -f $possible_libdir/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$possible_libdir + fi + fi + fi + fi + + if test -n "$gpgrt_libdir"; then + AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) + if test "$GPGRT_CONFIG" != "no"; then + GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$gpgrt_libdir" + fi fi min_gpgrt_version=ifelse([$1], ,1.33,$1) AC_MSG_CHECKING(for GPG Runtime - version >= $min_gpgrt_version) ok=no - if test "$GPGRT_CONFIG" != "no" \ - && test -f "$GPGRT_CONFIG" ; then + if test x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no" ; then req_major=`echo $min_gpgrt_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` req_minor=`echo $min_gpgrt_version | \ ----------------------------------------------------------------------- Summary of changes: src/gpg-error.m4 | 51 +++++++++++++++++++++++++++++++++++++++------------ src/gpgrt-config | 42 +++++------------------------------------- src/gpgrt.m4 | 37 +++++++++++++++++++++++++++++++------ 3 files changed, 75 insertions(+), 55 deletions(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 2 04:19:26 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 02 Nov 2018 04:19:26 +0100 Subject: [git] KSBA - branch, master, updated. libksba-1.3.5-31-g5a7c0d8 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "KSBA is a library to access X.509 certificates and CMS data.". The branch, master has been updated via 5a7c0d8667ceddf7820131865dad0ab850e5c3a4 (commit) from 9917a23a6c8177f79bdd8da031d3b7135b597c91 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5a7c0d8667ceddf7820131865dad0ab850e5c3a4 Author: NIIBE Yutaka Date: Fri Nov 2 12:09:56 2018 +0900 build: Update gpg-error.m4 and ksba.m4. * m4/gpg-error.m4: Update to 2018-11-02. * src/ksba.m4: Add AC_MSG_NOTICE. Signed-off-by: NIIBE Yutaka diff --git a/m4/gpg-error.m4 b/m4/gpg-error.m4 index 0964a26..a9d572f 100644 --- a/m4/gpg-error.m4 +++ b/m4/gpg-error.m4 @@ -9,7 +9,7 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Last-changed: 2018-10-29 +# Last-changed: 2018-11-02 dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION, @@ -64,15 +64,42 @@ AC_DEFUN([AM_PATH_GPG_ERROR], min_gpg_error_version=ifelse([$1], ,1.33,$1) ok=no - use_gpgrt_config="" - if test "$GPG_ERROR_CONFIG" = "no"; then + if test "$prefix" = NONE ; then + prefix_option_expanded=/usr/local + else + prefix_option_expanded="$prefix" + fi + if test "$exec_prefix" = NONE ; then + exec_prefix_option_expanded=$prefix_option_expanded + else + exec_prefix_option_expanded=$(prefix=$prefix_option_expanded eval echo $exec_prefix) + fi + libdir_option_expanded=$(prefix=$prefix_option_expanded exec_prefix=$exec_prefix_option_expanded eval echo $libdir) + + if test -f $libdir_option_expanded/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$libdir_option_expanded + else + if crt1_path=$(${CC:-cc} -print-file-name=crt1.o 2>/dev/null); then + if possible_libdir=$(cd ${crt1_path%/*} && pwd 2>/dev/null); then + if test -f $possible_libdir/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$possible_libdir + fi + fi + fi + fi + + if test "$GPG_ERROR_CONFIG" = "no" -a -n "$gpgrt_libdir"; then AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) - if test "$GPGRT_CONFIG" != "no"; then - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir" + if test "$GPGRT_CONFIG" = "no"; then + unset GPGRT_CONFIG + else + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" - use_gpgrt_config=yes + AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) gpg_error_config_version=`$GPG_ERROR_CONFIG --modversion` + else + unset GPGRT_CONFIG fi fi else @@ -96,13 +123,19 @@ AC_DEFUN([AM_PATH_GPG_ERROR], fi fi fi - if test -z "$GPGRT_CONFIG"; then + if test -z "$GPGRT_CONFIG" -a -n "$gpgrt_libdir"; then if test "$major" -gt 1 -o "$major" -eq 1 -a "$minor" -ge 33; then AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) - if test "$GPGRT_CONFIG" != "no"; then - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir" - GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" - use_gpgrt_config=yes + if test "$GPGRT_CONFIG" = "no"; then + unset GPGRT_CONFIG + else + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" + if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then + GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" + AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) + else + unset GPGRT_CONFIG + fi fi fi fi @@ -111,7 +144,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR], if test $ok = yes; then GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG --cflags` GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG --libs` - if test -z "$use_gpgrt_config"; then + if test -z "$GPGRT_CONFIG"; then GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG --mt --cflags 2>/dev/null` GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG --mt --libs 2>/dev/null` else @@ -122,7 +155,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR], fi AC_MSG_RESULT([yes ($gpg_error_config_version)]) ifelse([$2], , :, [$2]) - if test -z "$use_gpgrt_config"; then + if test -z "$GPGRT_CONFIG"; then gpg_error_config_host=`$GPG_ERROR_CONFIG --host 2>/dev/null || echo none` else gpg_error_config_host=`$GPG_ERROR_CONFIG --variable=host 2>/dev/null || echo none` diff --git a/src/ksba.m4 b/src/ksba.m4 index ee4b962..ad8de4f 100644 --- a/src/ksba.m4 +++ b/src/ksba.m4 @@ -46,6 +46,7 @@ AC_DEFUN([AM_PATH_KSBA], if test x"$KSBA_CONFIG" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then if $GPGRT_CONFIG ksba --exists; then KSBA_CONFIG="$GPGRT_CONFIG ksba" + AC_MSG_NOTICE([Use gpgrt-config as ksba-config]) use_gpgrt_config=yes fi fi ----------------------------------------------------------------------- Summary of changes: m4/gpg-error.m4 | 59 ++++++++++++++++++++++++++++++++++++++++++++------------- src/ksba.m4 | 1 + 2 files changed, 47 insertions(+), 13 deletions(-) hooks/post-receive -- KSBA is a library to access X.509 certificates and CMS data. http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 2 05:08:43 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 02 Nov 2018 05:08:43 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-249-g8e84efb Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 8e84efbe35633275e260712ba38a505e3f9d0898 (commit) from fd7aee6a97134fdf48a496841241f8ae25736e61 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8e84efbe35633275e260712ba38a505e3f9d0898 Author: NIIBE Yutaka Date: Fri Nov 2 13:06:43 2018 +0900 build: Update *.m4 from libraries. * m4/gpg-error.m4: Update from master. * m4/ksba.m4: Ditto. * m4/libassuan.m4: Ditto. * m4/libgcrypt.m4: Ditto. * m4/npth.m4: Ditto. * m4/ntbtls.m4: Ditto. -- Do it again today. Signed-off-by: NIIBE Yutaka diff --git a/m4/gpg-error.m4 b/m4/gpg-error.m4 index 0964a26..a9d572f 100644 --- a/m4/gpg-error.m4 +++ b/m4/gpg-error.m4 @@ -9,7 +9,7 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Last-changed: 2018-10-29 +# Last-changed: 2018-11-02 dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION, @@ -64,15 +64,42 @@ AC_DEFUN([AM_PATH_GPG_ERROR], min_gpg_error_version=ifelse([$1], ,1.33,$1) ok=no - use_gpgrt_config="" - if test "$GPG_ERROR_CONFIG" = "no"; then + if test "$prefix" = NONE ; then + prefix_option_expanded=/usr/local + else + prefix_option_expanded="$prefix" + fi + if test "$exec_prefix" = NONE ; then + exec_prefix_option_expanded=$prefix_option_expanded + else + exec_prefix_option_expanded=$(prefix=$prefix_option_expanded eval echo $exec_prefix) + fi + libdir_option_expanded=$(prefix=$prefix_option_expanded exec_prefix=$exec_prefix_option_expanded eval echo $libdir) + + if test -f $libdir_option_expanded/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$libdir_option_expanded + else + if crt1_path=$(${CC:-cc} -print-file-name=crt1.o 2>/dev/null); then + if possible_libdir=$(cd ${crt1_path%/*} && pwd 2>/dev/null); then + if test -f $possible_libdir/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$possible_libdir + fi + fi + fi + fi + + if test "$GPG_ERROR_CONFIG" = "no" -a -n "$gpgrt_libdir"; then AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) - if test "$GPGRT_CONFIG" != "no"; then - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir" + if test "$GPGRT_CONFIG" = "no"; then + unset GPGRT_CONFIG + else + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" - use_gpgrt_config=yes + AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) gpg_error_config_version=`$GPG_ERROR_CONFIG --modversion` + else + unset GPGRT_CONFIG fi fi else @@ -96,13 +123,19 @@ AC_DEFUN([AM_PATH_GPG_ERROR], fi fi fi - if test -z "$GPGRT_CONFIG"; then + if test -z "$GPGRT_CONFIG" -a -n "$gpgrt_libdir"; then if test "$major" -gt 1 -o "$major" -eq 1 -a "$minor" -ge 33; then AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) - if test "$GPGRT_CONFIG" != "no"; then - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir" - GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" - use_gpgrt_config=yes + if test "$GPGRT_CONFIG" = "no"; then + unset GPGRT_CONFIG + else + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" + if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then + GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" + AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) + else + unset GPGRT_CONFIG + fi fi fi fi @@ -111,7 +144,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR], if test $ok = yes; then GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG --cflags` GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG --libs` - if test -z "$use_gpgrt_config"; then + if test -z "$GPGRT_CONFIG"; then GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG --mt --cflags 2>/dev/null` GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG --mt --libs 2>/dev/null` else @@ -122,7 +155,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR], fi AC_MSG_RESULT([yes ($gpg_error_config_version)]) ifelse([$2], , :, [$2]) - if test -z "$use_gpgrt_config"; then + if test -z "$GPGRT_CONFIG"; then gpg_error_config_host=`$GPG_ERROR_CONFIG --host 2>/dev/null || echo none` else gpg_error_config_host=`$GPG_ERROR_CONFIG --variable=host 2>/dev/null || echo none` diff --git a/m4/ksba.m4 b/m4/ksba.m4 index ee4b962..ad8de4f 100644 --- a/m4/ksba.m4 +++ b/m4/ksba.m4 @@ -46,6 +46,7 @@ AC_DEFUN([AM_PATH_KSBA], if test x"$KSBA_CONFIG" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then if $GPGRT_CONFIG ksba --exists; then KSBA_CONFIG="$GPGRT_CONFIG ksba" + AC_MSG_NOTICE([Use gpgrt-config as ksba-config]) use_gpgrt_config=yes fi fi diff --git a/m4/libassuan.m4 b/m4/libassuan.m4 index 52058ea..4af2d04 100644 --- a/m4/libassuan.m4 +++ b/m4/libassuan.m4 @@ -30,6 +30,7 @@ AC_DEFUN([_AM_PATH_LIBASSUAN_COMMON], if test x"${LIBASSUAN_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then if $GPGRT_CONFIG libassuan --exists; then LIBASSUAN_CONFIG="$GPGRT_CONFIG libassuan" + AC_MSG_NOTICE([Use gpgrt-config as libassuan-config]) use_gpgrt_config=yes fi fi diff --git a/m4/libgcrypt.m4 b/m4/libgcrypt.m4 index 2646e96..40ea01c 100644 --- a/m4/libgcrypt.m4 +++ b/m4/libgcrypt.m4 @@ -9,7 +9,7 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Last-changed: 2018-10-29 +# Last-changed: 2018-11-02 dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION, @@ -56,6 +56,7 @@ AC_DEFUN([AM_PATH_LIBGCRYPT], if test x"${LIBGCRYPT_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then if $GPGRT_CONFIG libgcrypt --exists; then LIBGCRYPT_CONFIG="$GPGRT_CONFIG libgcrypt" + AC_MSG_NOTICE([Use gpgrt-config as libgcrypt-config]) use_gpgrt_config=yes fi fi diff --git a/m4/npth.m4 b/m4/npth.m4 index 7296cbc..7d3e73f 100644 --- a/m4/npth.m4 +++ b/m4/npth.m4 @@ -22,6 +22,7 @@ AC_DEFUN([_AM_PATH_NPTH_CONFIG], if test x"$NPTH_CONFIG" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then if $GPGRT_CONFIG npth --exists; then NPTH_CONFIG="$GPGRT_CONFIG npth" + AC_MSG_NOTICE([Use gpgrt-config as npth-config]) use_gpgrt_config=yes fi fi diff --git a/m4/ntbtls.m4 b/m4/ntbtls.m4 index c4e07dc..7bbd569 100644 --- a/m4/ntbtls.m4 +++ b/m4/ntbtls.m4 @@ -50,6 +50,7 @@ AC_DEFUN([AM_PATH_NTBTLS], if test x"${NTBTLS_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then if $GPGRT_CONFIG ntbtls --exists; then NTBTLS_CONFIG="$GPGRT_CONFIG ntbtls" + AC_MSG_NOTICE([Use gpgrt-config as ntbtls-config]) use_gpgrt_config=yes fi fi ----------------------------------------------------------------------- Summary of changes: m4/gpg-error.m4 | 59 ++++++++++++++++++++++++++++++++++++++++++++------------- m4/ksba.m4 | 1 + m4/libassuan.m4 | 1 + m4/libgcrypt.m4 | 3 ++- m4/npth.m4 | 1 + m4/ntbtls.m4 | 1 + 6 files changed, 52 insertions(+), 14 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 2 05:54:56 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 02 Nov 2018 05:54:56 +0100 Subject: [git] GCRYPT - branch, master, updated. libgcrypt-1.8.1-115-gf739533 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, master has been updated via f7395338d71d4d82180a11707fd6e77787162e24 (commit) from f46286851158878d5041ac5381b2807ecec541eb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f7395338d71d4d82180a11707fd6e77787162e24 Author: NIIBE Yutaka Date: Fri Nov 2 13:51:40 2018 +0900 build: Fix GCRYPT_HWF_MODULES. * configure.ac (GCRYPT_HWF_MODULES): Add libgcrypt_la- prefix. -- Before this change "make distcheck" fails because src/.deps/hwf-x86.Plo remains. Note that the distclean entry for the file is libgcrypt_la-hwf-x86.Plo. Signed-off-by: NIIBE Yutaka diff --git a/configure.ac b/configure.ac index cdce339..4e4f1f7 100644 --- a/configure.ac +++ b/configure.ac @@ -2588,7 +2588,7 @@ GCRYPT_HWF_MODULES= case "$mpi_cpu_arch" in x86) AC_DEFINE(HAVE_CPU_ARCH_X86, 1, [Defined for the x86 platforms]) - GCRYPT_HWF_MODULES="hwf-x86.lo" + GCRYPT_HWF_MODULES="libgcrypt_la-hwf-x86.lo" ;; alpha) AC_DEFINE(HAVE_CPU_ARCH_ALPHA, 1, [Defined for Alpha platforms]) @@ -2607,11 +2607,11 @@ case "$mpi_cpu_arch" in ;; arm) AC_DEFINE(HAVE_CPU_ARCH_ARM, 1, [Defined for ARM platforms]) - GCRYPT_HWF_MODULES="hwf-arm.lo" + GCRYPT_HWF_MODULES="libgcrypt_la-hwf-arm.lo" ;; aarch64) AC_DEFINE(HAVE_CPU_ARCH_ARM, 1, [Defined for ARM AArch64 platforms]) - GCRYPT_HWF_MODULES="hwf-arm.lo" + GCRYPT_HWF_MODULES="libgcrypt_la-hwf-arm.lo" ;; esac AC_SUBST([GCRYPT_HWF_MODULES]) ----------------------------------------------------------------------- Summary of changes: configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 2 09:03:59 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 02 Nov 2018 09:03:59 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-38-g337c108 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 337c10825525d4084f3f437fde5af3806707e6a4 (commit) via acef4f775f273bbef63bc81afbad8feaabc7414e (commit) from 63ba09b541dabbe838253926896e721cb9be564a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 337c10825525d4084f3f437fde5af3806707e6a4 Author: Werner Koch Date: Fri Nov 2 09:03:43 2018 +0100 core: Print a dump of the I/O data only at level 8. * src/debug.h (TRACE_SUC3): New. (TRACE_LOGBUFX): New. * src/posix-io.c: Use TRACE_LOGBUFX instead of TRACE_LOGBUF. * src/w32-glib-io.c: Ditto. -- This will also be changed for w32-io as part of another commit. Signed-off-by: Werner Koch diff --git a/src/debug.h b/src/debug.h index ca65d9e..ecd230f 100644 --- a/src/debug.h +++ b/src/debug.h @@ -34,7 +34,11 @@ #define XSTRINGIFY(v) STRINGIFY(v) -/* The debug levels. */ +/* + * The debug levels. + * + * Note that TRACE_LOGBUFX uses the current debug level + 1. + */ #define DEBUG_INIT 1 #define DEBUG_GLOBAL 2 @@ -211,6 +215,9 @@ _gpgme_trace_gpgme_error (gpgme_error_t err, const char *file, int line) #define TRACE_SUC2(fmt, arg1, arg2) \ _gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \ _gpgme_trace_func, arg1, arg2), _gpgme_debug_frame_end () +#define TRACE_SUC3(fmt, arg1, arg2, arg3) \ + _gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \ + _gpgme_trace_func, arg1, arg2, arg3), _gpgme_debug_frame_end () #define TRACE_SUC4(fmt, arg1, arg2, arg3, arg4) \ _gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \ _gpgme_trace_func, arg1, arg2, arg3, arg4), \ @@ -256,6 +263,10 @@ _gpgme_trace_gpgme_error (gpgme_error_t err, const char *file, int line) _gpgme_debug_buffer (_gpgme_trace_level, "%s: check: %s", \ _gpgme_trace_func, buf, len) +#define TRACE_LOGBUFX(buf, len) \ + _gpgme_debug_buffer (_gpgme_trace_level+1, "%s: check: %s", \ + _gpgme_trace_func, buf, len) + #define TRACE_SEQ(hlp,fmt) \ _gpgme_debug_begin (&(hlp), _gpgme_trace_level, \ "%s: check: %s=%p, " fmt, _gpgme_trace_func, \ diff --git a/src/posix-io.c b/src/posix-io.c index 0448d29..322c41a 100644 --- a/src/posix-io.c +++ b/src/posix-io.c @@ -117,7 +117,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) } while (nread == -1 && errno == EINTR); - TRACE_LOGBUF (buffer, nread); + TRACE_LOGBUFX (buffer, nread); return TRACE_SYSRES (nread); } @@ -128,7 +128,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count) int nwritten; TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_write", fd, "buffer=%p, count=%u", buffer, count); - TRACE_LOGBUF (buffer, count); + TRACE_LOGBUFX (buffer, count); do { @@ -785,7 +785,7 @@ _gpgme_io_recvmsg (int fd, struct msghdr *msg, int flags) while (nr > 0) { int len = nr > iov->iov_len ? iov->iov_len : nr; - TRACE_LOGBUF (msg->msg_iov->iov_base, len); + TRACE_LOGBUFX (msg->msg_iov->iov_base, len); iov++; nr -= len; } @@ -816,7 +816,7 @@ _gpgme_io_sendmsg (int fd, const struct msghdr *msg, int flags) while (nwritten > 0) { int len = nwritten > iov->iov_len ? iov->iov_len : nwritten; - TRACE_LOGBUF (msg->msg_iov->iov_base, len); + TRACE_LOGBUFX (msg->msg_iov->iov_base, len); iov++; nwritten -= len; } diff --git a/src/w32-glib-io.c b/src/w32-glib-io.c index 66dc9bf..967c64e 100644 --- a/src/w32-glib-io.c +++ b/src/w32-glib-io.c @@ -301,7 +301,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) } if (nread != 0 && nread != -1) - TRACE_LOGBUF (buffer, nread); + TRACE_LOGBUFX (buffer, nread); errno = saved_errno; return TRACE_SYSRES (nread); @@ -319,7 +319,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count) TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_write", fd, "buffer=%p, count=%u", buffer, count); - TRACE_LOGBUF (buffer, count); + TRACE_LOGBUFX (buffer, count); chan = find_channel (fd); if (!chan) commit acef4f775f273bbef63bc81afbad8feaabc7414e Author: Werner Koch Date: Fri Nov 2 08:47:44 2018 +0100 w32: Fix and improve CancelSynchronousIo use. * src/w32-util.c (_gpgme_w32_cancel_synchronous_io): Fix name of DLL and print trace info only on error. -- Fixes-commit: 63ba09b541dabbe838253926896e721cb9be564a Signed-off-by: Werner Koch diff --git a/src/w32-util.c b/src/w32-util.c index 8a04c8c..798f42b 100644 --- a/src/w32-util.c +++ b/src/w32-util.c @@ -251,7 +251,7 @@ _gpgme_w32_cancel_synchronous_io (HANDLE thread) { /* Available since Vista; thus we dynload it. */ initialized = 1; - handle = dlopen ("kerner32.dll", RTLD_LAZY); + handle = dlopen ("kernel32.dll", RTLD_LAZY); if (handle) { func = dlsym (handle, "CancelSynchronousIo"); @@ -265,9 +265,11 @@ _gpgme_w32_cancel_synchronous_io (HANDLE thread) if (func) { - int rc = func (thread); - TRACE2 (DEBUG_ENGINE, "gpgme:CancelSynchronousIo", 0, - "called for thread %p; result=%d", thread, rc); + if (!func (thread) && GetLastError() != ERROR_NOT_FOUND) + { + TRACE2 (DEBUG_ENGINE, "gpgme:CancelSynchronousIo", 0, + "called for thread %p: ec=%d", thread, GetLastError ()); + } } else { ----------------------------------------------------------------------- Summary of changes: src/debug.h | 13 ++++++++++++- src/posix-io.c | 8 ++++---- src/w32-glib-io.c | 4 ++-- src/w32-util.c | 10 ++++++---- 4 files changed, 24 insertions(+), 11 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 2 09:30:43 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 02 Nov 2018 09:30:43 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-39-gda89528 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via da89528ac39b687bfbed2209ca2637e3bd8e0ac5 (commit) from 337c10825525d4084f3f437fde5af3806707e6a4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit da89528ac39b687bfbed2209ca2637e3bd8e0ac5 Author: Werner Koch Date: Fri Nov 2 09:14:07 2018 +0100 w32: Revamp the closing of system objects. * src/w32-io.c (hddesc_t): New. (reader_context_s, writer_context_s): Replace file_sock and file_hd by the hddesc_t hdd. (fd_table): Ditto. Add want_reader and want_writer. (hddesc_lock): New lock variable. (new_hddesc, ref_hddesc): New. (release_hddesc): New. (reader, writer): Call release_hddesc. (create_reader, create_writer): Change for new hddesc scheme. (destroy_reader, destroy_writer): Replace closing by a call to release_hddesc. (_gpgme_io_pipe): Change for new hddesc scheme. (_gpgme_io_close): Ditto. (_gpgme_io_dup): Ditto. Use want_reader and want_writer. (_gpgme_io_socket): Change for new hddesc scheme. -- GnuPG-bug-id: 4237 Signed-off-by: Werner Koch diff --git a/src/w32-io.c b/src/w32-io.c index 436bb7b..e5ef396 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -54,14 +54,24 @@ #define PIPEBUF_SIZE 4096 +/* An object to store handles or sockets. */ +struct hddesc_s +{ + HANDLE hd; + SOCKET sock; + int refcount; +}; +typedef struct hddesc_s *hddesc_t; + + + /* The context used by a reader thread. */ struct reader_context_s { - HANDLE file_hd; - int file_sock; + hddesc_t hdd; HANDLE thread_hd; - int refcount; /* Bumbed if the FD has been duped and thus we have - * another FD referencinf this context. */ + int refcount; /* Bumped if the FD has been duped and thus we have + * another FD referencing this context. */ DECLARE_LOCK (mutex); @@ -86,8 +96,7 @@ struct reader_context_s /* The context used by a writer thread. */ struct writer_context_s { - HANDLE file_hd; - int file_sock; + hddesc_t hdd; HANDLE thread_hd; int refcount; @@ -115,27 +124,19 @@ static struct { int used; - /* If this is not INVALID_HANDLE_VALUE, then it's a handle. */ - HANDLE handle; - - /* If this is not INVALID_SOCKET, then it's a Windows socket. */ - int socket; - - /* DUP_FROM is -1 if this file descriptor was allocated by pipe or - socket functions. Only then should the handle or socket be - destroyed when this FD is closed. This, together with the fact - that dup'ed file descriptors are closed before the file - descriptors from which they are dup'ed are closed, ensures that - the handle or socket is always valid, and shared among all file - descriptors referring to the same underlying object. - - The logic behind this is that there is only one reason for us to - dup file descriptors anyway: to allow simpler book-keeping of - file descriptors shared between GPGME and libassuan, which both - want to close something. Using the same handle for these - duplicates works just fine. */ + /* The handle descriptor. */ + hddesc_t hdd; + + /* DUP_FROM is just a debug helper to show from which fd this fd was + * dup-ed. */ int dup_from; + /* Two flags to indicate whether a reader or writer (or both) are + * needed. This is so that we can delay the actual thread creation + * until they are needed. */ + unsigned int want_reader:1; + unsigned int want_writer:1; + /* The context of an associated reader object or NULL. */ struct reader_context_s *reader; @@ -155,10 +156,85 @@ static size_t fd_table_size = MAX_SLAFD; DEFINE_STATIC_LOCK (fd_table_lock); +/* We use a single global lock for all hddesc_t objects. */ +DEFINE_STATIC_LOCK (hddesc_lock); + + + +/* Create a new handle descriptor object. */ +static hddesc_t +new_hddesc (void) +{ + hddesc_t hdd; + + hdd = malloc (sizeof *hdd); + if (!hdd) + return NULL; + hdd->hd = INVALID_HANDLE_VALUE; + hdd->sock = INVALID_SOCKET; + hdd->refcount = 0; + + return hdd; +} + + +static hddesc_t +ref_hddesc (hddesc_t hdd) +{ + LOCK (hddesc_lock); + hdd->refcount++; + UNLOCK (hddesc_lock); + return hdd; +} + + +/* Release a handle descriptor object and close its handle or socket + * if needed. */ +static void +release_hddesc (hddesc_t hdd) +{ + if (!hdd) + return; + + LOCK (hddesc_lock); + hdd->refcount--; + if (hdd->refcount < 1) + { + /* Holds a valid handle or was never intialized (in which case + * REFCOUNT would be -1 here). */ + TRACE_BEG3 (DEBUG_SYSIO, "gpgme:release_hddesc", hdd, + "hd=%p, sock=%d, refcount=%d", + hdd->hd, hdd->sock, hdd->refcount); + + if (hdd->hd != INVALID_HANDLE_VALUE) + { + TRACE_LOG1 ("closing handle %p", hdd->hd); + if (!CloseHandle (hdd->hd)) + { + TRACE_LOG1 ("CloseHandle failed: ec=%d", (int) GetLastError ()); + } + } + if (hdd->sock != INVALID_SOCKET) + { + TRACE_LOG1 ("closing socket %d", hdd->sock); + if (closesocket (hdd->sock)) + { + TRACE_LOG1 ("closesocket failed: ec=%d", (int)WSAGetLastError ()); + } + } + + free (hdd); + TRACE_SUC (); + } + UNLOCK (hddesc_lock); +} + + + /* Returns our FD or -1 on resource limit. The returned integer * references a new object which has not been intialized but can be * release with release_fd. */ -int +static int new_fd (void) { int idx; @@ -177,9 +253,12 @@ new_fd (void) else { fd_table[idx].used = 1; - fd_table[idx].handle = INVALID_HANDLE_VALUE; - fd_table[idx].socket = INVALID_SOCKET; + fd_table[idx].hdd = NULL; fd_table[idx].dup_from = -1; + fd_table[idx].want_reader = 0; + fd_table[idx].want_writer = 0; + fd_table[idx].reader = NULL; + fd_table[idx].writer = NULL; fd_table[idx].notify.handler = NULL; fd_table[idx].notify.value = NULL; } @@ -189,10 +268,11 @@ new_fd (void) return idx; } + /* Releases our FD but it this is just this entry. No close operation * is involved here; it must be done prior to calling this * function. */ -void +static void release_fd (int fd) { if (fd < 0 || fd >= fd_table_size) @@ -202,10 +282,14 @@ release_fd (int fd) if (fd_table[fd].used) { + release_hddesc (fd_table[fd].hdd); fd_table[fd].used = 0; - fd_table[fd].handle = INVALID_HANDLE_VALUE; - fd_table[fd].socket = INVALID_SOCKET; + fd_table[fd].hdd = NULL; fd_table[fd].dup_from = -1; + fd_table[fd].want_reader = 0; + fd_table[fd].want_writer = 0; + fd_table[fd].reader = NULL; + fd_table[fd].writer = NULL; fd_table[fd].notify.handler = NULL; fd_table[fd].notify.value = NULL; } @@ -244,10 +328,12 @@ reader (void *arg) int nbytes; DWORD nread; int sock; - TRACE_BEG2 (DEBUG_SYSIO, "gpgme:reader", ctx->file_hd, - "file_sock=%d, thread=%p", ctx->file_sock, ctx->thread_hd); - if (ctx->file_hd != INVALID_HANDLE_VALUE) + TRACE_BEG4 (DEBUG_SYSIO, "gpgme:reader", ctx->hdd, + "hd=%p, sock=%d, thread=%p, refcount=%d", + ctx->hdd->hd, ctx->hdd->sock, ctx->thread_hd, ctx->refcount); + + if (ctx->hdd->hd != INVALID_HANDLE_VALUE) sock = 0; else sock = 1; @@ -261,9 +347,11 @@ reader (void *arg) { /* Wait for space. */ if (!ResetEvent (ctx->have_space_ev)) - TRACE_LOG1 ("ResetEvent failed: ec=%d", (int) GetLastError ()); + { + TRACE_LOG1 ("ResetEvent failed: ec=%d", (int) GetLastError ()); + } UNLOCK (ctx->mutex); - TRACE_LOG ("waiting for space"); + TRACE_LOG1 ("waiting for space (refcnt=%d)", ctx->refcount); WaitForSingleObject (ctx->have_space_ev, INFINITE); TRACE_LOG ("got space"); LOCK (ctx->mutex); @@ -285,7 +373,7 @@ reader (void *arg) { int n; - n = recv (ctx->file_sock, ctx->buffer + ctx->writepos, nbytes, 0); + n = recv (ctx->hdd->sock, ctx->buffer + ctx->writepos, nbytes, 0); if (n < 0) { ctx->error_code = (int) WSAGetLastError (); @@ -320,7 +408,7 @@ reader (void *arg) } else { - if (!ReadFile (ctx->file_hd, + if (!ReadFile (ctx->hdd->hd, ctx->buffer + ctx->writepos, nbytes, &nread, NULL)) { ctx->error_code = (int) GetLastError (); @@ -329,6 +417,11 @@ reader (void *arg) ctx->eof = 1; TRACE_LOG ("got EOF (broken pipe)"); } + else if (ctx->error_code == ERROR_OPERATION_ABORTED) + { + ctx->eof = 1; + TRACE_LOG ("got EOF (closed by us)"); + } else { ctx->error = 1; @@ -351,22 +444,27 @@ reader (void *arg) break; } - TRACE_LOG1 ("got %u bytes", nread); + TRACE_LOG2 ("got %u bytes (refcnt=%d)", nread, ctx->refcount); ctx->writepos = (ctx->writepos + nread) % READBUF_SIZE; if (!SetEvent (ctx->have_data_ev)) - TRACE_LOG2 ("SetEvent (0x%x) failed: ec=%d", ctx->have_data_ev, - (int) GetLastError ()); + { + TRACE_LOG2 ("SetEvent (0x%x) failed: ec=%d", ctx->have_data_ev, + (int) GetLastError ()); + } UNLOCK (ctx->mutex); } /* Indicate that we have an error or EOF. */ if (!SetEvent (ctx->have_data_ev)) - TRACE_LOG2 ("SetEvent (0x%x) failed: ec=%d", ctx->have_data_ev, + { + TRACE_LOG2 ("SetEvent (0x%x) failed: ec=%d", ctx->have_data_ev, (int) GetLastError ()); + } TRACE_LOG ("waiting for close"); WaitForSingleObject (ctx->close_ev, INFINITE); + release_hddesc (ctx->hdd); CloseHandle (ctx->close_ev); CloseHandle (ctx->have_data_ev); CloseHandle (ctx->have_space_ev); @@ -379,17 +477,19 @@ reader (void *arg) /* Create a new reader thread and return its context object. The - * input is a HANDLE or a socket SOCK. This function may not call any + * input is the handle descriptor HDD. This function may not call any * fd based functions because the caller already holds a lock on the * fd_table. */ static struct reader_context_s * -create_reader (HANDLE handle, int sock) +create_reader (hddesc_t hdd) { struct reader_context_s *ctx; SECURITY_ATTRIBUTES sec_attr; DWORD tid; - TRACE_BEG (DEBUG_SYSIO, "gpgme:create_reader", handle); + TRACE_BEG3 (DEBUG_SYSIO, "gpgme:create_reader", hdd, + "handle=%p sock=%d refhdd=%d", + hdd->hd, hdd->sock, hdd->refcount); memset (&sec_attr, 0, sizeof sec_attr); sec_attr.nLength = sizeof sec_attr; @@ -402,8 +502,7 @@ create_reader (HANDLE handle, int sock) return NULL; } - ctx->file_hd = handle; - ctx->file_sock = sock; + ctx->hdd = ref_hddesc (hdd); ctx->refcount = 1; ctx->have_data_ev = CreateEvent (&sec_attr, TRUE, FALSE, NULL); @@ -420,8 +519,8 @@ create_reader (HANDLE handle, int sock) CloseHandle (ctx->have_space_ev); if (ctx->close_ev) CloseHandle (ctx->close_ev); + release_hddesc (ctx->hdd); free (ctx); - /* FIXME: Translate the error code. */ TRACE_SYSERR (EIO); return NULL; } @@ -440,6 +539,7 @@ create_reader (HANDLE handle, int sock) CloseHandle (ctx->have_space_ev); if (ctx->close_ev) CloseHandle (ctx->close_ev); + release_hddesc (ctx->hdd); free (ctx); TRACE_SYSERR (EIO); return NULL; @@ -467,12 +567,16 @@ destroy_reader (struct reader_context_s *ctx) ctx->refcount--; if (ctx->refcount != 0) { + TRACE2 (DEBUG_SYSIO, "gpgme:destroy_reader", ctx, + "hdd=%p refcount now %d", ctx->hdd, ctx->refcount); UNLOCK (ctx->mutex); return; } ctx->stop_me = 1; if (ctx->have_space_ev) SetEvent (ctx->have_space_ev); + TRACE1 (DEBUG_SYSIO, "gpgme:destroy_reader", ctx, + "hdd=%p close triggered", ctx->hdd); UNLOCK (ctx->mutex); /* The reader thread is usually blocking in recv or ReadFile. If @@ -483,16 +587,17 @@ destroy_reader (struct reader_context_s *ctx) (i.e. pipes) it would also be nice to cancel the operation, but such a feature is only available since Vista. Thus we need to dlopen that syscall. */ - if (ctx->file_hd != INVALID_HANDLE_VALUE) + assert (ctx->hdd); + if (ctx->hdd && ctx->hdd->hd != INVALID_HANDLE_VALUE) { _gpgme_w32_cancel_synchronous_io (ctx->thread_hd); } - else if (ctx->file_sock != INVALID_SOCKET) + else if (ctx->hdd && ctx->hdd->sock != INVALID_SOCKET) { - if (shutdown (ctx->file_sock, 2)) - TRACE2 (DEBUG_SYSIO, "gpgme:destroy_reader", ctx->file_hd, + if (shutdown (ctx->hdd->sock, 2)) + TRACE2 (DEBUG_SYSIO, "gpgme:destroy_reader", ctx, "shutdown socket %d failed: %s", - ctx->file_sock, (int) WSAGetLastError ()); + ctx->hdd->sock, (int) WSAGetLastError ()); } /* After setting this event CTX is void. */ @@ -529,10 +634,9 @@ find_reader (int fd) } /* Create a new reader thread. */ - TRACE_LOG4 ("fd=%d -> handle=%p socket=%d dupfrom=%d creating reader", - fd, fd_table[fd].handle, fd_table[fd].socket, - fd_table[fd].dup_from); - rd = create_reader (fd_table[fd].handle, fd_table[fd].socket); + TRACE_LOG3 ("fd=%d -> hdd=%p dupfrom=%d creating reader", + fd, fd_table[fd].hdd, fd_table[fd].dup_from); + rd = create_reader (fd_table[fd].hdd); if (!rd) gpg_err_set_errno (EIO); else @@ -613,7 +717,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) } UNLOCK (ctx->mutex); - TRACE_LOGBUF (buffer, nread); + TRACE_LOGBUFX (buffer, nread); return TRACE_SYSRES (nread); } @@ -627,10 +731,11 @@ writer (void *arg) struct writer_context_s *ctx = arg; DWORD nwritten; int sock; - TRACE_BEG2 (DEBUG_SYSIO, "gpgme:writer", ctx->file_hd, - "file_sock=%d, thread=%p", ctx->file_sock, ctx->thread_hd); + TRACE_BEG4 (DEBUG_SYSIO, "gpgme:writer", ctx->hdd, + "hd=%p, sock=%d, thread=%p, refcount=%d", + ctx->hdd->hd, ctx->hdd->sock, ctx->thread_hd, ctx->refcount); - if (ctx->file_hd != INVALID_HANDLE_VALUE) + if (ctx->hdd->hd != INVALID_HANDLE_VALUE) sock = 0; else sock = 1; @@ -673,7 +778,7 @@ writer (void *arg) be used with WriteFile. */ int n; - n = send (ctx->file_sock, ctx->buffer, ctx->nbytes, 0); + n = send (ctx->hdd->sock, ctx->buffer, ctx->nbytes, 0); if (n < 0) { ctx->error_code = (int) WSAGetLastError (); @@ -685,7 +790,7 @@ writer (void *arg) } else { - if (!WriteFile (ctx->file_hd, ctx->buffer, + if (!WriteFile (ctx->hdd->hd, ctx->buffer, ctx->nbytes, &nwritten, NULL)) { if (GetLastError () == ERROR_BUSY) @@ -717,6 +822,7 @@ writer (void *arg) if (ctx->nbytes) TRACE_LOG1 ("still %d bytes in buffer at close time", ctx->nbytes); + release_hddesc (ctx->hdd); CloseHandle (ctx->close_ev); CloseHandle (ctx->have_data); CloseHandle (ctx->is_empty); @@ -729,13 +835,16 @@ writer (void *arg) static struct writer_context_s * -create_writer (HANDLE handle, int sock) +create_writer (hddesc_t hdd) { struct writer_context_s *ctx; SECURITY_ATTRIBUTES sec_attr; DWORD tid; - TRACE_BEG (DEBUG_SYSIO, "gpgme:create_writer", handle); + +TRACE_BEG3 (DEBUG_SYSIO, "gpgme:create_writer", hdd, + "handle=%p sock=%d refhdd=%d", + hdd->hd, hdd->sock, hdd->refcount); memset (&sec_attr, 0, sizeof sec_attr); sec_attr.nLength = sizeof sec_attr; @@ -748,8 +857,7 @@ create_writer (HANDLE handle, int sock) return NULL; } - ctx->file_hd = handle; - ctx->file_sock = sock; + ctx->hdd = ref_hddesc (hdd); ctx->refcount = 1; ctx->have_data = CreateEvent (&sec_attr, TRUE, FALSE, NULL); @@ -766,6 +874,7 @@ create_writer (HANDLE handle, int sock) CloseHandle (ctx->is_empty); if (ctx->close_ev) CloseHandle (ctx->close_ev); + release_hddesc (ctx->hdd); free (ctx); /* FIXME: Translate the error code. */ TRACE_SYSERR (EIO); @@ -785,6 +894,7 @@ create_writer (HANDLE handle, int sock) CloseHandle (ctx->is_empty); if (ctx->close_ev) CloseHandle (ctx->close_ev); + release_hddesc (ctx->hdd); free (ctx); TRACE_SYSERR (EIO); return NULL; @@ -809,12 +919,16 @@ destroy_writer (struct writer_context_s *ctx) ctx->refcount--; if (ctx->refcount != 0) { + TRACE2 (DEBUG_SYSIO, "gpgme:destroy_writer", ctx, + "hdd=%p refcount now %d", ctx->hdd, ctx->refcount); UNLOCK (ctx->mutex); return; } ctx->stop_me = 1; if (ctx->have_data) SetEvent (ctx->have_data); + TRACE1 (DEBUG_SYSIO, "gpgme:destroy_writer", ctx, + "hdd=%p close triggered", ctx->hdd); UNLOCK (ctx->mutex); /* Give the writer a chance to flush the buffer. */ @@ -832,6 +946,7 @@ static struct writer_context_s * find_writer (int fd) { struct writer_context_s *wt = NULL; + HANDLE ahandle; TRACE_BEG0 (DEBUG_SYSIO, "gpgme:find_writer", fd, ""); @@ -854,9 +969,9 @@ find_writer (int fd) /* Create a new writer thread. */ TRACE_LOG4 ("fd=%d -> handle=%p socket=%d dupfrom=%d creating writer", - fd, fd_table[fd].handle, fd_table[fd].socket, + fd, fd_table[fd].hdd->hd, fd_table[fd].hdd->sock, fd_table[fd].dup_from); - wt = create_writer (fd_table[fd].handle, fd_table[fd].socket); + wt = create_writer (fd_table[fd].hdd); if (!wt) gpg_err_set_errno (EIO); else @@ -874,7 +989,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count) struct writer_context_s *ctx; TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_write", fd, "buffer=%p, count=%u", buffer, count); - TRACE_LOGBUF (buffer, count); + TRACE_LOGBUFX (buffer, count); if (count == 0) return TRACE_SYSRES (0); @@ -954,6 +1069,8 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) int wfd; HANDLE rh; HANDLE wh; + hddesc_t rhdesc; + hddesc_t whdesc; SECURITY_ATTRIBUTES sec_attr; TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_pipe", filedes, @@ -970,6 +1087,21 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) release_fd (rfd); return TRACE_SYSRES (-1); } + rhdesc = new_hddesc (); + if (!rhdesc) + { + release_fd (rfd); + release_fd (wfd); + return TRACE_SYSRES (-1); + } + whdesc = new_hddesc (); + if (!whdesc) + { + release_fd (rfd); + release_fd (wfd); + release_hddesc (rhdesc); + return TRACE_SYSRES (-1); + } /* Create a pipe. */ memset (&sec_attr, 0, sizeof (sec_attr)); @@ -981,7 +1113,8 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) TRACE_LOG1 ("CreatePipe failed: ec=%d", (int) GetLastError ()); release_fd (rfd); release_fd (wfd); - /* FIXME: Should translate the error code. */ + release_hddesc (rhdesc); + release_hddesc (whdesc); gpg_err_set_errno (EIO); return TRACE_SYSRES (-1); } @@ -1000,7 +1133,8 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) release_fd (wfd); CloseHandle (rh); CloseHandle (wh); - /* FIXME: Should translate the error code. */ + release_hddesc (rhdesc); + release_hddesc (whdesc); gpg_err_set_errno (EIO); return TRACE_SYSRES (-1); } @@ -1020,7 +1154,8 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) release_fd (wfd); CloseHandle (rh); CloseHandle (wh); - /* FIXME: Should translate the error code. */ + release_hddesc (rhdesc); + release_hddesc (whdesc); gpg_err_set_errno (EIO); return TRACE_SYSRES (-1); } @@ -1032,13 +1167,19 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) * Note that we don't need to lock the table because we have just * acquired these two fresh fds and they are not known by any other * thread. */ - fd_table[rfd].handle = rh; - fd_table[wfd].handle = wh; + fd_table[rfd].want_reader = 1; + ref_hddesc (rhdesc)->hd = rh; + fd_table[rfd].hdd = rhdesc; + + fd_table[wfd].want_writer = 1; + ref_hddesc (whdesc)->hd = wh; + fd_table[wfd].hdd = whdesc; filedes[0] = rfd; filedes[1] = wfd; - return TRACE_SUC4 ("read=0x%x (%p), write=0x%x (%p)", - rfd, fd_table[rfd].handle, wfd, fd_table[wfd].handle); + return TRACE_SUC6 ("read=0x%x (hdd=%p,hd=%p), write=0x%x (hdd=%p,hd=%p)", + rfd, fd_table[rfd].hdd, fd_table[rfd].hdd->hd, + wfd, fd_table[wfd].hdd, fd_table[wfd].hdd->hd); } @@ -1048,6 +1189,7 @@ _gpgme_io_close (int fd) { _gpgme_close_notify_handler_t handler = NULL; void *value = NULL; + int any_reader_or_writer = 0; TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_close", fd); @@ -1067,18 +1209,20 @@ _gpgme_io_close (int fd) return TRACE_SYSRES (-1); } - TRACE_LOG4 ("fd=%d -> handle=%p socket=%d dupfrom=%d", - fd, fd_table[fd].handle, fd_table[fd].socket, - fd_table[fd].dup_from); + TRACE_LOG2 ("hdd=%p dupfrom=%d", fd_table[fd].hdd, fd_table[fd].dup_from); if (fd_table[fd].reader) { + any_reader_or_writer = 1; + TRACE_LOG1 ("destroying reader %p", fd_table[fd].reader); destroy_reader (fd_table[fd].reader); fd_table[fd].reader = NULL; } if (fd_table[fd].writer) { + any_reader_or_writer = 1; + TRACE_LOG1 ("destroying writer %p", fd_table[fd].writer); destroy_writer (fd_table[fd].writer); fd_table[fd].writer = NULL; } @@ -1088,31 +1232,12 @@ _gpgme_io_close (int fd) handler = fd_table[fd].notify.handler; value = fd_table[fd].notify.value; - if (fd_table[fd].dup_from == -1) - { - if (fd_table[fd].handle != INVALID_HANDLE_VALUE) - { - if (!CloseHandle (fd_table[fd].handle)) - { - TRACE_LOG1 ("CloseHandle failed: ec=%d", (int) GetLastError ()); - /* FIXME: Should translate the error code. */ - gpg_err_set_errno (EIO); - UNLOCK (fd_table_lock); - return TRACE_SYSRES (-1); - } - } - else if (fd_table[fd].socket != INVALID_SOCKET) - { - if (closesocket (fd_table[fd].socket)) - { - TRACE_LOG1 ("closesocket failed: ec=%d", (int)WSAGetLastError ()); - /* FIXME: Should translate the error code. */ - gpg_err_set_errno (EIO); - UNLOCK (fd_table_lock); - return TRACE_SYSRES (-1); - } - } - } + /* Release our reference to the handle descripor. Note that if no + * reader or writer threads were used this release will also take + * care that the handle descriptor is closed + * (i.e. CloseHandle(hdd->hd) is called). */ + release_hddesc (fd_table[fd].hdd); + fd_table[fd].hdd = NULL; UNLOCK (fd_table_lock); @@ -1363,8 +1488,9 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, HANDLE hd = INVALID_HANDLE_VALUE; /* Make it inheritable for the wrapper process. */ - if (fd >= 0 && fd < fd_table_size && fd_table[fd].used) - ohd = fd_table[fd].handle; + if (fd >= 0 && fd < fd_table_size && fd_table[fd].used + && fd_table[fd].hdd) + ohd = fd_table[fd].hdd->hd; if (!DuplicateHandle (GetCurrentProcess(), ohd, pi.hProcess, &hd, 0, TRUE, DUPLICATE_SAME_ACCESS)) @@ -1673,6 +1799,7 @@ _gpgme_io_dup (int fd) int newfd; struct reader_context_s *rd_ctx; struct writer_context_s *wt_ctx; + int want_reader, want_writer; TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_dup", fd); @@ -1692,27 +1819,30 @@ _gpgme_io_dup (int fd) return TRACE_SYSRES (-1); } - fd_table[newfd].handle = fd_table[fd].handle; - fd_table[newfd].socket = fd_table[fd].socket; + fd_table[newfd].hdd = ref_hddesc (fd_table[fd].hdd); fd_table[newfd].dup_from = fd; + want_reader = fd_table[fd].want_reader; + want_writer = fd_table[fd].want_writer; UNLOCK (fd_table_lock); - rd_ctx = find_reader (fd); + rd_ctx = want_reader? find_reader (fd) : NULL; if (rd_ctx) { - /* No need for locking in the context, as the only races are - * against the reader thread itself, which doesn't touch - * refcount. NEWFD initializes a freshly allocated slot and - * does not need locking either. */ + /* NEWFD initializes a freshly allocated slot and does not need + * to be locked. */ + LOCK (rd_ctx->mutex); rd_ctx->refcount++; + UNLOCK (rd_ctx->mutex); fd_table[newfd].reader = rd_ctx; } - wt_ctx = find_writer (fd); + wt_ctx = want_writer? find_writer (fd) : NULL; if (wt_ctx) { + LOCK (wt_ctx->mutex); wt_ctx->refcount++; + UNLOCK (wt_ctx->mutex); fd_table[newfd].writer = wt_ctx; } @@ -1764,6 +1894,7 @@ _gpgme_io_socket (int domain, int type, int proto) { int res; int fd; + hddesc_t hdd; TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_socket", domain, "type=%i, protp=%i", type, proto); @@ -1771,6 +1902,14 @@ _gpgme_io_socket (int domain, int type, int proto) fd = new_fd(); if (fd == -1) return TRACE_SYSRES (-1); + hdd = new_hddesc (); + if (!hdd) + { + UNLOCK (fd_table_lock); + release_fd (fd); + gpg_err_set_errno (ENOMEM); + return TRACE_SYSRES (-1); + } res = socket (domain, type, proto); if (res == INVALID_SOCKET) @@ -1779,9 +1918,12 @@ _gpgme_io_socket (int domain, int type, int proto) gpg_err_set_errno (wsa2errno (WSAGetLastError ())); return TRACE_SYSRES (-1); } - fd_table[fd].socket = res; + ref_hddesc (hdd)->sock = res; + fd_table[fd].hdd = hdd; + fd_table[fd].want_reader = 1; + fd_table[fd].want_writer = 1; - TRACE_SUC2 ("socket=0x%x (0x%x)", fd, fd_table[fd].socket); + TRACE_SUC3 ("hdd=%p, socket=0x%x (0x%x)", hdd, fd, hdd->sock); return fd; } @@ -1797,13 +1939,13 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen) "addr=%p, addrlen=%i", addr, addrlen); LOCK (fd_table_lock); - if (fd < 0 || fd >= fd_table_size || !fd_table[fd].used) + if (fd < 0 || fd >= fd_table_size || !fd_table[fd].used || !fd_table[fd].hdd) { gpg_err_set_errno (EBADF); UNLOCK (fd_table_lock); return TRACE_SYSRES (-1); } - sock = fd_table[fd].socket; + sock = fd_table[fd].hdd->sock; UNLOCK (fd_table_lock); res = connect (sock, addr, addrlen); ----------------------------------------------------------------------- Summary of changes: src/w32-io.c | 380 ++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 261 insertions(+), 119 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 2 11:27:40 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 02 Nov 2018 11:27:40 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-40-g4faa0cc Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 4faa0ccf58c7a0f64f51dcbc8466add660080414 (commit) from da89528ac39b687bfbed2209ca2637e3bd8e0ac5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4faa0ccf58c7a0f64f51dcbc8466add660080414 Author: Werner Koch Date: Fri Nov 2 11:26:19 2018 +0100 w32: Don't use CloseHandle on an arbitrary integer. * src/assuan-support.c (my_waitpid): Do not close the PID = it is not a handle. -- At some time in the distant past we might have used the process object as pid which obviously required a close. However this was changed and so what we did here was to close an arbitrary handle (one which matches the pid). GnuPG-bug-id: 4237 Signed-off-by: Werner Koch diff --git a/src/assuan-support.c b/src/assuan-support.c index 7fbd48a..705088e 100644 --- a/src/assuan-support.c +++ b/src/assuan-support.c @@ -219,7 +219,7 @@ my_waitpid (assuan_context_t ctx, pid_t pid, (void)nowait; (void)status; (void)options; - CloseHandle ((HANDLE) pid); + (void)pid; /* Just a number without a kernel object. */ #else /* We can't just release the PID, a waitpid is mandatory. But NOWAIT in POSIX systems just means the caller already did the ----------------------------------------------------------------------- Summary of changes: src/assuan-support.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 2 11:39:41 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 02 Nov 2018 11:39:41 +0100 Subject: [git] GCRYPT - branch, master, updated. libgcrypt-1.8.1-116-ga2e0cb1 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, master has been updated via a2e0cb1542818ad8a71de34ccbf191adab0a0b86 (commit) from f7395338d71d4d82180a11707fd6e77787162e24 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a2e0cb1542818ad8a71de34ccbf191adab0a0b86 Author: NIIBE Yutaka Date: Fri Nov 2 18:54:02 2018 +0900 aarch64: mpi: Distribute the header file as a part of source. * mpi/Makefile.am (EXTRA_libmpi_la_SOURCES): Add asm-common-aarch64.h. -- Fixes-commit: ec0a2f25c0f64a7b65b373508ce9081e10461965 Signed-off-by: NIIBE Yutaka diff --git a/mpi/Makefile.am b/mpi/Makefile.am index 8f39ee7..4a8d888 100644 --- a/mpi/Makefile.am +++ b/mpi/Makefile.am @@ -175,3 +175,4 @@ libmpi_la_SOURCES = longlong.h \ mpih-mul.c \ mpiutil.c \ ec.c ec-internal.h ec-ed25519.c +EXTRA_libmpi_la_SOURCES = asm-common-aarch64.h ----------------------------------------------------------------------- Summary of changes: mpi/Makefile.am | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 2 12:34:16 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 02 Nov 2018 12:34:16 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-41-ged3f5ad Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via ed3f5ad760a28566fa2571e0c7392467bfc3770d (commit) from 4faa0ccf58c7a0f64f51dcbc8466add660080414 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ed3f5ad760a28566fa2571e0c7392467bfc3770d Author: Werner Koch Date: Fri Nov 2 12:28:17 2018 +0100 w32: Log all errors from CloseHandle and WFSO in w32-io. * src/w32-io.c (close_handle, _close_handle): New macro and function; use in place of all CloseHandle calls. (wait_for_single_object, _wait_for_single_object): Likewise. Signed-off-by: Werner Koch diff --git a/src/w32-io.c b/src/w32-io.c index e5ef396..f6d58f4 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -161,6 +161,36 @@ DEFINE_STATIC_LOCK (hddesc_lock); +/* Wrapper around CloseHandle to print an error. */ +#define close_handle(hd) _close_handle ((hd), __LINE__); +static void +_close_handle (HANDLE hd, int line) +{ + if (!CloseHandle (hd)) + { + TRACE2 (DEBUG_INIT, "w32-io", hd, "CloseHandle failed at line %d: ec=%d", + line, (int) GetLastError ()); + } +} + +/* Wrapper around WaitForSingleObject to print an error. */ +#define wait_for_single_object(hd,msec) \ + _wait_for_single_object ((hd), (msec), __LINE__) +static DWORD +_wait_for_single_object (HANDLE hd, DWORD msec, int line) +{ + DWORD res; + + res = WaitForSingleObject (hd, msec); + if (res == WAIT_FAILED) + { + TRACE2 (DEBUG_INIT, "w32-io", hd, + "WFSO failed at line %d: ec=%d", line, (int) GetLastError ()); + } + return res; +} + + /* Create a new handle descriptor object. */ static hddesc_t new_hddesc (void) @@ -207,13 +237,8 @@ release_hddesc (hddesc_t hdd) hdd->hd, hdd->sock, hdd->refcount); if (hdd->hd != INVALID_HANDLE_VALUE) - { - TRACE_LOG1 ("closing handle %p", hdd->hd); - if (!CloseHandle (hdd->hd)) - { - TRACE_LOG1 ("CloseHandle failed: ec=%d", (int) GetLastError ()); - } - } + close_handle (hdd->hd); + if (hdd->sock != INVALID_SOCKET) { TRACE_LOG1 ("closing socket %d", hdd->sock); @@ -352,7 +377,7 @@ reader (void *arg) } UNLOCK (ctx->mutex); TRACE_LOG1 ("waiting for space (refcnt=%d)", ctx->refcount); - WaitForSingleObject (ctx->have_space_ev, INFINITE); + wait_for_single_object (ctx->have_space_ev, INFINITE); TRACE_LOG ("got space"); LOCK (ctx->mutex); } @@ -462,13 +487,13 @@ reader (void *arg) } TRACE_LOG ("waiting for close"); - WaitForSingleObject (ctx->close_ev, INFINITE); + wait_for_single_object (ctx->close_ev, INFINITE); release_hddesc (ctx->hdd); - CloseHandle (ctx->close_ev); - CloseHandle (ctx->have_data_ev); - CloseHandle (ctx->have_space_ev); - CloseHandle (ctx->thread_hd); + close_handle (ctx->close_ev); + close_handle (ctx->have_data_ev); + close_handle (ctx->have_space_ev); + close_handle (ctx->thread_hd); DESTROY_LOCK (ctx->mutex); free (ctx); @@ -514,11 +539,11 @@ create_reader (hddesc_t hdd) { TRACE_LOG1 ("CreateEvent failed: ec=%d", (int) GetLastError ()); if (ctx->have_data_ev) - CloseHandle (ctx->have_data_ev); + close_handle (ctx->have_data_ev); if (ctx->have_space_ev) - CloseHandle (ctx->have_space_ev); + close_handle (ctx->have_space_ev); if (ctx->close_ev) - CloseHandle (ctx->close_ev); + close_handle (ctx->close_ev); release_hddesc (ctx->hdd); free (ctx); TRACE_SYSERR (EIO); @@ -534,11 +559,11 @@ create_reader (hddesc_t hdd) TRACE_LOG1 ("CreateThread failed: ec=%d", (int) GetLastError ()); DESTROY_LOCK (ctx->mutex); if (ctx->have_data_ev) - CloseHandle (ctx->have_data_ev); + close_handle (ctx->have_data_ev); if (ctx->have_space_ev) - CloseHandle (ctx->have_space_ev); + close_handle (ctx->have_space_ev); if (ctx->close_ev) - CloseHandle (ctx->close_ev); + close_handle (ctx->close_ev); release_hddesc (ctx->hdd); free (ctx); TRACE_SYSERR (EIO); @@ -668,7 +693,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) /* No data available. */ UNLOCK (ctx->mutex); TRACE_LOG1 ("waiting for data from thread %p", ctx->thread_hd); - WaitForSingleObject (ctx->have_data_ev, INFINITE); + wait_for_single_object (ctx->have_data_ev, INFINITE); TRACE_LOG1 ("data from thread %p available", ctx->thread_hd); LOCK (ctx->mutex); } @@ -756,7 +781,7 @@ writer (void *arg) TRACE_LOG1 ("ResetEvent failed: ec=%d", (int) GetLastError ()); UNLOCK (ctx->mutex); TRACE_LOG ("idle"); - WaitForSingleObject (ctx->have_data, INFINITE); + wait_for_single_object (ctx->have_data, INFINITE); TRACE_LOG ("got data to send"); LOCK (ctx->mutex); } @@ -817,16 +842,16 @@ writer (void *arg) TRACE_LOG1 ("SetEvent failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("waiting for close"); - WaitForSingleObject (ctx->close_ev, INFINITE); + wait_for_single_object (ctx->close_ev, INFINITE); if (ctx->nbytes) TRACE_LOG1 ("still %d bytes in buffer at close time", ctx->nbytes); release_hddesc (ctx->hdd); - CloseHandle (ctx->close_ev); - CloseHandle (ctx->have_data); - CloseHandle (ctx->is_empty); - CloseHandle (ctx->thread_hd); + close_handle (ctx->close_ev); + close_handle (ctx->have_data); + close_handle (ctx->is_empty); + close_handle (ctx->thread_hd); DESTROY_LOCK (ctx->mutex); free (ctx); @@ -869,11 +894,11 @@ TRACE_BEG3 (DEBUG_SYSIO, "gpgme:create_writer", hdd, { TRACE_LOG1 ("CreateEvent failed: ec=%d", (int) GetLastError ()); if (ctx->have_data) - CloseHandle (ctx->have_data); + close_handle (ctx->have_data); if (ctx->is_empty) - CloseHandle (ctx->is_empty); + close_handle (ctx->is_empty); if (ctx->close_ev) - CloseHandle (ctx->close_ev); + close_handle (ctx->close_ev); release_hddesc (ctx->hdd); free (ctx); /* FIXME: Translate the error code. */ @@ -889,11 +914,11 @@ TRACE_BEG3 (DEBUG_SYSIO, "gpgme:create_writer", hdd, TRACE_LOG1 ("CreateThread failed: ec=%d", (int) GetLastError ()); DESTROY_LOCK (ctx->mutex); if (ctx->have_data) - CloseHandle (ctx->have_data); + close_handle (ctx->have_data); if (ctx->is_empty) - CloseHandle (ctx->is_empty); + close_handle (ctx->is_empty); if (ctx->close_ev) - CloseHandle (ctx->close_ev); + close_handle (ctx->close_ev); release_hddesc (ctx->hdd); free (ctx); TRACE_SYSERR (EIO); @@ -932,7 +957,7 @@ destroy_writer (struct writer_context_s *ctx) UNLOCK (ctx->mutex); /* Give the writer a chance to flush the buffer. */ - WaitForSingleObject (ctx->is_empty, INFINITE); + wait_for_single_object (ctx->is_empty, INFINITE); /* After setting this event CTX is void. */ SetEvent (ctx->close_ev); @@ -1014,7 +1039,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count) } UNLOCK (ctx->mutex); TRACE_LOG1 ("waiting for empty buffer in thread %p", ctx->thread_hd); - WaitForSingleObject (ctx->is_empty, INFINITE); + wait_for_single_object (ctx->is_empty, INFINITE); TRACE_LOG1 ("thread %p buffer is empty", ctx->thread_hd); LOCK (ctx->mutex); } @@ -1131,14 +1156,14 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) (int) GetLastError ()); release_fd (rfd); release_fd (wfd); - CloseHandle (rh); - CloseHandle (wh); + close_handle (rh); + close_handle (wh); release_hddesc (rhdesc); release_hddesc (whdesc); gpg_err_set_errno (EIO); return TRACE_SYSRES (-1); } - CloseHandle (rh); + close_handle (rh); rh = hd; } else if (inherit_idx == 1) @@ -1152,14 +1177,14 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) (int) GetLastError ()); release_fd (rfd); release_fd (wfd); - CloseHandle (rh); - CloseHandle (wh); + close_handle (rh); + close_handle (wh); release_hddesc (rhdesc); release_hddesc (whdesc); gpg_err_set_errno (EIO); return TRACE_SYSRES (-1); } - CloseHandle (wh); + close_handle (wh); wh = hd; } @@ -1500,8 +1525,8 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, /* Just in case TerminateProcess didn't work, let the process fail on its own. */ ResumeThread (pi.hThread); - CloseHandle (pi.hThread); - CloseHandle (pi.hProcess); + close_handle (pi.hThread); + close_handle (pi.hProcess); close (tmp_fd); DeleteFileA (tmp_name); @@ -1577,16 +1602,12 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, if (ResumeThread (pi.hThread) < 0) TRACE_LOG1 ("ResumeThread failed: ec=%d", (int) GetLastError ()); - if (!CloseHandle (pi.hThread)) - TRACE_LOG1 ("CloseHandle of thread failed: ec=%d", - (int) GetLastError ()); + close_handle (pi.hThread); TRACE_LOG1 ("process=%p", pi.hProcess); /* We don't need to wait for the process. */ - if (!CloseHandle (pi.hProcess)) - TRACE_LOG1 ("CloseHandle of process failed: ec=%d", - (int) GetLastError ()); + close_handle (pi.hProcess); if (! (flags & IOSPAWN_FLAG_NOCLOSE)) { @@ -1704,7 +1725,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) any = 0; for (i = code - WAIT_OBJECT_0; i < nwait; i++) { - if (WaitForSingleObject (waitbuf[i], 0) == WAIT_OBJECT_0) + if (wait_for_single_object (waitbuf[i], 0) == WAIT_OBJECT_0) { assert (waitidx[i] >=0 && waitidx[i] < nfds); fds[waitidx[i]].signaled = 1; ----------------------------------------------------------------------- Summary of changes: src/w32-io.c | 119 +++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 70 insertions(+), 49 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 2 12:55:03 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 02 Nov 2018 12:55:03 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-42-g5262ce0 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 5262ce0c815193fc901b00a9b4132925ba672df7 (commit) from ed3f5ad760a28566fa2571e0c7392467bfc3770d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5262ce0c815193fc901b00a9b4132925ba672df7 Author: Werner Koch Date: Fri Nov 2 12:54:22 2018 +0100 w32: Fix a few compiler warnings. * src/debug.h (TRACE_SYSERR_NR): New. * src/w32-io.c: Fix compiler warnings. Signed-off-by: Werner Koch diff --git a/src/debug.h b/src/debug.h index ecd230f..77fec55 100644 --- a/src/debug.h +++ b/src/debug.h @@ -202,6 +202,11 @@ _gpgme_trace_gpgme_error (gpgme_error_t err, const char *file, int line) (_gpgme_debug (_gpgme_trace_level, "%s: error: %s\n", \ _gpgme_trace_func, strerror (res)), \ _gpgme_debug_frame_end (), (res)) +#define TRACE_SYSERR_NR(res) \ + do { res == 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) : \ + (_gpgme_debug (_gpgme_trace_level, "%s: error: %s\n", \ + _gpgme_trace_func, strerror (res)), \ + _gpgme_debug_frame_end ()); } while (0) #define TRACE_SUC() \ _gpgme_debug (_gpgme_trace_level, "%s: leave\n", \ diff --git a/src/w32-io.c b/src/w32-io.c index f6d58f4..a6dfdbc 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -523,7 +523,7 @@ create_reader (hddesc_t hdd) ctx = calloc (1, sizeof *ctx); if (!ctx) { - TRACE_SYSERR (errno); + TRACE_SYSERR_NR (errno); return NULL; } @@ -546,7 +546,7 @@ create_reader (hddesc_t hdd) close_handle (ctx->close_ev); release_hddesc (ctx->hdd); free (ctx); - TRACE_SYSERR (EIO); + TRACE_SYSERR_NR (EIO); return NULL; } @@ -566,7 +566,7 @@ create_reader (hddesc_t hdd) close_handle (ctx->close_ev); release_hddesc (ctx->hdd); free (ctx); - TRACE_SYSERR (EIO); + TRACE_SYSERR_NR (EIO); return NULL; } else @@ -878,7 +878,7 @@ TRACE_BEG3 (DEBUG_SYSIO, "gpgme:create_writer", hdd, ctx = calloc (1, sizeof *ctx); if (!ctx) { - TRACE_SYSERR (errno); + TRACE_SYSERR_NR (errno); return NULL; } @@ -901,8 +901,7 @@ TRACE_BEG3 (DEBUG_SYSIO, "gpgme:create_writer", hdd, close_handle (ctx->close_ev); release_hddesc (ctx->hdd); free (ctx); - /* FIXME: Translate the error code. */ - TRACE_SYSERR (EIO); + TRACE_SYSERR_NR (EIO); return NULL; } @@ -921,7 +920,7 @@ TRACE_BEG3 (DEBUG_SYSIO, "gpgme:create_writer", hdd, close_handle (ctx->close_ev); release_hddesc (ctx->hdd); free (ctx); - TRACE_SYSERR (EIO); + TRACE_SYSERR_NR (EIO); return NULL; } else @@ -971,7 +970,6 @@ static struct writer_context_s * find_writer (int fd) { struct writer_context_s *wt = NULL; - HANDLE ahandle; TRACE_BEG0 (DEBUG_SYSIO, "gpgme:find_writer", fd, ""); @@ -1214,7 +1212,6 @@ _gpgme_io_close (int fd) { _gpgme_close_notify_handler_t handler = NULL; void *value = NULL; - int any_reader_or_writer = 0; TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_close", fd); @@ -1238,7 +1235,6 @@ _gpgme_io_close (int fd) if (fd_table[fd].reader) { - any_reader_or_writer = 1; TRACE_LOG1 ("destroying reader %p", fd_table[fd].reader); destroy_reader (fd_table[fd].reader); fd_table[fd].reader = NULL; @@ -1246,14 +1242,13 @@ _gpgme_io_close (int fd) if (fd_table[fd].writer) { - any_reader_or_writer = 1; TRACE_LOG1 ("destroying writer %p", fd_table[fd].writer); destroy_writer (fd_table[fd].writer); fd_table[fd].writer = NULL; } - /* FIXME: The handler may not use any fd fucntion becuase the table - * is locked. Can we avoid this? */ + /* The handler may not use any fd fucntion because the table is + * locked. Can we avoid this? */ handler = fd_table[fd].notify.handler; value = fd_table[fd].notify.value; @@ -1599,7 +1594,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, *r_pid = (pid_t)pi.dwProcessId; - if (ResumeThread (pi.hThread) < 0) + if (ResumeThread (pi.hThread) == (DWORD)(-1)) TRACE_LOG1 ("ResumeThread failed: ec=%d", (int) GetLastError ()); close_handle (pi.hThread); @@ -1713,7 +1708,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) return TRACE_SYSRES (0); code = WaitForMultipleObjects (nwait, waitbuf, 0, nonblock ? 0 : 1000); - if (code >= WAIT_OBJECT_0 && code < WAIT_OBJECT_0 + nwait) + if (code < WAIT_OBJECT_0 + nwait) { /* The WFMO is a really silly function: It does return either the index of the signaled object or if 2 objects have been ----------------------------------------------------------------------- Summary of changes: src/debug.h | 5 +++++ src/w32-io.c | 25 ++++++++++--------------- 2 files changed, 15 insertions(+), 15 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 2 15:13:07 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 02 Nov 2018 15:13:07 +0100 Subject: [git] gnupg-doc - branch, master, updated. 211888957e67cc0fc6a06dfaf442937fa2f296d1 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GnuPG website and other docs". The branch, master has been updated via 211888957e67cc0fc6a06dfaf442937fa2f296d1 (commit) from c730362aea99564e54bfae00a9e39e7ee913dfcc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 211888957e67cc0fc6a06dfaf442937fa2f296d1 Author: Werner Koch Date: Fri Nov 2 15:12:46 2018 +0100 web: Remove link to SWITCHmirror The mirror will be decommissioned; see http://mirror.switch.ch diff --git a/web/download/mirrors.org b/web/download/mirrors.org index af7e45f..ab52ef2 100644 --- a/web/download/mirrors.org +++ b/web/download/mirrors.org @@ -34,7 +34,6 @@ web site mirrors, please consult the [[../mirrors.html][WWW mirror page]] . | Netherlands | [[http://www.bit.nl/][BIT]] | [[ftp://ftp.bit.nl/mirror/gnupg/][ftp]] | | | | [[http://www.surfnet.nl/][SurfNet]] | [[ftp://ftp.surfnet.nl/pub/security/gnupg/][ftp]] | | | Romania | [[http://www.iasi.roedu.net/][Romanian Edu., Iasi Branch]] | [[ftp://ftp.iasi.roedu.net/pub/mirrors/ftp.gnupg.org/][ftp]] | | - | Switzerland | [[http://mirror.switch.ch/][SWITCHmirror]] | [[ftp://mirror.switch.ch/mirror/gnupg/][ftp]] | | | United Kingdom | [[http://mirror.tje.me.uk/][mirror.tje.me.uk]] | [[ftp://mirror.tje.me.uk/pub/mirrors/ftp.gnupg.org][ftp]] [[http://mirror.tje.me.uk/pub/mirrors/ftp.gnupg.org/][http]] | 4/day | | | [[http://www.mirrorservice.org/][UK Mirror Service]] | [[ftp://ftp.mirrorservice.org/sites/ftp.gnupg.org/gcrypt][ftp]] [[http://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt][http]] {{{rsync(rsync://rsync.mirrorservice.org/ftp.gnupg.org/gcrypt/)}}} | | |----------------+----------------------------+----------------------------------------------------------------------------------+-------| ----------------------------------------------------------------------- Summary of changes: web/download/mirrors.org | 1 - 1 file changed, 1 deletion(-) hooks/post-receive -- The GnuPG website and other docs http://git.gnupg.org From cvs at cvs.gnupg.org Sat Nov 3 08:13:26 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Sat, 03 Nov 2018 08:13:26 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-43-g13e09bd Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 13e09bd21a531b448f2f34b1f075315502b76fb6 (commit) from 5262ce0c815193fc901b00a9b4132925ba672df7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 13e09bd21a531b448f2f34b1f075315502b76fb6 Author: Ben McGinnes Date: Sat Nov 3 18:12:25 2018 +1100 docs: typo * lang/python/doc/src/gpgme-python-howto: s/Revokinging/Revoking/g diff --git a/lang/python/doc/src/gpgme-python-howto b/lang/python/doc/src/gpgme-python-howto index ffcb1d4..4ad5bc4 100644 --- a/lang/python/doc/src/gpgme-python-howto +++ b/lang/python/doc/src/gpgme-python-howto @@ -2580,7 +2580,7 @@ Unsurprisingly the result of this is: #+END_SRC -*** Revokinging User IDs +*** Revoking User IDs :PROPERTIES: :CUSTOM_ID: keygen-uids-revoke :END: ----------------------------------------------------------------------- Summary of changes: lang/python/doc/src/gpgme-python-howto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 5 09:01:48 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 05 Nov 2018 09:01:48 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-250-ga3a5a24 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via a3a5a2451924640588e5ecc03a1d4ba6a6ba94a5 (commit) from 8e84efbe35633275e260712ba38a505e3f9d0898 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a3a5a2451924640588e5ecc03a1d4ba6a6ba94a5 Author: Werner Koch Date: Mon Nov 5 08:59:13 2018 +0100 dirmngr: Fix LDAP port parsing. * dirmngr/misc.c (host_and_port_from_url): Fix bad port parsing and a segv for a missing slash after the host name. -- Reportted-by: Tomas Mraz GnuPG-bug-id: 4230 Signed-off-by: Werner Koch diff --git a/dirmngr/misc.c b/dirmngr/misc.c index 9ad60d5..9cedf91 100644 --- a/dirmngr/misc.c +++ b/dirmngr/misc.c @@ -515,7 +515,7 @@ host_and_port_from_url (const char *url, int *port) if ((p = strchr (buf, '/'))) *p++ = 0; strlwr (buf); - if ((p = strchr (p, ':'))) + if ((p = strchr (buf, ':'))) { *p++ = 0; *port = atoi (p); ----------------------------------------------------------------------- Summary of changes: dirmngr/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 5 09:04:47 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 05 Nov 2018 09:04:47 +0100 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.10-22-g5ab58d3 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 5ab58d3001b0342aecaf691b1af70b1f76426f55 (commit) from 8a33d5c9c699d2145d39b362d580df67571c5f36 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5ab58d3001b0342aecaf691b1af70b1f76426f55 Author: Werner Koch Date: Mon Nov 5 08:59:13 2018 +0100 dirmngr: Fix LDAP port parsing. * dirmngr/misc.c (host_and_port_from_url): Fix bad port parsing and a segv for a missing slash after the host name. -- Reportted-by: Tomas Mraz GnuPG-bug-id: 4230 Signed-off-by: Werner Koch (cherry picked from commit a3a5a2451924640588e5ecc03a1d4ba6a6ba94a5) diff --git a/dirmngr/misc.c b/dirmngr/misc.c index 6291a9a..eef04ed 100644 --- a/dirmngr/misc.c +++ b/dirmngr/misc.c @@ -515,7 +515,7 @@ host_and_port_from_url (const char *url, int *port) if ((p = strchr (buf, '/'))) *p++ = 0; strlwr (buf); - if ((p = strchr (p, ':'))) + if ((p = strchr (buf, ':'))) { *p++ = 0; *port = atoi (p); ----------------------------------------------------------------------- Summary of changes: dirmngr/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 5 09:27:58 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 05 Nov 2018 09:27:58 +0100 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.10-27-g5075692 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 50756927ce6247abc2fadefbc76c58b75c8a7586 (commit) via d5f540e7a9b3a723ba787e3a587fcd1b0948f105 (commit) via 82cd7556fdce989aaacf91e0d369a62e4652f224 (commit) via e486fb2495cf5a7506463b4e42144fb8d6a1f42d (commit) via ab7a907a184f37ddafaa0dc7200c76b735ba4853 (commit) from 5ab58d3001b0342aecaf691b1af70b1f76426f55 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 50756927ce6247abc2fadefbc76c58b75c8a7586 Author: Werner Koch Date: Mon Oct 22 14:23:11 2018 +0200 dirmngr: In verbose mode print the OCSP responder id. * dirmngr/ocsp.c (ocsp_isvalid): Print the responder id. Signed-off-by: Werner Koch (cherry picked from commit 0a7f446c189201ca6e527af08b44da756b343209) diff --git a/dirmngr/ocsp.c b/dirmngr/ocsp.c index 22391c3..2067b7b 100644 --- a/dirmngr/ocsp.c +++ b/dirmngr/ocsp.c @@ -653,6 +653,33 @@ ocsp_isvalid (ctrl_t ctrl, ksba_cert_t cert, const char *cert_fpr, if (err) goto leave; + /* It is sometimes useful to know the responder ID. */ + if (opt.verbose) + { + char *resp_name; + ksba_sexp_t resp_keyid; + + err = ksba_ocsp_get_responder_id (ocsp, &resp_name, &resp_keyid); + if (err) + log_info (_("error getting responder ID: %s\n"), gpg_strerror (err)); + else + { + log_info ("responder id: "); + if (resp_name) + log_printf ("'/%s' ", resp_name); + if (resp_keyid) + { + log_printf ("{"); + dump_serial (resp_keyid); + log_printf ("} "); + } + log_printf ("\n"); + } + ksba_free (resp_name); + ksba_free (resp_keyid); + err = 0; + } + /* We got a useful answer, check that the answer has a valid signature. */ sigval = ksba_ocsp_get_sig_val (ocsp, produced_at); if (!sigval || !*produced_at) commit d5f540e7a9b3a723ba787e3a587fcd1b0948f105 Author: Werner Koch Date: Mon Oct 15 11:32:19 2018 +0200 tools: Replace duplicated code in mime-maker. * tools/rfc822parse.c (HEADER_NAME_CHARS): New. Taken from mime-maker.c. (rfc822_valid_header_name_p): New. Based on code from mime-maker.c. (rfc822_capitalize_header_name): New. Copied from mime-maker.c. (capitalize_header_name): Remove. Replace calls by new func. (my_toupper, my_strcasecmp): New. * tools/mime-maker.c: Include rfc822parse.h. (HEADER_NAME_CHARS, capitalize_header_name): Remove. (add_header): Replace check and capitalization by new functions. -- This is a straightforward change with two minor chnages: - In rfc822parse.c the capitalization handles MIME-Version special. - The check in mime-maker bow detects a zero-length name as invalid. my_toupper and my_strcasecmp are introduced to allow standalone use of that file. Signed-off-by: Werner Koch (cherry picked from commit f03928b16c4fb00077d22d8ec141575ef6d26913) diff --git a/tools/mime-maker.c b/tools/mime-maker.c index 0edc14d..91eab82 100644 --- a/tools/mime-maker.c +++ b/tools/mime-maker.c @@ -25,14 +25,10 @@ #include "../common/util.h" #include "../common/zb32.h" +#include "rfc822parse.h" #include "mime-maker.h" -/* All valid characters in a header name. */ -#define HEADER_NAME_CHARS ("abcdefghijklmnopqrstuvwxyz" \ - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ - "-01234567890") - /* An object to store an header. Also used for a list of headers. */ struct header_s { @@ -269,38 +265,6 @@ ensure_part (mime_maker_t ctx, part_t *r_parent) } -/* Transform a header name into a standard capitalized format. - * "Content-Type". Conversion stops at the colon. */ -static void -capitalize_header_name (char *name) -{ - unsigned char *p = name; - int first = 1; - - /* Special cases first. */ - if (!ascii_strcasecmp (name, "MIME-Version")) - { - strcpy (name, "MIME-Version"); - return; - } - - /* Regular cases. */ - for (; *p && *p != ':'; p++) - { - if (*p == '-') - first = 1; - else if (first) - { - if (*p >= 'a' && *p <= 'z') - *p = *p - 'a' + 'A'; - first = 0; - } - else if (*p >= 'A' && *p <= 'Z') - *p = *p - 'A' + 'a'; - } -} - - /* Check whether a header with NAME has already been set into PART. * NAME must be in canonical capitalized format. Return true or * false. */ @@ -344,17 +308,14 @@ add_header (part_t part, const char *name, const char *value) memcpy (hdr->name, name, namelen); hdr->name[namelen] = 0; - /* Check that the header name is valid. We allow all lower and - * uppercase letters and, except for the first character, digits and - * the dash. */ - if (strspn (hdr->name, HEADER_NAME_CHARS) != namelen - || strchr ("-0123456789", *hdr->name)) + /* Check that the header name is valid. */ + if (!rfc822_valid_header_name_p (hdr->name)) { xfree (hdr); return gpg_error (GPG_ERR_INV_NAME); } - capitalize_header_name (hdr->name); + rfc822_capitalize_header_name (hdr->name); hdr->value = xtrystrdup (value); if (!hdr->value) { diff --git a/tools/rfc822parse.c b/tools/rfc822parse.c index e8cdb02..0a4e2bc 100644 --- a/tools/rfc822parse.c +++ b/tools/rfc822parse.c @@ -41,6 +41,12 @@ #include "rfc822parse.h" +/* All valid characters in a header name. */ +#define HEADER_NAME_CHARS ("abcdefghijklmnopqrstuvwxyz" \ + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ + "-01234567890") + + enum token_type { tSPACE, @@ -131,28 +137,31 @@ lowercase_string (unsigned char *string) *string = *string - 'A' + 'a'; } -/* Transform a header name into a standard capitalized format; i.e - "Content-Type". Conversion stops at the colon. As usual we don't - use the localized versions of ctype.h. - */ -static void -capitalize_header_name (unsigned char *name) + +static int +my_toupper (int c) { - int first = 1; + if (c >= 'a' && c <= 'z') + c &= ~0x20; + return c; +} + +/* This is the same as ascii_strcasecmp. */ +static int +my_strcasecmp (const char *a, const char *b) +{ + if (a == b) + return 0; - for (; *name && *name != ':'; name++) - if (*name == '-') - first = 1; - else if (first) - { - if (*name >= 'a' && *name <= 'z') - *name = *name - 'a' + 'A'; - first = 0; - } - else if (*name >= 'A' && *name <= 'Z') - *name = *name - 'A' + 'a'; + for (; *a && *b; a++, b++) + { + if (*a != *b && my_toupper(*a) != my_toupper(*b)) + break; + } + return *a == *b? 0 : (my_toupper (*a) - my_toupper (*b)); } + #ifndef HAVE_STPCPY static char * my_stpcpy (char *a,const char *b) @@ -228,6 +237,62 @@ release_handle_data (rfc822parse_t msg) } +/* Check that the header name is valid. We allow all lower and + * uppercase letters and, except for the first character, digits and + * the dash. The check stops at the first colon or at string end. + * Returns true if the name is valid. */ +int +rfc822_valid_header_name_p (const char *name) +{ + const char *s; + size_t namelen; + + if ((s=strchr (name, ':'))) + namelen = s - name; + else + namelen = strlen (name); + + if (!namelen + || strspn (name, HEADER_NAME_CHARS) != namelen + || strchr ("-0123456789", *name)) + return 0; + return 1; +} + + +/* Transform a header NAME into a standard capitalized format. + * Conversion stops at the colon. */ +void +rfc822_capitalize_header_name (char *name) +{ + unsigned char *p = name; + int first = 1; + + /* Special cases first. */ + if (!my_strcasecmp (name, "MIME-Version")) + { + strcpy (name, "MIME-Version"); + return; + } + + /* Regular cases. */ + for (; *p && *p != ':'; p++) + { + if (*p == '-') + first = 1; + else if (first) + { + if (*p >= 'a' && *p <= 'z') + *p = *p - 'a' + 'A'; + first = 0; + } + else if (*p >= 'A' && *p <= 'Z') + *p = *p - 'A' + 'a'; + } +} + + + /* Create a new parsing context for an entire rfc822 message and return it. CB and CB_VALUE may be given to callback for certain events. NULL is returned on error with errno set appropriately. */ @@ -432,7 +497,7 @@ insert_header (rfc822parse_t msg, const unsigned char *line, size_t length) /* Transform a field name into canonical format. */ if (!hdr->cont && strchr (line, ':')) - capitalize_header_name (hdr->line); + rfc822_capitalize_header_name (hdr->line); *msg->current_part->hdr_lines_tail = hdr; msg->current_part->hdr_lines_tail = &hdr->next; diff --git a/tools/rfc822parse.h b/tools/rfc822parse.h index 177d827..e2f2bed 100644 --- a/tools/rfc822parse.h +++ b/tools/rfc822parse.h @@ -48,6 +48,8 @@ typedef int (*rfc822parse_cb_t) (void *opaque, rfc822parse_event_t event, rfc822parse_t msg); +int rfc822_valid_header_name_p (const char *name); +void rfc822_capitalize_header_name (char *name); rfc822parse_t rfc822parse_open (rfc822parse_cb_t cb, void *opaque_value); commit 82cd7556fdce989aaacf91e0d369a62e4652f224 Author: Werner Koch Date: Wed Oct 10 11:46:16 2018 +0200 gpg: Don't take the a TOFU trust model from the trustdb, * g10/tdbio.c (tdbio_update_version_record): Never store a TOFU model. (create_version_record): Don't init as TOFU. (tdbio_db_matches_options): Don't indicate a change in case TOFU is stored in an old trustdb file. -- This change allows to switch between a tofu and pgp or tofu+pgp trust model without an auto rebuild of the trustdb. This also requires that the tofu trust model is requested on the command line. If TOFU will ever be the default we need to tweak the model detection via TM_AUTO by also looking into the TOFU data base, GnuPG-bug-id: 4134 (cherry picked from commit 150a33df41944d764621f037038683f3d605aa3f) diff --git a/doc/gpg.texi b/doc/gpg.texi index 3f8f6b9..ffcdaf2 100644 --- a/doc/gpg.texi +++ b/doc/gpg.texi @@ -1724,7 +1724,8 @@ Set what trust model GnuPG should follow. The models are: @opindex trust-model:auto Select the trust model depending on whatever the internal trust database says. This is the default model if such a database already - exists. + exists. Note that a tofu trust model is not considered here and + must be enabled explicitly. @end table @item --auto-key-locate @var{mechanisms} diff --git a/g10/tdbio.c b/g10/tdbio.c index fed0cf5..8f75306 100644 --- a/g10/tdbio.c +++ b/g10/tdbio.c @@ -562,6 +562,12 @@ tdbio_update_version_record (ctrl_t ctrl) { TRUSTREC rec; int rc; + int opt_tm; + + /* Never store a TOFU trust model in the trustdb. Use PGP instead. */ + opt_tm = opt.trust_model; + if (opt_tm == TM_TOFU || opt_tm == TM_TOFU_PGP) + opt_tm = TM_PGP; memset (&rec, 0, sizeof rec); @@ -572,7 +578,7 @@ tdbio_update_version_record (ctrl_t ctrl) rec.r.ver.marginals = opt.marginals_needed; rec.r.ver.completes = opt.completes_needed; rec.r.ver.cert_depth = opt.max_cert_depth; - rec.r.ver.trust_model = opt.trust_model; + rec.r.ver.trust_model = opt_tm; rec.r.ver.min_cert_level = opt.min_cert_level; rc = tdbio_write_record (ctrl, &rec); } @@ -591,6 +597,12 @@ create_version_record (ctrl_t ctrl) { TRUSTREC rec; int rc; + int opt_tm; + + /* Never store a TOFU trust model in the trustdb. Use PGP instead. */ + opt_tm = opt.trust_model; + if (opt_tm == TM_TOFU || opt_tm == TM_TOFU_PGP) + opt_tm = TM_PGP; memset (&rec, 0, sizeof rec); rec.r.ver.version = 3; @@ -598,8 +610,8 @@ create_version_record (ctrl_t ctrl) rec.r.ver.marginals = opt.marginals_needed; rec.r.ver.completes = opt.completes_needed; rec.r.ver.cert_depth = opt.max_cert_depth; - if (opt.trust_model == TM_PGP || opt.trust_model == TM_CLASSIC) - rec.r.ver.trust_model = opt.trust_model; + if (opt_tm == TM_PGP || opt_tm == TM_CLASSIC) + rec.r.ver.trust_model = opt_tm; else rec.r.ver.trust_model = TM_PGP; rec.r.ver.min_cert_level = opt.min_cert_level; @@ -883,16 +895,25 @@ tdbio_db_matches_options() { TRUSTREC vr; int rc; + int opt_tm, tm; rc = tdbio_read_record (0, &vr, RECTYPE_VER); if( rc ) log_fatal( _("%s: error reading version record: %s\n"), db_name, gpg_strerror (rc) ); + /* Consider tofu and pgp the same. */ + tm = vr.r.ver.trust_model; + if (tm == TM_TOFU || tm == TM_TOFU_PGP) + tm = TM_PGP; + opt_tm = opt.trust_model; + if (opt_tm == TM_TOFU || opt_tm == TM_TOFU_PGP) + opt_tm = TM_PGP; + yes_no = vr.r.ver.marginals == opt.marginals_needed && vr.r.ver.completes == opt.completes_needed && vr.r.ver.cert_depth == opt.max_cert_depth - && vr.r.ver.trust_model == opt.trust_model + && tm == opt_tm && vr.r.ver.min_cert_level == opt.min_cert_level; } commit e486fb2495cf5a7506463b4e42144fb8d6a1f42d Author: Werner Koch Date: Thu Oct 4 09:57:03 2018 +0200 gpg: Add new card vendor -- (cherry picked from commit 3c2ffd27f36dfe77005aa01005145904761d8743) diff --git a/g10/card-util.c b/g10/card-util.c index 3148de0..397a8d6 100644 --- a/g10/card-util.c +++ b/g10/card-util.c @@ -216,6 +216,7 @@ get_manufacturer (unsigned int no) case 0x1337: return "Warsaw Hackerspace"; case 0x2342: return "warpzone"; /* hackerspace Muenster. */ + case 0x4354: return "Confidential Technologies"; /* cotech.de */ case 0x63AF: return "Trustica"; case 0xBD0E: return "Paranoidlabs"; case 0xF517: return "FSIJ"; commit ab7a907a184f37ddafaa0dc7200c76b735ba4853 Author: Werner Koch Date: Fri Sep 7 11:48:18 2018 +0200 dirmngr: Emit SOURCE status also on NO_DATA. * dirmngr/ks-engine-hkp.c (ks_hkp_search): Send SOURCE status also on NO DATA error. (ks_hkp_get): Ditto. * g10/call-dirmngr.c (gpg_dirmngr_ks_search): Print "data source" info also on error. (gpg_dirmngr_ks_get): Ditto. -- If a keyserver does not return any data it can be useful to know which keyserver out of the pool answered. Signed-off-by: Werner Koch (cherry picked from commit bee65edfbc8cc2c369e5941cc9d1a01a0519b388) diff --git a/dirmngr/ks-engine-hkp.c b/dirmngr/ks-engine-hkp.c index 32840e6..7c2836c 100644 --- a/dirmngr/ks-engine-hkp.c +++ b/dirmngr/ks-engine-hkp.c @@ -1493,7 +1493,11 @@ ks_hkp_search (ctrl_t ctrl, parsed_uri_t uri, const char *pattern, goto again; } if (err) - goto leave; + { + if (gpg_err_code (err) == GPG_ERR_NO_DATA) + dirmngr_status (ctrl, "SOURCE", hostport, NULL); + goto leave; + } err = dirmngr_status (ctrl, "SOURCE", hostport, NULL); if (err) @@ -1628,7 +1632,11 @@ ks_hkp_get (ctrl_t ctrl, parsed_uri_t uri, const char *keyspec, estream_t *r_fp) goto again; } if (err) - goto leave; + { + if (gpg_err_code (err) == GPG_ERR_NO_DATA) + dirmngr_status (ctrl, "SOURCE", hostport, NULL); + goto leave; + } err = dirmngr_status (ctrl, "SOURCE", hostport, NULL); if (err) diff --git a/g10/call-dirmngr.c b/g10/call-dirmngr.c index d086cef..8896f27 100644 --- a/g10/call-dirmngr.c +++ b/g10/call-dirmngr.c @@ -606,6 +606,12 @@ gpg_dirmngr_ks_search (ctrl_t ctrl, const char *searchstr, NULL, NULL, ks_status_cb, &stparm); if (!err) err = cb (cb_value, 0, NULL); /* Send EOF. */ + else if (parm.stparm->source) + { + /* Error but we received a SOURCE status. Tell via callback but + * ignore errors. */ + parm.data_cb (parm.data_cb_value, 1, parm.stparm->source); + } xfree (get_membuf (&parm.saveddata, NULL)); xfree (parm.helpbuf); @@ -648,6 +654,7 @@ ks_get_data_cb (void *opaque, const void *data, size_t datalen) If R_SOURCE is not NULL the source of the data is stored as a malloced string there. If a source is not known NULL is stored. + Note that this may even be returned after an error. If there are too many patterns the function returns an error. That could be fixed by issuing several search commands or by @@ -735,13 +742,13 @@ gpg_dirmngr_ks_get (ctrl_t ctrl, char **pattern, *r_fp = parm.memfp; parm.memfp = NULL; - if (r_source) + + leave: + if (r_source && stparm.source) { *r_source = stparm.source; stparm.source = NULL; } - - leave: es_fclose (parm.memfp); xfree (stparm.source); xfree (line); ----------------------------------------------------------------------- Summary of changes: dirmngr/ks-engine-hkp.c | 12 +++++- dirmngr/ocsp.c | 27 +++++++++++++ doc/gpg.texi | 3 +- g10/call-dirmngr.c | 13 ++++-- g10/card-util.c | 1 + g10/tdbio.c | 29 ++++++++++++-- tools/mime-maker.c | 47 ++-------------------- tools/rfc822parse.c | 103 +++++++++++++++++++++++++++++++++++++++--------- tools/rfc822parse.h | 2 + 9 files changed, 165 insertions(+), 72 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 5 10:31:07 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 05 Nov 2018 10:31:07 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-44-gbded8eb Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via bded8ebc59c7fdad2617f4c9232a58047656834c (commit) from 13e09bd21a531b448f2f34b1f075315502b76fb6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bded8ebc59c7fdad2617f4c9232a58047656834c Author: Werner Koch Date: Mon Nov 5 10:30:27 2018 +0100 gpg: Avoid error diagnostics with --override-session-key. * src/engine-gpg.c (gpg_decrypt): Add --no-keyring. -- GnuPG-bug-id: 3464 Signed-off-by: Werner Koch diff --git a/src/engine-gpg.c b/src/engine-gpg.c index aed933e..17fba80 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -1694,7 +1694,14 @@ gpg_decrypt (void *engine, strlen (override_session_key), 1); if (!err) { - err = add_arg (gpg, "--override-session-key-fd"); + /* We add --no-keyring because a keyring is not required + * when we are overriding the session key. It would + * work without that option but --no-keyring avoids that + * gpg return a failure due to a missing key log_error() + * diagnostic. --no-keyring is supported since 2.1.14. */ + err = add_arg (gpg, "--no-keyring"); + if (!err) + err = add_arg (gpg, "--override-session-key-fd"); if (!err) err = add_data (gpg, gpg->override_session_key, -2, 0); } ----------------------------------------------------------------------- Summary of changes: src/engine-gpg.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 5 12:48:05 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 05 Nov 2018 12:48:05 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-251-gd7323bb Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via d7323bb2d957fbeb8192c0ecbd99b1d14d302912 (commit) from a3a5a2451924640588e5ecc03a1d4ba6a6ba94a5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d7323bb2d957fbeb8192c0ecbd99b1d14d302912 Author: Werner Koch Date: Mon Nov 5 12:47:44 2018 +0100 speedo: Remove obsolete configure option of gpgme. * build-aux/speedo.mk (speedo_pkg_gpgme_configure): Remove --disable-w32-qt option. -- This option is obsolete since GPGME 1.7 (in 2016) Signed-off-by: Werner Koch diff --git a/build-aux/speedo.mk b/build-aux/speedo.mk index 5ec5823..d0f97f3 100644 --- a/build-aux/speedo.mk +++ b/build-aux/speedo.mk @@ -521,12 +521,12 @@ endif # The LDFLAGS is needed for -lintl for glib. ifeq ($(WITH_GUI),1) speedo_pkg_gpgme_configure = \ - --enable-static --enable-w32-glib --disable-w32-qt \ + --enable-static --enable-w32-glib \ --with-gpg-error-prefix=$(idir) \ LDFLAGS=-L$(idir)/lib else speedo_pkg_gpgme_configure = \ - --disable-static --disable-w32-glib --disable-w32-qt \ + --disable-static --disable-w32-glib \ --with-gpg-error-prefix=$(idir) \ LDFLAGS=-L$(idir)/lib endif ----------------------------------------------------------------------- Summary of changes: build-aux/speedo.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 5 13:19:45 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 05 Nov 2018 13:19:45 +0100 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.10-29-g593895a Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 593895a5e495c4647efa7db164356f3cae3d5759 (commit) via 62686b56da19b3a7184dc342cede5c9d20d150d7 (commit) from 50756927ce6247abc2fadefbc76c58b75c8a7586 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 593895a5e495c4647efa7db164356f3cae3d5759 Author: Werner Koch Date: Mon Nov 5 12:47:44 2018 +0100 speedo: Remove obsolete configure option of gpgme. * build-aux/speedo.mk (speedo_pkg_gpgme_configure): Remove --disable-w32-qt option. -- This option is obsolete since GPGME 1.7 (in 2016) Signed-off-by: Werner Koch (cherry picked from commit d7323bb2d957fbeb8192c0ecbd99b1d14d302912) diff --git a/build-aux/speedo.mk b/build-aux/speedo.mk index bfbce05..9c4189a 100644 --- a/build-aux/speedo.mk +++ b/build-aux/speedo.mk @@ -521,12 +521,12 @@ endif # The LDFLAGS is needed for -lintl for glib. ifeq ($(WITH_GUI),1) speedo_pkg_gpgme_configure = \ - --enable-static --enable-w32-glib --disable-w32-qt \ + --enable-static --enable-w32-glib \ --with-gpg-error-prefix=$(idir) \ LDFLAGS=-L$(idir)/lib else speedo_pkg_gpgme_configure = \ - --disable-static --disable-w32-glib --disable-w32-qt \ + --disable-static --disable-w32-glib \ --with-gpg-error-prefix=$(idir) \ LDFLAGS=-L$(idir)/lib endif commit 62686b56da19b3a7184dc342cede5c9d20d150d7 Author: Werner Koch Date: Mon Nov 5 08:59:13 2018 +0100 speedo: Include Windows patch for gpgme 1.12.0 -- We don't want to do a release of gpgme right now, so we include just this minimal but important fix. diff --git a/Makefile.am b/Makefile.am index 680fe1b..2c7a462 100644 --- a/Makefile.am +++ b/Makefile.am @@ -58,6 +58,7 @@ EXTRA_DIST = build-aux/config.rpath build-aux/potomo autogen.sh autogen.rc \ build-aux/speedo/patches/atk-1.32.0.patch \ build-aux/speedo/patches/libiconv-1.14.patch \ build-aux/speedo/patches/pango-1.29.4.patch \ + build-aux/speedo/patches/gpgme-1.12.0.patch \ build-aux/speedo/patches/sqlite.patch diff --git a/build-aux/speedo/patches/gpgme-1.12.0.patch b/build-aux/speedo/patches/gpgme-1.12.0.patch new file mode 100755 index 0000000..1920dcf --- /dev/null +++ b/build-aux/speedo/patches/gpgme-1.12.0.patch @@ -0,0 +1,36 @@ +#! /bin/sh +patch -p1 -l -f $* < $0 +exit $? + + From 4faa0ccf58c7a0f64f51dcbc8466add660080414 Mon Sep 17 00:00:00 2001 + From: Werner Koch + Date: Fri, 2 Nov 2018 11:26:19 +0100 + Subject: [PATCH] w32: Don't use CloseHandle on an arbitrary integer. + + * src/assuan-support.c (my_waitpid): Do not close the PID = it is not + a handle. + -- + + At some time in the distant past we might have used the process object + as pid which obviously required a close. However this was changed and + so what we did here was to close an arbitrary handle (one which + matches the pid). + + GnuPG-bug-id: 4237 + Signed-off-by: Werner Koch + +diff --git a/src/assuan-support.c b/src/assuan-support.c +index 7fbd48a8..705088e4 100644 +--- a/src/assuan-support.c ++++ b/src/assuan-support.c +@@ -219,7 +219,7 @@ my_waitpid (assuan_context_t ctx, pid_t pid, + (void)nowait; + (void)status; + (void)options; +- CloseHandle ((HANDLE) pid); ++ (void)pid; /* Just a number without a kernel object. */ + #else + /* We can't just release the PID, a waitpid is mandatory. But + NOWAIT in POSIX systems just means the caller already did the +-- +2.11.0 ----------------------------------------------------------------------- Summary of changes: Makefile.am | 1 + build-aux/speedo.mk | 4 ++-- build-aux/speedo/patches/gpgme-1.12.0.patch | 36 +++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100755 build-aux/speedo/patches/gpgme-1.12.0.patch hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 5 19:58:26 2018 From: cvs at cvs.gnupg.org (by Jussi Kivilinna) Date: Mon, 05 Nov 2018 19:58:26 +0100 Subject: [git] GCRYPT - branch, master, updated. libgcrypt-1.8.1-123-g23f56d3 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, master has been updated via 23f56d3359ca7d152aa87874ddd6305171a91408 (commit) via d6c6680ca31c05bafbb8becda56da051346eceb3 (commit) via 4faeaa1cbd235a2560fa04a8ac3766a07029acd8 (commit) via 0068d41d9304ebcdb2caba1fa8848925e2bfaac7 (commit) via 30e783ec487466132324673f197d36b85a91b060 (commit) via ec49013d23d9a7b874c42d77ceb08bd313ba69e1 (commit) via 2aece89d3967e692743541cea857f2e4771b0b62 (commit) from a2e0cb1542818ad8a71de34ccbf191adab0a0b86 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 23f56d3359ca7d152aa87874ddd6305171a91408 Author: Jussi Kivilinna Date: Mon Nov 5 20:42:58 2018 +0200 stdmem: free: only call _gcry_secmem_free if needed * src/stdmem.c (_gcry_private_free): Check if memory is secure before calling _gcry_secmem_free to avoid unnecessarily taking secmem lock. -- Unnecessarily taking secmem lock on non-secure memory can result poor performance on multi-threaded workloads: https://lists.gnupg.org/pipermail/gcrypt-devel/2018-August/004535.html Reported-by: Christian Grothoff Signed-off-by: Jussi Kivilinna diff --git a/src/stdmem.c b/src/stdmem.c index cbda8d8..04ce64f 100644 --- a/src/stdmem.c +++ b/src/stdmem.c @@ -224,19 +224,23 @@ void _gcry_private_free (void *a) { unsigned char *p = a; + unsigned char *freep; if (!p) return; - if (use_m_guard ) + if (use_m_guard) { - _gcry_private_check_heap(p); - if (! _gcry_secmem_free (p - EXTRA_ALIGN - 4)) - { - free (p - EXTRA_ALIGN - 4); - } + _gcry_private_check_heap (p); + freep = p - EXTRA_ALIGN - 4; + } + else + { + freep = p; } - else if (!_gcry_secmem_free (p)) + + if (!_gcry_private_is_secure (freep) || + !_gcry_secmem_free (freep)) { - free(p); + free (freep); } } commit d6c6680ca31c05bafbb8becda56da051346eceb3 Author: Jussi Kivilinna Date: Mon Nov 5 20:42:58 2018 +0200 secmem: fix potential memory visibility issue * configure.ac (gcry_cv_have_sync_synchronize): New check. * src/secmem.c (pooldesc_s): Make next pointer volatile. (memory_barrier): New. (_gcry_secmem_malloc_internal): Insert memory barrier between pool->next and mainpool.next assigments. (_gcry_private_is_secure): Update comments. -- Signed-off-by: Jussi Kivilinna diff --git a/configure.ac b/configure.ac index 4e4f1f7..9803d51 100644 --- a/configure.ac +++ b/configure.ac @@ -859,6 +859,21 @@ fi # +# Check for __sync_synchronize intrinsic. +# +AC_CACHE_CHECK(for __sync_synchronize, + [gcry_cv_have_sync_synchronize], + [gcry_cv_have_sync_synchronize=no + AC_LINK_IFELSE([AC_LANG_PROGRAM([], + [__sync_synchronize(); return 0;])], + [gcry_cv_have_sync_synchronize=yes])]) +if test "$gcry_cv_have_sync_synchronize" = "yes" ; then + AC_DEFINE(HAVE_SYNC_SYNCHRONIZE, 1, + [Defined if compiler has '__sync_synchronize' intrinsic]) +fi + + +# # Check for VLA support (variable length arrays). # AC_CACHE_CHECK(whether the variable length arrays are supported, diff --git a/src/secmem.c b/src/secmem.c index 3e091d8..b6f07c5 100644 --- a/src/secmem.c +++ b/src/secmem.c @@ -64,7 +64,7 @@ typedef struct pooldesc_s { /* A link to the next pool. This is used to connect the overflow * pools. */ - struct pooldesc_s *next; + struct pooldesc_s * volatile next; /* A memory buffer used as allocation pool. */ void *mem; @@ -118,6 +118,29 @@ GPGRT_LOCK_DEFINE (secmem_lock); #define ADDR_TO_BLOCK(addr) \ (memblock_t *) (void *) ((char *) addr - BLOCK_HEAD_SIZE) + +/* Memory barrier */ +static inline void +memory_barrier(void) +{ +#ifdef HAVE_SYNC_SYNCHRONIZE +#ifdef HAVE_GCC_ASM_VOLATILE_MEMORY + asm volatile ("":::"memory"); +#endif + /* Use GCC / clang intrinsic for memory barrier. */ + __sync_synchronize(); +#else + /* Slow portable alternative, implement memory barrier by using mutex. */ + gpgrt_lock_t tmp; + memset (&tmp, 0, sizeof(tmp)); + gpgrt_lock_init (&tmp); + gpgrt_lock_lock (&tmp); + gpgrt_lock_unlock (&tmp); + gpgrt_lock_destroy (&tmp); +#endif +} + + /* Check whether P points into POOL. */ static inline int ptr_into_pool_p (pooldesc_t *pool, const void *p) @@ -520,7 +543,7 @@ _gcry_secmem_get_flags (void) } -/* This function initializes the main memory pool MAINPOOL. Itis +/* This function initializes the main memory pool MAINPOOL. It is * expected to be called with the secmem lock held. */ static void _gcry_secmem_init_internal (size_t n) @@ -670,8 +693,12 @@ _gcry_secmem_malloc_internal (size_t size, int xhint) pool->okay = 1; /* Take care: in _gcry_private_is_secure we do not lock and thus - * we assume that the second assignment below is atomic. */ + * we assume that the second assignment below is atomic. Memory + * barrier prevents reordering of stores to new pool structure after + * MAINPOOL.NEXT assigment and prevents _gcry_private_is_secure seeing + * non-initialized POOL->NEXT pointers. */ pool->next = mainpool.next; + memory_barrier(); mainpool.next = pool; /* After the first time we allocated an overflow pool, print a @@ -811,9 +838,13 @@ _gcry_private_is_secure (const void *p) { pooldesc_t *pool; - /* We do no lock here because once a pool is allocatred it will not - * be removed anymore (except for gcry_secmem_term). Further, - * adding a new pool to the list should be atomic. */ + /* We do no lock here because once a pool is allocated it will not + * be removed anymore (except for gcry_secmem_term). Further, as + * assigment of POOL->NEXT in new pool structure is visible in + * this thread before assigment of MAINPOOL.NEXT, pool list can be + * iterated locklessly. This visiblity is ensured by memory barrier + * between POOL->NEXT and MAINPOOL.NEXT assignments in + * _gcry_secmem_malloc_internal. */ for (pool = &mainpool; pool; pool = pool->next) if (pool->okay && ptr_into_pool_p (pool, p)) return 1; commit 4faeaa1cbd235a2560fa04a8ac3766a07029acd8 Author: Jussi Kivilinna Date: Mon Nov 5 20:42:58 2018 +0200 wipememory: use memset for non-constant length or large buffer wipes * src/g10lib.h (CONSTANT_P): New. (_gcry_wipememory2): New prototype. (wipememory2): Use _gcry_wipememory2 if _len not constant expression or lenght is larger than 64 bytes. (FASTWIPE_T, FASTWIPE_MULT, fast_wipememory2_unaligned_head): Remove. (fast_wipememory2): Always handle buffer as unaligned. * src/misc.c (__gcry_burn_stack): Move memset_ptr variable to... (memset_ptr): ... here. New. (_gcry_wipememory2): New. -- Signed-off-by: Jussi Kivilinna diff --git a/src/g10lib.h b/src/g10lib.h index c64cbcf..9b21478 100644 --- a/src/g10lib.h +++ b/src/g10lib.h @@ -76,11 +76,13 @@ #endif #if __GNUC__ >= 3 -#define LIKELY( expr ) __builtin_expect( !!(expr), 1 ) -#define UNLIKELY( expr ) __builtin_expect( !!(expr), 0 ) +#define LIKELY(expr) __builtin_expect( !!(expr), 1 ) +#define UNLIKELY(expr) __builtin_expect( !!(expr), 0 ) +#define CONSTANT_P(expr) __builtin_constant_p( expr ) #else -#define LIKELY( expr ) (!!(expr)) -#define UNLIKELY( expr ) (!!(expr)) +#define LIKELY(expr) (!!(expr)) +#define UNLIKELY(expr) (!!(expr)) +#define CONSTANT_P(expr) (0) #endif /* Gettext macros. */ @@ -334,60 +336,50 @@ void __gcry_burn_stack (unsigned int bytes); /* To avoid that a compiler optimizes certain memset calls away, these - macros may be used instead. */ + macros may be used instead. For small constant length buffers, + memory wiping is inlined. For non-constant or large length buffers, + memory is wiped with memset through _gcry_wipememory. */ +void _gcry_wipememory2(void *ptr, int set, size_t len); #define wipememory2(_ptr,_set,_len) do { \ - volatile char *_vptr=(volatile char *)(_ptr); \ - size_t _vlen=(_len); \ - unsigned char _vset=(_set); \ - fast_wipememory2(_vptr,_vset,_vlen); \ - while(_vlen) { *_vptr=(_vset); _vptr++; _vlen--; } \ - } while(0) + if (!CONSTANT_P(_len) || _len > 64) { \ + _gcry_wipememory2((void *)_ptr, _set, _len); \ + } else {\ + volatile char *_vptr = (volatile char *)(_ptr); \ + size_t _vlen = (_len); \ + const unsigned char _vset = (_set); \ + fast_wipememory2(_vptr, _vset, _vlen); \ + while(_vlen) { *_vptr = (_vset); _vptr++; _vlen--; } \ + } \ + } while(0) #define wipememory(_ptr,_len) wipememory2(_ptr,0,_len) -#define FASTWIPE_T u64 -#define FASTWIPE_MULT (U64_C(0x0101010101010101)) - -/* Following architectures can handle unaligned accesses fast. */ #if defined(HAVE_GCC_ATTRIBUTE_PACKED) && \ defined(HAVE_GCC_ATTRIBUTE_ALIGNED) && \ - defined(HAVE_GCC_ATTRIBUTE_MAY_ALIAS) && \ - (defined(__i386__) || defined(__x86_64__) || \ - defined(__powerpc__) || defined(__powerpc64__) || \ - (defined(__arm__) && defined(__ARM_FEATURE_UNALIGNED)) || \ - defined(__aarch64__)) -#define fast_wipememory2_unaligned_head(_ptr,_set,_len) /*do nothing*/ + defined(HAVE_GCC_ATTRIBUTE_MAY_ALIAS) typedef struct fast_wipememory_s { - FASTWIPE_T a; + u64 a; } __attribute__((packed, aligned(1), may_alias)) fast_wipememory_t; +/* fast_wipememory may leave tail bytes unhandled, in which case tail bytes + are handled by wipememory. */ +# define fast_wipememory2(_vptr,_vset,_vlen) do { \ + fast_wipememory_t _vset_long; \ + if (_vlen < sizeof(fast_wipememory_t)) \ + break; \ + _vset_long.a = (_vset); \ + _vset_long.a *= U64_C(0x0101010101010101); \ + do { \ + volatile fast_wipememory_t *_vptr_long = \ + (volatile void *)_vptr; \ + _vptr_long->a = _vset_long.a; \ + _vlen -= sizeof(fast_wipememory_t); \ + _vptr += sizeof(fast_wipememory_t); \ + } while (_vlen >= sizeof(fast_wipememory_t)); \ + } while (0) #else -#define fast_wipememory2_unaligned_head(_vptr,_vset,_vlen) do { \ - while(UNLIKELY((size_t)(_vptr)&(sizeof(FASTWIPE_T)-1)) && _vlen) \ - { *_vptr=(_vset); _vptr++; _vlen--; } \ - } while(0) -typedef struct fast_wipememory_s -{ - FASTWIPE_T a; -} fast_wipememory_t; +# define fast_wipememory2(_vptr,_vset,_vlen) #endif -/* fast_wipememory2 may leave tail bytes unhandled, in which case tail bytes - are handled by wipememory2. */ -#define fast_wipememory2(_vptr,_vset,_vlen) do { \ - FASTWIPE_T _vset_long = _vset; \ - fast_wipememory2_unaligned_head(_vptr,_vset,_vlen); \ - if (_vlen < sizeof(FASTWIPE_T)) \ - break; \ - _vset_long *= FASTWIPE_MULT; \ - do { \ - volatile fast_wipememory_t *_vptr_long = \ - (volatile void *)_vptr; \ - _vptr_long->a = _vset_long; \ - _vlen -= sizeof(FASTWIPE_T); \ - _vptr += sizeof(FASTWIPE_T); \ - } while (_vlen >= sizeof(FASTWIPE_T)); \ - } while (0) - /* Digit predicates. */ diff --git a/src/misc.c b/src/misc.c index 47d2dc7..420ce74 100644 --- a/src/misc.c +++ b/src/misc.c @@ -32,6 +32,8 @@ static int verbosity_level = 0; +static void *(*volatile memset_ptr)(void *, int, size_t) = (void *)memset; + static void (*fatal_error_handler)(void*,int, const char*) = NULL; static void *fatal_error_handler_value = 0; static void (*log_handler)(void*,int, const char*, va_list) = NULL; @@ -498,22 +500,28 @@ _gcry_strtokenize (const char *string, const char *delim) void +_gcry_wipememory2 (void *ptr, int set, size_t len) +{ + memset_ptr (ptr, set, len); +} + + +void __gcry_burn_stack (unsigned int bytes) { #ifdef HAVE_VLA - static void *(*volatile memset_ptr)(void *, int, size_t) = (void *)memset; - /* (bytes == 0 ? 1 : bytes) == (!bytes + bytes) */ - unsigned int buflen = ((!bytes + bytes) + 63) & ~63; - char buf[buflen]; + /* (bytes == 0 ? 1 : bytes) == (!bytes + bytes) */ + unsigned int buflen = ((!bytes + bytes) + 63) & ~63; + char buf[buflen]; - memset_ptr (buf, 0, sizeof buf); + memset_ptr (buf, 0, buflen); #else - volatile char buf[64]; + volatile char buf[64]; - wipememory (buf, sizeof buf); + wipememory (buf, sizeof buf); - if (bytes > sizeof buf) - _gcry_burn_stack (bytes - sizeof buf); + if (bytes > sizeof buf) + _gcry_burn_stack (bytes - sizeof buf); #endif } commit 0068d41d9304ebcdb2caba1fa8848925e2bfaac7 Author: Jussi Kivilinna Date: Mon Nov 5 20:42:58 2018 +0200 Change buf_cpy and buf_xor* functions to use buf_put/buf_get helpers * cipher/bufhelp.h (BUFHELP_FAST_UNALIGNED_ACCESS) (bufhelp_int_s, buf_xor_1): Remove. (buf_cpy, buf_xor, buf_xor_2dst, buf_xor_n_copy_2): Use buf_put/buf_get helpers to handle unaligned memory accesses. -- Signed-off-by: Jussi Kivilinna diff --git a/cipher/bufhelp.h b/cipher/bufhelp.h index 4e97c4d..0e8f599 100644 --- a/cipher/bufhelp.h +++ b/cipher/bufhelp.h @@ -35,277 +35,6 @@ #endif -#undef BUFHELP_FAST_UNALIGNED_ACCESS -#if defined(BUFHELP_UNALIGNED_ACCESS) && \ - (defined(__i386__) || defined(__x86_64__) || \ - (defined(__arm__) && defined(__ARM_FEATURE_UNALIGNED)) || \ - defined(__aarch64__)) -/* These architectures are able of unaligned memory accesses and can - handle those fast. - */ -# define BUFHELP_FAST_UNALIGNED_ACCESS 1 -#endif - - -#ifdef BUFHELP_FAST_UNALIGNED_ACCESS -/* Define type with one-byte alignment on architectures with fast unaligned - memory accesses. - */ -typedef struct bufhelp_int_s -{ - uintptr_t a; -} __attribute__((packed, aligned(1), may_alias)) bufhelp_int_t; -#else -/* Define type with default alignment for other architectures (unaligned - accessed handled in per byte loops). - */ -#ifdef HAVE_GCC_ATTRIBUTE_MAY_ALIAS -typedef struct bufhelp_int_s -{ - uintptr_t a; -} __attribute__((may_alias)) bufhelp_int_t; -#else -typedef struct bufhelp_int_s -{ - uintptr_t a; -} bufhelp_int_t; -#endif -#endif - - -/* Optimized function for small buffer copying */ -static inline void -buf_cpy(void *_dst, const void *_src, size_t len) -{ -#if __GNUC__ >= 4 && (defined(__x86_64__) || defined(__i386__)) - /* For AMD64 and i386, memcpy is faster. */ - memcpy(_dst, _src, len); -#else - byte *dst = _dst; - const byte *src = _src; - bufhelp_int_t *ldst; - const bufhelp_int_t *lsrc; -#ifndef BUFHELP_FAST_UNALIGNED_ACCESS - const unsigned int longmask = sizeof(bufhelp_int_t) - 1; - - /* Skip fast processing if buffers are unaligned. */ - if (UNLIKELY(((uintptr_t)dst | (uintptr_t)src) & longmask)) - goto do_bytes; -#endif - - ldst = (bufhelp_int_t *)(void *)dst; - lsrc = (const bufhelp_int_t *)(const void *)src; - - for (; len >= sizeof(bufhelp_int_t); len -= sizeof(bufhelp_int_t)) - (ldst++)->a = (lsrc++)->a; - - dst = (byte *)ldst; - src = (const byte *)lsrc; - -#ifndef BUFHELP_FAST_UNALIGNED_ACCESS -do_bytes: -#endif - /* Handle tail. */ - for (; len; len--) - *dst++ = *src++; -#endif /*__GNUC__ >= 4 && (__x86_64__ || __i386__)*/ -} - - -/* Optimized function for buffer xoring */ -static inline void -buf_xor(void *_dst, const void *_src1, const void *_src2, size_t len) -{ - byte *dst = _dst; - const byte *src1 = _src1; - const byte *src2 = _src2; - bufhelp_int_t *ldst; - const bufhelp_int_t *lsrc1, *lsrc2; -#ifndef BUFHELP_FAST_UNALIGNED_ACCESS - const unsigned int longmask = sizeof(bufhelp_int_t) - 1; - - /* Skip fast processing if buffers are unaligned. */ - if (UNLIKELY(((uintptr_t)dst | (uintptr_t)src1 | (uintptr_t)src2) & longmask)) - goto do_bytes; -#endif - - ldst = (bufhelp_int_t *)(void *)dst; - lsrc1 = (const bufhelp_int_t *)(const void *)src1; - lsrc2 = (const bufhelp_int_t *)(const void *)src2; - - for (; len >= sizeof(bufhelp_int_t); len -= sizeof(bufhelp_int_t)) - (ldst++)->a = (lsrc1++)->a ^ (lsrc2++)->a; - - dst = (byte *)ldst; - src1 = (const byte *)lsrc1; - src2 = (const byte *)lsrc2; - -#ifndef BUFHELP_FAST_UNALIGNED_ACCESS -do_bytes: -#endif - /* Handle tail. */ - for (; len; len--) - *dst++ = *src1++ ^ *src2++; -} - - -/* Optimized function for in-place buffer xoring. */ -static inline void -buf_xor_1(void *_dst, const void *_src, size_t len) -{ - byte *dst = _dst; - const byte *src = _src; - bufhelp_int_t *ldst; - const bufhelp_int_t *lsrc; -#ifndef BUFHELP_FAST_UNALIGNED_ACCESS - const unsigned int longmask = sizeof(bufhelp_int_t) - 1; - - /* Skip fast processing if buffers are unaligned. */ - if (UNLIKELY(((uintptr_t)dst | (uintptr_t)src) & longmask)) - goto do_bytes; -#endif - - ldst = (bufhelp_int_t *)(void *)dst; - lsrc = (const bufhelp_int_t *)(const void *)src; - - for (; len >= sizeof(bufhelp_int_t); len -= sizeof(bufhelp_int_t)) - (ldst++)->a ^= (lsrc++)->a; - - dst = (byte *)ldst; - src = (const byte *)lsrc; - -#ifndef BUFHELP_FAST_UNALIGNED_ACCESS -do_bytes: -#endif - /* Handle tail. */ - for (; len; len--) - *dst++ ^= *src++; -} - - -/* Optimized function for buffer xoring with two destination buffers. Used - mainly by CFB mode encryption. */ -static inline void -buf_xor_2dst(void *_dst1, void *_dst2, const void *_src, size_t len) -{ - byte *dst1 = _dst1; - byte *dst2 = _dst2; - const byte *src = _src; - bufhelp_int_t *ldst1, *ldst2; - const bufhelp_int_t *lsrc; -#ifndef BUFHELP_FAST_UNALIGNED_ACCESS - const unsigned int longmask = sizeof(bufhelp_int_t) - 1; - - /* Skip fast processing if buffers are unaligned. */ - if (UNLIKELY(((uintptr_t)src | (uintptr_t)dst1 | (uintptr_t)dst2) & longmask)) - goto do_bytes; -#endif - - ldst1 = (bufhelp_int_t *)(void *)dst1; - ldst2 = (bufhelp_int_t *)(void *)dst2; - lsrc = (const bufhelp_int_t *)(const void *)src; - - for (; len >= sizeof(bufhelp_int_t); len -= sizeof(bufhelp_int_t)) - (ldst1++)->a = ((ldst2++)->a ^= (lsrc++)->a); - - dst1 = (byte *)ldst1; - dst2 = (byte *)ldst2; - src = (const byte *)lsrc; - -#ifndef BUFHELP_FAST_UNALIGNED_ACCESS -do_bytes: -#endif - /* Handle tail. */ - for (; len; len--) - *dst1++ = (*dst2++ ^= *src++); -} - - -/* Optimized function for combined buffer xoring and copying. Used by mainly - CBC mode decryption. */ -static inline void -buf_xor_n_copy_2(void *_dst_xor, const void *_src_xor, void *_srcdst_cpy, - const void *_src_cpy, size_t len) -{ - byte *dst_xor = _dst_xor; - byte *srcdst_cpy = _srcdst_cpy; - const byte *src_xor = _src_xor; - const byte *src_cpy = _src_cpy; - byte temp; - bufhelp_int_t *ldst_xor, *lsrcdst_cpy; - const bufhelp_int_t *lsrc_cpy, *lsrc_xor; - uintptr_t ltemp; -#ifndef BUFHELP_FAST_UNALIGNED_ACCESS - const unsigned int longmask = sizeof(bufhelp_int_t) - 1; - - /* Skip fast processing if buffers are unaligned. */ - if (UNLIKELY(((uintptr_t)src_cpy | (uintptr_t)src_xor | (uintptr_t)dst_xor | - (uintptr_t)srcdst_cpy) & longmask)) - goto do_bytes; -#endif - - ldst_xor = (bufhelp_int_t *)(void *)dst_xor; - lsrc_xor = (const bufhelp_int_t *)(void *)src_xor; - lsrcdst_cpy = (bufhelp_int_t *)(void *)srcdst_cpy; - lsrc_cpy = (const bufhelp_int_t *)(const void *)src_cpy; - - for (; len >= sizeof(bufhelp_int_t); len -= sizeof(bufhelp_int_t)) - { - ltemp = (lsrc_cpy++)->a; - (ldst_xor++)->a = (lsrcdst_cpy)->a ^ (lsrc_xor++)->a; - (lsrcdst_cpy++)->a = ltemp; - } - - dst_xor = (byte *)ldst_xor; - src_xor = (const byte *)lsrc_xor; - srcdst_cpy = (byte *)lsrcdst_cpy; - src_cpy = (const byte *)lsrc_cpy; - -#ifndef BUFHELP_FAST_UNALIGNED_ACCESS -do_bytes: -#endif - /* Handle tail. */ - for (; len; len--) - { - temp = *src_cpy++; - *dst_xor++ = *srcdst_cpy ^ *src_xor++; - *srcdst_cpy++ = temp; - } -} - - -/* Optimized function for combined buffer xoring and copying. Used by mainly - CFB mode decryption. */ -static inline void -buf_xor_n_copy(void *_dst_xor, void *_srcdst_cpy, const void *_src, size_t len) -{ - buf_xor_n_copy_2(_dst_xor, _src, _srcdst_cpy, _src, len); -} - - -/* Constant-time compare of two buffers. Returns 1 if buffers are equal, - and 0 if buffers differ. */ -static inline int -buf_eq_const(const void *_a, const void *_b, size_t len) -{ - const byte *a = _a; - const byte *b = _b; - int ab, ba; - size_t i; - - /* Constant-time compare. */ - for (i = 0, ab = 0, ba = 0; i < len; i++) - { - /* If a[i] != b[i], either ab or ba will be negative. */ - ab |= a[i] - b[i]; - ba |= b[i] - a[i]; - } - - /* 'ab | ba' is negative when buffers are not equal. */ - return (ab | ba) >= 0; -} - - #ifndef BUFHELP_UNALIGNED_ACCESS /* Functions for loading and storing unaligned u32 values of different @@ -467,4 +196,188 @@ static inline void buf_put_le64(void *_buf, u64 val) #endif + +/* Optimized function for small buffer copying */ +static inline void +buf_cpy(void *_dst, const void *_src, size_t len) +{ + byte *dst = _dst; + const byte *src = _src; + +#if __GNUC__ >= 4 + if (!__builtin_constant_p (len)) + { + memcpy(_dst, _src, len); + return; + } +#endif + + while (len >= sizeof(u64)) + { + buf_put_he64(dst, buf_get_he64(src)); + dst += sizeof(u64); + src += sizeof(u64); + len -= sizeof(u64); + } + + if (len >= sizeof(u32)) + { + buf_put_he32(dst, buf_get_he32(src)); + dst += sizeof(u32); + src += sizeof(u32); + len -= sizeof(u32); + } + + /* Handle tail. */ + for (; len; len--) + *dst++ = *src++; +} + + +/* Optimized function for buffer xoring */ +static inline void +buf_xor(void *_dst, const void *_src1, const void *_src2, size_t len) +{ + byte *dst = _dst; + const byte *src1 = _src1; + const byte *src2 = _src2; + + while (len >= sizeof(u64)) + { + buf_put_he64(dst, buf_get_he64(src1) ^ buf_get_he64(src2)); + dst += sizeof(u64); + src1 += sizeof(u64); + src2 += sizeof(u64); + len -= sizeof(u64); + } + + if (len > sizeof(u32)) + { + buf_put_he32(dst, buf_get_he32(src1) ^ buf_get_he32(src2)); + dst += sizeof(u32); + src1 += sizeof(u32); + src2 += sizeof(u32); + len -= sizeof(u32); + } + + /* Handle tail. */ + for (; len; len--) + *dst++ = *src1++ ^ *src2++; +} + + +/* Optimized function for buffer xoring with two destination buffers. Used + mainly by CFB mode encryption. */ +static inline void +buf_xor_2dst(void *_dst1, void *_dst2, const void *_src, size_t len) +{ + byte *dst1 = _dst1; + byte *dst2 = _dst2; + const byte *src = _src; + + while (len >= sizeof(u64)) + { + u64 temp = buf_get_he64(dst2) ^ buf_get_he64(src); + buf_put_he64(dst2, temp); + buf_put_he64(dst1, temp); + dst2 += sizeof(u64); + dst1 += sizeof(u64); + src += sizeof(u64); + len -= sizeof(u64); + } + + if (len >= sizeof(u32)) + { + u32 temp = buf_get_he32(dst2) ^ buf_get_he32(src); + buf_put_he32(dst2, temp); + buf_put_he32(dst1, temp); + dst2 += sizeof(u32); + dst1 += sizeof(u32); + src += sizeof(u32); + len -= sizeof(u32); + } + + /* Handle tail. */ + for (; len; len--) + *dst1++ = (*dst2++ ^= *src++); +} + + +/* Optimized function for combined buffer xoring and copying. Used by mainly + CBC mode decryption. */ +static inline void +buf_xor_n_copy_2(void *_dst_xor, const void *_src_xor, void *_srcdst_cpy, + const void *_src_cpy, size_t len) +{ + byte *dst_xor = _dst_xor; + byte *srcdst_cpy = _srcdst_cpy; + const byte *src_xor = _src_xor; + const byte *src_cpy = _src_cpy; + + while (len >= sizeof(u64)) + { + u64 temp = buf_get_he64(src_cpy); + buf_put_he64(dst_xor, buf_get_he64(srcdst_cpy) ^ buf_get_he64(src_xor)); + buf_put_he64(srcdst_cpy, temp); + dst_xor += sizeof(u64); + srcdst_cpy += sizeof(u64); + src_xor += sizeof(u64); + src_cpy += sizeof(u64); + len -= sizeof(u64); + } + + if (len >= sizeof(u32)) + { + u32 temp = buf_get_he32(src_cpy); + buf_put_he32(dst_xor, buf_get_he32(srcdst_cpy) ^ buf_get_he32(src_xor)); + buf_put_he32(srcdst_cpy, temp); + dst_xor += sizeof(u32); + srcdst_cpy += sizeof(u32); + src_xor += sizeof(u32); + src_cpy += sizeof(u32); + len -= sizeof(u32); + } + + /* Handle tail. */ + for (; len; len--) + { + byte temp = *src_cpy++; + *dst_xor++ = *srcdst_cpy ^ *src_xor++; + *srcdst_cpy++ = temp; + } +} + + +/* Optimized function for combined buffer xoring and copying. Used by mainly + CFB mode decryption. */ +static inline void +buf_xor_n_copy(void *_dst_xor, void *_srcdst_cpy, const void *_src, size_t len) +{ + buf_xor_n_copy_2(_dst_xor, _src, _srcdst_cpy, _src, len); +} + + +/* Constant-time compare of two buffers. Returns 1 if buffers are equal, + and 0 if buffers differ. */ +static inline int +buf_eq_const(const void *_a, const void *_b, size_t len) +{ + const byte *a = _a; + const byte *b = _b; + int ab, ba; + size_t i; + + /* Constant-time compare. */ + for (i = 0, ab = 0, ba = 0; i < len; i++) + { + /* If a[i] != b[i], either ab or ba will be negative. */ + ab |= a[i] - b[i]; + ba |= b[i] - a[i]; + } + + /* 'ab | ba' is negative when buffers are not equal. */ + return (ab | ba) >= 0; +} + + #endif /*GCRYPT_BUFHELP_H*/ commit 30e783ec487466132324673f197d36b85a91b060 Author: Jussi Kivilinna Date: Mon Nov 5 20:42:58 2018 +0200 rijndael: fix unused parameter warning * cipher/rijndael.c (do_setkey): Silence unused 'hd' warning. -- This commit fixes "warning: unused parameter 'hd'" warning seen on architectures that do not have alternative AES implementations. Signed-off-by: Jussi Kivilinna diff --git a/cipher/rijndael.c b/cipher/rijndael.c index d126f88..1bc8b0f 100644 --- a/cipher/rijndael.c +++ b/cipher/rijndael.c @@ -264,6 +264,8 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen, unsigned int hwfeatures; #endif + (void)hd; + /* The on-the-fly self tests are only run in non-fips mode. In fips mode explicit self-tests are required. Actually the on-the-fly self-tests are not fully thread-safe and it might happen that a commit ec49013d23d9a7b874c42d77ceb08bd313ba69e1 Author: Jussi Kivilinna Date: Mon Nov 5 20:42:58 2018 +0200 mpi/longlong.h: enable inline assembly for powerpc64 * mpi/longlong.h [__powerpc__ && W_TYPE_SIZE == 64]: Remove '#if 0'. -- PowerPC64 inline assembly was tested on QEMU ('make check' pass). Signed-off-by: Jussi Kivilinna diff --git a/mpi/longlong.h b/mpi/longlong.h index d6958f3..c0f24c8 100644 --- a/mpi/longlong.h +++ b/mpi/longlong.h @@ -1088,7 +1088,6 @@ typedef unsigned int UTItype __attribute__ ((mode (TI))); /* Powerpc 64 bit support taken from gmp-4.1.2. */ /* We should test _IBMR2 here when we add assembly support for the system vendor compilers. */ -#if 0 /* Not yet enabled because we don't have hardware for a test. */ #if (defined (_ARCH_PPC) || defined (__powerpc__)) && W_TYPE_SIZE == 64 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ do { \ @@ -1141,7 +1140,6 @@ typedef unsigned int UTItype __attribute__ ((mode (TI))); #define SMUL_TIME 14 /* ??? */ #define UDIV_TIME 120 /* ??? */ #endif /* 64-bit PowerPC. */ -#endif /* if 0 */ /*************************************** ************** PYR ****************** commit 2aece89d3967e692743541cea857f2e4771b0b62 Author: Jussi Kivilinna Date: Mon Nov 5 20:42:58 2018 +0200 Change remaining users of _gcry_fips_mode to use fips_mode * src/fips.c (_gcry_fips_mode): Remove. (_gcry_enforced_fips_mode, _gcry_inactivate_fips_mode) (_gcry_is_fips_mode_inactive): Use fips_mode. * src/g10lib.h (_gcry_fips_mode): Remove. -- Signed-off-by: Jussi Kivilinna diff --git a/src/fips.c b/src/fips.c index 2b3a0af..36358bf 100644 --- a/src/fips.c +++ b/src/fips.c @@ -255,25 +255,11 @@ unlock_fsm (void) } -/* This function returns true if fips mode is enabled. This is - independent of the fips required finite state machine and only used - to enable fips specific code. Please use the fips_mode macro - instead of calling this function directly. */ -int -_gcry_fips_mode (void) -{ - /* No locking is required because we have the requirement that this - variable is only initialized once with no other threads - existing. */ - return !_gcry_no_fips_mode_required; -} - - /* Return a flag telling whether we are in the enforced fips mode. */ int _gcry_enforced_fips_mode (void) { - if (!_gcry_fips_mode ()) + if (!fips_mode ()) return 0; return enforced_fips_mode; } @@ -292,7 +278,7 @@ _gcry_set_enforced_fips_mode (void) void _gcry_inactivate_fips_mode (const char *text) { - gcry_assert (_gcry_fips_mode ()); + gcry_assert (fips_mode ()); if (_gcry_enforced_fips_mode () ) { @@ -323,7 +309,7 @@ _gcry_is_fips_mode_inactive (void) { int flag; - if (!_gcry_fips_mode ()) + if (!fips_mode ()) return 0; lock_fsm (); flag = inactive_fips_mode; diff --git a/src/g10lib.h b/src/g10lib.h index c1f84ee..c64cbcf 100644 --- a/src/g10lib.h +++ b/src/g10lib.h @@ -427,8 +427,6 @@ extern int _gcry_no_fips_mode_required; void _gcry_initialize_fips_mode (int force); -int _gcry_fips_mode (void); - /* This macro returns true if fips mode is enabled. This is independent of the fips required finite state machine and only used to enable fips specific code. ----------------------------------------------------------------------- Summary of changes: cipher/bufhelp.h | 455 ++++++++++++++++++++++-------------------------------- cipher/rijndael.c | 2 + configure.ac | 15 ++ mpi/longlong.h | 2 - src/fips.c | 20 +-- src/g10lib.h | 88 +++++------ src/misc.c | 26 ++-- src/secmem.c | 43 +++++- src/stdmem.c | 20 ++- 9 files changed, 309 insertions(+), 362 deletions(-) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 5 20:58:36 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 05 Nov 2018 20:58:36 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-252-ge3a1e80 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via e3a1e80d13487c9336640a99b2f6d385d7d6f55c (commit) from d7323bb2d957fbeb8192c0ecbd99b1d14d302912 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e3a1e80d13487c9336640a99b2f6d385d7d6f55c Author: Werner Koch Date: Mon Nov 5 20:58:27 2018 +0100 wks: New option --with-colons for gpg-wks-client. * tools/gpg-wks.h (opt): Add field with_colons. * tools/gpg-wks-client.c (oWithColons): New const. (opts, parse_arguments): Add option --with-colons. (main): Change aSupported to take several domains in --with-colons mode. (command_send): Factor policy getting code out to ... (get_policy_and_sa): New function. (command_supported): Make use of new function. -- In addition to this the --create command now also supports a submission address only in the policy file. That means the submission-address file is not anymore required and can be replaced by the policy file. Signed-off-by: Werner Koch diff --git a/doc/wks.texi b/doc/wks.texi index bd2b8d5..03d7482 100644 --- a/doc/wks.texi +++ b/doc/wks.texi @@ -65,7 +65,8 @@ site supports the Web Key Service. The argument is an arbitrary address in the to be tested domain. For example @file{foo@@example.net}. The command returns success if the Web Key Service is supported. The operation is silent; to get diagnostic -output use the option @option{--verbose}. +output use the option @option{--verbose}. See option + at option{--with-colons} for a variant of this command. With the @option{--check} command the caller can test whether a key exists for a supplied mail address. The command returns success if a @@ -109,6 +110,44 @@ $(gpgconf --list-dirs libexecdir)/gpg-wks-client --check foo@@example.net Directly send created mails using the @command{sendmail} command. Requires installation of that command. + at item --with-colons + at opindex with-colons +This option has currently only an effect on the @option{--supported} +command. If it is used all arguimenst on the command line are taken +as domain names and tested for WKD support. The output format is one +line per domain with colon delimited fields. The currently specified +fields are (future versions may specify additional fields): + + at table @asis + + @item 1 - domain + This is the domain name. Although quoting is not required for valid + domain names this field is specified to be quoted in standard C + manner. + + @item 2 - WKD + If the value is true the domain supports the Web Key Directory. + + @item 3 - WKS + If the value is true the domain supports the Web Key Service + protocol to upload keys to the directory. + + @item 4 - error-code + This may contain an gpg-error code to describe certain + failures. Use @samp{gpg-error CODE} to explain the code. + + @item 5 - protocol-version + The minimum protocol version supported by the server. + + @item 6 - auth-submit + The auth-submit flag from the policy file of the server. + + @item 7 - mailbox-only + The mailbox-only flag from the policy file of the server. + at end table + + + @item --output @var{file} @itemx -o @opindex output diff --git a/tools/gpg-wks-client.c b/tools/gpg-wks-client.c index 73945ff..bf6b119 100644 --- a/tools/gpg-wks-client.c +++ b/tools/gpg-wks-client.c @@ -61,6 +61,7 @@ enum cmd_and_opt_values oSend, oFakeSubmissionAddr, oStatusFD, + oWithColons, oDummy }; @@ -90,6 +91,7 @@ static ARGPARSE_OPTS opts[] = { ARGPARSE_s_n (oSend, "send", "send the mail using sendmail"), ARGPARSE_s_s (oOutput, "output", "|FILE|write the mail to FILE"), ARGPARSE_s_i (oStatusFD, "status-fd", N_("|FD|write status info to this FD")), + ARGPARSE_s_n (oWithColons, "with-colons", "@"), ARGPARSE_s_s (oFakeSubmissionAddr, "fake-submission-addr", "@"), @@ -204,6 +206,9 @@ parse_arguments (ARGPARSE_ARGS *pargs, ARGPARSE_OPTS *popts) case oStatusFD: wks_set_status_fd (translate_sys2libc_fd_int (pargs->r.ret_int, 1)); break; + case oWithColons: + opt.with_colons = 1; + break; case aSupported: case aCreate: @@ -271,11 +276,20 @@ main (int argc, char **argv) switch (cmd) { case aSupported: - if (argc != 1) - wrong_args ("--supported USER-ID"); - err = command_supported (argv[0]); - if (err && gpg_err_code (err) != GPG_ERR_FALSE) - log_error ("checking support failed: %s\n", gpg_strerror (err)); + if (opt.with_colons) + { + for (; argc; argc--, argv++) + command_supported (*argv); + err = 0; + } + else + { + if (argc != 1) + wrong_args ("--supported DOMAIN"); + err = command_supported (argv[0]); + if (err && gpg_err_code (err) != GPG_ERR_FALSE) + log_error ("checking support failed: %s\n", gpg_strerror (err)); + } break; case aCreate: @@ -471,6 +485,134 @@ decrypt_stream (estream_t *r_output, struct decrypt_stream_parm_s *decinfo, } +/* Return the submission address for the address or just the domain in + * ADDRSPEC. The submission address is stored as a malloced string at + * R_SUBMISSION_ADDRESS. At R_POLICY the policy flags of the domain + * are stored. The caller needs to free them with wks_free_policy. + * The function returns an error code on failure to find a submission + * address or policy file. Note: The function may store NULL at + * R_SUBMISSION_ADDRESS but return success to indicate that the web + * key directory is supported but not the web key service. As per WKD + * specs a policy file is always required and will thus be return on + * success. */ +static gpg_error_t +get_policy_and_sa (const char *addrspec, int silent, + policy_flags_t *r_policy, char **r_submission_address) +{ + gpg_error_t err; + estream_t mbuf = NULL; + const char *domain; + const char *s; + policy_flags_t policy = NULL; + char *submission_to = NULL; + + *r_submission_address = NULL; + *r_policy = NULL; + + domain = strchr (addrspec, '@'); + if (domain) + domain++; + + if (opt.with_colons) + { + s = domain? domain : addrspec; + es_write_sanitized (es_stdout, s, strlen (s), ":", NULL); + es_putc (':', es_stdout); + } + + /* We first try to get the submission address from the policy file + * (this is the new method). If both are available we check that + * they match and print a warning if not. In the latter case we + * keep on using the one from the submission-address file. */ + err = wkd_get_policy_flags (addrspec, &mbuf); + if (err && gpg_err_code (err) != GPG_ERR_NO_DATA + && gpg_err_code (err) != GPG_ERR_NO_NAME) + { + if (!opt.with_colons) + log_error ("error reading policy flags for '%s': %s\n", + domain, gpg_strerror (err)); + goto leave; + } + if (!mbuf) + { + if (!opt.with_colons) + log_error ("provider for '%s' does NOT support the Web Key Directory\n", + addrspec); + err = gpg_error (GPG_ERR_FALSE); + goto leave; + } + + policy = xtrycalloc (1, sizeof *policy); + if (!policy) + err = gpg_error_from_syserror (); + else + err = wks_parse_policy (policy, mbuf, 1); + es_fclose (mbuf); + mbuf = NULL; + if (err) + goto leave; + + err = wkd_get_submission_address (addrspec, &submission_to); + if (err && !policy->submission_address) + { + if (!silent && !opt.with_colons) + log_error (_("error looking up submission address for domain '%s'" + ": %s\n"), domain, gpg_strerror (err)); + if (!silent && gpg_err_code (err) == GPG_ERR_NO_DATA && !opt.with_colons) + log_error (_("this domain probably doesn't support WKS.\n")); + goto leave; + } + + if (submission_to && policy->submission_address + && ascii_strcasecmp (submission_to, policy->submission_address)) + log_info ("Warning: different submission addresses (sa=%s, po=%s)\n", + submission_to, policy->submission_address); + + if (!submission_to && policy->submission_address) + { + submission_to = xtrystrdup (policy->submission_address); + if (!submission_to) + { + err = gpg_error_from_syserror (); + goto leave; + } + } + + leave: + *r_submission_address = submission_to; + submission_to = NULL; + *r_policy = policy; + policy = NULL; + + if (opt.with_colons) + { + if (*r_policy && !*r_submission_address) + es_fprintf (es_stdout, "1:0::"); + else if (*r_policy && *r_submission_address) + es_fprintf (es_stdout, "1:1::"); + else if (err && !(gpg_err_code (err) == GPG_ERR_FALSE + || gpg_err_code (err) == GPG_ERR_NO_DATA + || gpg_err_code (err) == GPG_ERR_UNKNOWN_HOST)) + es_fprintf (es_stdout, "0:0:%d:", err); + else + es_fprintf (es_stdout, "0:0::"); + if (*r_policy) + { + es_fprintf (es_stdout, "%u:%u:%u:", + (*r_policy)->protocol_version, + (*r_policy)->auth_submit, + (*r_policy)->mailbox_only); + } + es_putc ('\n', es_stdout); + } + + xfree (submission_to); + wks_free_policy (policy); + xfree (policy); + es_fclose (mbuf); + return err; +} + /* Check whether the provider supports the WKS protocol. */ @@ -480,6 +622,7 @@ command_supported (char *userid) gpg_error_t err; char *addrspec = NULL; char *submission_to = NULL; + policy_flags_t policy = NULL; if (!strchr (userid, '@')) { @@ -497,24 +640,41 @@ command_supported (char *userid) } /* Get the submission address. */ - err = wkd_get_submission_address (addrspec, &submission_to); - if (err) + err = get_policy_and_sa (addrspec, 1, &policy, &submission_to); + if (err || !submission_to) { - if (gpg_err_code (err) == GPG_ERR_NO_DATA - || gpg_err_code (err) == GPG_ERR_UNKNOWN_HOST) + if (!submission_to + || gpg_err_code (err) == GPG_ERR_FALSE + || gpg_err_code (err) == GPG_ERR_NO_DATA + || gpg_err_code (err) == GPG_ERR_UNKNOWN_HOST + ) { - if (opt.verbose) - log_info ("provider for '%s' does NOT support WKS (%s)\n", - addrspec, gpg_strerror (err)); + /* FALSE is returned if we already figured out that even the + * Web Key Directory is not supported and thus printed an + * error message. */ + if (opt.verbose && gpg_err_code (err) != GPG_ERR_FALSE + && !opt.with_colons) + { + if (gpg_err_code (err) == GPG_ERR_NO_DATA) + log_info ("provider for '%s' does NOT support WKS\n", + addrspec); + else + log_info ("provider for '%s' does NOT support WKS (%s)\n", + addrspec, gpg_strerror (err)); + } err = gpg_error (GPG_ERR_FALSE); - log_inc_errorcount (); + if (!opt.with_colons) + log_inc_errorcount (); } goto leave; } - if (opt.verbose) + + if (opt.verbose && !opt.with_colons) log_info ("provider for '%s' supports WKS\n", addrspec); leave: + wks_free_policy (policy); + xfree (policy); xfree (submission_to); xfree (addrspec); return err; @@ -628,7 +788,7 @@ command_send (const char *fingerprint, const char *userid) estream_t keyenc = NULL; char *submission_to = NULL; mime_maker_t mime = NULL; - struct policy_flags_s policy; + policy_flags_t policy = NULL; int no_encrypt = 0; int posteo_hack = 0; const char *domain; @@ -636,8 +796,6 @@ command_send (const char *fingerprint, const char *userid) uidinfo_list_t uid, thisuid; time_t thistime; - memset (&policy, 0, sizeof policy); - if (classify_user_id (fingerprint, &desc, 1) || !(desc.mode == KEYDB_SEARCH_MODE_FPR || desc.mode == KEYDB_SEARCH_MODE_FPR20)) @@ -665,62 +823,26 @@ command_send (const char *fingerprint, const char *userid) /* Get the submission address. */ if (fake_submission_addr) { + policy = xcalloc (1, sizeof *policy); submission_to = xstrdup (fake_submission_addr); err = 0; } else { - /* We first try to get the submission address from the policy - * file (this is the new method). If both are available we - * check that they match and print a warning if not. In the - * latter case we keep on using the one from the - * submission-address file. */ - estream_t mbuf; - - err = wkd_get_policy_flags (addrspec, &mbuf); - if (err && gpg_err_code (err) != GPG_ERR_NO_DATA) - { - log_error ("error reading policy flags for '%s': %s\n", - domain, gpg_strerror (err)); - goto leave; - } - if (mbuf) - { - err = wks_parse_policy (&policy, mbuf, 1); - es_fclose (mbuf); - if (err) - goto leave; - } - - err = wkd_get_submission_address (addrspec, &submission_to); - if (err && !policy.submission_address) - { - log_error (_("error looking up submission address for domain '%s'" - ": %s\n"), domain, gpg_strerror (err)); - if (gpg_err_code (err) == GPG_ERR_NO_DATA) - log_error (_("this domain probably doesn't support WKS.\n")); - goto leave; - } - - if (submission_to && policy.submission_address - && ascii_strcasecmp (submission_to, policy.submission_address)) - log_info ("Warning: different submission addresses (sa=%s, po=%s)\n", - submission_to, policy.submission_address); - + err = get_policy_and_sa (addrspec, 0, &policy, &submission_to); + if (err) + goto leave; if (!submission_to) { - submission_to = xtrystrdup (policy.submission_address); - if (!submission_to) - { - err = gpg_error_from_syserror (); - goto leave; - } + log_error (_("this domain probably doesn't support WKS.\n")); + err = gpg_error (GPG_ERR_NO_DATA); + goto leave; } } log_info ("submitting request to '%s'\n", submission_to); - if (policy.auth_submit) + if (policy->auth_submit) log_info ("no confirmation required for '%s'\n", addrspec); /* In case the key has several uids with the same addr-spec we will @@ -738,8 +860,7 @@ command_send (const char *fingerprint, const char *userid) { if (!uid->mbox) continue; /* Should not happen anyway. */ - if (policy.mailbox_only - && ascii_strcasecmp (uid->uid, uid->mbox)) + if (policy->mailbox_only && ascii_strcasecmp (uid->uid, uid->mbox)) continue; /* UID has more than just the mailbox. */ if (uid->created > thistime) { @@ -770,7 +891,7 @@ command_send (const char *fingerprint, const char *userid) key = newkey; } - if (policy.mailbox_only + if (policy->mailbox_only && (!thisuid->mbox || ascii_strcasecmp (thisuid->uid, thisuid->mbox))) { log_info ("Warning: policy requires 'mailbox-only'" @@ -791,7 +912,7 @@ command_send (const char *fingerprint, const char *userid) /* Hack to support posteo but let them disable this by setting the * new policy-version flag. */ - if (policy.protocol_version < 3 + if (policy->protocol_version < 3 && !ascii_strcasecmp (domain, "posteo.de")) { log_info ("Warning: Using draft-1 method for domain '%s'\n", domain); @@ -908,7 +1029,8 @@ command_send (const char *fingerprint, const char *userid) free_uidinfo_list (uidlist); es_fclose (keyenc); es_fclose (key); - wks_free_policy (&policy); + wks_free_policy (policy); + xfree (policy); xfree (addrspec); return err; } diff --git a/tools/gpg-wks.h b/tools/gpg-wks.h index 1b91b65..fba73f0 100644 --- a/tools/gpg-wks.h +++ b/tools/gpg-wks.h @@ -36,6 +36,7 @@ struct unsigned int debug; int quiet; int use_sendmail; + int with_colons; const char *output; const char *gpg_program; const char *directory; diff --git a/tools/wks-util.c b/tools/wks-util.c index 862cd33..729098a 100644 --- a/tools/wks-util.c +++ b/tools/wks-util.c @@ -556,7 +556,7 @@ wks_send_mime (mime_maker_t mime) /* Parse the policy flags by reading them from STREAM and storing them - * into FLAGS. If IGNORE_UNKNOWN is iset unknown keywords are + * into FLAGS. If IGNORE_UNKNOWN is set unknown keywords are * ignored. */ gpg_error_t wks_parse_policy (policy_flags_t flags, estream_t stream, int ignore_unknown) ----------------------------------------------------------------------- Summary of changes: doc/wks.texi | 41 +++++++- tools/gpg-wks-client.c | 254 ++++++++++++++++++++++++++++++++++++------------- tools/gpg-wks.h | 1 + tools/wks-util.c | 2 +- 4 files changed, 230 insertions(+), 68 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 5 20:59:54 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 05 Nov 2018 20:59:54 +0100 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.10-30-g66e0bd3 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 66e0bd37ee3dd5ab534b2664493576ef6ad15a08 (commit) from 593895a5e495c4647efa7db164356f3cae3d5759 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 66e0bd37ee3dd5ab534b2664493576ef6ad15a08 Author: Werner Koch Date: Mon Nov 5 20:58:27 2018 +0100 wks: New option --with-colons for gpg-wks-client. * tools/gpg-wks.h (opt): Add field with_colons. * tools/gpg-wks-client.c (oWithColons): New const. (opts, parse_arguments): Add option --with-colons. (main): Change aSupported to take several domains in --with-colons mode. (command_send): Factor policy getting code out to ... (get_policy_and_sa): New function. (command_supported): Make use of new function. -- In addition to this the --create command now also supports a submission address only in the policy file. That means the submission-address file is not anymore required and can be replaced by the policy file. Signed-off-by: Werner Koch (cherry picked from commit e3a1e80d13487c9336640a99b2f6d385d7d6f55c) diff --git a/doc/wks.texi b/doc/wks.texi index b8de296..89288d0 100644 --- a/doc/wks.texi +++ b/doc/wks.texi @@ -65,7 +65,8 @@ site supports the Web Key Service. The argument is an arbitray address in the to be tested domain. For example @file{foo@@example.net}. The command returns success if the Web Key Service is supported. The operation is silent; to get diagnostic -output use the option @option{--verbose}. +output use the option @option{--verbose}. See option + at option{--with-colons} for a variant of this command. With the @option{--check} command the caller can test whether a key exists for a supplied mail address. The command returns success if a @@ -109,6 +110,44 @@ $(gpgconf --list-dirs libexecdir)/gpg-wks-client --check foo@@example.net Directly send created mails using the @command{sendmail} command. Requires installation of that command. + at item --with-colons + at opindex with-colons +This option has currently only an effect on the @option{--supported} +command. If it is used all arguimenst on the command line are taken +as domain names and tested for WKD support. The output format is one +line per domain with colon delimited fields. The currently specified +fields are (future versions may specify additional fields): + + at table @asis + + @item 1 - domain + This is the domain name. Although quoting is not required for valid + domain names this field is specified to be quoted in standard C + manner. + + @item 2 - WKD + If the value is true the domain supports the Web Key Directory. + + @item 3 - WKS + If the value is true the domain supports the Web Key Service + protocol to upload keys to the directory. + + @item 4 - error-code + This may contain an gpg-error code to describe certain + failures. Use @samp{gpg-error CODE} to explain the code. + + @item 5 - protocol-version + The minimum protocol version supported by the server. + + @item 6 - auth-submit + The auth-submit flag from the policy file of the server. + + @item 7 - mailbox-only + The mailbox-only flag from the policy file of the server. + at end table + + + @item --output @var{file} @itemx -o @opindex output diff --git a/tools/gpg-wks-client.c b/tools/gpg-wks-client.c index 73945ff..bf6b119 100644 --- a/tools/gpg-wks-client.c +++ b/tools/gpg-wks-client.c @@ -61,6 +61,7 @@ enum cmd_and_opt_values oSend, oFakeSubmissionAddr, oStatusFD, + oWithColons, oDummy }; @@ -90,6 +91,7 @@ static ARGPARSE_OPTS opts[] = { ARGPARSE_s_n (oSend, "send", "send the mail using sendmail"), ARGPARSE_s_s (oOutput, "output", "|FILE|write the mail to FILE"), ARGPARSE_s_i (oStatusFD, "status-fd", N_("|FD|write status info to this FD")), + ARGPARSE_s_n (oWithColons, "with-colons", "@"), ARGPARSE_s_s (oFakeSubmissionAddr, "fake-submission-addr", "@"), @@ -204,6 +206,9 @@ parse_arguments (ARGPARSE_ARGS *pargs, ARGPARSE_OPTS *popts) case oStatusFD: wks_set_status_fd (translate_sys2libc_fd_int (pargs->r.ret_int, 1)); break; + case oWithColons: + opt.with_colons = 1; + break; case aSupported: case aCreate: @@ -271,11 +276,20 @@ main (int argc, char **argv) switch (cmd) { case aSupported: - if (argc != 1) - wrong_args ("--supported USER-ID"); - err = command_supported (argv[0]); - if (err && gpg_err_code (err) != GPG_ERR_FALSE) - log_error ("checking support failed: %s\n", gpg_strerror (err)); + if (opt.with_colons) + { + for (; argc; argc--, argv++) + command_supported (*argv); + err = 0; + } + else + { + if (argc != 1) + wrong_args ("--supported DOMAIN"); + err = command_supported (argv[0]); + if (err && gpg_err_code (err) != GPG_ERR_FALSE) + log_error ("checking support failed: %s\n", gpg_strerror (err)); + } break; case aCreate: @@ -471,6 +485,134 @@ decrypt_stream (estream_t *r_output, struct decrypt_stream_parm_s *decinfo, } +/* Return the submission address for the address or just the domain in + * ADDRSPEC. The submission address is stored as a malloced string at + * R_SUBMISSION_ADDRESS. At R_POLICY the policy flags of the domain + * are stored. The caller needs to free them with wks_free_policy. + * The function returns an error code on failure to find a submission + * address or policy file. Note: The function may store NULL at + * R_SUBMISSION_ADDRESS but return success to indicate that the web + * key directory is supported but not the web key service. As per WKD + * specs a policy file is always required and will thus be return on + * success. */ +static gpg_error_t +get_policy_and_sa (const char *addrspec, int silent, + policy_flags_t *r_policy, char **r_submission_address) +{ + gpg_error_t err; + estream_t mbuf = NULL; + const char *domain; + const char *s; + policy_flags_t policy = NULL; + char *submission_to = NULL; + + *r_submission_address = NULL; + *r_policy = NULL; + + domain = strchr (addrspec, '@'); + if (domain) + domain++; + + if (opt.with_colons) + { + s = domain? domain : addrspec; + es_write_sanitized (es_stdout, s, strlen (s), ":", NULL); + es_putc (':', es_stdout); + } + + /* We first try to get the submission address from the policy file + * (this is the new method). If both are available we check that + * they match and print a warning if not. In the latter case we + * keep on using the one from the submission-address file. */ + err = wkd_get_policy_flags (addrspec, &mbuf); + if (err && gpg_err_code (err) != GPG_ERR_NO_DATA + && gpg_err_code (err) != GPG_ERR_NO_NAME) + { + if (!opt.with_colons) + log_error ("error reading policy flags for '%s': %s\n", + domain, gpg_strerror (err)); + goto leave; + } + if (!mbuf) + { + if (!opt.with_colons) + log_error ("provider for '%s' does NOT support the Web Key Directory\n", + addrspec); + err = gpg_error (GPG_ERR_FALSE); + goto leave; + } + + policy = xtrycalloc (1, sizeof *policy); + if (!policy) + err = gpg_error_from_syserror (); + else + err = wks_parse_policy (policy, mbuf, 1); + es_fclose (mbuf); + mbuf = NULL; + if (err) + goto leave; + + err = wkd_get_submission_address (addrspec, &submission_to); + if (err && !policy->submission_address) + { + if (!silent && !opt.with_colons) + log_error (_("error looking up submission address for domain '%s'" + ": %s\n"), domain, gpg_strerror (err)); + if (!silent && gpg_err_code (err) == GPG_ERR_NO_DATA && !opt.with_colons) + log_error (_("this domain probably doesn't support WKS.\n")); + goto leave; + } + + if (submission_to && policy->submission_address + && ascii_strcasecmp (submission_to, policy->submission_address)) + log_info ("Warning: different submission addresses (sa=%s, po=%s)\n", + submission_to, policy->submission_address); + + if (!submission_to && policy->submission_address) + { + submission_to = xtrystrdup (policy->submission_address); + if (!submission_to) + { + err = gpg_error_from_syserror (); + goto leave; + } + } + + leave: + *r_submission_address = submission_to; + submission_to = NULL; + *r_policy = policy; + policy = NULL; + + if (opt.with_colons) + { + if (*r_policy && !*r_submission_address) + es_fprintf (es_stdout, "1:0::"); + else if (*r_policy && *r_submission_address) + es_fprintf (es_stdout, "1:1::"); + else if (err && !(gpg_err_code (err) == GPG_ERR_FALSE + || gpg_err_code (err) == GPG_ERR_NO_DATA + || gpg_err_code (err) == GPG_ERR_UNKNOWN_HOST)) + es_fprintf (es_stdout, "0:0:%d:", err); + else + es_fprintf (es_stdout, "0:0::"); + if (*r_policy) + { + es_fprintf (es_stdout, "%u:%u:%u:", + (*r_policy)->protocol_version, + (*r_policy)->auth_submit, + (*r_policy)->mailbox_only); + } + es_putc ('\n', es_stdout); + } + + xfree (submission_to); + wks_free_policy (policy); + xfree (policy); + es_fclose (mbuf); + return err; +} + /* Check whether the provider supports the WKS protocol. */ @@ -480,6 +622,7 @@ command_supported (char *userid) gpg_error_t err; char *addrspec = NULL; char *submission_to = NULL; + policy_flags_t policy = NULL; if (!strchr (userid, '@')) { @@ -497,24 +640,41 @@ command_supported (char *userid) } /* Get the submission address. */ - err = wkd_get_submission_address (addrspec, &submission_to); - if (err) + err = get_policy_and_sa (addrspec, 1, &policy, &submission_to); + if (err || !submission_to) { - if (gpg_err_code (err) == GPG_ERR_NO_DATA - || gpg_err_code (err) == GPG_ERR_UNKNOWN_HOST) + if (!submission_to + || gpg_err_code (err) == GPG_ERR_FALSE + || gpg_err_code (err) == GPG_ERR_NO_DATA + || gpg_err_code (err) == GPG_ERR_UNKNOWN_HOST + ) { - if (opt.verbose) - log_info ("provider for '%s' does NOT support WKS (%s)\n", - addrspec, gpg_strerror (err)); + /* FALSE is returned if we already figured out that even the + * Web Key Directory is not supported and thus printed an + * error message. */ + if (opt.verbose && gpg_err_code (err) != GPG_ERR_FALSE + && !opt.with_colons) + { + if (gpg_err_code (err) == GPG_ERR_NO_DATA) + log_info ("provider for '%s' does NOT support WKS\n", + addrspec); + else + log_info ("provider for '%s' does NOT support WKS (%s)\n", + addrspec, gpg_strerror (err)); + } err = gpg_error (GPG_ERR_FALSE); - log_inc_errorcount (); + if (!opt.with_colons) + log_inc_errorcount (); } goto leave; } - if (opt.verbose) + + if (opt.verbose && !opt.with_colons) log_info ("provider for '%s' supports WKS\n", addrspec); leave: + wks_free_policy (policy); + xfree (policy); xfree (submission_to); xfree (addrspec); return err; @@ -628,7 +788,7 @@ command_send (const char *fingerprint, const char *userid) estream_t keyenc = NULL; char *submission_to = NULL; mime_maker_t mime = NULL; - struct policy_flags_s policy; + policy_flags_t policy = NULL; int no_encrypt = 0; int posteo_hack = 0; const char *domain; @@ -636,8 +796,6 @@ command_send (const char *fingerprint, const char *userid) uidinfo_list_t uid, thisuid; time_t thistime; - memset (&policy, 0, sizeof policy); - if (classify_user_id (fingerprint, &desc, 1) || !(desc.mode == KEYDB_SEARCH_MODE_FPR || desc.mode == KEYDB_SEARCH_MODE_FPR20)) @@ -665,62 +823,26 @@ command_send (const char *fingerprint, const char *userid) /* Get the submission address. */ if (fake_submission_addr) { + policy = xcalloc (1, sizeof *policy); submission_to = xstrdup (fake_submission_addr); err = 0; } else { - /* We first try to get the submission address from the policy - * file (this is the new method). If both are available we - * check that they match and print a warning if not. In the - * latter case we keep on using the one from the - * submission-address file. */ - estream_t mbuf; - - err = wkd_get_policy_flags (addrspec, &mbuf); - if (err && gpg_err_code (err) != GPG_ERR_NO_DATA) - { - log_error ("error reading policy flags for '%s': %s\n", - domain, gpg_strerror (err)); - goto leave; - } - if (mbuf) - { - err = wks_parse_policy (&policy, mbuf, 1); - es_fclose (mbuf); - if (err) - goto leave; - } - - err = wkd_get_submission_address (addrspec, &submission_to); - if (err && !policy.submission_address) - { - log_error (_("error looking up submission address for domain '%s'" - ": %s\n"), domain, gpg_strerror (err)); - if (gpg_err_code (err) == GPG_ERR_NO_DATA) - log_error (_("this domain probably doesn't support WKS.\n")); - goto leave; - } - - if (submission_to && policy.submission_address - && ascii_strcasecmp (submission_to, policy.submission_address)) - log_info ("Warning: different submission addresses (sa=%s, po=%s)\n", - submission_to, policy.submission_address); - + err = get_policy_and_sa (addrspec, 0, &policy, &submission_to); + if (err) + goto leave; if (!submission_to) { - submission_to = xtrystrdup (policy.submission_address); - if (!submission_to) - { - err = gpg_error_from_syserror (); - goto leave; - } + log_error (_("this domain probably doesn't support WKS.\n")); + err = gpg_error (GPG_ERR_NO_DATA); + goto leave; } } log_info ("submitting request to '%s'\n", submission_to); - if (policy.auth_submit) + if (policy->auth_submit) log_info ("no confirmation required for '%s'\n", addrspec); /* In case the key has several uids with the same addr-spec we will @@ -738,8 +860,7 @@ command_send (const char *fingerprint, const char *userid) { if (!uid->mbox) continue; /* Should not happen anyway. */ - if (policy.mailbox_only - && ascii_strcasecmp (uid->uid, uid->mbox)) + if (policy->mailbox_only && ascii_strcasecmp (uid->uid, uid->mbox)) continue; /* UID has more than just the mailbox. */ if (uid->created > thistime) { @@ -770,7 +891,7 @@ command_send (const char *fingerprint, const char *userid) key = newkey; } - if (policy.mailbox_only + if (policy->mailbox_only && (!thisuid->mbox || ascii_strcasecmp (thisuid->uid, thisuid->mbox))) { log_info ("Warning: policy requires 'mailbox-only'" @@ -791,7 +912,7 @@ command_send (const char *fingerprint, const char *userid) /* Hack to support posteo but let them disable this by setting the * new policy-version flag. */ - if (policy.protocol_version < 3 + if (policy->protocol_version < 3 && !ascii_strcasecmp (domain, "posteo.de")) { log_info ("Warning: Using draft-1 method for domain '%s'\n", domain); @@ -908,7 +1029,8 @@ command_send (const char *fingerprint, const char *userid) free_uidinfo_list (uidlist); es_fclose (keyenc); es_fclose (key); - wks_free_policy (&policy); + wks_free_policy (policy); + xfree (policy); xfree (addrspec); return err; } diff --git a/tools/gpg-wks.h b/tools/gpg-wks.h index 1b91b65..fba73f0 100644 --- a/tools/gpg-wks.h +++ b/tools/gpg-wks.h @@ -36,6 +36,7 @@ struct unsigned int debug; int quiet; int use_sendmail; + int with_colons; const char *output; const char *gpg_program; const char *directory; diff --git a/tools/wks-util.c b/tools/wks-util.c index 3fd824c..1bcdf78 100644 --- a/tools/wks-util.c +++ b/tools/wks-util.c @@ -556,7 +556,7 @@ wks_send_mime (mime_maker_t mime) /* Parse the policy flags by reading them from STREAM and storing them - * into FLAGS. If IGNORE_UNKNOWN is iset unknown keywords are + * into FLAGS. If IGNORE_UNKNOWN is set unknown keywords are * ignored. */ gpg_error_t wks_parse_policy (policy_flags_t flags, estream_t stream, int ignore_unknown) ----------------------------------------------------------------------- Summary of changes: doc/wks.texi | 41 +++++++- tools/gpg-wks-client.c | 254 ++++++++++++++++++++++++++++++++++++------------- tools/gpg-wks.h | 1 + tools/wks-util.c | 2 +- 4 files changed, 230 insertions(+), 68 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 6 04:12:45 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Tue, 06 Nov 2018 04:12:45 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-45-g1b9d30d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 1b9d30db089e9de3ef859195ad58d2164a0231a0 (commit) from bded8ebc59c7fdad2617f4c9232a58047656834c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1b9d30db089e9de3ef859195ad58d2164a0231a0 Author: Ben McGinnes Date: Tue Nov 6 14:11:01 2018 +1100 python examples: protonmail hkp scripts * fixed a bug in the import try statement for both versions. diff --git a/lang/python/examples/howto/pmkey-import-hkp-alt.py b/lang/python/examples/howto/pmkey-import-hkp-alt.py index 673fe62..859de03 100755 --- a/lang/python/examples/howto/pmkey-import-hkp-alt.py +++ b/lang/python/examples/howto/pmkey-import-hkp-alt.py @@ -123,20 +123,17 @@ for keyterm in keyterms: for k in ksearch: print("Checking for key for: {0}".format(k)) - try: - keys = server.search(k) - if isinstance(keys, list) is True: - for key in keys: - allkeys.append(key) - try: - import_result = c.key_import(key.key_blob) - except Exception as e: - import_result = c.key_import(key.key) - else: - paradox.append(keys) - import_result = None - except Exception as e: - import_result = None + import_result = None + keys = server.search(k) + if isinstance(keys, list) is True: + for key in keys: + allkeys.append(key) + try: + import_result = c.key_import(key.key_blob) + except Exception as e: + import_result = c.key_import(key.key) + else: + paradox.append(keys) results.append(import_result) for result in results: diff --git a/lang/python/examples/howto/pmkey-import-hkp.py b/lang/python/examples/howto/pmkey-import-hkp.py index f7f6266..3b9345f 100755 --- a/lang/python/examples/howto/pmkey-import-hkp.py +++ b/lang/python/examples/howto/pmkey-import-hkp.py @@ -86,20 +86,17 @@ for keyterm in keyterms: for k in ksearch: print("Checking for key for: {0}".format(k)) - try: - keys = server.search(k) - if isinstance(keys, list) is True: - for key in keys: - allkeys.append(key) - try: - import_result = c.key_import(key.key_blob) - except Exception as e: - import_result = c.key_import(key.key) - else: - paradox.append(keys) - import_result = None - except Exception as e: - import_result = None + import_result = None + keys = server.search(k) + if isinstance(keys, list) is True: + for key in keys: + allkeys.append(key) + try: + import_result = c.key_import(key.key_blob) + except Exception as e: + import_result = c.key_import(key.key) + else: + paradox.append(keys) results.append(import_result) for result in results: ----------------------------------------------------------------------- Summary of changes: lang/python/examples/howto/pmkey-import-hkp-alt.py | 25 ++++++++++------------ lang/python/examples/howto/pmkey-import-hkp.py | 25 ++++++++++------------ 2 files changed, 22 insertions(+), 28 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 6 04:59:22 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Tue, 06 Nov 2018 04:59:22 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-46-g0cb625d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 0cb625da84d7e5deeacad113c404a8bc2154c8e7 (commit) from 1b9d30db089e9de3ef859195ad58d2164a0231a0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0cb625da84d7e5deeacad113c404a8bc2154c8e7 Author: Ben McGinnes Date: Tue Nov 6 14:58:15 2018 +1100 python examples: another importer * Fixed a similar type of bug with the non-protonmail importer. diff --git a/lang/python/examples/howto/import-keys-hkp.py b/lang/python/examples/howto/import-keys-hkp.py index 7d873ca..e619524 100755 --- a/lang/python/examples/howto/import-keys-hkp.py +++ b/lang/python/examples/howto/import-keys-hkp.py @@ -45,7 +45,10 @@ else: try: keys = server.search(pattern) - print("Found {0} key(s).".format(len(keys))) + if keys is not None: + print("Found {0} key(s).".format(len(keys))) + else: + pass except Exception as e: keys = [] for logrus in pattern.split(): @@ -56,9 +59,10 @@ except Exception as e: keys.append(key[0]) print("Found {0} key(s).".format(len(keys))) -for key in keys: - import_result = c.key_import(key.key_blob) - results.append(import_result) +if keys is not None: + for key in keys: + import_result = c.key_import(key.key_blob) + results.append(import_result) for result in results: if result is not None and hasattr(result, "considered") is False: ----------------------------------------------------------------------- Summary of changes: lang/python/examples/howto/import-keys-hkp.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 6 06:25:34 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Tue, 06 Nov 2018 06:25:34 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-47-gd0a5caf Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via d0a5caf73c2d6b73dd043f62574c31946e4f347d (commit) from 0cb625da84d7e5deeacad113c404a8bc2154c8e7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d0a5caf73c2d6b73dd043f62574c31946e4f347d Author: Ben McGinnes Date: Tue Nov 6 16:22:50 2018 +1100 docs: python bindings * Continued restructuring as part of moving beyond mere;y the HOWTO file. * Generated the alternative source files for reST and Texinfo. * Fixed some errors and updated links after moving the what's new section to two new files (yes, two). diff --git a/lang/python/doc/README b/lang/python/doc/README index a14e1ad..76f1908 100644 --- a/lang/python/doc/README +++ b/lang/python/doc/README @@ -25,14 +25,14 @@ This docs directory contains four main subdirectories: 4. texinfo The Meta directory is for docs that are not intended for distribution -or are about the docs themselves. The sole exception being this RDME -file. +or are about the docs themselves. The sole exception being this +README file. The Src directory is where the original edited files are, from which the following two formats are generated initially. Most, if not all, of these are written in Org Mode. -The ReST directory contains reStructuredText files ehich have been +The ReST directory contains reStructuredText files which have been converted to that format from the Org Mode files via Pandoc. The Texinfo directory contains Texinfo files which have been exported diff --git a/lang/python/doc/rst/gpgme-python-howto.rst b/lang/python/doc/rst/gpgme-python-howto.rst index 104b530..3fd8a4d 100644 --- a/lang/python/doc/rst/gpgme-python-howto.rst +++ b/lang/python/doc/rst/gpgme-python-howto.rst @@ -71,87 +71,25 @@ produced in between major releases. What\'s New ----------- -The most obviously new point for those reading this guide is this -section on other new things, but that\'s hardly important. Not given all -the other things which spurred the need for adding this section and its -subsections. +Full details of what is new are now available in the `What\'s +New `__ file and archives of the preceding *What\'s +New* sections are available in the `What Was New `__ file. + +.. _new-stuff-1-13-0: + +New in GPGME 1?13?0 +~~~~~~~~~~~~~~~~~~~ + +See the `What\'s New `__ document for what +is new in version 1.13.0. .. _new-stuff-1-12-0: New in GPGME 1?12?0 ~~~~~~~~~~~~~~~~~~~ -There have been quite a number of additions to GPGME and the Python -bindings to it since the last release of GPGME with versions 1.11.0 and -1.11.1 in April, 2018. - -The bullet points of new additiions are: - -- an expanded section on `installing <#installation>`__ and - `troubleshooting <#snafu>`__ the Python bindings. -- The release of Python 3.7.0; which appears to be working just fine - with our bindings, in spite of intermittent reports of problems for - many other Python projects with that new release. -- Python 3.7 has been moved to the head of the specified python - versions list in the build process. -- In order to fix some other issues, there are certain underlying - functions which are more exposed through the - `gpg.Context() <#howto-get-context>`__, but ongoing documentation - ought to clarify that or otherwise provide the best means of using - the bindings. Some additions to ``gpg.core`` and the ``Context()``, - however, were intended (see below). -- Continuing work in identifying and confirming the cause of - oft-reported `problems installing the Python bindings on - Windows <#snafu-runtime-not-funtime>`__. -- GSOC: Google\'s Surreptitiously Ordered Conscription ... erm ... oh, - right; Google\'s Summer of Code. Though there were two hopeful - candidates this year; only one ended up involved with the GnuPG - Project directly, the other concentrated on an unrelated third party - project with closer ties to one of the GNU/Linux distributions than - to the GnuPG Project. Thus the Python bindings benefited from GSOC - participant Jacob Adams, who added the key\ :sub:`import` function; - building on prior work by Tobias Mueller. -- Several new methods functions were added to the gpg.Context(), - including: `key\ import <#howto-import-key>`__, - `key\ export <#howto-export-key>`__, - `key\ exportminimal <#howto-export-public-key>`__ and - `key\ exportsecret <#howto-export-secret-key>`__. -- Importing and exporting examples include versions integrated with - Marcel Fest\'s recently released `HKP for - Python `__ module. Some - `additional notes on this module <#hkp4py>`__ are included at the end - of the HOWTO. -- Instructions for dealing with semi-walled garden implementations like - ProtonMail are also included. This is intended to make things a - little easier when communicating with users of ProtonMail\'s services - and should not be construed as an endorsement of said service. The - GnuPG Project neither favours, nor disfavours ProtonMail and the - majority of this deals with interacting with the ProtonMail - keyserver. -- Semi-formalised the location where `draft - versions <#draft-editions>`__ of this HOWTO may periodically be - accessible. This is both for the reference of others and testing the - publishing of the document itself. Renamed this file at around the - same time. -- The Texinfo documentation build configuration has been replicated - from the parent project in order to make to maintain consistency with - that project (and actually ship with each release). -- a reStructuredText (``.rst``) version is also generated for Python - developers more used to and comfortable with that format as it is the - standard Python documentation format and Python developers may wish - to use it with Sphinx. Please note that there has been no testing of - the reStructuredText version with Sphinx at all. The reST file was - generated by the simple expedient of using - `Pandoc `__. -- Added a new section for `advanced or experimental - use <#advanced-use>`__. -- Began the advanced use cases with `a section <#cython>`__ on using - the module with `Cython `__. -- Added a number of new scripts to the ``example/howto/`` directory; - some of which may be in advance of their planned sections of the - HOWTO (and some are just there because it seemed like a good idea at - the time). -- Cleaned up a lot of things under the hood. +See the `What Was New `__ document for +what was new in version 1.12.0. GPGME Concepts ============== @@ -472,7 +410,7 @@ place. Multiple installations ~~~~~~~~~~~~~~~~~~~~~~ -For a veriety of reasons it may be either necessary or just preferable +For a variety of reasons it may be either necessary or just preferable to install the bindings to alternative installed Python versions which meet the requirements of these bindings. @@ -489,6 +427,16 @@ by major version numbers and probably minor numbers too). On most POSIX systems, including OS X, this will very likely be the case in most, if not all, cases. +Note that from GPGME +`1.12.1 `__ +the default installation installs to each version of Python it can find +first. That is that it will currently install for the first copies of +Python versions 2.7, 3.4, 3.5, 3.6, 3.7 and 3.8 (dev branch) that it +finds. Usually this will be in the same prefix as GPGME itself, but is +dictated by the ``$PATH`` when the installation is performed. The above +instructions can still be performed on other python installations which +the installer does not find, including alternative prefixes. + .. _snafu-runtime-not-funtime: Won\'t Work With Windows @@ -602,10 +550,10 @@ to or which are found by GPGME\'s configuration stage immediately prior to running the make commands. Which is exactly what the compiling and installing process of GPGME does by default. -Once that is done, however, it appears that a copy the compiled module -may be installed into a virtualenv of the same major and minor version -matching the build. Alternatively it is possible to utilise a -``sites.pth`` file in the ``site-packages/`` directory of a viertualenv +Once that is done, however, it appears that a copy of the compiled +module may be installed into a virtualenv of the same major and minor +version matching the build. Alternatively it is possible to utilise a +``sites.pth`` file in the ``site-packages/`` directory of a virtualenv installation, which links back to the system installations corresponding directory in order to import anything installed system wide. This may or may not be appropriate on a case by case basis. @@ -2565,8 +2513,8 @@ Unsurprisingly the result of this is: .. _keygen-uids-revoke: -Revokinging User IDs -~~~~~~~~~~~~~~~~~~~~ +Revoking User IDs +~~~~~~~~~~~~~~~~~ Revoking a user ID is a fairly similar process, except that it uses the ``key_revoke_uid`` method. @@ -2815,7 +2763,7 @@ is the key IDs of the group as a string. The ``group_lists`` result is very similar in that it is a list of lists. The first part, ``group_lists[i][0]`` matches ``group_lines[i][0]`` as the name of the group, but -``group_lists[i][1]`` is the key IDs of the group as a string. +``group_lists[i][1]`` is the key IDs of the group as a list. A demonstration of using the ``groups.py`` module is also available in the form of the executable ``mutt-groups.py`` script. This second script @@ -2920,17 +2868,18 @@ All of these draft versions except for one have been generated from this document via Emacs `Org mode `__ and `GNU Texinfo `__. Though it is likely that the specific -`file `__ +`file `__ `version `__ used will be on the same server with the generated output formats. The one exception is the reStructuredText version, which was converted using the latest version of Pandoc from the Org mode source file using -the following command: +either of the following two commands: .. code:: shell - pandoc -f org -t rst+smart -o gpgme-python-howto.rst gpgme-python-howto.org + pandoc -f org -t rst -o gpgme-python-howto.rst gpgme-python-howto.org + pandoc -f org -t rst -o gpgme-python-howto.rst gpgme-python-howto In addition to these there is a significantly less frequently updated version as a HTML `WebHelp @@ -2965,7 +2914,7 @@ Footnotes ========= .. [1] - ``short-history.org`` and/or ``short-history.html``. + ``short-history`` and/or ``short-history.html``. .. [2] With no issues reported specific to Python 3.7, the release of Python diff --git a/lang/python/doc/rst/index.rst b/lang/python/doc/rst/index.rst index 31dc146..5f736c7 100644 --- a/lang/python/doc/rst/index.rst +++ b/lang/python/doc/rst/index.rst @@ -1,12 +1,12 @@ -.. _index: +.. _top: GPGME Python Bindings ===================== -.. _index-contents: - Contents -------- -- `A short history of the project `__ -- `GPGME Python Bindings HOWTO `__ +- `A short history of the project `__ +- `What\'s New `__ +- `What Was New `__ +- `GPGME Python Bindings HOWTO `__ diff --git a/lang/python/doc/rst/short-history.rst b/lang/python/doc/rst/short-history.rst index 8cf604f..d6f0a5d 100644 --- a/lang/python/doc/rst/short-history.rst +++ b/lang/python/doc/rst/short-history.rst @@ -19,10 +19,10 @@ Keeping the flame alive ----------------------- A couple of years later the project was picked up by Igor Belyi and -actively developed and maintained by him from 2004 to 2008. Igor's -whereabouts at the time of this document's creation are unknown, but the -current authors do hope he is well. We're assuming (or hoping) that life -did what life does and made continuing untenable. +actively developed and maintained by him from 2004 to 2008. Igor\'s +whereabouts at the time of this document\'s creation are unknown, but +the current authors do hope he is well. We\'re assuming (or hoping) that +life did what life does and made continuing untenable. Passing the torch ----------------- @@ -135,7 +135,7 @@ Python 2 to Python 3 code was made in 2015. Users of the more recent Python bindings will recognise numerous points of similarity, but also significant differences. It is likely that the -more recent official bindings will feel "more pythonic." +more recent official bindings will feel \"more pythonic.\" For those using Python 2, there is essentially no harm in using this module, but it may lack a number of more recent features added to GPGME. @@ -144,7 +144,7 @@ Footnotes ========= .. [1] - In all likelihood thos would have been Python 2.2 or possibly Python + In all likelihood this would have been Python 2.2 or possibly Python 2.3. .. [2] diff --git a/lang/python/doc/rst/what-is-new.rst b/lang/python/doc/rst/what-is-new.rst new file mode 100644 index 0000000..9332fb6 --- /dev/null +++ b/lang/python/doc/rst/what-is-new.rst @@ -0,0 +1,42 @@ +.. _new-stuff: + +What\'s New +=========== + ++-----------------------------------+-----------------------------------+ +| Version: | 0.0.1-draft | ++-----------------------------------+-----------------------------------+ +| GPGME Version: | 1.13.0 | ++-----------------------------------+-----------------------------------+ +| Author: | `Ben | +| | McGinnes `__ | +| | | ++-----------------------------------+-----------------------------------+ +| Author GPG Key: | DB4724E6FA4286C92B4E55C4321E4E237 | +| | 3590E5D | ++-----------------------------------+-----------------------------------+ +| Language: | Australian English, British | +| | English | ++-----------------------------------+-----------------------------------+ +| xml:lang: | en-AU, en-GB, en | ++-----------------------------------+-----------------------------------+ + +Last time the most obviously new thing was adding the *What\'s New* +section to the HOWTO. Now it\'s moving it out of the HOWTO. Not to +mention expanding on the documentation both generally and considerably. + +.. _new-stuff-1-13-0: + +New in GPGME 1?13?0 +------------------- + +Additions since GPGME 1.12.0 include: + +- An advanced HOWTO on using the bindings with web interfaces, + specifically Flask. +- Moving the *What\'s New* section out of the basic + `HOWTO `__ document and into its own file so + as to more readily include other documents beyond that HOWTO. +- Moving the preceding, archival, segments into `another + file `__. diff --git a/lang/python/doc/rst/what-was-new.rst b/lang/python/doc/rst/what-was-new.rst new file mode 100644 index 0000000..23f3082 --- /dev/null +++ b/lang/python/doc/rst/what-was-new.rst @@ -0,0 +1,116 @@ +.. _new-stuff: + +What Was New +============ + ++-----------------------------------+-----------------------------------+ +| Version: | 0.0.1-draft | ++-----------------------------------+-----------------------------------+ +| GPGME Version: | 1.13.0 | ++-----------------------------------+-----------------------------------+ +| Author: | `Ben | +| | McGinnes `__ | +| | | ++-----------------------------------+-----------------------------------+ +| Author GPG Key: | DB4724E6FA4286C92B4E55C4321E4E237 | +| | 3590E5D | ++-----------------------------------+-----------------------------------+ +| Language: | Australian English, British | +| | English | ++-----------------------------------+-----------------------------------+ +| xml:lang: | en-AU, en-GB, en | ++-----------------------------------+-----------------------------------+ + +The following are all the past *What\'s New* sections for the Python +Bindings HOWTO and other documentation. + +.. _gpgme-1-12-0: + +What Was New in GPGME 1?12?0 +---------------------------- + +The most obviously new point for those reading this guide is this +section on other new things, but that's hardly important. Not given all +the other things which spurred the need for adding this section and its +subsections. + +.. _new-stuff-1-12-0: + +New in GPGME 1?12?0 +~~~~~~~~~~~~~~~~~~~ + +There have been quite a number of additions to GPGME and the Python +bindings to it since the last release of GPGME with versions 1.11.0 and +1.11.1 in April, 2018. + +The bullet points of new additiions are: + +- an expanded section on + `installing `__ and + `troubleshooting `__ the Python bindings. +- The release of Python 3.7.0; which appears to be working just fine + with our bindings, in spite of intermittent reports of problems for + many other Python projects with that new release. +- Python 3.7 has been moved to the head of the specified python + versions list in the build process. +- In order to fix some other issues, there are certain underlying + functions which are more exposed through the + `gpg.Context() `__, but ongoing + documentation ought to clarify that or otherwise provide the best + means of using the bindings. Some additions to ``gpg.core`` and the + ``Context()``, however, were intended (see below). +- Continuing work in identifying and confirming the cause of + oft-reported `problems installing the Python bindings on + Windows `__. +- GSOC: Google\'s Surreptitiously Ordered Conscription ... erm ... oh, + right; Google\'s Summer of Code. Though there were two hopeful + candidates this year; only one ended up involved with the GnuPG + Project directly, the other concentrated on an unrelated third party + project with closer ties to one of the GNU/Linux distributions than + to the GnuPG Project. Thus the Python bindings benefited from GSOC + participant Jacob Adams, who added the key\ :sub:`import` function; + building on prior work by Tobias Mueller. +- Several new methods functions were added to the gpg.Context(), + including: `key\ import `__, + `key\ export `__, + `key\ exportminimal `__ + and + `key\ exportsecret `__. +- Importing and exporting examples include versions integrated with + Marcel Fest\'s recently released `HKP for + Python `__ module. Some + `additional notes on this module `__ are + included at the end of the HOWTO. +- Instructions for dealing with semi-walled garden implementations like + ProtonMail are also included. This is intended to make things a + little easier when communicating with users of ProtonMail\'s services + and should not be construed as an endorsement of said service. The + GnuPG Project neither favours, nor disfavours ProtonMail and the + majority of this deals with interacting with the ProtonMail + keyserver. +- Semi-formalised the location where `draft + versions `__ of this HOWTO may + periodically be accessible. This is both for the reference of others + and testing the publishing of the document itself. Renamed this file + at around the same time. +- The Texinfo documentation build configuration has been replicated + from the parent project in order to make to maintain consistency with + that project (and actually ship with each release). +- a reStructuredText (``.rst``) version is also generated for Python + developers more used to and comfortable with that format as it is the + standard Python documentation format and Python developers may wish + to use it with Sphinx. Please note that there has been no testing of + the reStructuredText version with Sphinx at all. The reST file was + generated by the simple expedient of using + `Pandoc `__. +- Added a new section for `advanced or experimental + use `__. +- Began the advanced use cases with `a + section `__ on using the module with + `Cython `__. +- Added a number of new scripts to the ``example/howto/`` directory; + some of which may be in advance of their planned sections of the + HOWTO (and some are just there because it seemed like a good idea at + the time). +- Cleaned up a lot of things under the hood. diff --git a/lang/python/doc/src/index b/lang/python/doc/src/index index 18c9386..ce347ea 100644 --- a/lang/python/doc/src/index +++ b/lang/python/doc/src/index @@ -12,15 +12,17 @@ * GPGME Python Bindings :PROPERTIES: - :CUSTOM_ID: index + :CUSTOM_ID: top :END: ** Contents :PROPERTIES: - :CUSTOM_ID: index-contents + :CUSTOM_ID: contents :END: - [[file:short-history][A short history of the project]] +- [[file:what-is-new][What's New]] +- [[file:what-was-new][What Was New]] - [[file:gpgme-python-howto][GPGME Python Bindings HOWTO]] diff --git a/lang/python/doc/src/short-history b/lang/python/doc/src/short-history index ac5804d..6c5c96e 100644 --- a/lang/python/doc/src/short-history +++ b/lang/python/doc/src/short-history @@ -166,7 +166,7 @@ SWIG itself, which are worth noting here. * Footnotes -[fn:1] In all likelihood thos would have been Python 2.2 or possibly +[fn:1] In all likelihood this would have been Python 2.2 or possibly Python 2.3. [fn:2] The entire PyME git log and other preceding VCS logs are diff --git a/lang/python/doc/src/what-was-new b/lang/python/doc/src/what-was-new index 666e5cc..7c851b1 100644 --- a/lang/python/doc/src/what-was-new +++ b/lang/python/doc/src/what-was-new @@ -48,7 +48,7 @@ and 1.11.1 in April, 2018. The bullet points of new additiions are: -- an expanded section on [[#installation][installing]] and [[#snafu][troubleshooting]] the Python +- an expanded section on [[file:gpgme-python-howto#installation][installing]] and [[file:gpgme-python-howto#snafu][troubleshooting]] the Python bindings. - The release of Python 3.7.0; which appears to be working just fine with our bindings, in spite of intermittent reports of problems for @@ -56,12 +56,12 @@ The bullet points of new additiions are: - Python 3.7 has been moved to the head of the specified python versions list in the build process. - In order to fix some other issues, there are certain underlying - functions which are more exposed through the [[#howto-get-context][gpg.Context()]], but + functions which are more exposed through the [[file:gpgme-python-howto#howto-get-context][gpg.Context()]], but ongoing documentation ought to clarify that or otherwise provide the best means of using the bindings. Some additions to =gpg.core= and the =Context()=, however, were intended (see below). - Continuing work in identifying and confirming the cause of - oft-reported [[#snafu-runtime-not-funtime][problems installing the Python bindings on Windows]]. + oft-reported [[file:gpgme-python-howto#snafu-runtime-not-funtime][problems installing the Python bindings on Windows]]. - GSOC: Google's Surreptitiously Ordered Conscription ... erm ... oh, right; Google's Summer of Code. Though there were two hopeful candidates this year; only one ended up involved with the GnuPG @@ -71,11 +71,11 @@ The bullet points of new additiions are: participant Jacob Adams, who added the key_import function; building on prior work by Tobias Mueller. - Several new methods functions were added to the gpg.Context(), - including: [[#howto-import-key][key_import]], [[#howto-export-key][key_export]], [[#howto-export-public-key][key_export_minimal]] and - [[#howto-export-secret-key][key_export_secret]]. + including: [[file:gpgme-python-howto#howto-import-key][key_import]], [[file:gpgme-python-howto#howto-export-key][key_export]], [[file:gpgme-python-howto#howto-export-public-key][key_export_minimal]] and + [[file:gpgme-python-howto#howto-export-secret-key][key_export_secret]]. - Importing and exporting examples include versions integrated with Marcel Fest's recently released [[https://github.com/Selfnet/hkp4py][HKP for Python]] module. Some - [[#hkp4py][additional notes on this module]] are included at the end of the HOWTO. + [[file:gpgme-python-howto#hkp4py][additional notes on this module]] are included at the end of the HOWTO. - Instructions for dealing with semi-walled garden implementations like ProtonMail are also included. This is intended to make things a little easier when communicating with users of ProtonMail's @@ -83,7 +83,7 @@ The bullet points of new additiions are: service. The GnuPG Project neither favours, nor disfavours ProtonMail and the majority of this deals with interacting with the ProtonMail keyserver. -- Semi-formalised the location where [[#draft-editions][draft versions]] of this HOWTO may +- Semi-formalised the location where [[file:gpgme-python-howto#draft-editions][draft versions]] of this HOWTO may periodically be accessible. This is both for the reference of others and testing the publishing of the document itself. Renamed this file at around the same time. @@ -96,8 +96,8 @@ The bullet points of new additiions are: wish to use it with Sphinx. Please note that there has been no testing of the reStructuredText version with Sphinx at all. The reST file was generated by the simple expedient of using [[https://pandoc.org/][Pandoc]]. -- Added a new section for [[#advanced-use][advanced or experimental use]]. -- Began the advanced use cases with [[#cython][a section]] on using the module with +- Added a new section for [[file:gpgme-python-howto#advanced-use][advanced or experimental use]]. +- Began the advanced use cases with [[file:gpgme-python-howto#cython][a section]] on using the module with [[https://cython.org/][Cython]]. - Added a number of new scripts to the =example/howto/= directory; some of which may be in advance of their planned sections of the diff --git a/lang/python/doc/texinfo/gpgme-python-howto.texi b/lang/python/doc/texinfo/gpgme-python-howto.texi index 695ed15..d776f58 100644 --- a/lang/python/doc/texinfo/gpgme-python-howto.texi +++ b/lang/python/doc/texinfo/gpgme-python-howto.texi @@ -43,6 +43,7 @@ Introduction What's New +* New in GPGME 1?13?0:: * New in GPGME 1?12?0:: GPGME Concepts @@ -138,7 +139,7 @@ Creating keys and subkeys User IDs * Adding User IDs:: -* Revokinging User IDs:: +* Revoking User IDs:: Advanced or Experimental Use Cases @@ -230,98 +231,24 @@ major releases. @node What's New @section What's New -The most obviously new point for those reading this guide is this -section on other new things, but that's hardly important. Not given -all the other things which spurred the need for adding this section -and its subsections. +Full details of what is new are now available in the @uref{what-is-new.org, What's New} file +and archives of the preceding @emph{What's New} sections are available in +the @uref{what-was-new, What Was New} file. @menu +* New in GPGME 1?13?0:: * New in GPGME 1?12?0:: @end menu - at node New in GPGME 1?12?0 - at subsection New in GPGME 1?12?0 + at node New in GPGME 1?13?0 + at subsection New in GPGME 1?13?0 -There have been quite a number of additions to GPGME and the Python -bindings to it since the last release of GPGME with versions 1.11.0 -and 1.11.1 in April, 2018. +See the @uref{what-is-new#new-stuff-1-13-0, What's New} document for what is new in version 1.13.0. -The bullet points of new additiions are: + at node New in GPGME 1?12?0 + at subsection New in GPGME 1?12?0 - at itemize - at item -an expanded section on @ref{Installation, , installing} and @ref{Known Issues, , troubleshooting} the Python -bindings. - at item -The release of Python 3.7.0; which appears to be working just fine -with our bindings, in spite of intermittent reports of problems for -many other Python projects with that new release. - at item -Python 3.7 has been moved to the head of the specified python -versions list in the build process. - at item -In order to fix some other issues, there are certain underlying -functions which are more exposed through the @ref{Context, , gpg.Context()}, but -ongoing documentation ought to clarify that or otherwise provide the -best means of using the bindings. Some additions to @samp{gpg.core} and -the @samp{Context()}, however, were intended (see below). - at item -Continuing work in identifying and confirming the cause of -oft-reported @ref{Won't Work With Windows, , problems installing the Python bindings on Windows}. - at item -GSOC: Google's Surreptitiously Ordered Conscription @dots{} erm @dots{} oh, -right; Google's Summer of Code. Though there were two hopeful -candidates this year; only one ended up involved with the GnuPG -Project directly, the other concentrated on an unrelated third party -project with closer ties to one of the GNU/Linux distributions than -to the GnuPG Project. Thus the Python bindings benefited from GSOC -participant Jacob Adams, who added the key at math{_import} function; building -on prior work by Tobias Mueller. - at item -Several new methods functions were added to the gpg.Context(), -including: @ref{Importing keys, , key at math{_import}}, @ref{Exporting keys, , key at math{_export}}, @ref{Exporting public keys, , key at math{_export}@math{_minimal}} and - at ref{Exporting secret keys, , key at math{_export}@math{_secret}}. - at item -Importing and exporting examples include versions integrated with -Marcel Fest's recently released @uref{https://github.com/Selfnet/hkp4py, HKP for Python} module. Some - at ref{Keyserver access for Python, , additional notes on this module} are included at the end of the HOWTO. - at item -Instructions for dealing with semi-walled garden implementations -like ProtonMail are also included. This is intended to make things -a little easier when communicating with users of ProtonMail's -services and should not be construed as an endorsement of said -service. The GnuPG Project neither favours, nor disfavours -ProtonMail and the majority of this deals with interacting with the -ProtonMail keyserver. - at item -Semi-formalised the location where @ref{Draft Editions of this HOWTO, , draft versions} of this HOWTO may -periodically be accessible. This is both for the reference of -others and testing the publishing of the document itself. Renamed -this file at around the same time. - at item -The Texinfo documentation build configuration has been replicated -from the parent project in order to make to maintain consistency -with that project (and actually ship with each release). - at item -a reStructuredText (@samp{.rst}) version is also generated for Python -developers more used to and comfortable with that format as it is -the standard Python documentation format and Python developers may -wish to use it with Sphinx. Please note that there has been no -testing of the reStructuredText version with Sphinx at all. The -reST file was generated by the simple expedient of using @uref{https://pandoc.org/, Pandoc}. - at item -Added a new section for @ref{Advanced or Experimental Use Cases, , advanced or experimental use}. - at item -Began the advanced use cases with @ref{C plus Python plus SWIG plus Cython, , a section} on using the module with - at uref{https://cython.org/, Cython}. - at item -Added a number of new scripts to the @samp{example/howto/} directory; -some of which may be in advance of their planned sections of the -HOWTO (and some are just there because it seemed like a good idea at -the time). - at item -Cleaned up a lot of things under the hood. - at end itemize +See the @uref{what-was-new#new-stuff-1-12-0, What Was New} document for what was new in version 1.12.0. @node GPGME Concepts @chapter GPGME Concepts @@ -418,7 +345,7 @@ version 3.0 (or any later version). This package is the origin of these bindings, though they are somewhat different now. For details of when and how the PyME package was -folded back into GPGME itself see the @uref{short-history.org, Short History} document. at footnote{@samp{short-history.org} and/or @samp{short-history.html}.} +folded back into GPGME itself see the @uref{short-history.org, Short History} document. at footnote{@samp{short-history} and/or @samp{short-history.html}.} The PyME package was first released in 2002 and was also the first attempt to implement a low level binding to GPGME. In doing so it @@ -670,7 +597,7 @@ place. @node Multiple installations @subsection Multiple installations -For a veriety of reasons it may be either necessary or just preferable +For a variety of reasons it may be either necessary or just preferable to install the bindings to alternative installed Python versions which meet the requirements of these bindings. @@ -687,6 +614,15 @@ by major version numbers and probably minor numbers too). On most POSIX systems, including OS X, this will very likely be the case in most, if not all, cases. +Note that from GPGME @uref{https://dev.gnupg.org/rMff6ff616aea6f59b7f2ce1176492850ecdf3851e, 1.12.1} the default installation installs to each +version of Python it can find first. That is that it will currently +install for the first copies of Python versions 2.7, 3.4, 3.5, 3.6, +3.7 and 3.8 (dev branch) that it finds. Usually this will be in the +same prefix as GPGME itself, but is dictated by the @samp{$PATH} when the +installation is performed. The above instructions can still be +performed on other python installations which the installer does not +find, including alternative prefixes. + @node Won't Work With Windows @subsection Won't Work With Windows @@ -800,10 +736,10 @@ to or which are found by GPGME's configuration stage immediately prior to running the make commands. Which is exactly what the compiling and installing process of GPGME does by default. -Once that is done, however, it appears that a copy the compiled module -may be installed into a virtualenv of the same major and minor version -matching the build. Alternatively it is possible to utilise a - at samp{sites.pth} file in the @samp{site-packages/} directory of a viertualenv +Once that is done, however, it appears that a copy of the compiled +module may be installed into a virtualenv of the same major and minor +version matching the build. Alternatively it is possible to utilise a + at samp{sites.pth} file in the @samp{site-packages/} directory of a virtualenv installation, which links back to the system installations corresponding directory in order to import anything installed system wide. This may or may not be appropriate on a case by case basis. @@ -2724,7 +2660,7 @@ bash-4.4$ @menu * Adding User IDs:: -* Revokinging User IDs:: +* Revoking User IDs:: @end menu @node Adding User IDs @@ -2763,8 +2699,8 @@ ssb rsa3072 2018-03-15 [E] [expires: 2018-09-13] bash-4.4$ @end example - at node Revokinging User IDs - at subsection Revokinging User IDs + at node Revoking User IDs + at subsection Revoking User IDs Revoking a user ID is a fairly similar process, except that it uses the @samp{key_revoke_uid} method. @@ -3009,7 +2945,7 @@ is the key IDs of the group as a string. The @samp{group_lists} result is very similar in that it is a list of lists. The first part, @samp{group_lists[i][0]} matches @samp{group_lines[i][0]} as the name of the group, but @samp{group_lists[i][1]} -is the key IDs of the group as a string. +is the key IDs of the group as a list. A demonstration of using the @samp{groups.py} module is also available in the form of the executable @samp{mutt-groups.py} script. This second @@ -3116,15 +3052,16 @@ from the author at any of the following URLs: All of these draft versions except for one have been generated from this document via Emacs @uref{https://orgmode.org/, Org mode} and @uref{https://www.gnu.org/software/texinfo/, GNU Texinfo}. Though it is likely -that the specific @uref{https://files.au.adversary.org/crypto/gpgme-python-howto.org, file} @uref{http://files.au.adversary.org/crypto/gpgme-python-howto.org, version} used will be on the same server with +that the specific @uref{https://files.au.adversary.org/crypto/gpgme-python-howto, file} @uref{http://files.au.adversary.org/crypto/gpgme-python-howto.org, version} used will be on the same server with the generated output formats. The one exception is the reStructuredText version, which was converted using the latest version of Pandoc from the Org mode source file using -the following command: +either of the following two commands: @example -pandoc -f org -t rst+smart -o gpgme-python-howto.rst gpgme-python-howto.org +pandoc -f org -t rst -o gpgme-python-howto.rst gpgme-python-howto.org +pandoc -f org -t rst -o gpgme-python-howto.rst gpgme-python-howto @end example In addition to these there is a significantly less frequently updated @@ -3152,4 +3089,4 @@ WITHOUT ANY WARRANTY, to the extent permitted by law; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - at bye + at bye \ No newline at end of file diff --git a/lang/python/doc/texinfo/index.texi b/lang/python/doc/texinfo/index.texi index 4f80423..2ec5e24 100644 --- a/lang/python/doc/texinfo/index.texi +++ b/lang/python/doc/texinfo/index.texi @@ -44,9 +44,13 @@ GPGME Python Bindings @itemize @item - at uref{short-history.org, A short history of the project} + at uref{short-history, A short history of the project} @item - at uref{gpgme-python-howto.org, GPGME Python Bindings HOWTO} + at uref{what-is-new, What's New} + at item + at uref{what-was-new, What Was New} + at item + at uref{gpgme-python-howto, GPGME Python Bindings HOWTO} @end itemize @bye \ No newline at end of file diff --git a/lang/python/doc/texinfo/short-history.texi b/lang/python/doc/texinfo/short-history.texi index a982f02..395901f 100644 --- a/lang/python/doc/texinfo/short-history.texi +++ b/lang/python/doc/texinfo/short-history.texi @@ -65,7 +65,7 @@ return to the source. This is a short explanation of that journey. In 2002 John Goerzen released PyME; Python bindings for the GPGME module which utilised the current release of Python of the time and -SWIG. at footnote{In all likelihood thos would have been Python 2.2 or possibly +SWIG. at footnote{In all likelihood this would have been Python 2.2 or possibly Python 2.3.} Shortly after creating it and ensuring it worked he stopped supporting it, though he left his work available on his Gopher site. diff --git a/lang/python/doc/texinfo/what-is-new.texi b/lang/python/doc/texinfo/what-is-new.texi new file mode 100644 index 0000000..6233cac --- /dev/null +++ b/lang/python/doc/texinfo/what-is-new.texi @@ -0,0 +1,79 @@ +\input texinfo @c -*- texinfo -*- + at c %**start of header + at setfilename what-is-new.info + at settitle What's New in the GPGME Python Bindings and Documentation + at documentencoding UTF-8 + at documentlanguage en + at c %**end of header + + at finalout + at titlepage + at title What's New in the GPGME Python Bindings and Documentation + at author Ben McGinnes + at end titlepage + + at contents + + at ifnottex + at node Top + at top What's New in the GPGME Python Bindings and Documentation + at end ifnottex + + at menu +* What's New:: + + at detailmenu +--- The Detailed Node Listing --- + +What's New + +* New in GPGME 1?13?0:: + + at end detailmenu + at end menu + + at node What's New + at chapter What's New + + at multitable {aaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} + at item Version: + at tab 0.0.1-draft + at item GPGME Version: + at tab 1.13.0 + at item Author: + at tab @uref{https://gnupg.org/people/index.html#sec-1-5, Ben McGinnes} + at item Author GPG Key: + at tab DB4724E6FA4286C92B4E55C4321E4E2373590E5D + at item Language: + at tab Australian English, British English + at item xml:lang: + at tab en-AU, en-GB, en + at end multitable + +Last time the most obviously new thing was adding the @emph{What's New} +section to the HOWTO. Now it's moving it out of the HOWTO. Not to +mention expanding on the documentation both generally and +considerably. + + at menu +* New in GPGME 1?13?0:: + at end menu + + at node New in GPGME 1?13?0 + at section New in GPGME 1?13?0 + +Additions since GPGME 1.12.0 include: + + at itemize + at item +An advanced HOWTO on using the bindings with web interfaces, +specifically Flask. + at item +Moving the @emph{What's New} section out of the basic @uref{gpgme-python-howto.org, HOWTO} document and +into its own file so as to more readily include other documents +beyond that HOWTO. + at item +Moving the preceding, archival, segments into @uref{what-was-new.org, another file}. + at end itemize + + at bye \ No newline at end of file diff --git a/lang/python/doc/texinfo/what-was-new.texi b/lang/python/doc/texinfo/what-was-new.texi new file mode 100644 index 0000000..f81e0c3 --- /dev/null +++ b/lang/python/doc/texinfo/what-was-new.texi @@ -0,0 +1,160 @@ +\input texinfo @c -*- texinfo -*- + at c %**start of header + at setfilename what-was-new.info + at settitle What Was New in the GPGME Python Bindings and Documentation + at documentencoding UTF-8 + at documentlanguage en + at c %**end of header + + at finalout + at titlepage + at title What Was New in the GPGME Python Bindings and Documentation + at author Ben McGinnes + at end titlepage + + at contents + + at ifnottex + at node Top + at top What Was New in the GPGME Python Bindings and Documentation + at end ifnottex + + at menu +* What Was New:: + + at detailmenu +--- The Detailed Node Listing --- + +What Was New + +* What Was New in GPGME 1?12?0:: + +What Was New in GPGME 1?12?0 + +* New in GPGME 1?12?0:: + + at end detailmenu + at end menu + + at node What Was New + at chapter What Was New + + at multitable {aaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} + at item Version: + at tab 0.0.1-draft + at item GPGME Version: + at tab 1.13.0 + at item Author: + at tab @uref{https://gnupg.org/people/index.html#sec-1-5, Ben McGinnes} + at item Author GPG Key: + at tab DB4724E6FA4286C92B4E55C4321E4E2373590E5D + at item Language: + at tab Australian English, British English + at item xml:lang: + at tab en-AU, en-GB, en + at end multitable + +The following are all the past @emph{What's New} sections for the Python +Bindings HOWTO and other documentation. + + at menu +* What Was New in GPGME 1?12?0:: + at end menu + + at node What Was New in GPGME 1?12?0 + at section What Was New in GPGME 1?12?0 + +The most obviously new point for those reading this guide is this +section on other new things, but that?s hardly important. Not given +all the other things which spurred the need for adding this section +and its subsections. + + at menu +* New in GPGME 1?12?0:: + at end menu + + at node New in GPGME 1?12?0 + at subsection New in GPGME 1?12?0 + +There have been quite a number of additions to GPGME and the Python +bindings to it since the last release of GPGME with versions 1.11.0 +and 1.11.1 in April, 2018. + +The bullet points of new additiions are: + + at itemize + at item +an expanded section on @uref{gpgme-python-howto#installation, installing} and @uref{gpgme-python-howto#snafu, troubleshooting} the Python +bindings. + at item +The release of Python 3.7.0; which appears to be working just fine +with our bindings, in spite of intermittent reports of problems for +many other Python projects with that new release. + at item +Python 3.7 has been moved to the head of the specified python +versions list in the build process. + at item +In order to fix some other issues, there are certain underlying +functions which are more exposed through the @uref{gpgme-python-howto#howto-get-context, gpg.Context()}, but +ongoing documentation ought to clarify that or otherwise provide the +best means of using the bindings. Some additions to @samp{gpg.core} and +the @samp{Context()}, however, were intended (see below). + at item +Continuing work in identifying and confirming the cause of +oft-reported @uref{gpgme-python-howto#snafu-runtime-not-funtime, problems installing the Python bindings on Windows}. + at item +GSOC: Google's Surreptitiously Ordered Conscription @dots{} erm @dots{} oh, +right; Google's Summer of Code. Though there were two hopeful +candidates this year; only one ended up involved with the GnuPG +Project directly, the other concentrated on an unrelated third party +project with closer ties to one of the GNU/Linux distributions than +to the GnuPG Project. Thus the Python bindings benefited from GSOC +participant Jacob Adams, who added the key at math{_import} function; building +on prior work by Tobias Mueller. + at item +Several new methods functions were added to the gpg.Context(), +including: @uref{gpgme-python-howto#howto-import-key, key at math{_import}}, @uref{gpgme-python-howto#howto-export-key, key at math{_export}}, @uref{gpgme-python-howto#howto-export-public-key, key at math{_export}@math{_minimal}} and + at uref{gpgme-python-howto#howto-export-secret-key, key at math{_export}@math{_secret}}. + at item +Importing and exporting examples include versions integrated with +Marcel Fest's recently released @uref{https://github.com/Selfnet/hkp4py, HKP for Python} module. Some + at uref{gpgme-python-howto#hkp4py, additional notes on this module} are included at the end of the HOWTO. + at item +Instructions for dealing with semi-walled garden implementations +like ProtonMail are also included. This is intended to make things +a little easier when communicating with users of ProtonMail's +services and should not be construed as an endorsement of said +service. The GnuPG Project neither favours, nor disfavours +ProtonMail and the majority of this deals with interacting with the +ProtonMail keyserver. + at item +Semi-formalised the location where @uref{gpgme-python-howto#draft-editions, draft versions} of this HOWTO may +periodically be accessible. This is both for the reference of +others and testing the publishing of the document itself. Renamed +this file at around the same time. + at item +The Texinfo documentation build configuration has been replicated +from the parent project in order to make to maintain consistency +with that project (and actually ship with each release). + at item +a reStructuredText (@samp{.rst}) version is also generated for Python +developers more used to and comfortable with that format as it is +the standard Python documentation format and Python developers may +wish to use it with Sphinx. Please note that there has been no +testing of the reStructuredText version with Sphinx at all. The +reST file was generated by the simple expedient of using @uref{https://pandoc.org/, Pandoc}. + at item +Added a new section for @uref{gpgme-python-howto#advanced-use, advanced or experimental use}. + at item +Began the advanced use cases with @uref{gpgme-python-howto#cython, a section} on using the module with + at uref{https://cython.org/, Cython}. + at item +Added a number of new scripts to the @samp{example/howto/} directory; +some of which may be in advance of their planned sections of the +HOWTO (and some are just there because it seemed like a good idea at +the time). + at item +Cleaned up a lot of things under the hood. + at end itemize + + at bye \ No newline at end of file ----------------------------------------------------------------------- Summary of changes: lang/python/doc/README | 6 +- lang/python/doc/rst/gpgme-python-howto.rst | 123 ++++++------------ lang/python/doc/rst/index.rst | 10 +- lang/python/doc/rst/short-history.rst | 12 +- lang/python/doc/rst/what-is-new.rst | 42 +++++++ lang/python/doc/rst/what-was-new.rst | 116 +++++++++++++++++ lang/python/doc/src/index | 6 +- lang/python/doc/src/short-history | 2 +- lang/python/doc/src/what-was-new | 18 +-- lang/python/doc/texinfo/gpgme-python-howto.texi | 135 ++++++-------------- lang/python/doc/texinfo/index.texi | 8 +- lang/python/doc/texinfo/short-history.texi | 2 +- lang/python/doc/texinfo/what-is-new.texi | 79 ++++++++++++ lang/python/doc/texinfo/what-was-new.texi | 160 ++++++++++++++++++++++++ 14 files changed, 504 insertions(+), 215 deletions(-) create mode 100644 lang/python/doc/rst/what-is-new.rst create mode 100644 lang/python/doc/rst/what-was-new.rst create mode 100644 lang/python/doc/texinfo/what-is-new.texi create mode 100644 lang/python/doc/texinfo/what-was-new.texi hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 6 07:32:10 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Tue, 06 Nov 2018 07:32:10 +0100 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.10-31-g627839e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 627839ea88da11a9e8d033e3c91bdf5a048b15c3 (commit) from 66e0bd37ee3dd5ab534b2664493576ef6ad15a08 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 627839ea88da11a9e8d033e3c91bdf5a048b15c3 Author: NIIBE Yutaka Date: Tue Nov 6 15:28:43 2018 +0900 g10: Fix print_keygrip for smartcard. * g10/card-util.c (print_keygrip): Use tty_fprintf. -- Reported-by: Joey Pabalinas Signed-off-by: NIIBE Yutaka diff --git a/g10/card-util.c b/g10/card-util.c index 397a8d6..52a09b5 100644 --- a/g10/card-util.c +++ b/g10/card-util.c @@ -274,7 +274,7 @@ print_keygrip (estream_t fp, const unsigned char *grp) { tty_fprintf (fp, " keygrip ....: "); for (i=0; i < 20 ; i++, grp++) - es_fprintf (fp, "%02X", *grp); + tty_fprintf (fp, "%02X", *grp); tty_fprintf (fp, "\n"); } } ----------------------------------------------------------------------- Summary of changes: g10/card-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 6 07:37:17 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Tue, 06 Nov 2018 07:37:17 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-253-g01b77eb Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 01b77ebbb71d47ba276d3a1af9595fdcd9b48f5f (commit) from e3a1e80d13487c9336640a99b2f6d385d7d6f55c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 01b77ebbb71d47ba276d3a1af9595fdcd9b48f5f Author: NIIBE Yutaka Date: Tue Nov 6 15:28:43 2018 +0900 g10: Fix print_keygrip for smartcard. * g10/card-util.c (print_keygrip): Use tty_fprintf. -- Reported-by: Joey Pabalinas Signed-off-by: NIIBE Yutaka diff --git a/g10/card-util.c b/g10/card-util.c index 5205798..a1a099d 100644 --- a/g10/card-util.c +++ b/g10/card-util.c @@ -276,7 +276,7 @@ print_keygrip (estream_t fp, const unsigned char *grp) { tty_fprintf (fp, " keygrip ....: "); for (i=0; i < 20 ; i++, grp++) - es_fprintf (fp, "%02X", *grp); + tty_fprintf (fp, "%02X", *grp); tty_fprintf (fp, "\n"); } } ----------------------------------------------------------------------- Summary of changes: g10/card-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 6 08:57:12 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 06 Nov 2018 08:57:12 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-2.3.1-26-g83c0023 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 83c00237b6b9f37e1079b4a7b3baf0e34a8d9d97 (commit) via a49abe7fe79e25a15b60a78093abc9704a5ef198 (commit) via b9dea48de425c00e0d0630ae11144e72ac9352d2 (commit) via 99d4c80e57459d834aad1b63c18a1cc3823ce3de (commit) from dc2a57f878282e50ccae9c55b3cfadcea1bb7f27 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 83c00237b6b9f37e1079b4a7b3baf0e34a8d9d97 Author: Andre Heinecke Date: Tue Nov 6 08:56:27 2018 +0100 Fix infographic url * src/ribbon-callbacks.cpp (launch_cert_details): Fix url. -- The old redirect redirects to 404 :-( Maybe time to change the infographic. diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp index 2d3604c..fc5d79a 100644 --- a/src/ribbon-callbacks.cpp +++ b/src/ribbon-callbacks.cpp @@ -676,7 +676,7 @@ HRESULT launch_cert_details (LPDISPATCH ctrl) if (!mail || (!mail->isSigned () && !mail->isEncrypted ())) { - ShellExecuteA(NULL, NULL, "https://emailselfdefense.fsf.org/infographic", + ShellExecuteA(NULL, NULL, "https://emailselfdefense.fsf.org/en/infographic.html", 0, 0, SW_SHOWNORMAL); return S_OK; } commit a49abe7fe79e25a15b60a78093abc9704a5ef198 Author: Andre Heinecke Date: Tue Nov 6 08:54:26 2018 +0100 Add junk mail handling * src/categorymanager.cpp (getJunkMailCategory): New. * src/mail.cpp (Mail::decryptVerify_o): Handle junk. * src/mail.h (Mail::m_is_junk): New. -- Junk mails are special. An addon can't access the attachments so we can't decrypt PGP-MIME. We just add a marker to let the user now and register our folder event handler so that the mail can be moved out of junk. GnuPG-Bug-Id: T4188 diff --git a/src/categorymanager.cpp b/src/categorymanager.cpp index e671f2d..d8c67e0 100644 --- a/src/categorymanager.cpp +++ b/src/categorymanager.cpp @@ -251,3 +251,16 @@ CategoryManager::getEncMailCategory () } return decStr; } + +/* static */ +const std::string & +CategoryManager::getJunkMailCategory () +{ + static std::string decStr; + if (decStr.empty()) + { + decStr = std::string ("GpgOL: ") + + std::string (_("Junk Email cannot be processed")); + } + return decStr; +} diff --git a/src/categorymanager.h b/src/categorymanager.h index 0e96485..f76018d 100644 --- a/src/categorymanager.h +++ b/src/categorymanager.h @@ -61,6 +61,8 @@ public: /** Get the name of the encryption category. */ static const std::string & getEncMailCategory (); + /** Get the name of the junk category. */ + static const std::string & getJunkMailCategory (); private: class Private; std::shared_ptr d; diff --git a/src/mail.cpp b/src/mail.cpp index 9305057..eafa3ef 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -107,7 +107,8 @@ Mail::Mail (LPDISPATCH mailitem) : m_first_autosecure_check(true), m_locate_count(0), m_is_about_to_be_moved(false), - m_locate_in_progress(false) + m_locate_in_progress(false), + m_is_junk(false) { TSTART; if (getMailForItem (mailitem)) @@ -1058,6 +1059,7 @@ int Mail::decryptVerify_o () { TSTART; + if (!isCryptoMail ()) { log_debug ("%s:%s: Decrypt Verify for non crypto mail: %p.", @@ -1070,10 +1072,31 @@ Mail::decryptVerify_o () SRCNAME, __func__, m_mailitem); TRETURN 1; } + + auto cipherstream = get_attachment_stream_o (m_mailitem, m_moss_position); + if (!cipherstream) + { + m_is_junk = is_junk_mail (m_mailitem); + if (m_is_junk) + { + log_debug ("%s:%s: Detected: %p as junk", + SRCNAME, __func__, m_mailitem); + auto mngr = CategoryManager::instance (); + m_store_id = mngr->addCategoryToMail (this, + CategoryManager::getJunkMailCategory (), + 3 /* peach */); + installFolderEventHandler_o (); + TRETURN 0; + } + log_debug ("%s:%s: Failed to get cipherstream. Aborting handling.", + SRCNAME, __func__); + m_type = MSGTYPE_UNKNOWN; + TRETURN 1; + } + setUUID_o (); m_processed = true; - /* Insert placeholder */ char *placeholder_buf = nullptr; if (m_type == MSGTYPE_GPGOL_WKS_CONFIRMATION) @@ -1133,22 +1156,12 @@ Mail::decryptVerify_o () memdbg_alloc (placeholder_buf); xfree (placeholder_buf); - /* Do the actual parsing */ - auto cipherstream = get_attachment_stream_o (m_mailitem, m_moss_position); - if (m_type == MSGTYPE_GPGOL_WKS_CONFIRMATION) { WKSHelper::instance ()->handle_confirmation_read (this, cipherstream); TRETURN 0; } - if (!cipherstream) - { - log_debug ("%s:%s: Failed to get cipherstream.", - SRCNAME, __func__); - TRETURN 1; - } - m_parser = std::shared_ptr (new ParseController (cipherstream, m_type)); m_parser->setSender(GpgME::UserID::addrSpecFromString(getSender_o ().c_str())); log_data ("%s:%s: Parser for \"%s\" is %p", @@ -2212,6 +2225,13 @@ Mail::removeCategories_o () CategoryManager::instance ()->removeCategory (this, CategoryManager::getEncMailCategory ()); } + if (m_is_junk) + { + log_oom ("%s:%s: Unreffing junk category", + SRCNAME, __func__); + CategoryManager::instance ()->removeCategory (this, + CategoryManager::getJunkMailCategory ()); + } TRETURN; } @@ -2347,15 +2367,15 @@ Mail::updateCategories_o () int color = 0; if (lvl == 2) { - color = 7; + color = 7; /* Olive */ } if (lvl == 3) { - color = 5; + color = 5; /* Green */ } if (lvl == 4) { - color = 20; + color = 20; /* Dark Green */ } m_store_id = mngr->addCategoryToMail (this, buf, color); m_verify_category = buf; @@ -2370,7 +2390,7 @@ Mail::updateCategories_o () { const auto id = mngr->addCategoryToMail (this, CategoryManager::getEncMailCategory (), - 8); + 8 /* Blue */); if (m_store_id.empty()) { m_store_id = id; diff --git a/src/mail.h b/src/mail.h index 05d26d0..170770c 100644 --- a/src/mail.h +++ b/src/mail.h @@ -654,5 +654,6 @@ private: bool m_locate_in_progress; /* Simplified state variable for locate */ std::string m_store_id; /* Store id for categories */ std::string m_verify_category; /* The category string for the verify result */ + bool m_is_junk; /* Mail is in the junk folder */ }; #endif // MAIL_H commit b9dea48de425c00e0d0630ae11144e72ac9352d2 Author: Andre Heinecke Date: Mon Nov 5 16:44:00 2018 +0100 Add junk/spam mail folder detection * src/oomhelp.cpp, src/oomhelp.h (is_junk_mail): New. -- We can't access attachments in junk so we need some special handling. As there is no "Junk" property we do this by comparing the entryid of the accounts junk folder with the actual folder of the mail. GnuPG-Bug-Id: T4188 diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp index 9ac1083..ace525a 100644 --- a/src/oomhelp.cpp +++ b/src/oomhelp.cpp @@ -2872,3 +2872,60 @@ release_disp (LPDISPATCH obj) gpgol_release (obj); TRETURN; } + +bool +is_junk_mail (LPDISPATCH mailitem) +{ + TSTART; + if (!mailitem) + { + STRANGEPOINT; + TRETURN false; + } + + auto mapi_namespace = MAKE_SHARED (get_oom_object (mailitem, "Session")); + + if (!mapi_namespace) + { + STRANGEPOINT; + TRETURN false; + } + + auto spam_folder = MAKE_SHARED (get_oom_object (mapi_namespace.get(), + "GetDefaultFolder(23)")); + + if (!spam_folder) + { + STRANGEPOINT; + TRETURN false; + } + + auto mail_folder = MAKE_SHARED (get_oom_object (mailitem, "Parent")); + + if (!mail_folder) + { + STRANGEPOINT; + TRETURN false; + } + + char *spam_id = get_oom_string (spam_folder.get(), "entryID"); + if (!spam_id) + { + STRANGEPOINT; + TRETURN false; + } + char *folder_id = get_oom_string (mail_folder.get(), "entryID"); + if (!folder_id) + { + STRANGEPOINT; + free (spam_id); + TRETURN false; + } + + bool ret = !strcmp (spam_id, folder_id); + + free (spam_id); + free (folder_id); + + TRETURN ret; +} diff --git a/src/oomhelp.h b/src/oomhelp.h index 3f9199c..762f578 100644 --- a/src/oomhelp.h +++ b/src/oomhelp.h @@ -427,4 +427,7 @@ LPDISPATCH find_or_add_text_prop (LPDISPATCH props, const char *name); /* Find a user property and return it if found. */ LPDISPATCH find_user_prop (LPDISPATCH props, const char *name); + +/* Return true if this message is in the junk folder for this account */ +bool is_junk_mail (LPDISPATCH mailitem); #endif /*OOMHELP_H*/ commit 99d4c80e57459d834aad1b63c18a1cc3823ce3de Author: Andre Heinecke Date: Mon Nov 5 09:11:14 2018 +0100 Fix tests build for different gpgmepp prefix * tests/Makefile.am: Add GPGME_CXXFLAGS to CXXFLAGS. diff --git a/tests/Makefile.am b/tests/Makefile.am index dfb96b0..336794f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -32,11 +32,11 @@ if !HAVE_W32_SYSTEM AM_CXXFLAGS = -I$(top_srcdir)/src $(GPGME_CFLAGS) $(GPGME_CFLAGS)/gpgme++ \ $(LIBASSUAN_CFLAGS) -std=c++11 -D_FILE_OFFSET_BITS=64 \ -DBUILD_TESTS -DDATADIR=\"$(abs_srcdir)/data\" \ - -DGPGHOMEDIR=\"$(abs_srcdir)/gnupg_home\" + -DGPGHOMEDIR=\"$(abs_srcdir)/gnupg_home\" $(GPGMEPP_CXXFLAGS) else AM_CXXFLAGS = -I$(top_srcdir)/src $(GPGME_CFLAGS) $(GPGME_CFLAGS)/gpgme++ \ - $(LIBASSUAN_CFLAGS) -std=c++11 -D_FILE_OFFSET_BITS=64 \ - -DBUILD_TESTS + $(LIBASSUAN_CFLAGS) $(GPGMEPP_CXXFLAGS) -std=c++11 \ + -D_FILE_OFFSET_BITS=64 -DBUILD_TESTS endif LDADD = @GPG_ERROR_LIBS@ ----------------------------------------------------------------------- Summary of changes: src/categorymanager.cpp | 13 +++++++++++ src/categorymanager.h | 2 ++ src/mail.cpp | 52 +++++++++++++++++++++++++++++-------------- src/mail.h | 1 + src/oomhelp.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ src/oomhelp.h | 3 +++ src/ribbon-callbacks.cpp | 2 +- tests/Makefile.am | 6 ++--- 8 files changed, 116 insertions(+), 20 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 6 12:23:51 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 06 Nov 2018 12:23:51 +0100 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.10-35-g10157b4 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 10157b41793247baa9c42c0450da146241a2c7b5 (commit) via cb46b787571ef149856be03b8c3481bb79871698 (commit) via e11bab3c1181f70a3b383cf8cc426a916a77b0ca (commit) via 7e72bb4295e49a5be063e8fc93f05e122e9a0700 (commit) from 627839ea88da11a9e8d033e3c91bdf5a048b15c3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 10157b41793247baa9c42c0450da146241a2c7b5 Author: Werner Koch Date: Tue Nov 6 11:42:26 2018 +0100 Post release updates. -- diff --git a/NEWS b/NEWS index 2d72ada..ab6dbce 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +Noteworthy changes in version 2.2.12 (unreleased) +------------------------------------------------- + + Noteworthy changes in version 2.2.11 (2018-11-06) ------------------------------------------------- diff --git a/configure.ac b/configure.ac index 4d66af9..4d21545 100644 --- a/configure.ac +++ b/configure.ac @@ -28,7 +28,7 @@ min_automake_version="1.14" m4_define([mym4_package],[gnupg]) m4_define([mym4_major], [2]) m4_define([mym4_minor], [2]) -m4_define([mym4_micro], [11]) +m4_define([mym4_micro], [12]) # To start a new development series, i.e a new major or minor number # you need to mark an arbitrary commit before the first beta release commit cb46b787571ef149856be03b8c3481bb79871698 Author: Werner Koch Date: Tue Nov 6 11:08:02 2018 +0100 Release 2.1.11 Signed-off-by: Werner Koch diff --git a/NEWS b/NEWS index baace07..2d72ada 100644 --- a/NEWS +++ b/NEWS @@ -1,21 +1,62 @@ -Noteworthy changes in version 2.2.11 (unreleased) +Noteworthy changes in version 2.2.11 (2018-11-06) ------------------------------------------------- + * gpgsm: Fix CRL loading when intermediate certicates are not yet + trusted. + + * gpgsm: Fix an error message about the digest algo. [#4219] + + * gpg: Fix a wrong warning due to new sign usage check introduced + with 2.2.9. [#4014] + + * gpg: Print the "data source" even for an unsuccessful keyserver + query. + + * gpg: Do not store the TOFU trust model in the trustdb. This + allows to enable or disable a TOFO model without triggering a + trustdb rebuild. [#4134] + + * scd: Fix cases of "Bad PIN" after using "forcesig". [#4177] + + * agent: Fix possible hang in the ssh handler. [#4221] + + * dirmngr: Tack the unmodified mail address to a WKD request. See + commit a2bd4a64e5b057f291a60a9499f881dd47745e2f for details. + + * dirmngr: Tweak diagnostic about missing LDAP server file. + + * dirmngr: In verbose mode print the OCSP responder id. + + * dirmngr: Fix parsing of the LDAP port. [#4230] + + * wks: Add option --directory/-C to the server. Always build the + server on Unix systems. + + * wks: Add option --with-colons to the client. Support sites which + use the policy file instead of the submission-address file. + + * Fix EBADF when gpg et al. are called by broken CGI scripts. + + * Fix some minor memory leaks and bugs. + + Release-info: https://dev.gnupg.org/T4233 + See-also: gnupg-announce/2018q4/000432.html + Noteworthy changes in version 2.2.10 (2018-08-30) ------------------------------------------------- - gpg: Refresh expired keys originating from the WKD. [#2917] + * gpg: Refresh expired keys originating from the WKD. [#2917] - gpg: Use a 256 KiB limit for a WKD imported key. + * gpg: Use a 256 KiB limit for a WKD imported key. - gpg: New option --known-notation. [#4060] + * gpg: New option --known-notation. [#4060] - scd: Add support for the Trustica Cryptoucan reader. + * scd: Add support for the Trustica Cryptoucan reader. - agent: Speed up starting during on-demand launching. [#3490] + * agent: Speed up starting during on-demand launching. [#3490] - dirmngr: Validate SRV records in WKD queries. + * dirmngr: Validate SRV records in WKD queries. Release-info: https://dev.gnupg.org/T4112 See-also: gnupg-announce/2018q3/000428.html commit e11bab3c1181f70a3b383cf8cc426a916a77b0ca Author: Petr Pisar Date: Tue Nov 6 11:04:25 2018 +0100 po: Update Czech translation -- diff --git a/po/cs.po b/po/cs.po index 8155691..c5c45e4 100644 --- a/po/cs.po +++ b/po/cs.po @@ -4,7 +4,7 @@ # Magda Proch?zkov? 2001, # Roman Pavlik 2001, 2002, 2003, 2004, 2005. # Petr Pisar , 2009, 2010, 2011, 2013, 2014, 2015, 2016. -# Petr Pisar , 2017. +# Petr Pisar , 2017, 2018. # # A "%%0A" is used by Pinentry to insert a line break. The double percent # sign is actually needed because it is also a printf format string. If you @@ -35,9 +35,9 @@ # msgid "" msgstr "" -"Project-Id-Version: gnupg2 2.2.1\n" +"Project-Id-Version: gnupg2 2.2.10\n" "Report-Msgid-Bugs-To: translations at gnupg.org\n" -"PO-Revision-Date: 2017-11-17 10:33+01:00\n" +"PO-Revision-Date: 2018-11-06 11:01+0100\n" "Last-Translator: Petr Pisar \n" "Language-Team: Czech \n" "Language: cs\n" @@ -388,7 +388,7 @@ msgid "allow presetting passphrase" msgstr "umo?nit p?ednastaven? hesla" msgid "disallow caller to override the pinentry" -msgstr "zmemo?nit volaj?c?mu p?eb?t pinentry" +msgstr "znemo?nit volaj?c?mu p?eb?t pinentry" msgid "allow passphrase to be prompted through Emacs" msgstr "umo?nit zad?n? hesla skrze Emacs" @@ -397,7 +397,7 @@ msgid "enable ssh support" msgstr "zapnout podporu pro OpenSSH" msgid "|ALGO|use ALGO to show ssh fingerprints" -msgstr "|ALGORITMUS|ukazovat otkisky SSH?pomoc? ALGORITMU" +msgstr "|ALGORITMUS|ukazovat otisky SSH?pomoc? ALGORITMU" msgid "enable putty support" msgstr "zapnout podporu pro PuTTY" @@ -852,15 +852,13 @@ msgstr "VAROV?N?: ?%s%s? je zastaral? parametr?? ne??inkuje\n" msgid "unknown debug flag '%s' ignored\n" msgstr "nezn?m? ladic? p??znak ?%s? se ignoruje\n" -#, fuzzy, c-format -#| msgid "waiting for the agent to come up ... (%ds)\n" +#, c-format msgid "waiting for the %s to come up ... (%ds)\n" -msgstr "?ek? se na agenta? (%d?s)\n" +msgstr "?ek? se, a? nab?hne %s? (%d?s)\n" -#, fuzzy, c-format -#| msgid "connection to agent established\n" +#, c-format msgid "connection to %s established\n" -msgstr "spojen? na agenta ustanoveno\n" +msgstr "spojen? k?programu %s ustanoveno\n" #, c-format msgid "no running gpg-agent - starting '%s'\n" @@ -1404,22 +1402,16 @@ msgid "%s keysizes must be in the range %u-%u\n" msgstr "velikost kl??e %s mus? b?t v intervalu %u-%u\n" msgid "Changing card key attribute for: " -msgstr "" +msgstr "M?n? se atribut kartov?ho kl??e pro: " -#, fuzzy -#| msgid " (1) Signature key\n" msgid "Signature key\n" -msgstr " (1) Podepisovac? kl??\n" +msgstr "Podepisovac? kl??\n" -#, fuzzy -#| msgid " (2) Encryption key\n" msgid "Encryption key\n" -msgstr " (2) ?ifrovac? kl??\n" +msgstr "?ifrovac? kl??\n" -#, fuzzy -#| msgid " (3) Authentication key\n" msgid "Authentication key\n" -msgstr " (3) Autentiza?n? kl??\n" +msgstr "Autentiza?n? kl??\n" msgid "Please select what kind of key you want:\n" msgstr "Pros?m, vyberte druh kl??e, kter? chcete:\n" @@ -1428,10 +1420,9 @@ msgstr "Pros?m, vyberte druh kl??e, kter? chcete:\n" msgid " (%d) RSA\n" msgstr " (%d) RSA\n" -#, fuzzy, c-format -#| msgid " (%d) ECC and ECC\n" +#, c-format msgid " (%d) ECC\n" -msgstr " (%d) ECC a ECC\n" +msgstr " (%d) ECC\n" msgid "Invalid selection.\n" msgstr "Neplatn? v?b?r.\n" @@ -1440,20 +1431,17 @@ msgstr "Neplatn? v?b?r.\n" msgid "The card will now be re-configured to generate a key of %u bits\n" msgstr "Karta bude nyn? p?enastavena na generov?n? kl??e dlouh?ho %u bit?\n" -#, fuzzy, c-format -#| msgid "The card will now be re-configured to generate a key of %u bits\n" +#, c-format msgid "The card will now be re-configured to generate a key of type: %s\n" -msgstr "Karta bude nyn? p?enastavena na generov?n? kl??e dlouh?ho %u bit?\n" +msgstr "Karta bude nyn? p?enastavena na generov?n? kl??e typu: %s\n" -#, fuzzy, c-format -#| msgid "error changing size of key %d to %u bits: %s\n" +#, c-format msgid "error changing key attribute for key %d: %s\n" -msgstr "chyba p?i zm?n? velikosti kl??e %d na %u bit?: %s\n" +msgstr "chyba p?i zm?n? atributu kl??e %d: %s\n" -#, fuzzy, c-format -#| msgid "error getting current key info: %s\n" +#, c-format msgid "error getting card info: %s\n" -msgstr "chyba p?i z?sk?n? informac? o aktu?ln?m kl??i: %s\n" +msgstr "chyba p?i z?sk?n? informac? o?kart?: %s\n" #, c-format msgid "This command is not supported by this card\n" @@ -1509,10 +1497,9 @@ msgstr "Pokra?ovat (a/N) " msgid "Really do a factory reset? (enter \"yes\") " msgstr "Opravdu obnovit tov?rn? nastaven? (zadejte ?yes?) " -#, fuzzy, c-format -#| msgid "error looking up: %s\n" +#, c-format msgid "error for setup KDF: %s\n" -msgstr "chyba p?i vyhled?v?n?: %s\n" +msgstr "chyba p?i nastavov?n? KDF: %s\n" msgid "quit this menu" msgstr "ukon?it toto menu" @@ -1565,15 +1552,11 @@ msgstr "odblokovat PIN pomoc? reseta?n?ho k?du" msgid "destroy all keys and data" msgstr "zni?it v?echny kl??e a data" -#, fuzzy -#| msgid "|NAME|use user NAME for authentication" msgid "setup KDF for PIN authentication" -msgstr "|JM?NO|pro autentizaci pou?ije JM?NO u?ivatele" +msgstr "nastavit KDF pro autentizaci k?dem PIN" -#, fuzzy -#| msgid "change the ownertrust" msgid "change the key attribute" -msgstr "zm?nit d?v?ryhodnost vlastn?ka kl??e" +msgstr "zm?nit atribut kl??e" msgid "gpg/card> " msgstr "gpg/karta> " @@ -1840,7 +1823,7 @@ msgstr "Chyb? otisk" #, c-format msgid "checking for a fresh copy of an expired key via %s\n" -msgstr "" +msgstr "zji??uje se nov? kopie zastaral?ho kl??e skrze %s\n" #, c-format msgid "secret key \"%s\" not found: %s\n" @@ -2226,10 +2209,9 @@ msgstr "?%s? nen? spr?vn? e-mailov? adresa\n" msgid "invalid pinentry mode '%s'\n" msgstr "neplatn? re?im pinentry??%s?\n" -#, fuzzy, c-format -#| msgid "invalid value for option '%s'\n" +#, c-format msgid "invalid request origin '%s'\n" -msgstr "neplatn? argument u?volby ?%s?\n" +msgstr "neplatn? p?vod po?adavku ?%s?\n" #, c-format msgid "'%s' is not a valid character set\n" @@ -3304,10 +3286,8 @@ msgstr "sm?stnat nepou?iteln? ID u?ivatel? a odstranit z?kl??e v?echny msgid "Secret key is available.\n" msgstr "Tajn? kl?? je dostupn?.\n" -#, fuzzy -#| msgid "Secret key is available.\n" msgid "Secret subkeys are available.\n" -msgstr "Tajn? kl?? je dostupn?.\n" +msgstr "Tajn? podkl??e jsou dostupn?.\n" msgid "Need the secret key to do this.\n" msgstr "Pro proveden? t?to operace je pot?eba tajn? kl??.\n" @@ -3630,7 +3610,7 @@ msgid "" "cause\n" " some versions of PGP to reject this key.\n" msgstr "" -"VAROV?N?: Toto je PGP2 kl??. P?id?n? pov??e?ho odvolatele m??e v n?kter?ch\n" +"VAROV?N?: Toto je PGP2 kl??. P?id?n? pov??en?ho odvolatele m??e v n?kter?ch\n" " verz?ch PGP v?st k odm?tnut? tohoto kl??e.\n" msgid "You may not add a designated revoker to a PGP 2.x-style key.\n" @@ -3674,15 +3654,11 @@ msgstr "M?n?m dobu expirace prim?rn?ho kl??e.\n" msgid "You can't change the expiration date of a v3 key\n" msgstr "Nem??ete zm?nit dobu platnosti kl??e verze 3\n" -#, fuzzy -#| msgid "Changing expiration time for a subkey.\n" msgid "Changing usage of a subkey.\n" -msgstr "M?n?m dobu expirace podkl??e.\n" +msgstr "M?n? se ??el podkl??e.\n" -#, fuzzy -#| msgid "Changing expiration time for the primary key.\n" msgid "Changing usage of the primary key.\n" -msgstr "M?n?m dobu expirace prim?rn?ho kl??e.\n" +msgstr "M?n? se ??el prim?rn?ho kl??e.\n" #, c-format msgid "signing subkey %s is already cross-certified\n" @@ -4518,15 +4494,16 @@ msgid "" "likely that this message is legitimate. This is because back\n" "then integrity protection was not widely used.\n" msgstr "" +"Pokyn: Pokud tato zpr?va byla vytvo?ena p?ed rokem 2003, je pravd?podobn?,\n" +"?e je legitimn?. Tehdy se toti? ochrana integrity p??li? nepou??vala.\n" #, c-format msgid "Use the option '%s' to decrypt anyway.\n" -msgstr "" +msgstr "De?ifrov?n? lze vynutit volbou ?%s?.\n" -#, fuzzy, c-format -#| msgid "decryption failed: %s\n" +#, c-format msgid "decryption forced to fail!\n" -msgstr "de?ifrov?n? selhalo: %s\n" +msgstr "vynucen? de?ifrov?n? selhalo!\n" #, c-format msgid "decryption okay\n" @@ -4788,10 +4765,9 @@ msgstr "nemohu pracovat s algoritmem ve?ejn?ho kl??e %d\n" msgid "WARNING: potentially insecure symmetrically encrypted session key\n" msgstr "VAROV?N?: potencion?ln? nebezpe?n? symetricky za?ifrov?n kl?? sezen?\n" -#, fuzzy, c-format -#| msgid "Critical signature notation: " +#, c-format msgid "Unknown critical signature notation: " -msgstr "Kritick? podepisovac? notace: " +msgstr "Nezn?m? kritick? notace podpisu: " #, c-format msgid "subpacket of type %d has critical bit set\n" @@ -4810,7 +4786,7 @@ msgstr "zru?eno u?ivatelem\n" #, c-format msgid " (main key ID %s)" -msgstr " (hlavn? ID kl??e %s)" +msgstr " (ID hlavn?ho kl??e %s)" msgid "Please enter the passphrase to unlock the OpenPGP secret key:" msgstr "Pros?m, zadejte heslo, abyste odemkli tajn? kl?? OpenPGP:" @@ -5229,7 +5205,7 @@ msgid "" "declare that a key shall not anymore be used. It is not possible\n" "to retract such a revocation certificate once it has been published." msgstr "" -"Odovolac? certifik?t je sv?m zp?soben ?bezpe?nostn? vyp?na??, kter?\n" +"Odvolac? certifik?t je sv?m zp?soben ?bezpe?nostn? vyp?na??, kter?\n" "ve?ejn? prohla?uje, ?e kl?? by se ji? nem?l pou??vat. Jednou zve?ejn?n?\n" "odvolac? certifik?t ji? nelze vz?t zp?t." @@ -5409,15 +5385,13 @@ msgstr "Pozn?mka: podpisov?mu kl??i %s skon?ila platnost v?%s\n" msgid "Note: signature key %s has been revoked\n" msgstr "Pozn?mka: podpisov? kl?? %s byl odvol?n\n" -#, fuzzy, c-format -#| msgid "standalone signature of class 0x%02x\n" +#, c-format msgid "bad key signature from key %s: %s (0x%02x, 0x%x)\n" -msgstr "samostatn? podpis t??dy 0x%02x\n" +msgstr "?patn? podpis kl??e kl??em %s: %s (0x%02x, 0x%x)\n" -#, fuzzy, c-format -#| msgid "standalone signature of class 0x%02x\n" +#, c-format msgid "bad data signature from key %s: %s (0x%02x, 0x%x)\n" -msgstr "samostatn? podpis t??dy 0x%02x\n" +msgstr "?patn? podpis dat kl??em %s: %s (0x%02x, 0x%x)\n" #, c-format msgid "assuming bad signature from key %s due to an unknown critical bit\n" @@ -5650,7 +5624,7 @@ msgstr "chyba p?i zah?jen? transakce v?datab?zi TOFU: %s\n" #, c-format msgid "error committing transaction on TOFU database: %s\n" -msgstr "chyba p?i potvrzov?n? transakce v?dat?zi TOFU: %s\n" +msgstr "chyba p?i potvrzov?n? transakce v?datab?zi TOFU: %s\n" #, c-format msgid "error rolling back transaction on TOFU database: %s\n" @@ -5719,12 +5693,11 @@ msgid "" "or whether you think someone is impersonating \"%s\"." msgstr "" "Pros?m nazna?te, jestli tato e-mailov? adresa m? b?t spojov?na s kl??em %s " -"nebo jestli si myl?ste, ?e n?kdo se vyd?v? za ?%s?\n" -"." +"nebo jestli si mysl?te, ?e n?kdo se vyd?v? za ?%s?." #, c-format msgid "error gathering other user IDs: %s\n" -msgstr "chyba p?i sb?ru dal??ch ID u?ivetele: %s\n" +msgstr "chyba p?i sb?ru dal??ch ID u?ivatele: %s\n" msgid "This key's user IDs:\n" msgstr "ID u?ivatel? tohoto kl??e:\n" @@ -5762,7 +5735,7 @@ msgstr[2] "%d zpr?v ov??eno." msgid "Encrypted %d message." msgid_plural "Encrypted %d messages." msgstr[0] "%d zpr?va za?ifrov?na." -msgstr[1] "%d zpr?vy za?ifrov?ny." +msgstr[1] "%d zpr?vy za?ifrov?ny." msgstr[2] "%d zpr?v za?ifrov?no." #, c-format @@ -5827,7 +5800,7 @@ msgstr "Zpr?v ov??eno v minulosti: %d." #, c-format msgid "Messages encrypted in the past: %d." -msgstr "Zpr?v za?ifrovno v minulosti: %d." +msgstr "Zpr?v za?ifrov?no v minulosti: %d." #. TRANSLATORS: Please translate the text found in the source #. * file below. We don't directly internationalize that text so @@ -5845,11 +5818,11 @@ msgid "(G)ood, (A)ccept once, (U)nknown, (R)eject once, (B)ad? " msgstr "(D)obr?, (P)?ijmout jednou, (N)ezn?m?, (O)dm?tnout jednou, ?pa(T)n?? " msgid "Defaulting to unknown.\n" -msgstr "Pou??je se v?choz? volba nezn?m?.\n" +msgstr "Pou?ije se v?choz? volba nezn?m?.\n" #, c-format msgid "TOFU db corruption detected.\n" -msgstr "Zjist?no po?kozen? datab?ze TOFU.\n" +msgstr "Zji?t?no po?kozen? datab?ze TOFU.\n" #, c-format msgid "resetting keydb: %s\n" @@ -5947,19 +5920,19 @@ msgstr "(politika: %s)" msgid "" "Warning: we have yet to see a message signed using this key and user id!\n" msgstr "" -"Pozor:?je?t? mus?me vid?t zpr?vu podepsanou t?mto kl??em a idenitou " +"Pozor:?je?t? mus?me vid?t zpr?vu podepsanou t?mto kl??em a identitou " "u?ivatele!\n" #, c-format msgid "" "Warning: we've only seen one message signed using this key and user id!\n" msgstr "" -"Pozor:?vid?li jsme pouze jednu zpr?vu podepsanou t?mto kl??em a idenitou\n" +"Pozor:?vid?li jsme pouze jednu zpr?vu podepsanou t?mto kl??em a identitou\n" "u?ivatele!\n" #, c-format msgid "Warning: you have yet to encrypt a message to this key!\n" -msgstr "Pozor:?je?te je t?eba za?ifrovat zpr?vu t?mto kl??em!\n" +msgstr "Pozor:?je?t? je t?eba za?ifrovat zpr?vu t?mto kl??em!\n" #, c-format msgid "Warning: you have only encrypted one message to this key!\n" @@ -8924,18 +8897,27 @@ msgstr "" "Syntaxe: gpg-check-pattern [volby] soubor_se_vzorem\n" "Prov??? heslo zadan? na vstupu proti souboru se vzory\n" +#~ msgid "listen() failed: %s\n" +#~ msgstr "vol?n? listen() selhalo: %s\n" + #~ msgid "waiting for the dirmngr to come up ... (%ds)\n" #~ msgstr "?ek? se na dirmngr? (%d?s)\n" #~ msgid "connection to the dirmngr established\n" #~ msgstr "spojen? na?dirmngr ustanoveno\n" +#~ msgid "What keysize do you want for the Signature key? (%u) " +#~ msgstr "Jakou d?lku kl??e pro podepisov?n? si p?ejete? (%u) " + +#~ msgid "What keysize do you want for the Encryption key? (%u) " +#~ msgstr "Jakou d?lku kl??e pro ?ifrov?n? si p?ejete? (%u) " + +#~ msgid "What keysize do you want for the Authentication key? (%u) " +#~ msgstr "Jakou d?lku kl??e pro autentizaci si p?ejete? (%u) " + #~ msgid "Warning: '%s' should be a long key ID or a fingerprint\n" #~ msgstr "Pozor: ?%s? by m?l b?t dlouh? identifik?tor kl??e nebo jeho otisk\n" -#~ msgid "error looking up: %s\n" -#~ msgstr "chyba p?i vyhled?v?n?: %s\n" - #~ msgid "Warning: %s appears in the keyring %d times\n" #~ msgstr "Pozor: %s se nach?z? v?souboru kl??? (keyring) %dkr?t\n" @@ -8954,18 +8936,6 @@ msgstr "" #~ msgid "reading from ldap wrapper %d failed: %s\n" #~ msgstr "?ten? z?ldapov? ob?lky %d selhalo: %s\n" -#~ msgid "What keysize do you want for the Signature key? (%u) " -#~ msgstr "Jakou d?lku kl??e pro podepisov?n? si p?ejete? (%u) " - -#~ msgid "What keysize do you want for the Encryption key? (%u) " -#~ msgstr "Jakou d?lku kl??e pro ?ifrov?n? si p?ejete? (%u) " - -#~ msgid "What keysize do you want for the Authentication key? (%u) " -#~ msgstr "Jakou d?lku kl??e pro autentizaci si p?ejete? (%u) " - -#~ msgid "listen() failed: %s\n" -#~ msgstr "vol?n? listen() selhalo: %s\n" - #~ msgid "shadowing the key failed: %s\n" #~ msgstr "v?roba st?nov?ho kl??e se nezda?ila: %s\n" commit 7e72bb4295e49a5be063e8fc93f05e122e9a0700 Author: Werner Koch Date: Tue Nov 6 11:00:27 2018 +0100 po: Update German translation -- diff --git a/po/de.po b/po/de.po index 2e73b83..6badf9d 100644 --- a/po/de.po +++ b/po/de.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: gnupg-2.1.0\n" "Report-Msgid-Bugs-To: translations at gnupg.org\n" -"PO-Revision-Date: 2018-08-30 09:44+0200\n" +"PO-Revision-Date: 2018-11-06 10:59+0100\n" "Last-Translator: Werner Koch \n" "Language-Team: German \n" "Language: de\n" @@ -851,15 +851,13 @@ msgstr "WARNUNG: \"%s%s\" ist eine veraltete Option - sie hat keine Wirkung.\n" msgid "unknown debug flag '%s' ignored\n" msgstr "Unbekanntes Debug Flag '%s' wird ignoriert\n" -#, fuzzy, c-format -#| msgid "waiting for the agent to come up ... (%ds)\n" +#, c-format msgid "waiting for the %s to come up ... (%ds)\n" -msgstr "Warte bis der gpg-agent bereit ist ... (%ds)\n" +msgstr "Warte bis der %s bereit ist ... (%ds)\n" -#, fuzzy, c-format -#| msgid "connection to agent established\n" +#, c-format msgid "connection to %s established\n" -msgstr "Verbindung zum gpg-agent aufgebaut\n" +msgstr "Verbindung zum %s aufgebaut\n" #, c-format msgid "no running gpg-agent - starting '%s'\n" @@ -4817,10 +4815,9 @@ msgstr "" "WARNUNG: M?glicherweise unsicherer symmetrisch verschl?sselter " "Sitzungsschl?ssel\n" -#, fuzzy, c-format -#| msgid "Critical signature notation: " +#, c-format msgid "Unknown critical signature notation: " -msgstr "Entscheidender Beglaubigungs-\"Notation\": " +msgstr "Unbekannte Entscheidende Beglaubigungs-\"Notation\": " #, c-format msgid "subpacket of type %d has critical bit set\n" ----------------------------------------------------------------------- Summary of changes: NEWS | 59 ++++++++++++++++++--- configure.ac | 2 +- po/cs.po | 164 ++++++++++++++++++++++++----------------------------------- po/de.po | 17 +++---- 4 files changed, 127 insertions(+), 115 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 6 12:27:33 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 06 Nov 2018 12:27:33 +0100 Subject: [git] gnupg-doc - branch, master, updated. 8ea539b320dc27225bbdf09e4cdc7158f4260c5b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GnuPG website and other docs". The branch, master has been updated via 8ea539b320dc27225bbdf09e4cdc7158f4260c5b (commit) from 211888957e67cc0fc6a06dfaf442937fa2f296d1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8ea539b320dc27225bbdf09e4cdc7158f4260c5b Author: Werner Koch Date: Tue Nov 6 12:27:06 2018 +0100 swdb: Released GnuPG 2.2.11 diff --git a/web/swdb.mac b/web/swdb.mac index 6477e2b..e9aadc3 100644 --- a/web/swdb.mac +++ b/web/swdb.mac @@ -10,17 +10,17 @@ # # GnuPG-2.2 # -#+macro: gnupg22_ver 2.2.10 -#+macro: gnupg22_date 2018-08-30 -#+macro: gnupg22_size 6503k -#+macro: gnupg22_sha1 3e87504e2ca317718aa9b6299947ebf7e906b54e -#+macro: gnupg22_sha2 799dd37a86a1448732e339bd20440f4f5ee6e69755f6fd7a73ee8af30840c915 +#+macro: gnupg22_ver 2.2.11 +#+macro: gnupg22_date 2018-11-06 +#+macro: gnupg22_size 6496k +#+macro: gnupg22_sha1 c762d300c6c5616c14abff1cfaa099baa5fcbd2c +#+macro: gnupg22_sha2 496c3e123ef53f35436ddccca58e82acaa901ca4e21174e77386c0cea0c49cd9 #+macro: gnupg22_branch STABLE-BRANCH-2-2 -#+macro: gnupg22_w32_ver 2.2.10_20180830 -#+macro: gnupg22_w32_date 2018-08-30 -#+macro: gnupg22_w32_size 3919k -#+macro: gnupg22_w32_sha1 682002bce9e45309179a09348df3b92a82bdc501 -#+macro: gnupg22_w32_sha2 e84bad2436e3a0309d59e0ed313b346a1fc4ac556b5fd68bcea2d0e58d0516a2 +#+macro: gnupg22_w32_ver 2.2.11_20181106 +#+macro: gnupg22_w32_date 2018-11-06 +#+macro: gnupg22_w32_size 3928k +#+macro: gnupg22_w32_sha1 d1b1ba1bcf433cd1accf22772600f8a5186e156c +#+macro: gnupg22_w32_sha2 1e3fe08215b34f1ba71e7fb7856151db9167478cb9e8f21140801d776799bdfe # ----------------------------------------------------------------------- Summary of changes: web/swdb.mac | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) hooks/post-receive -- The GnuPG website and other docs http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 7 10:43:16 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Wed, 07 Nov 2018 10:43:16 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.32-51-gb39b44b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via b39b44b9acbed6d4889acba4fe9eae2556c80acc (commit) from 78af09ce13969b64f121ae5990e66fb7f1cd3f1d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b39b44b9acbed6d4889acba4fe9eae2556c80acc Author: NIIBE Yutaka Date: Wed Nov 7 18:42:18 2018 +0900 Fix a typo. * src/spawn-w32.c (src/spawn-w32.c): Fix to use pid_to_handle. Signed-off-by: NIIBE Yutaka diff --git a/src/spawn-w32.c b/src/spawn-w32.c index e8c2eb0..4c57756 100644 --- a/src/spawn-w32.c +++ b/src/spawn-w32.c @@ -735,7 +735,7 @@ _gpgrt_wait_processes (const char **pgmnames, pid_t *pids, size_t count, if (pids[i] == (pid_t)(-1)) return GPG_ERR_INV_VALUE; - procs[i] = fd_to_handle (pids[i]); + procs[i] = pid_to_handle (pids[i]); } _gpgrt_pre_syscall (); ----------------------------------------------------------------------- Summary of changes: src/spawn-w32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 7 19:56:00 2018 From: cvs at cvs.gnupg.org (by Jussi Kivilinna) Date: Wed, 07 Nov 2018 19:56:00 +0100 Subject: [git] GCRYPT - branch, master, updated. libgcrypt-1.8.1-125-g3f76319 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, master has been updated via 3f76319803a4abcd33fa29a0ac39f8ed9d646226 (commit) via 9d6431604b5ee21572c1c2cfa8376e6d81162cbb (commit) from 23f56d3359ca7d152aa87874ddd6305171a91408 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3f76319803a4abcd33fa29a0ac39f8ed9d646226 Author: Jussi Kivilinna Date: Wed Nov 7 19:12:29 2018 +0200 Fix 'variable may be used uninitialized' warning for CTR mode * cipher/cipher-ctr.c (_gcry_cipher_ctr_encrypt): Set N to BLOCKSIZE before counter loop. -- Signed-off-by: Jussi Kivilinna diff --git a/cipher/cipher-ctr.c b/cipher/cipher-ctr.c index 2df0b8c..546d4f8 100644 --- a/cipher/cipher-ctr.c +++ b/cipher/cipher-ctr.c @@ -77,6 +77,7 @@ _gcry_cipher_ctr_encrypt (gcry_cipher_hd_t c, { unsigned char tmp[MAX_BLOCKSIZE]; + n = blocksize; do { nburn = enc_fn (&c->context.c, tmp, c->u_ctr.ctr); @@ -91,7 +92,6 @@ _gcry_cipher_ctr_encrypt (gcry_cipher_hd_t c, if (inbuflen < blocksize) break; - n = blocksize; cipher_block_xor(outbuf, inbuf, tmp, blocksize); inbuflen -= n; commit 9d6431604b5ee21572c1c2cfa8376e6d81162cbb Author: Jussi Kivilinna Date: Tue Nov 6 20:27:34 2018 +0200 Fix inlining of ocb_get_l for x86 AES implementations * cipher/rijndael-aesni.c (aes_ocb_get_l): New. (aesni_ocb_enc, aesni_ocb_dec, _gcry_aes_aesni_ocb_auth): Use 'aes_ocb_get_l'. * cipher/rijndael-ssse3-amd4.c (aes_ocb_get_l): New. (ssse3_ocb_enc, ssse3_ocb_dec, _gcry_aes_ssse3_ocb_auth): Use 'aes_ocb_get_l'. -- Signed-off-by: Jussi Kivilinna diff --git a/cipher/rijndael-aesni.c b/cipher/rijndael-aesni.c index e7e61ca..d190c0a 100644 --- a/cipher/rijndael-aesni.c +++ b/cipher/rijndael-aesni.c @@ -47,6 +47,23 @@ typedef struct u128_s } __attribute__((packed, aligned(1), may_alias)) u128_t; +/* Copy of ocb_get_l needed here as GCC is unable to inline ocb_get_l + because of 'pragma target'. */ +static inline const unsigned char * +aes_ocb_get_l (gcry_cipher_hd_t c, u64 n) +{ + unsigned long ntz; + + /* Assumes that N != 0. */ + asm ("rep;bsfl %k[low], %k[ntz]\n\t" + : [ntz] "=r" (ntz) + : [low] "r" ((unsigned long)n) + : "cc"); + + return c->u_mode.ocb.L[ntz]; +} + + /* Two macros to be called prior and after the use of AESNI instructions. There should be no external function calls between the use of these macros. There purpose is to make sure that the @@ -2199,7 +2216,7 @@ aesni_ocb_enc (gcry_cipher_hd_t c, void *outbuf_arg, for ( ;nblocks && n % 4; nblocks-- ) { - l = ocb_get_l(c, ++n); + l = aes_ocb_get_l(c, ++n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ /* Checksum_i = Checksum_{i-1} xor P_i */ @@ -2241,7 +2258,7 @@ aesni_ocb_enc (gcry_cipher_hd_t c, void *outbuf_arg, for ( ;nblocks >= 8 ; nblocks -= 8 ) { n += 4; - l = ocb_get_l(c, n); + l = aes_ocb_get_l(c, n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ /* Checksum_i = Checksum_{i-1} xor P_i */ @@ -2285,7 +2302,7 @@ aesni_ocb_enc (gcry_cipher_hd_t c, void *outbuf_arg, : "memory" ); n += 4; - l = ocb_get_l(c, n); + l = aes_ocb_get_l(c, n); asm volatile ("movdqu %[inbuf4], %%xmm8\n\t" "pxor %%xmm7, %%xmm5\n\t" @@ -2364,7 +2381,7 @@ aesni_ocb_enc (gcry_cipher_hd_t c, void *outbuf_arg, for ( ;nblocks >= 4 ; nblocks -= 4 ) { n += 4; - l = ocb_get_l(c, n); + l = aes_ocb_get_l(c, n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ /* Checksum_i = Checksum_{i-1} xor P_i */ @@ -2433,7 +2450,7 @@ aesni_ocb_enc (gcry_cipher_hd_t c, void *outbuf_arg, for ( ;nblocks; nblocks-- ) { - l = ocb_get_l(c, ++n); + l = aes_ocb_get_l(c, ++n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ /* Checksum_i = Checksum_{i-1} xor P_i */ @@ -2503,7 +2520,7 @@ aesni_ocb_dec (gcry_cipher_hd_t c, void *outbuf_arg, for ( ;nblocks && n % 4; nblocks-- ) { - l = ocb_get_l(c, ++n); + l = aes_ocb_get_l(c, ++n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ /* P_i = Offset_i xor DECIPHER(K, C_i xor Offset_i) */ @@ -2545,7 +2562,7 @@ aesni_ocb_dec (gcry_cipher_hd_t c, void *outbuf_arg, for ( ;nblocks >= 8 ; nblocks -= 8 ) { n += 4; - l = ocb_get_l(c, n); + l = aes_ocb_get_l(c, n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ /* P_i = Offset_i xor DECIPHER(K, C_i xor Offset_i) */ @@ -2585,7 +2602,7 @@ aesni_ocb_dec (gcry_cipher_hd_t c, void *outbuf_arg, : "memory" ); n += 4; - l = ocb_get_l(c, n); + l = aes_ocb_get_l(c, n); asm volatile ("movdqu %[inbuf4], %%xmm8\n\t" "pxor %%xmm7, %%xmm5\n\t" @@ -2668,7 +2685,7 @@ aesni_ocb_dec (gcry_cipher_hd_t c, void *outbuf_arg, for ( ;nblocks >= 4 ; nblocks -= 4 ) { n += 4; - l = ocb_get_l(c, n); + l = aes_ocb_get_l(c, n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ /* P_i = Offset_i xor DECIPHER(K, C_i xor Offset_i) */ @@ -2737,7 +2754,7 @@ aesni_ocb_dec (gcry_cipher_hd_t c, void *outbuf_arg, for ( ;nblocks; nblocks-- ) { - l = ocb_get_l(c, ++n); + l = aes_ocb_get_l(c, ++n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ /* P_i = Offset_i xor DECIPHER(K, C_i xor Offset_i) */ @@ -2813,7 +2830,7 @@ _gcry_aes_aesni_ocb_auth (gcry_cipher_hd_t c, const void *abuf_arg, for ( ;nblocks && n % 4; nblocks-- ) { - l = ocb_get_l(c, ++n); + l = aes_ocb_get_l(c, ++n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ /* Sum_i = Sum_{i-1} xor ENCIPHER(K, A_i xor Offset_i) */ @@ -2853,7 +2870,7 @@ _gcry_aes_aesni_ocb_auth (gcry_cipher_hd_t c, const void *abuf_arg, for ( ;nblocks >= 8 ; nblocks -= 8 ) { n += 4; - l = ocb_get_l(c, n); + l = aes_ocb_get_l(c, n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ /* Sum_i = Sum_{i-1} xor ENCIPHER(K, A_i xor Offset_i) */ @@ -2885,7 +2902,7 @@ _gcry_aes_aesni_ocb_auth (gcry_cipher_hd_t c, const void *abuf_arg, : "memory" ); n += 4; - l = ocb_get_l(c, n); + l = aes_ocb_get_l(c, n); asm volatile ("movdqu %[abuf4], %%xmm8\n\t" "pxor %%xmm7, %%xmm5\n\t" @@ -2938,7 +2955,7 @@ _gcry_aes_aesni_ocb_auth (gcry_cipher_hd_t c, const void *abuf_arg, for ( ;nblocks >= 4 ; nblocks -= 4 ) { n += 4; - l = ocb_get_l(c, n); + l = aes_ocb_get_l(c, n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ /* Sum_i = Sum_{i-1} xor ENCIPHER(K, A_i xor Offset_i) */ @@ -2989,7 +3006,7 @@ _gcry_aes_aesni_ocb_auth (gcry_cipher_hd_t c, const void *abuf_arg, for ( ;nblocks; nblocks-- ) { - l = ocb_get_l(c, ++n); + l = aes_ocb_get_l(c, ++n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ /* Sum_i = Sum_{i-1} xor ENCIPHER(K, A_i xor Offset_i) */ diff --git a/cipher/rijndael-ssse3-amd64.c b/cipher/rijndael-ssse3-amd64.c index 07a64a4..fa481bb 100644 --- a/cipher/rijndael-ssse3-amd64.c +++ b/cipher/rijndael-ssse3-amd64.c @@ -57,6 +57,23 @@ #endif +/* Copy of ocb_get_l needed here as GCC is unable to inline ocb_get_l + because of 'pragma target'. */ +static inline const unsigned char * +aes_ocb_get_l (gcry_cipher_hd_t c, u64 n) +{ + unsigned long ntz; + + /* Assumes that N != 0. */ + asm ("rep;bsfl %k[low], %k[ntz]\n\t" + : [ntz] "=r" (ntz) + : [low] "r" ((unsigned long)n) + : "cc"); + + return c->u_mode.ocb.L[ntz]; +} + + /* Assembly functions in rijndael-ssse3-amd64-asm.S. Note that these have custom calling convention (additional XMM parameters). */ extern void _gcry_aes_ssse3_enc_preload(void); @@ -528,7 +545,7 @@ ssse3_ocb_enc (gcry_cipher_hd_t c, void *outbuf_arg, { const unsigned char *l; - l = ocb_get_l(c, ++n); + l = aes_ocb_get_l(c, ++n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ /* Checksum_i = Checksum_{i-1} xor P_i */ @@ -597,7 +614,7 @@ ssse3_ocb_dec (gcry_cipher_hd_t c, void *outbuf_arg, { const unsigned char *l; - l = ocb_get_l(c, ++n); + l = aes_ocb_get_l(c, ++n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ /* P_i = Offset_i xor DECIPHER(K, C_i xor Offset_i) */ @@ -673,7 +690,7 @@ _gcry_aes_ssse3_ocb_auth (gcry_cipher_hd_t c, const void *abuf_arg, { const unsigned char *l; - l = ocb_get_l(c, ++n); + l = aes_ocb_get_l(c, ++n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ /* Sum_i = Sum_{i-1} xor ENCIPHER(K, A_i xor Offset_i) */ ----------------------------------------------------------------------- Summary of changes: cipher/cipher-ctr.c | 2 +- cipher/rijndael-aesni.c | 47 +++++++++++++++++++++++++++++-------------- cipher/rijndael-ssse3-amd64.c | 23 ++++++++++++++++++--- 3 files changed, 53 insertions(+), 19 deletions(-) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 8 03:39:20 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Thu, 08 Nov 2018 03:39:20 +0100 Subject: [git] KSBA - branch, master, updated. libksba-1.3.5-32-g3f5dcb5 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "KSBA is a library to access X.509 certificates and CMS data.". The branch, master has been updated via 3f5dcb5ff6721b0c70c8b0e320e4fd58f1c2cada (commit) from 5a7c0d8667ceddf7820131865dad0ab850e5c3a4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3f5dcb5ff6721b0c70c8b0e320e4fd58f1c2cada Author: NIIBE Yutaka Date: Thu Nov 8 11:38:25 2018 +0900 Add annotation for fall through path. * src/ber-decoder.c (decoder_next): Add FALLTHROUGH. Signed-off-by: NIIBE Yutaka diff --git a/src/ber-decoder.c b/src/ber-decoder.c index 20a91b1..b1054df 100644 --- a/src/ber-decoder.c +++ b/src/ber-decoder.c @@ -933,6 +933,7 @@ decoder_next (BerDecoder d) if (debug) fprintf (stderr, " ANY"); ds->cur.in_any = 1; + /* FALLTHROUGH */ case 3: /* match */ case 5: /* end tag */ if (debug) ----------------------------------------------------------------------- Summary of changes: src/ber-decoder.c | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- KSBA is a library to access X.509 certificates and CMS data. http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 8 04:22:16 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Thu, 08 Nov 2018 04:22:16 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-254-g7fc3dec Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 7fc3decc2e038be905d47701c7ce196ed86a725b (commit) from 01b77ebbb71d47ba276d3a1af9595fdcd9b48f5f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7fc3decc2e038be905d47701c7ce196ed86a725b Author: NIIBE Yutaka Date: Thu Nov 8 12:14:23 2018 +0900 g10: Fix log_debug formatting. * g10/cipher-aead.c (do_flush): No cast is correct. * g10/decrypt-data.c (aead_underflow): No cast needed. Use "%j" for uint64_t for chunklen. Signed-off-by: NIIBE Yutaka diff --git a/g10/cipher-aead.c b/g10/cipher-aead.c index f9a996c..b14b854 100644 --- a/g10/cipher-aead.c +++ b/g10/cipher-aead.c @@ -278,7 +278,7 @@ do_flush (cipher_filter_context_t *cfx, iobuf_t a, byte *buf, size_t size) if (DBG_FILTER) log_debug ("chunksize %ju reached;" " cur buflen=%zu using %zu of %zu\n", - (uintmax_t)cfx->chunksize, (uintmax_t)cfx->buflen, + cfx->chunksize, cfx->buflen, n1, n); n = n1; } diff --git a/g10/decrypt-data.c b/g10/decrypt-data.c index 3951fa7..61e0112 100644 --- a/g10/decrypt-data.c +++ b/g10/decrypt-data.c @@ -647,7 +647,7 @@ aead_underflow (decode_filter_ctx_t dfx, iobuf_t a, byte *buf, size_t *ret_len) * case when a chunk ends within the buffer. */ if (DBG_FILTER) log_debug ("decrypt: chunklen=%ju total=%ju size=%zu len=%zu%s\n", - (uintmax_t)dfx->chunklen, (uintmax_t)dfx->total, size, len, + dfx->chunklen, dfx->total, size, len, dfx->eof_seen? " eof":""); while (len && dfx->chunklen + len >= dfx->chunksize) @@ -683,7 +683,7 @@ aead_underflow (decode_filter_ctx_t dfx, iobuf_t a, byte *buf, size_t *ret_len) len -= n; if (DBG_FILTER) - log_debug ("ndecrypted: %zu (nchunk=%zu) bytes left: %zu at off=%zu\n", + log_debug ("ndecrypted: %zu (nchunk=%ju) bytes left: %zu at off=%zu\n", totallen, dfx->chunklen, len, off); /* Check the tag. */ @@ -765,7 +765,7 @@ aead_underflow (decode_filter_ctx_t dfx, iobuf_t a, byte *buf, size_t *ret_len) dfx->chunklen += len; dfx->total += len; if (DBG_FILTER) - log_debug ("ndecrypted: %zu (nchunk=%zu)\n", totallen, dfx->chunklen); + log_debug ("ndecrypted: %zu (nchunk=%ju)\n", totallen, dfx->chunklen); } if (dfx->eof_seen) ----------------------------------------------------------------------- Summary of changes: g10/cipher-aead.c | 2 +- g10/decrypt-data.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 8 06:36:04 2018 From: cvs at cvs.gnupg.org (by Daniel Kahn Gillmor) Date: Thu, 08 Nov 2018 06:36:04 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-48-g2557d0a Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 2557d0ae6ff0336b041129b7bf5c1e3a8c20a805 (commit) from d0a5caf73c2d6b73dd043f62574c31946e4f347d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2557d0ae6ff0336b041129b7bf5c1e3a8c20a805 Author: Daniel Kahn Gillmor Date: Thu Nov 8 12:34:27 2018 +0700 spelling: fix misspellings Signed-off-by: Daniel Kahn Gillmor diff --git a/Makefile.am b/Makefile.am index 7b35128..52639b7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -99,7 +99,7 @@ release: $(MAKE) distcheck TESTFLAGS=--parallel; \ echo "/* Build finished at $$(date -uIseconds) */" ;\ echo "/*" ;\ - echo " * Please run the final step interactivly:" ;\ + echo " * Please run the final step interactively:" ;\ echo " * make sign-release" ;\ echo " */" ;\ ) 2>&1 | tee "$(RELEASE_NAME).buildlog" diff --git a/NEWS b/NEWS index 69fe066..9c11df3 100644 --- a/NEWS +++ b/NEWS @@ -459,7 +459,7 @@ Noteworthy changes in version 1.6.0 (2015-08-26) [C25/A14/R0] * The passphrase handler for the loopback mode has been improved and may also be used with genkey. - * [w32] The standard GnuPG 2.1 install directory is now seached for + * [w32] The standard GnuPG 2.1 install directory is now searched for gpgconf.exe before a registry specified directory and the Gpg4win install directory. @@ -762,7 +762,7 @@ Noteworthy changes in version 1.1.8 (2008-12-08) ------------------------------------------------ * SIGPIPE is now again ignored as described in the manual. Fixes - regresion introduced with 1.1.6. + regression introduced with 1.1.6. Noteworthy changes in version 1.1.7 (2008-10-17) @@ -958,8 +958,8 @@ Noteworthy changes in version 1.0.3 (2005-06-20) * Previousy, GPGME would use a default "include certs" of 1. This has been changed. Now GPGME will use the crypto backend engines default unless you set the value with gpgme_set_include_certs() - explicitely. A new macro GPGME_INCLUDE_CERTS_DEFAULT can be used - as a value to explicitely request the new default behaviour. + explicitly. A new macro GPGME_INCLUDE_CERTS_DEFAULT can be used + as a value to explicitly request the new default behaviour. Because the default changes, this is a slight change of the API semantics. We consider it to be a bug fix. @@ -1046,7 +1046,7 @@ Noteworthy changes in version 0.4.7 (2004-04-29) disabled in the gpgme_key_t structures. * A bug fix: The flag wrong_key_usage of gpgme_signature_t was - accidently of type int instead unsigned int. + accidentally of type int instead unsigned int. * Interface changes relative to the 0.4.5 release: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1259,7 +1259,7 @@ Noteworthy changes in version 0.4.1 (2003-06-06) The error values have been completely replaced by a more sophisticated model that allows GPGME to transparently and accurately - report all errors from the other GnuPG components, irregardless of + report all errors from the other GnuPG components, regardless of process boundaries. This is achieved by using the library libgpg-errors, which is shared by all GnuPG components. This library is now required for GPGME. @@ -1877,7 +1877,7 @@ Noteworthy changes in version 0.3.1 (2002-02-09) selects between local keyring, remote keyserver, or both. For this, two new macros are defined, GPGME_KEYLIST_MODE_LOCAL and GPGME_KEYLIST_MODE_EXTERN. To make it possible to modify the - current setting, a fucntion gpgme_get_keylist_mode was added to + current setting, a function gpgme_get_keylist_mode was added to retrieve the current mode. * gpgme_wait accepts a new argument STATUS to return the error status diff --git a/TODO b/TODO index a915ed7..121ced2 100644 --- a/TODO +++ b/TODO @@ -32,7 +32,7 @@ Hey Emacs, this is -*- org -*- mode! 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 ans see if some of these ancient things can be removed + 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). @@ -78,7 +78,7 @@ Hey Emacs, this is -*- org -*- mode! :PROPERTIES: :CUSTOM_ID: set-fd-blocking :END: - issueing simple commands, because we are mixing synchronous + issuing simple commands, because we are mixing synchronous commands into potentially asynchronous operations. ** Might want to implement nonblock for w32 native backend! :PROPERTIES: @@ -272,7 +272,7 @@ Hey Emacs, this is -*- org -*- mode! 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 notfication system should be independent of any + usages too. This notification system should be independent of any contextes of course. Not sure whether this is still required. GPGME_PROTOCOL_ASSUAN is diff --git a/configure.ac b/configure.ac index 1398993..688a4b3 100644 --- a/configure.ac +++ b/configure.ac @@ -347,7 +347,7 @@ if test "$found" = "1"; then AC_CHECK_PROGS([DOXYGEN], [doxygen]) if test -z "$DOXYGEN"; - # This is not highlighted becase it's not really important. + # This is not highlighted because 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]) diff --git a/doc/ChangeLog-2011 b/doc/ChangeLog-2011 index e270fae..ac93421 100644 --- a/doc/ChangeLog-2011 +++ b/doc/ChangeLog-2011 @@ -700,7 +700,7 @@ 2002-05-26 Marcus Brinkmann - * gpgme.texi: Some typographical correctons throughout. + * gpgme.texi: Some typographical corrections throughout. 2002-05-09 Marcus Brinkmann @@ -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 fucntions and + (Verify): Updated to include the new attribute functions and status codes. 2002-04-27 Werner Koch @@ -839,7 +839,7 @@ 2002-01-29 Marcus Brinkmann * gpgme.texi (Run Control): New section. - (Verify): Docuent gpgme_get_notation. + (Verify): Document gpgme_get_notation. (More Information): New section describing gpgme_get_op_info. 2002-01-22 Marcus Brinkmann @@ -865,7 +865,7 @@ * gpgme.texi (Top): Complete detailmenu. - * gpgme.texi: Convert embarassing cruft to the real thing. + * gpgme.texi: Convert embarrassing cruft to the real thing. 2002-01-16 Marcus Brinkmann diff --git a/doc/examples/show-group-options.c b/doc/examples/show-group-options.c index 48ca260..3e10207 100644 --- a/doc/examples/show-group-options.c +++ b/doc/examples/show-group-options.c @@ -1,4 +1,4 @@ -/* show-group-options.c - Example code to retriev the group option. +/* show-group-options.c - Example code to retrieve the group option. Copyright (C) 2008 g10 Code GmbH This file is part of GPGME. diff --git a/doc/gpgme.texi b/doc/gpgme.texi index fc4840e..7d410f8 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -732,7 +732,7 @@ directory part is used as the default installation directory; the Windows. @item require-gnupg -Set the mimimum version of the required GnuPG engine. If that version +Set the minimum version of the required GnuPG engine. If that version is not met, GPGME fails early instead of trying to use the existent version. The given version must be a string with major, minor, and micro number. Example: "2.1.0". @@ -4031,7 +4031,7 @@ does only work for OpenPGP and requires at least version 2.1.13 of GnuPG. @var{userid} is commonly the mail address associated with the key. -GPGME does not require a specificy syntax but if more than a mail +GPGME does not require a specific syntax but if more than a mail address is given, RFC-822 style format is suggested. The value is expected to be in UTF-8 encoding (i.e. no IDN encoding for mail addresses). This is a required parameter. @@ -4240,7 +4240,7 @@ requires at least version 2.1.13 of GnuPG. @var{userid} is the user ID to add to the key. A user ID is commonly the mail address to be associated with the key. GPGME does not -require a specificy syntax but if more than a mail address is given, +require a specific syntax but if more than a mail address is given, RFC-822 style format is suggested. The value is expected to be in UTF-8 encoding (i.e. no IDN encoding for mail addresses). This is a required parameter. @@ -5432,7 +5432,7 @@ multiple of the following bit values: @since{1.8.0} The @code{GPGME_DECRYPT_VERIFY} symbol specifies that this function -shall exacty act as @code{gpgme_op_decrypt_verify}. +shall exactly act as @code{gpgme_op_decrypt_verify}. @item GPGME_DECRYPT_UNWRAP @since{1.8.0} @@ -5444,7 +5444,7 @@ counterpart to @code{GPGME_ENCRYPT_WRAP}. @end table -The function returns the error codes as descriped for +The function returns the error codes as described for @code{gpgme_op_decrypt} respective @code{gpgme_op_encrypt}. @end deftypefun @@ -5739,7 +5739,7 @@ The defined bits are: A policy requirement was not met. @item GPGME_SIGSUM_SYS_ERROR - A system error occured. + A system error occurred. @item GPGME_SIGSUM_TOFU_CONFLICT A TOFU conflict was detected. @@ -6897,7 +6897,7 @@ returned. Synchronous operations running in parallel, as well as key and trust item list operations, do not affect @code{gpgme_wait}. In a multi-threaded environment, only one thread should ever call - at code{gpgme_wait} at any time, irregardless if @var{ctx} is specified + at code{gpgme_wait} at any time, regardless of whether @var{ctx} is specified or not. This means that all calls to this function should be fully synchronized by locking primitives. It is safe to start asynchronous operations while a thread is running in @code{gpgme_wait}. @@ -8229,7 +8229,7 @@ The function @code{gpgme_get_sig_string_attr} is equivalent to: @end example @end deftypefun - at deftypefun {const char *} gpgme_get_sig_ulong_attr (@w{gpgme_ctx_t @var{ctx}}, @w{int @var{idx}}, @w{gpgme_attr_t @var{waht}}, @w{int @var{whatidx}}) + at deftypefun {const char *} gpgme_get_sig_ulong_attr (@w{gpgme_ctx_t @var{ctx}}, @w{int @var{idx}}, @w{gpgme_attr_t @var{what}}, @w{int @var{whatidx}}) The function @code{gpgme_get_sig_ulong_attr} is equivalent to: @example diff --git a/doc/uiserver.texi b/doc/uiserver.texi index 6938aee..e001d12 100644 --- a/doc/uiserver.texi +++ b/doc/uiserver.texi @@ -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 immediatley returns (does not +into the foregound and that this command immediately 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 -immediatley returns (i.e. it does not wait until the dialog has been +immediately returns (i.e. it does not wait until the dialog has been fully brought up). @end deffn diff --git a/lang/cl/gpgme.lisp b/lang/cl/gpgme.lisp index b1a38ca..a0d5f3d 100644 --- a/lang/cl/gpgme.lisp +++ b/lang/cl/gpgme.lisp @@ -140,11 +140,11 @@ (gpg-err-source err)) (defun gpgme-strerror (err) - "Return a string containig a description of the error code." + "Return a string containing a description of the error code." (gpg-strerror err)) (defun gpgme-strsource (err) - "Return a string containig a description of the error source." + "Return a string containing a description of the error source." (gpg-strsource err)) (defun gpgme-err-code-from-errno (err) @@ -267,7 +267,7 @@ :from-c translate-gpgme-sig-notation-t-from-foreign) "Signature notation pointer type.") -;; FIXME: Doesn't this depend on endianess? +;; FIXME: Doesn't this depend on endianness? (defbitfield (gpgme-sig-notation-bitfield :unsigned-int) (:human-readable 1) (:critical 2)) @@ -411,7 +411,7 @@ :from-c translate-gpgme-subkey-t-from-foreign) "A subkey from a key.") -;; FIXME: Doesn't this depend on endianess? +;; FIXME: Doesn't this depend on endianness? (defbitfield (gpgme-subkey-bitfield :unsigned-int) "The subkey bitfield." (:revoked 1) @@ -445,7 +445,7 @@ :from-c translate-gpgme-key-sig-t-from-foreign) "A signature on a user ID.") -;; FIXME: Doesn't this depend on endianess? +;; FIXME: Doesn't this depend on endianness? (defbitfield (gpgme-key-sig-bitfield :unsigned-int) "The key signature bitfield." (:revoked 1) @@ -476,7 +476,7 @@ :from-c translate-gpgme-user-id-t-from-foreign) "A user ID from a key.") -;; FIXME: Doesn't this depend on endianess? +;; FIXME: Doesn't this depend on endianness? (defbitfield (gpgme-user-id-bitfield :unsigned-int) "The user ID bitfield." (:revoked 1) @@ -501,7 +501,7 @@ :to-c translate-gpgme-key-t-to-foreign) "A key from the keyring.") -;; FIXME: Doesn't this depend on endianess? +;; FIXME: Doesn't this depend on endianness? (defbitfield (gpgme-key-bitfield :unsigned-int) "The key bitfield." (:revoked 1) @@ -1017,7 +1017,7 @@ :from-c translate-gpgme-signature-t-from-foreign) "A signature structure.") -;; FIXME: Doesn't this depend on endianess? +;; FIXME: Doesn't this depend on endianness? (defbitfield (gpgme-signature-bitfield :unsigned-int) "The signature bitfield." (:wrong-key-usage 1) @@ -1683,7 +1683,7 @@ ;;; 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 implicitely invoked (through GPGME) by +;;; that hash. It is implicitly invoked (through GPGME) by ;;; gpgme-data-release. (defcallback data-release-cb :void ((handle :pointer)) (unwind-protect (remhash (pointer-address handle) *data-handles*) @@ -1783,7 +1783,7 @@ (when *debug* (format t "DEBUG: gpgme-data-new: ~A~%" dh)) dh)))) -;;; This function releases a GPGME data object. It implicitely +;;; This function releases a GPGME data object. It implicitly ;;; invokes the data-release-cb function to clean up associated junk. (defun gpgme-data-release (dh) "Release a GPGME data object." @@ -1907,7 +1907,7 @@ (:documentation "Set the protocol of CONTEXT to PROTOCOL.")) ;;; FIXME: Adjust translator to reject invalid protocols. Currently, -;;; specifing an invalid protocol throws a "NIL is not 32 signed int" +;;; specifying 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)) diff --git a/lang/cpp/README b/lang/cpp/README index e142e37..16c9a4a 100644 --- a/lang/cpp/README +++ b/lang/cpp/README @@ -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 convienience code provides Data objects and +GpgMEpp. Additional convenience 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. diff --git a/lang/cpp/src/key.h b/lang/cpp/src/key.h index c4edba0..dd855ae 100644 --- a/lang/cpp/src/key.h +++ b/lang/cpp/src/key.h @@ -163,7 +163,7 @@ public: * Needs gnupg 2.1.13 and the key needs to be updated * afterwards to see the new uid. * - * @param uid should be fully formated and UTF-8 encoded. + * @param uid should be fully formatted and UTF-8 encoded. * * @returns a possible error. **/ diff --git a/lang/js/DemoExtension/maindemo.js b/lang/js/DemoExtension/maindemo.js index a9fdf28..0c64860 100644 --- a/lang/js/DemoExtension/maindemo.js +++ b/lang/js/DemoExtension/maindemo.js @@ -110,7 +110,7 @@ document.addEventListener('DOMContentLoaded', function () { document.getElementById( 'pubkey').value = keys[0].fingerprint; } else if (keys.length > 1) { - alert('The pattern was not unambigious enough for a Key. ' + alert('The pattern was not unambiguous enough for a Key. ' + keys.length + ' Keys were found'); } else { alert('No keys found'); diff --git a/lang/js/jsdoc_index.md b/lang/js/jsdoc_index.md index b7371ad..e5cf287 100644 --- a/lang/js/jsdoc_index.md +++ b/lang/js/jsdoc_index.md @@ -39,7 +39,7 @@ gnupg. **Due to security constraints, the javascript-binding currently only offers limited support for secret-Key interaction.** -The existance of secret Keys is not secret, and those secret Keys can be used +The existence of secret Keys is not secret, and those secret Keys can be used for signing, but Operations that may expose, modify or delete secret Keys are not supported. diff --git a/lang/js/src/Helpers.js b/lang/js/src/Helpers.js index f472b23..0b5ab7e 100644 --- a/lang/js/src/Helpers.js +++ b/lang/js/src/Helpers.js @@ -171,7 +171,7 @@ export function atobArray (base64) { * Taken and slightly adapted from * https://www.onicos.com/staff/iz/amuse/javascript/expert/utf.txt * (original header: - * utf.js - UTF-8 <=> UTF-16 convertion + * utf.js - UTF-8 <=> UTF-16 conversion * * Copyright (C) 1999 Masanao Izumo * Version: 1.0 diff --git a/lang/js/src/Key.js b/lang/js/src/Key.js index f5ee965..a3f5204 100644 --- a/lang/js/src/Key.js +++ b/lang/js/src/Key.js @@ -94,7 +94,7 @@ class GPGME_Key { /** * Query any property of the Key listed in {@link validKeyProperties} - * @param {String} property property to be retreived + * @param {String} property property to be retrieved * @returns {Boolean| String | Date | Array | Object} * @returns {Promise} (if in async * mode) @@ -708,4 +708,4 @@ function getGnupgState (fingerprint, property){ }); } }); -} \ No newline at end of file +} diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index 850f9f1..9f31357 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -384,7 +384,7 @@ export class GPGME_Keyring { * @param {String} option.userId The user Id, e.g. 'Foo Bar ' * @param {String} option.algo (optional) algorithm (and optionally key * size) to be used. See {@link supportedKeyAlgos} below for supported - * values. If ommitted, 'default' is used. + * values. If omitted, 'default' is used. * @param {Number} option.expires (optional) Expiration time in seconds * from now. If not set or set to 0, expiration will be 'never' * diff --git a/lang/python/doc/meta/old-commits.log b/lang/python/doc/meta/old-commits.log index 93661e3..eb870cd 100644 --- a/lang/python/doc/meta/old-commits.log +++ b/lang/python/doc/meta/old-commits.log @@ -420,7 +420,7 @@ Date: Sat May 2 10:28:42 2015 +1000 Updated Makefile * set make to use python3 instead. - * This will mean a successful port may need to be maintained seperately + * This will mean a successful port may need to be maintained separately from the original python2 code instead of merged, but ought to be able to share most things. So maybe merge with separated make files or a pre-make script to set python2 or python3 prior to building ... decide @@ -1934,7 +1934,7 @@ commit 45e8a5f4e13d3ca797ec3b0037242874a6be5562 Author: belyi Date: Sat Mar 26 19:44:18 2005 +0000 - Updated verion number to 0.6.2 in version.py + Updated version number to 0.6.2 in version.py Added examples/*.glade files into documentation package. pyme/debian/examples | 1 + @@ -1997,7 +1997,7 @@ Author: belyi Date: Fri Mar 25 04:30:17 2005 +0000 Improved PyGtkGpgKeys example to manage owner_trust on keys. - Added another example inter-edit.py which is just a hepler to write + Added another example inter-edit.py which is just a helper to write scripts for Context.op_edit() command. pyme/examples/PyGtkGpgKeys.glade | 78 ++++++++++++++++++++++++++++++++++++++++ @@ -2011,7 +2011,7 @@ Author: belyi Date: Fri Mar 25 00:30:39 2005 +0000 Updated PyGtkGpgKeys example to include import, export and reload - functionality. Also added ability to remove number of keys simultanously. + functionality. Also added ability to remove number of keys simultaneously. Rearanged how KeyColumn is used to avoid unnecessary sorts and duplication of information in different parts of the code. @@ -2035,7 +2035,7 @@ commit 59e23f32c3b46413c9ec09e23e1a385a110fb103 Author: belyi Date: Thu Mar 24 05:44:58 2005 +0000 - Added wait method Context class which handles asynchornous calls a little + Added wait method Context class which handles asynchronous calls a little bit better than the one generated by SWIG. pyme/debian/changelog | 7 +++++++ @@ -2101,7 +2101,7 @@ Date: Fri Mar 18 19:09:33 2005 +0000 Added package building for python2.4 - Updated copyright notes to include myslef and avoid confusion who's the + Updated copyright notes to include myself and avoid confusion who's the maintainer. In John's own words: "I'd prefer to just step out of the picture". Jonh's copyright notice left intact. @@ -2182,7 +2182,7 @@ Date: Thu Apr 8 16:15:09 2004 +0000 Ensure that we support only python2.2 and up. :-) Use generators in core.Context class which makes pyme.aux obsolete - Remove importing future nested_scopes since they are standart starting + Remove importing future nested_scopes since they are standard starting with python2.2 pyme/pyme/__init__.py | 5 ++--- @@ -2293,7 +2293,7 @@ commit af7129baa8260697d85c2ddb434562e8a80b62d8 Author: belyi Date: Sat Mar 20 20:15:53 2004 +0000 - Added minimum of formating and SF icon. + Added minimum of formatting and SF icon. pyme-web/index.html | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lang/python/doc/rst/gpgme-python-howto.rst b/lang/python/doc/rst/gpgme-python-howto.rst index 3fd8a4d..4cbb929 100644 --- a/lang/python/doc/rst/gpgme-python-howto.rst +++ b/lang/python/doc/rst/gpgme-python-howto.rst @@ -1063,7 +1063,7 @@ obtained. #. Import from ProtonMail via HKP for Python Example no. 1 - The following script is avalable with the rest of the examples under + The following script is available with the rest of the examples under the somewhat less than original name, ``pmkey-import-hkp.py``. .. code:: python @@ -1814,7 +1814,7 @@ to any preconfigured keys set in the ``gpg.conf`` file: with open("secret_plans.txt.asc", "wb") as afile: afile.write(ciphertext) -If the ``recipients`` paramater is empty then the plaintext is encrypted +If the ``recipients`` parameter is empty then the plaintext is encrypted symmetrically. If no ``passphrase`` is supplied as a parameter or via a callback registered with the ``Context()`` then an out-of-band prompt for the passphrase via pinentry will be invoked. @@ -2592,7 +2592,7 @@ demonstrable. One of the better and easier examples being the one of the early examples in this HOWTO, the `key counting <#howto-keys-counting>`__ code. Running that example as an executable Python script, ``keycount.py`` (available in the -``examples/howto/`` directory), will take a noticable amount of time to +``examples/howto/`` directory), will take a noticeable amount of time to run on most systems where the public keybox or keyring contains a few thousand public keys. diff --git a/lang/python/doc/src/gpgme-python-howto b/lang/python/doc/src/gpgme-python-howto index 4ad5bc4..e12dc36 100644 --- a/lang/python/doc/src/gpgme-python-howto +++ b/lang/python/doc/src/gpgme-python-howto @@ -1108,7 +1108,7 @@ address can be obtained. :CUSTOM_ID: import-hkp4py-pm1 :END: -The following script is avalable with the rest of the examples under +The following script is available with the rest of the examples under the somewhat less than original name, =pmkey-import-hkp.py=. #+BEGIN_SRC python -i @@ -1869,7 +1869,7 @@ with open("secret_plans.txt.asc", "wb") as afile: afile.write(ciphertext) #+END_SRC -If the =recipients= paramater is empty then the plaintext is encrypted +If the =recipients= parameter is empty then the plaintext is encrypted symmetrically. If no =passphrase= is supplied as a parameter or via a callback registered with the =Context()= then an out-of-band prompt for the passphrase via pinentry will be invoked. @@ -2662,7 +2662,7 @@ Nevertheless, there are some situations where the benefits are demonstrable. One of the better and easier examples being the one of the early examples in this HOWTO, the [[#howto-keys-counting][key counting]] code. Running that example as an executable Python script, =keycount.py= (available in -the =examples/howto/= directory), will take a noticable amount of time +the =examples/howto/= directory), will take a noticeable amount of time to run on most systems where the public keybox or keyring contains a few thousand public keys. diff --git a/lang/python/doc/texinfo/gpgme-python-howto.texi b/lang/python/doc/texinfo/gpgme-python-howto.texi index d776f58..4f10bc5 100644 --- a/lang/python/doc/texinfo/gpgme-python-howto.texi +++ b/lang/python/doc/texinfo/gpgme-python-howto.texi @@ -1249,7 +1249,7 @@ address can be obtained. Import from ProtonMail via HKP for Python Example no. 1 -The following script is avalable with the rest of the examples under +The following script is available with the rest of the examples under the somewhat less than original name, @samp{pmkey-import-hkp.py}. @example @@ -2006,7 +2006,7 @@ with open("secret_plans.txt.asc", "wb") as afile: afile.write(ciphertext) @end example -If the @samp{recipients} paramater is empty then the plaintext is encrypted +If the @samp{recipients} parameter is empty then the plaintext is encrypted symmetrically. If no @samp{passphrase} is supplied as a parameter or via a callback registered with the @samp{Context()} then an out-of-band prompt for the passphrase via pinentry will be invoked. @@ -2774,7 +2774,7 @@ Nevertheless, there are some situations where the benefits are demonstrable. One of the better and easier examples being the one of the early examples in this HOWTO, the @ref{Counting keys, , key counting} code. Running that example as an executable Python script, @samp{keycount.py} (available in -the @samp{examples/howto/} directory), will take a noticable amount of time +the @samp{examples/howto/} directory), will take a noticeable amount of time to run on most systems where the public keybox or keyring contains a few thousand public keys. @@ -3089,4 +3089,4 @@ WITHOUT ANY WARRANTY, to the extent permitted by law; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - at bye \ No newline at end of file + at bye diff --git a/lang/python/helpers.c b/lang/python/helpers.c index 947819d..d5d1fc9 100644 --- a/lang/python/helpers.c +++ b/lang/python/helpers.c @@ -914,7 +914,7 @@ static ssize_t pyDataWriteCb(void *hook, const void *buffer, size_t size) } /* Set the current position from where the next read or write starts - in the data object with the handle HOOK to OFFSET, relativ to + in the data object with the handle HOOK to OFFSET, relative to WHENCE. Returns the new offset in bytes from the beginning of the data object. */ static off_t pyDataSeekCb(void *hook, off_t offset, int whence) diff --git a/lang/python/tests/t-quick-key-manipulation.py b/lang/python/tests/t-quick-key-manipulation.py index 0cfaa9d..73dce16 100755 --- a/lang/python/tests/t-quick-key-manipulation.py +++ b/lang/python/tests/t-quick-key-manipulation.py @@ -82,7 +82,7 @@ with support.EphemeralContext() as ctx: # try to revoke a non-existent UID try: - ctx.key_revoke_uid(key, "i dont exist") + ctx.key_revoke_uid(key, "i don't exist") # IMHO this should fail. issue2963. # assert False, "Expected an error but got none" except gpg.errors.GpgError: diff --git a/lang/qt/README b/lang/qt/README index 4621d28..450fb03 100644 --- a/lang/qt/README +++ b/lang/qt/README @@ -3,7 +3,7 @@ Qt API bindings/wrapper for GPGME Based on KF5gpgmepp QGpgME and libkleo/backends/qgpgme Please note that QGpgME has a different license (GPL only) -then GPGME itself. See the License secion in this +then GPGME itself. See the License section in this document for more information. Overview @@ -47,14 +47,14 @@ for API stability reasons. Some jobs like the verification or decryption jobs have dedicated result classes. Each result class at least has the member function error() that can be used -to check if a job failed. Additionally errors are emited +to check if a job failed. Additionally errors are emitted in the result signal. Jobs also provide progress signal whenever GnuPG emits a progress status line. Most jobs also provide a way synchronusly execute them. -Please not that synchronus use does not cause the autodeletion +Please not that synchronous use does not cause the autodeletion to take place so you have to manually delete them. Async usage: diff --git a/lang/qt/doc/Doxyfile.in b/lang/qt/doc/Doxyfile.in index c672c4c..8ccd11c 100644 --- a/lang/qt/doc/Doxyfile.in +++ b/lang/qt/doc/Doxyfile.in @@ -1092,7 +1092,7 @@ HTML_STYLESHEET = # cascading style sheets that are included after the standard style sheets # created by doxygen. Using this option one can overrule certain style aspects. # This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefor more robust against future updates. +# standard style sheet and is therefore more robust against future updates. # Doxygen will copy the style sheet files to the output directory. # Note: The order of the extra stylesheet files is of importance (e.g. the last # stylesheet in the list overrules the setting of the previous ones in the @@ -1635,8 +1635,8 @@ EXTRA_PACKAGES = # Note: Only use a user-defined header if you know what you are doing! The # following commands have a special meaning inside the header: $title, # $datetime, $date, $doxygenversion, $projectname, $projectnumber, -# $projectbrief, $projectlogo. Doxygen will replace $title with the empy string, -# for the replacement values of the other commands the user is refered to +# $projectbrief, $projectlogo. Doxygen will replace $title with the empty string, +# for the replacement values of the other commands the user is referred to # HTML_HEADER. # This tag requires that the tag GENERATE_LATEX is set to YES. diff --git a/lang/qt/src/dn.h b/lang/qt/src/dn.h index ef6fea0..2d655c5 100644 --- a/lang/qt/src/dn.h +++ b/lang/qt/src/dn.h @@ -83,7 +83,7 @@ public: const_iterator begin() const; const_iterator end() const; - /** Set the order in which prettyDN will reorder the Attirbutes. */ + /** Set the order in which prettyDN will reorder the Attributes. */ void setAttributeOrder(const QStringList &order) const; /** Get the used attribute order. */ diff --git a/lang/qt/src/wkspublishjob.h b/lang/qt/src/wkspublishjob.h index 8d17e52..ff3f21e 100644 --- a/lang/qt/src/wkspublishjob.h +++ b/lang/qt/src/wkspublishjob.h @@ -53,7 +53,7 @@ namespace QGpgME { * send the RFC822 mail returned in returnedData. * * When the response is received start a startRecieve with the - * RFC822 mail received as paramater response. Check for errors + * RFC822 mail received as parameter response. Check for errors * and then send again send the result from returnedData back to * the server. * @@ -87,7 +87,7 @@ public: */ virtual void startCreate(const char *fpr, const QString &mailbox) = 0; - /** Handle a submisson response. The returnedData in the result singnal + /** Handle a submission response. The returnedData in the result singnal * will contain the confirmation response as returned by gpg-wks-client --receive * * @param response The response of the server. diff --git a/lang/qt/tests/t-encrypt.cpp b/lang/qt/tests/t-encrypt.cpp index 5bd472a..f25da31 100644 --- a/lang/qt/tests/t-encrypt.cpp +++ b/lang/qt/tests/t-encrypt.cpp @@ -303,7 +303,7 @@ private: killAgent(mDir.path()); - /* Now create a new homedir which with we test symetric decrypt. */ + /* Now create a new homedir which with we test symmetric decrypt. */ QTemporaryDir tmp; qputenv("GNUPGHOME", tmp.path().toUtf8()); QFile agentConf(tmp.path() + QStringLiteral("/gpg-agent.conf")); diff --git a/m4/glib-2.0.m4 b/m4/glib-2.0.m4 index a22e6e6..cb28430 100644 --- a/m4/glib-2.0.m4 +++ b/m4/glib-2.0.m4 @@ -116,7 +116,7 @@ main () glib_major_version, glib_minor_version, glib_micro_version); printf ("*** was found! If pkg-config was correct, then it is best\n"); printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); - printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** by modifying your LD_LIBRARY_PATH environment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); @@ -152,7 +152,7 @@ main () printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); printf("*** correct copy of pkg-config. (In this case, you will have to\n"); - printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } @@ -194,7 +194,7 @@ main () echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means GLIB is incorrectly installed."]) + echo "*** exact error that occurred. This usually means GLIB is incorrectly installed."]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi diff --git a/m4/gpg-error.m4 b/m4/gpg-error.m4 index 1661204..8ba24b7 100644 --- a/m4/gpg-error.m4 +++ b/m4/gpg-error.m4 @@ -17,7 +17,7 @@ dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) dnl dnl Test for libgpg-error and define GPG_ERROR_CFLAGS, GPG_ERROR_LIBS, dnl GPG_ERROR_MT_CFLAGS, and GPG_ERROR_MT_LIBS. The _MT_ variants are -dnl used for programs requireing real multi thread support. +dnl used for programs requiring real multi thread support. dnl dnl If a prefix option is not used, the config script is first dnl searched in $SYSROOT/bin and then along $PATH. If the used diff --git a/m4/python.m4 b/m4/python.m4 index 7adcdea..f8a759c 100644 --- a/m4/python.m4 +++ b/m4/python.m4 @@ -2,7 +2,7 @@ ## Python file handling ## From Andrew Dalke ## Updated by James Henstridge -## Upated by Werner Koch 2018-10-17 +## Updated by Werner Koch 2018-10-17 ## --------------------------------- # Copyright (C) 1999-2017 Free Software Foundation, Inc. # diff --git a/m4/qt.m4 b/m4/qt.m4 index 700f4e0..62579d5 100644 --- a/m4/qt.m4 +++ b/m4/qt.m4 @@ -56,7 +56,7 @@ AC_DEFUN([FIND_QT], fi AC_MSG_RESULT([$mocversion]) dnl Check that a binary can actually be build with this qt. - dnl pkg-config may be set up in a way that it looks also for libaries + dnl pkg-config may be set up in a way that it looks also for libraries dnl of the build system and not only for the host system. In that case dnl we check here that we can actually compile / link a qt application dnl for host. diff --git a/src/ChangeLog-2011 b/src/ChangeLog-2011 index c1a901a..112d132 100644 --- a/src/ChangeLog-2011 +++ b/src/ChangeLog-2011 @@ -514,7 +514,7 @@ * engine-backend.h (struct engine_ops): Add PASSWD. * engine-gpgsm.c (gpgsm_passwd): New. (_gpgme_engine_ops_gpgsm): Register. - (gpgsm_reset): Reset only if we have a conenction. + (gpgsm_reset): Reset only if we have a connection. * gpgme.h.in (GPGME_PK_ECDSA, GPGME_PK_ECDH): New. * gpgme.c (gpgme_pubkey_algo_name): Add them. @@ -934,7 +934,7 @@ * engine-backend.h: Define with [ENABLE_ASSUAN] instead of [ENABLE_GPGSM]. * posix-io.c (_gpgme_io_waitpid): Make non-static. - * util.h (ENABLE_ASSUAN): Declar _gpgme_assuan_system_hooks, + * util.h (ENABLE_ASSUAN): Declare _gpgme_assuan_system_hooks, _gpgme_assuan_malloc_hooks, _gpgme_assuan_log_cb. * engine-gpgsm.c: Don't map assuan error codes. Use assuan_release instead of assuan_disconnect. @@ -1401,7 +1401,7 @@ 2008-06-19 Werner Koch * gpgme.h (GPGME_CONF_PATHNAME): Replace by GPGME_CONF_FILENAME, - change all callers and provide compatibilty macro. + change all callers and provide compatibility macro. (gpgme_conf_type_t): Add complex types 34..37. * engine-gpgconf.c (gpgconf_parse_option, arg_to_data) (_gpgme_conf_arg_new, _gpgme_conf_arg_release): Add new types. @@ -1806,7 +1806,7 @@ 2007-07-12 Marcus Brinkmann - * Makefile.am: Replace implicite rule by suffix rule. Add + * Makefile.am: Replace implicit rule by suffix rule. Add SUFFIXES for that. 2007-07-12 Werner Koch @@ -2029,7 +2029,7 @@ 2006-03-06 Marcus Brinkmann - * gpgme-config.in (cflags_pth): Revert accidential removal of + * gpgme-config.in (cflags_pth): Revert accidental removal of pthread support with last change. 2006-02-28 Marcus Brinkmann @@ -2052,7 +2052,7 @@ 2006-02-15 Marcus Brinkmann - * w32-io.c (create_writer): Make C->have_data a manually resetted + * w32-io.c (create_writer): Make C->have_data a manually reset event. (writer): Move code from end of if block to beginning, so it is also run the first time. @@ -2368,7 +2368,7 @@ * gpgme.def: New. * versioninfo.rc.in: New. - * Makefile.am: Addes support for building a W32 DLL. + * Makefile.am: Adds support for building a W32 DLL. * ttyname_r.c (ttyname_r) [W32]: Return error. * ath-compat.c [W32]: select and co are not yet supported; return @@ -2779,7 +2779,7 @@ 2004-03-03 Werner Koch * engine-gpgsm.c (gpgsm_export_ext): Properly insert a space - beween patterns. + between patterns. 2004-02-18 Werner Koch @@ -3132,23 +3132,23 @@ * engine.h: Likewise for _gpgme_engine_op_export and _gpgme_engine_op_export_ext. * engine-backend.h (struct engine_ops): Change second argument of - prototype of export to const char *, and add reserverd int as + prototype of export to const char *, and add reserved int as third argument. Add prototype for export_ext. * engine.c (_gpgme_engine_op_export_ext): New function. (_gpgme_engine_op_export): Change second argument of prototype of - export to const char *, and add reserverd int as third argument. + export to const char *, and add reserved int as third argument. * rungpg.c (gpg_export): Change second argument of prototype of - export to const char *, and add reserverd int as third argument. + export to const char *, and add reserved int as third argument. (gpg_export_ext): New function. (gpg_keylist_ext): Break loop at error. (_gpgme_engine_ops_gpg): Add gpg_export_ext. * engine-gpgsm.c (gpgsm_export): Change second argument of - prototype of export to const char *, and add reserverd int as + prototype of export to const char *, and add reserved int as third argument. (gpgsm_export_ext): New function. (_gpgme_engine_ops_gpgsm): Add gpgsm_export_ext. * export.c (export_start): Change second argument of prototype of - export to const char *, and add reserverd int as third argument. + export to const char *, and add reserved int as third argument. (gpgme_op_export_start): Likewise. (export_ext_start): New function. (gpgme_op_export_ext_start): Likewise. @@ -5109,7 +5109,7 @@ * key.h (struct certsig_s): New. Use it in gpgme_key_s. * key.c (gpgme_key_release): Release it. We need to add more code of course. - (_gpgme_key_append_name): Use memset to intialize the struct. + (_gpgme_key_append_name): Use memset to initialize the struct. * gpgme.h (GPGME_KEYLIST_MODE_SIGS): New. * rungpg.c (_gpgme_gpg_op_keylist): Include sigs in listing depending non the list mode. @@ -5217,7 +5217,7 @@ 2002-07-27 Marcus Brinkmann - * delete.c (delete_problem): New case ambigious specification. + * delete.c (delete_problem): New case ambiguous specification. (delete_status_handler): Handle new case (poorly). 2002-07-25 Marcus Brinkmann @@ -5338,8 +5338,8 @@ * import.c (append_xml_impinfo): Kludge to print fingerprint instead of keyid for use with gpgsm. (import_status_handler): Set a flag to know whether any import - occured. - (gpgme_op_import): Reurn -1 if no certificate ewas imported. + occurred. + (gpgme_op_import): Return -1 if no certificate ewas imported. 2002-06-25 Werner Koch @@ -5364,7 +5364,7 @@ (gpgsm_status_handler): Use parse_status. (gpgsm_assuan_simple_command): Accept new arguments STATUS_FNC and STATUS_FNC_VALUE and process status messages. - (gpgsm_set_recipients): Pass new arugments to gpgsm_assuan_simple_command. + (gpgsm_set_recipients): Pass new arguments to gpgsm_assuan_simple_command. (gpgsm_set_fd): Likewise. (_gpgme_gpgsm_op_keylist): Likewise. (_gpgme_gpgsm_op_keylist_ext): Likewise. @@ -5397,7 +5397,7 @@ 2002-06-13 Werner Koch * verify.c (gpgme_op_verify): Make sure that we never access an - unitialized result structure. + uninitialized result structure. 2002-06-12 Werner Koch @@ -5701,7 +5701,7 @@ (_gpgme_key_cache_get): Likewise. (gpgme_key_ref, gpgme_key_release): Lock the key_ref_lock. * import.c (append_xml_impinfo): Make IMPORTED_FIELDS and - IMPORT_RES_FIELDS very const. Make FIELD and FIELD_NAME a litle + IMPORT_RES_FIELDS very const. Make FIELD and FIELD_NAME a little const. * engine.c (_gpgme_engine_get_info): New variable ENGINE_INFO_LOCK. Take lock while determining engine info. @@ -6058,7 +6058,7 @@ flagged and EOF is not received. One problem is that the engine status handlers don't have access to the context, a horrible kludge works around this for now. All errors that happen during a - pending operation should be catched and reported in ctx->error, + pending operation should be caught and reported in ctx->error, including out-of-core and cancellation. This rounds up neatly a couple of loose ends, and makes it possible to pass up any errors in the communication with the backend as well. As a bonus, there @@ -6424,7 +6424,7 @@ (gpgsm_assuan_simple_command): Removed underscore from assuan_write_line. (_gpgme_gpgsm_start): Ditto. - (gpgsm_assuan_simple_command): Replaced interal Assuan read + (gpgsm_assuan_simple_command): Replaced internal Assuan read function by the new assuan_read_line. Removed the use of the internal header. (gpgsm_status_handler): Ditto. Use the new assuan_pending_line. @@ -6516,7 +6516,7 @@ 2001-11-22 Marcus Brinkmann * engine-gpgsm.c: Shuffle around header inclusion a bit, to still - keep them seperate. + keep them separate. (_gpgme_set_status_handler) [!ENABLE_GPGSM]: New function. 2001-11-22 Werner Koch @@ -6726,7 +6726,7 @@ passphrase result. (_gpgme_release_decrypt_result): Don't release removed members. (decrypt_status_handler): Call _gpgme_passphrase_status_handler, - and don't handle the cases catched there. + and don't handle the cases caught there. (command_handler): Removed. (gpgme_op_decrypt_start): Don't set command handler, but invoke _gpgme_passphrase_start which does it. @@ -6739,7 +6739,7 @@ passphrase result. (_gpgme_release_sign_result): Don't release removed members. (sign_status_handler): Call _gpgme_passphrase_status_handler, - and don't handle the cases catched there. + and don't handle the cases caught there. (command_handler): Removed. (gpgme_op_sign_start): Don't set command handler, but invoke _gpgme_passphrase_start which does it. @@ -6976,7 +6976,7 @@ * key.h: New keyflags for capabilities. * keylist.c (set_mainkey_capability, set_subkey_capability): New. (keylist_colon_handler): Parse them. - * gpgme.h: New attribute values for capabilties. + * gpgme.h: New attribute values for capabilities. * key.c (gpgme_key_get_string_attr): Return them. (capabilities_to_string): New. (gpgme_key_get_ulong_attr): Return the global caps. @@ -7006,9 +7006,9 @@ * w32-io.c (destroy_reader): Set stop_me flag. (writer,create_writer,destroy_writer,find_writer,kill_writer): New. - (_gpgme_io_write): Use a writer thread to avaoid blocking. + (_gpgme_io_write): Use a writer thread to avoid blocking. (_gpgme_io_close): Cleanup a writer thread - (_gpgme_io_select): Repalce tthe faked wait on writing by a real + (_gpgme_io_select): Repalce the faked wait on writing by a real waiting which is now possible due to the use of a writer thread. 2001-02-20 Werner Koch @@ -7109,7 +7109,7 @@ * w32-io.c: Does now use reader threads, so that we can use WaitForMultipleObjects. - * sema.h, posix-sema.c, w32-sema.c: Support for Critcial sections. + * sema.h, posix-sema.c, w32-sema.c: Support for Critical sections. Does currently only work for W32. * debug.c, util.h : New. Changed all fprintfs to use this new diff --git a/src/argparse.c b/src/argparse.c index f3a5a48..fcefbba 100644 --- a/src/argparse.c +++ b/src/argparse.c @@ -417,7 +417,7 @@ static void store_alias( ARGPARSE_ARGS *arg, char *name, char *value ) { /* TODO: replace this dummy function with a rea one - * and fix the probelms IRIX has with (ALIAS_DEV)arg.. + * and fix the problems IRIX has with (ALIAS_DEV)arg.. * used as lvalue */ (void)arg; @@ -448,7 +448,7 @@ ignore_invalid_option_p (ARGPARSE_ARGS *arg, const char *keyword) /* Add the keywords up to the next LF to the list of to be ignored options. After returning FP will either be at EOF or the next - character read wll be the first of a new line. The function + character read will be the first of a new line. The function returns 0 on success or true on malloc failure. */ static int ignore_invalid_option_add (ARGPARSE_ARGS *arg, FILE *fp) @@ -1230,7 +1230,7 @@ long_opt_strlen( ARGPARSE_OPTS *o ) * this option * - a description,ine which starts with a '@' and is followed by * any other characters is printed as is; this may be used for examples - * ans such. + * as such. * - A description which starts with a '|' outputs the string between this * bar and the next one as arguments of the long option. */ diff --git a/src/cJSON.h b/src/cJSON.h index a200c31..3a97c20 100644 --- a/src/cJSON.h +++ b/src/cJSON.h @@ -145,7 +145,7 @@ extern void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); extern void cJSON_AddItemReferenceToObject(cJSON *object, const char *string,cJSON *item); -/* Remove/Detatch items from Arrays/Objects. */ +/* Remove/Detach items from Arrays/Objects. */ extern cJSON *cJSON_DetachItemFromArray(cJSON *array,int which); extern void cJSON_DeleteItemFromArray(cJSON *array,int which); extern cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string); diff --git a/src/data-fd.c b/src/data-fd.c index cf17f00..dec52af 100644 --- a/src/data-fd.c +++ b/src/data-fd.c @@ -1,4 +1,4 @@ -/* data-fd.c - A file descripor based data object. +/* data-fd.c - A file descriptor based data object. Copyright (C) 2002, 2004 g10 Code GmbH This file is part of GPGME. diff --git a/src/data-identify.c b/src/data-identify.c index 857d06c..826c427 100644 --- a/src/data-identify.c +++ b/src/data-identify.c @@ -258,7 +258,7 @@ pgp_binary_detection (const void *image_arg, size_t imagelen) case PKT_COMPRESSED: /* If this is the first packet we assume that that a signed * packet follows. We do not want to uncompress it here due - * to the need of a lot of code and the potentail DoS. */ + * to the need of a lot of code and the potential DoS. */ if (!anypacket) return GPGME_DATA_TYPE_PGP_SIGNED; return GPGME_DATA_TYPE_PGP_OTHER; @@ -479,7 +479,7 @@ basic_detection (char *data, size_t datalen) file pointer but there is no guarantee that it will work. FIXME: We may want to add internal buffering so that this function - can be implemented for allmost all kind of data objects. + can be implemented for almost all kind of data objects. */ gpgme_data_type_t gpgme_data_identify (gpgme_data_t dh, int reserved) diff --git a/src/data.c b/src/data.c index 1df6b0a..ba32477 100644 --- a/src/data.c +++ b/src/data.c @@ -409,7 +409,7 @@ gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size) /* Set the current position from where the next read or write starts - in the data object with the handle DH to OFFSET, relativ to + in the data object with the handle DH to OFFSET, relative to WHENCE. */ gpgme_off_t gpgme_data_seek (gpgme_data_t dh, gpgme_off_t offset, int whence) diff --git a/src/data.h b/src/data.h index 692eb9a..481a245 100644 --- a/src/data.h +++ b/src/data.h @@ -49,7 +49,7 @@ typedef gpgme_ssize_t (*gpgme_data_write_cb) (gpgme_data_t dh, size_t size); /* Set the current position from where the next read or write starts - in the data object with the handle DH to OFFSET, relativ to + in the data object with the handle DH to OFFSET, relative to WHENCE. */ typedef gpgme_off_t (*gpgme_data_seek_cb) (gpgme_data_t dh, gpgme_off_t offset, diff --git a/src/engine-gpg.c b/src/engine-gpg.c index 17fba80..2785bf2 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -745,7 +745,7 @@ gpg_set_status_cb (void *engine, gpgme_status_cb_t cb, void *cb_value) } -/* Note, that the status_handler is allowed to modifiy the args +/* Note, that the status_handler is allowed to modify the args value. */ static void gpg_set_status_handler (void *engine, engine_status_handler_t fnc, diff --git a/src/engine-gpgconf.c b/src/engine-gpgconf.c index 24867c7..33a1da0 100644 --- a/src/engine-gpgconf.c +++ b/src/engine-gpgconf.c @@ -1041,7 +1041,7 @@ gpgconf_conf_dir (void *engine, const char *what, char **result) /* Parse a line received from gpgconf --query-swdb. This function may - * modify LINE. The result is stored at RESUL. */ + * modify LINE. The result is stored at RESULT. */ static gpg_error_t parse_swdb_line (char *line, gpgme_query_swdb_result_t result) { diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c index 6e6df46..5700990 100644 --- a/src/engine-gpgsm.c +++ b/src/engine-gpgsm.c @@ -1661,7 +1661,7 @@ gpgsm_import (void *engine, gpgme_data_t keydata, gpgme_key_t *keyarray) && *keyarray[idx]->subkeys->fpr) buflen += strlen (keyarray[idx]->subkeys->fpr) + 1; } - /* Allocate a bufer with extra space for the trailing Nul + /* Allocate a buffer with extra space for the trailing Nul introduced by the use of stpcpy. */ buffer = malloc (buflen+1); if (!buffer) diff --git a/src/gpgme-json.c b/src/gpgme-json.c index 7809d81..ba80f08 100644 --- a/src/gpgme-json.c +++ b/src/gpgme-json.c @@ -52,7 +52,7 @@ int main (void){fputs ("Build with Libgpg-error >= 1.28!\n", stderr);return 1;} #define MIN_REPLY_CHUNK_SIZE 30 /* If no chunksize is provided we print everything. Changing - * this to a positive value will result in all messages beeing + * this to a positive value will result in all messages being * chunked. */ #define DEF_REPLY_CHUNK_SIZE 0 #define MAX_REPLY_CHUNK_SIZE (10 * 1024 * 1024) @@ -720,7 +720,7 @@ create_keylist_patterns (cjson_t request, const char *name) ret[i++] = xstrdup (tmp); tmp = p + 1; } - /* The last key is not newline delimted. */ + /* The last key is not newline delimited. */ ret[i] = *tmp ? xstrdup (tmp) : NULL; xfree (keystring); @@ -1499,11 +1499,11 @@ make_data_object (cjson_t result, gpgme_data_t data, /* Encode and chunk response. * - * If neccessary this base64 encodes and chunks the repsonse + * If necessary this base64 encodes and chunks the response * for getmore so that we always return valid json independent * of the chunksize. * - * A chunked repsonse contains the base64 encoded chunk + * A chunked response contains the base64 encoded chunk * as a string and a boolean if there is still more data * available for getmore like: * { @@ -3681,7 +3681,7 @@ native_messaging_repl (void) for (;;) { - /* Read length. Note that the protocol uses native endianess. + /* Read length. Note that the protocol uses native endianness. * Is it allowed to call such a thing a well thought out * protocol? */ if (es_read (es_stdin, &nrequest, sizeof nrequest, &n)) @@ -3702,7 +3702,7 @@ native_messaging_repl (void) log_error ("error reading request: request too long (%zu MiB)\n", (size_t)nrequest / (1024*1024)); /* Fixme: Shall we read the request to the bit bucket and - * return an error reponse or just return an error reponse + * return an error response or just return an error response * and terminate? Needs some testing. */ break; } diff --git a/src/sign.c b/src/sign.c index ab4109e..73a3803 100644 --- a/src/sign.c +++ b/src/sign.c @@ -337,7 +337,7 @@ _gpgme_sign_status_handler (void *priv, gpgme_status_code_t code, char *args) case GPGME_STATUS_INV_RECP: if (opd->inv_sgnr_seen && opd->ignore_inv_recp) break; - /* FALLTROUGH */ + /* FALLTHROUGH */ case GPGME_STATUS_INV_SGNR: if (code == GPGME_STATUS_INV_SGNR) opd->inv_sgnr_seen = 1; diff --git a/src/trustlist.c b/src/trustlist.c index d7eb4c6..ee09e6e 100644 --- a/src/trustlist.c +++ b/src/trustlist.c @@ -65,7 +65,7 @@ trustlist_status_handler (void *priv, gpgme_status_code_t code, char *args) With TYPE = U for a user ID K for a key The RECNO is either the one of the dir record or the one of the uid - record. OT is the the usual trust letter and only availabel on K + record. OT is the the usual trust letter and only available on K lines. VAL is the calculated validity MC is the marginal trust counter and only available on U lines CC is the same for the complete count NAME ist the username and only printed on U diff --git a/src/verify.c b/src/verify.c index 26b205a..bd35346 100644 --- a/src/verify.c +++ b/src/verify.c @@ -1024,7 +1024,7 @@ _gpgme_verify_status_handler (void *priv, gpgme_status_code_t code, char *args) * a GPGME user can do a keylisting with the address * normalisation. * So when a duplicated TOFU_USER line is encountered - * we ignore the conflicting tofu stats emited afterwards. + * we ignore the conflicting tofu stats emitted afterwards. */ if (gpg_err_code (err) == GPG_ERR_DUP_VALUE) { diff --git a/src/w32-io.c b/src/w32-io.c index a6dfdbc..b4a0344 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -143,7 +143,7 @@ static struct /* The context of an associated writer object or NULL. */ struct writer_context_s *writer; - /* A notification hanlder. Noet that we current support only one + /* A notification handler. Noet that we current support only one * callback per fd. */ struct { _gpgme_close_notify_handler_t handler; @@ -230,7 +230,7 @@ release_hddesc (hddesc_t hdd) hdd->refcount--; if (hdd->refcount < 1) { - /* Holds a valid handle or was never intialized (in which case + /* Holds a valid handle or was never initialized (in which case * REFCOUNT would be -1 here). */ TRACE_BEG3 (DEBUG_SYSIO, "gpgme:release_hddesc", hdd, "hd=%p, sock=%d, refcount=%d", @@ -257,7 +257,7 @@ release_hddesc (hddesc_t hdd) /* Returns our FD or -1 on resource limit. The returned integer - * references a new object which has not been intialized but can be + * references a new object which has not been initialized but can be * release with release_fd. */ static int new_fd (void) @@ -1247,12 +1247,12 @@ _gpgme_io_close (int fd) fd_table[fd].writer = NULL; } - /* The handler may not use any fd fucntion because the table is + /* The handler may not use any fd function because the table is * locked. Can we avoid this? */ handler = fd_table[fd].notify.handler; value = fd_table[fd].notify.value; - /* Release our reference to the handle descripor. Note that if no + /* Release our reference to the handle descriptor. Note that if no * reader or writer threads were used this release will also take * care that the handle descriptor is closed * (i.e. CloseHandle(hdd->hd) is called). */ @@ -1272,8 +1272,8 @@ _gpgme_io_close (int fd) /* Set a close notification callback which is called right after FD - * has been closed but before its slot (ie. the FD number) is beeing - * released. Tha HANDLER may thus use the provided value of the FD + * has been closed but before its slot (ie. the FD number) is being + * released. The HANDLER may thus use the provided value of the FD * but it may not pass it to any I/O functions. Note: Only the last * handler set for an FD is used. */ int diff --git a/tests/gpg/t-encrypt-mixed.c b/tests/gpg/t-encrypt-mixed.c index cc9ce89..57fdc51 100644 --- a/tests/gpg/t-encrypt-mixed.c +++ b/tests/gpg/t-encrypt-mixed.c @@ -31,7 +31,7 @@ #include "t-support.h" -/* Tests mixed symmetric and asymetric decryption. Verifies +/* Tests mixed symmetric and asymmetric decryption. Verifies that an encrypted message can be decrypted without the secret key but that the recipient is also set correctly. */ int diff --git a/tests/gpgsm/t-genkey.c b/tests/gpgsm/t-genkey.c index fb05034..120ed68 100644 --- a/tests/gpgsm/t-genkey.c +++ b/tests/gpgsm/t-genkey.c @@ -105,7 +105,7 @@ main (void) if (result->fpr) { - fprintf (stderr, "%s:%d: generated key has (unexpectdly) a fingerprint\n", + fprintf (stderr, "%s:%d: generated key has (unexpectedly) a fingerprint\n", __FILE__, __LINE__); exit (1); } ----------------------------------------------------------------------- Summary of changes: Makefile.am | 2 +- NEWS | 14 +++--- TODO | 6 +-- configure.ac | 2 +- doc/ChangeLog-2011 | 8 ++-- doc/examples/show-group-options.c | 2 +- doc/gpgme.texi | 16 +++---- doc/uiserver.texi | 4 +- lang/cl/gpgme.lisp | 22 +++++----- lang/cpp/README | 2 +- lang/cpp/src/key.h | 2 +- lang/js/DemoExtension/maindemo.js | 2 +- lang/js/jsdoc_index.md | 2 +- lang/js/src/Helpers.js | 2 +- lang/js/src/Key.js | 4 +- lang/js/src/Keyring.js | 2 +- lang/python/doc/meta/old-commits.log | 16 +++---- lang/python/doc/rst/gpgme-python-howto.rst | 6 +-- lang/python/doc/src/gpgme-python-howto | 6 +-- lang/python/doc/texinfo/gpgme-python-howto.texi | 8 ++-- lang/python/helpers.c | 2 +- lang/python/tests/t-quick-key-manipulation.py | 2 +- lang/qt/README | 6 +-- lang/qt/doc/Doxyfile.in | 6 +-- lang/qt/src/dn.h | 2 +- lang/qt/src/wkspublishjob.h | 4 +- lang/qt/tests/t-encrypt.cpp | 2 +- m4/glib-2.0.m4 | 6 +-- m4/gpg-error.m4 | 2 +- m4/python.m4 | 2 +- m4/qt.m4 | 2 +- src/ChangeLog-2011 | 58 ++++++++++++------------- src/argparse.c | 6 +-- src/cJSON.h | 2 +- src/data-fd.c | 2 +- src/data-identify.c | 4 +- src/data.c | 2 +- src/data.h | 2 +- src/engine-gpg.c | 2 +- src/engine-gpgconf.c | 2 +- src/engine-gpgsm.c | 2 +- src/gpgme-json.c | 12 ++--- src/sign.c | 2 +- src/trustlist.c | 2 +- src/verify.c | 2 +- src/w32-io.c | 14 +++--- tests/gpg/t-encrypt-mixed.c | 2 +- tests/gpgsm/t-genkey.c | 2 +- 48 files changed, 141 insertions(+), 141 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 8 10:39:21 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Thu, 08 Nov 2018 10:39:21 +0100 Subject: [git] Assuan - branch, master, updated. libassuan-2.5.1-23-gea69c71 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "IPC library used by GnuPG". The branch, master has been updated via ea69c7126ff25d7d44950bf4a70467d577989a34 (commit) from 50ed4f7d5b68e94464df7c0646c3424cee2f47de (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ea69c7126ff25d7d44950bf4a70467d577989a34 Author: NIIBE Yutaka Date: Thu Nov 8 18:21:23 2018 +0900 socket: Use union for sockaddr access. * src/assuan-socket.c (socks5_connect, use_socks): Use union to access, instead of using cast to the pointer. -- In some machine like 32-bit ARM, alignment requirement of struct sockaddr and struct sockaddr_in (or struct sockaddr_in6) is different. Although it is completely valid to use the value of the address by cast here, because the object should be allocated by struct sockaddr_in or struct sockaddr_in6 to be referred by struct sockaddr *. But compiler doesn't assume such a usage, thus, emits warnings. The API with struct sockaddr * is a bit difficult thing. I examined GNU C library for the implementation of the connect function, it uses transparent union, the GCC feature. It would be too much, if we do same thing here. Signed-off-by: NIIBE Yutaka diff --git a/src/assuan-socket.c b/src/assuan-socket.c index 7fb2201..7644ada 100644 --- a/src/assuan-socket.c +++ b/src/assuan-socket.c @@ -703,14 +703,19 @@ socks5_connect (assuan_context_t ctx, assuan_fd_t sock, struct sockaddr_in proxyaddr_in; struct sockaddr *proxyaddr; size_t proxyaddrlen; - struct sockaddr_in6 *addr_in6; - struct sockaddr_in *addr_in; + union { + struct sockaddr *addr; + struct sockaddr_in *addr_in; + struct sockaddr_in6 *addr_in6; + } addru; unsigned char buffer[22+512]; /* The extra 512 gives enough space for username/password or the hostname. */ size_t buflen, hostnamelen; int method; + addru.addr = addr; + /* memset (&proxyaddr_in6, 0, sizeof proxyaddr_in6); */ memset (&proxyaddr_in, 0, sizeof proxyaddr_in); @@ -848,20 +853,16 @@ socks5_connect (assuan_context_t ctx, assuan_fd_t sock, } else if (addr->sa_family == AF_INET6) { - addr_in6 = (struct sockaddr_in6 *)addr; - buffer[3] = 4; /* ATYP = IPv6 */ - memcpy (buffer+ 4, &addr_in6->sin6_addr.s6_addr, 16); /* DST.ADDR */ - memcpy (buffer+20, &addr_in6->sin6_port, 2); /* DST.PORT */ + memcpy (buffer+ 4, &addru.addr_in6->sin6_addr.s6_addr, 16); /* DST.ADDR */ + memcpy (buffer+20, &addru.addr_in6->sin6_port, 2); /* DST.PORT */ buflen = 22; } else { - addr_in = (struct sockaddr_in *)addr; - buffer[3] = 1; /* ATYP = IPv4 */ - memcpy (buffer+4, &addr_in->sin_addr.s_addr, 4); /* DST.ADDR */ - memcpy (buffer+8, &addr_in->sin_port, 2); /* DST.PORT */ + memcpy (buffer+4, &addru.addr_in->sin_addr.s_addr, 4); /* DST.ADDR */ + memcpy (buffer+8, &addru.addr_in->sin_port, 2); /* DST.PORT */ buflen = 10; } ret = do_writen (ctx, sock, buffer, buflen); @@ -931,15 +932,22 @@ socks5_connect (assuan_context_t ctx, assuan_fd_t sock, static int use_socks (struct sockaddr *addr) { + union { + struct sockaddr *addr; + struct sockaddr_in *addr_in; + struct sockaddr_in6 *addr_in6; + } addru; + + addru.addr = addr; + if (!tor_mode) return 0; else if (addr->sa_family == AF_INET6) { - struct sockaddr_in6 *addr_in6 = (struct sockaddr_in6 *)addr; const unsigned char *s; int i; - s = (unsigned char *)&addr_in6->sin6_addr.s6_addr; + s = (unsigned char *)&addru.addr_in6->sin6_addr.s6_addr; if (s[15] != 1) return 1; /* Last octet is not 1 - not the loopback address. */ for (i=0; i < 15; i++, s++) @@ -950,9 +958,7 @@ use_socks (struct sockaddr *addr) } else if (addr->sa_family == AF_INET) { - struct sockaddr_in *addr_in = (struct sockaddr_in *)addr; - - if (*(unsigned char*)&addr_in->sin_addr.s_addr == 127) + if (*(unsigned char*)&addru.addr_in->sin_addr.s_addr == 127) return 0; /* Loopback (127.0.0.0/8) */ return 1; ----------------------------------------------------------------------- Summary of changes: src/assuan-socket.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) hooks/post-receive -- IPC library used by GnuPG http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 8 12:57:30 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Thu, 08 Nov 2018 12:57:30 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-255-g69930f6 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 69930f6884a934207f7aa523cf6d2b8e22dfe666 (commit) from 7fc3decc2e038be905d47701c7ce196ed86a725b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 69930f6884a934207f7aa523cf6d2b8e22dfe666 Author: NIIBE Yutaka Date: Thu Nov 8 20:52:38 2018 +0900 gpgcompose: Fix --sk-esk. * g10/gpgcompose.c (sk_esk): Copy the result content correctly. Don't forget to free the result. -- Fixes-commit: 0131d4369a81a51bf7bb328cc81a3bb082ed1a94 Signed-off-by: NIIBE Yutaka diff --git a/g10/gpgcompose.c b/g10/gpgcompose.c index b3f7ecd..9b69015 100644 --- a/g10/gpgcompose.c +++ b/g10/gpgcompose.c @@ -2281,16 +2281,27 @@ sk_esk (const char *option, int argc, char *argv[], void *cookie) /* Encrypt the session key using the s2k specifier. */ { DEK *sesdekp = &sesdek; + void *enckey; + size_t enckeylen; /* Now encrypt the session key (or rather, the algorithm used to - encrypt the SKESK plus the session key) using ENCKEY. */ - err = encrypt_seskey (&s2kdek, 0, &sesdekp, - (void**)&ske->seskey, (size_t *)&ske->seskeylen); + encrypt the SKESK plus the session key) using S2KDEK. */ + err = encrypt_seskey (&s2kdek, 0, &sesdekp, &enckey, &enckeylen); + if (err) log_fatal ("encrypt_seskey failed: %s\n", gpg_strerror (err)); + if (enckeylen - 1 > sesdek.keylen) + log_fatal ("key size is too big: %z\n", enckeylen); + else + { + ske->seskeylen = (byte)enckeylen; + memcpy (ske->seskey, enckey, enckeylen); + } + /* Save the session key for later. */ session_key = sesdek; + xfree (enckey); } pkt.pkttype = PKT_SYMKEY_ENC; ----------------------------------------------------------------------- Summary of changes: g10/gpgcompose.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 8 13:15:22 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 08 Nov 2018 13:15:22 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-2.3.1-28-g7b7226d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 7b7226d6982e7ab2d44de72c298f59eff0932058 (commit) from e367d25a02d09b63760366f208595ed08650c216 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7b7226d6982e7ab2d44de72c298f59eff0932058 Author: Andre Heinecke Date: Thu Nov 8 13:13:06 2018 +0100 Add external API with WindowMessages * src/windowmessages.cpp: Handle new messages. * src/windowmessagees.h: Add new codes. * tests/Makefile.am: Update accordingly. * tests/run-messenger.cpp: New. -- The run-messenger can be used as an example how to use this API. As we block saves while decrypted data is open we add API to close the mails now. Either all or a specific uuid. e.g.: run-messenger.exe 1301 1147d7ed-22fb-48d2-8678-a814df5009eb GnuPG-Bug-Id: T4241 diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp index e269d0a..da73117 100644 --- a/src/windowmessages.cpp +++ b/src/windowmessages.cpp @@ -43,6 +43,13 @@ gpgol_window_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) if (message == WM_USER + 42) { TSTART; + + if (!lParam) + { + log_error ("%s:%s: Recieved user msg without lparam", + SRCNAME, __func__); + TRETURN DefWindowProc(hWnd, message, wParam, lParam); + } wm_ctx_t *ctx = (wm_ctx_t *) lParam; log_debug ("%s:%s: Recieved user msg: %i", SRCNAME, __func__, ctx->wmsg_type); @@ -283,6 +290,58 @@ gpgol_window_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } TRETURN 0; } + else if (message == WM_USER + 43) + { + switch (wParam) + { + case (EXT_API_CLOSE_ALL): + { + log_debug ("%s:%s: Closing all mails.", + SRCNAME, __func__); + Mail::closeAllMails_o (); + TRETURN 0; + } + default: + log_debug ("%s:%s: Unknown external msg %i", + SRCNAME, __func__, wParam); + } + } + else if (message == WM_COPYDATA) + { + log_debug ("%s:%s Received copydata message.", + SRCNAME, __func__); + if (!lParam) + { + STRANGEPOINT; + TRETURN DefWindowProc(hWnd, message, wParam, lParam); + } + const COPYDATASTRUCT *cds = (COPYDATASTRUCT*)lParam; + + if (cds->dwData == EXT_API_CLOSE) + { + log_debug ("%s:%s CopyData with external close. Payload: %.*s", + SRCNAME, __func__, (int)cds->cbData, (char *) cds->lpData); + + std::string uid ((char*) cds->lpData, cds->cbData); + auto mail = Mail::getMailForUUID (uid.c_str ()); + if (!mail) + { + log_error ("%s:%s Failed to find mail for: %s", + SRCNAME, __func__, uid.c_str() ); + TRETURN DefWindowProc(hWnd, message, wParam, lParam); + } + + mail->refCurrentItem (); + Mail::closeInspector_o (mail); + TRACEPOINT; + Mail::close (mail); + log_debug ("%s:%s: Close for %p uid: %s finished.", + SRCNAME, __func__, mail, uid.c_str ()); + mail->releaseCurrentItem(); + TRETURN 0; + } + + } return DefWindowProc(hWnd, message, wParam, lParam); } diff --git a/src/windowmessages.h b/src/windowmessages.h index 599a90c..a8d24de 100644 --- a/src/windowmessages.h +++ b/src/windowmessages.h @@ -56,6 +56,9 @@ typedef enum _gpgol_wmsg_type DO_AUTO_SECURE, DONT_AUTO_SECURE, CONFIG_KEY_DONE, + /* External API, keep it stable! */ + EXT_API_CLOSE = 1301, + EXT_API_CLOSE_ALL = 1302, } gpgol_wmsg_type; typedef struct diff --git a/tests/Makefile.am b/tests/Makefile.am index 336794f..02afc54 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -67,10 +67,11 @@ run_parser_SOURCES = run-parser.cpp $(parser_SRC) else run_parser_SOURCES = run-parser.cpp $(parser_SRC) \ ../src/w32-gettext.cpp ../src/w32-gettext.h +run_messenger_SOURCES = run-messenger.cpp endif if !HAVE_W32_SYSTEM noinst_PROGRAMS = t-parser run-parser else -noinst_PROGRAMS = run-parser +noinst_PROGRAMS = run-parser run-messenger endif diff --git a/tests/run-messenger.cpp b/tests/run-messenger.cpp new file mode 100644 index 0000000..99c4cf2 --- /dev/null +++ b/tests/run-messenger.cpp @@ -0,0 +1,84 @@ +/* run-messenger.cpp - Test for GpgOL's external windowmessage API. + * Copyright (C) 2016 by Bundesamt f?r Sicherheit in der Informationstechnik + * Software engineering by Intevation GmbH + * + * This file is part of GpgOL. + * + * GpgOL is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * GpgOL 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 Lesser General Public License + * along with this program; if not, see . + */ + + +#include + +#include + +static int +show_usage (int ex) +{ + fputs ("usage: run-messgenger id [PAYLOAD]\n\n" + "Options:\n" + , stderr); + exit (ex); +} + + +int main(int argc, char **argv) +{ + int last_argc = -1; + if (argc) + { argc--; argv++; } + + while (argc && last_argc != argc ) + { + last_argc = argc; + if (!strcmp (*argv, "--help")) + { + show_usage (0); + } + } + + if (argc != 1 && argc != 2) + { + show_usage (1); + } + + int id = atoi (*argv); + + HWND gpgol = FindWindowA ("GpgOLResponder", "GpgOLResponder"); + + if (!gpgol) + { + fprintf (stderr, "Failed to find GpgOL Window"); + exit (1); + } + + if (argc == 1) + { + printf ("Sending message: %i\n", id); + SendMessage (gpgol, WM_USER + 43, id, NULL); + exit (0); + } + + /* Send message with payload */ + char *payload = argv[1]; + COPYDATASTRUCT cds; + + cds.dwData = id; + cds.cbData = strlen (payload) + 1; + cds.lpData = payload; + + printf ("Sending message: %i\n with param: %s", id, payload); + SendMessage (gpgol, WM_COPYDATA, 0, (LPARAM) &cds); + exit (0); +} ----------------------------------------------------------------------- Summary of changes: src/windowmessages.cpp | 59 ++++++++++++++++++++++++++++++++++ src/windowmessages.h | 3 ++ tests/Makefile.am | 3 +- tests/run-messenger.cpp | 84 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 tests/run-messenger.cpp hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 8 13:41:54 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 08 Nov 2018 13:41:54 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-2.3.1-30-g5152f5a Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 5152f5a30c7bbf4716f7c6b1c279f7de3f47595c (commit) via bdba540b6759fdcc0f5237f7be1bbca8cc57812f (commit) from 7b7226d6982e7ab2d44de72c298f59eff0932058 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5152f5a30c7bbf4716f7c6b1c279f7de3f47595c Author: Andre Heinecke Date: Thu Nov 8 13:40:30 2018 +0100 Set validate keylist mode for keycache * src/keycache.cpp (do_populate_protocol): Add validate option. -- This fixes S/MIME keys for verfied signatures to have trust level 2 (because their trust was unknown) before the key is first updated. diff --git a/src/keycache.cpp b/src/keycache.cpp index 1371930..3352144 100644 --- a/src/keycache.cpp +++ b/src/keycache.cpp @@ -229,7 +229,9 @@ do_populate_protocol (GpgME::Protocol proto, bool secret) TRETURN; } - ctx->setKeyListMode (GpgME::KeyListMode::Local); + ctx->setKeyListMode (GpgME::KeyListMode::Local | + GpgME::KeyListMode::Validate); + ctx->setOffline (true); GpgME::Error err; if ((err = ctx->startKeyListing ((const char*)nullptr, secret))) commit bdba540b6759fdcc0f5237f7be1bbca8cc57812f Author: Andre Heinecke Date: Thu Nov 8 13:38:27 2018 +0100 Fix 64bit format error * src/windowmessages.cpp (gpgol_window_proc): Fix message id. diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp index da73117..c2f2ca0 100644 --- a/src/windowmessages.cpp +++ b/src/windowmessages.cpp @@ -303,7 +303,7 @@ gpgol_window_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } default: log_debug ("%s:%s: Unknown external msg %i", - SRCNAME, __func__, wParam); + SRCNAME, __func__, (int) wParam); } } else if (message == WM_COPYDATA) ----------------------------------------------------------------------- Summary of changes: src/keycache.cpp | 4 +++- src/windowmessages.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 8 15:36:23 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 08 Nov 2018 15:36:23 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-2.3.1-33-g39f9f19 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 39f9f19fb8749b10bcdc9348f23bf5c61550994f (commit) via 95c1ee605d8f6f74a63897c9b00c11b2c5db1d11 (commit) via e86a0c1c06505b4846e50d1b01ed552faefeb7a9 (commit) from 5152f5a30c7bbf4716f7c6b1c279f7de3f47595c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 39f9f19fb8749b10bcdc9348f23bf5c61550994f Author: Andre Heinecke Date: Thu Nov 8 14:04:23 2018 +0100 Add some NEWS -- diff --git a/NEWS b/NEWS index f5bb4ea..62c683a 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,17 @@ Noteworthy changes for version 2.3.2 (unreleased) ================================================= + * Reduced leakage of private information without + DBG_DATA. (T4193) + + * Added handling for Junk folders. (T4188) + + * Added a fallback for encoding problems. (T4156) + + * Fixed system wide default configuration. + + * Added WindowMessage API for external use. (T4241) + Noteworthy changes for version 2.3.1 (2018-10-16) ================================================= commit 95c1ee605d8f6f74a63897c9b00c11b2c5db1d11 Author: Andre Heinecke Date: Thu Nov 8 14:01:40 2018 +0100 Use WM_USER without offset for ext messages * src/windowmessages.cpp, tests/run-messanger.cpp: Use WM_USER without offset. -- Some documentation like the wine windowmessages list documents that above WM_USER messages are still system defined. diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp index c2f2ca0..d39cd2b 100644 --- a/src/windowmessages.cpp +++ b/src/windowmessages.cpp @@ -290,7 +290,7 @@ gpgol_window_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } TRETURN 0; } - else if (message == WM_USER + 43) + else if (message == WM_USER) { switch (wParam) { diff --git a/tests/run-messenger.cpp b/tests/run-messenger.cpp index 99c4cf2..8cf007d 100644 --- a/tests/run-messenger.cpp +++ b/tests/run-messenger.cpp @@ -66,7 +66,7 @@ int main(int argc, char **argv) if (argc == 1) { printf ("Sending message: %i\n", id); - SendMessage (gpgol, WM_USER + 43, id, NULL); + SendMessage (gpgol, WM_USER, id, NULL); exit (0); } commit e86a0c1c06505b4846e50d1b01ed552faefeb7a9 Author: Andre Heinecke Date: Thu Nov 8 14:01:06 2018 +0100 Add tracing in shutdown * src/gpgoladdin.cpp (GpgolAddin::shutdown): Add tracing. diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp index be3bdac..bd9cdb8 100644 --- a/src/gpgoladdin.cpp +++ b/src/gpgoladdin.cpp @@ -1189,11 +1189,12 @@ GpgolAddin::addRibbon (LPDISPATCH disp) void GpgolAddin::shutdown () { + TSTART; if (m_shutdown) { log_debug ("%s:%s: Already shutdown", SRCNAME, __func__); - return; + TRETURN; } m_shutdown = true; @@ -1233,6 +1234,7 @@ GpgolAddin::shutdown () gpgol_release (m_application); m_application = nullptr; + TRETURN; } void ----------------------------------------------------------------------- Summary of changes: NEWS | 11 +++++++++++ src/gpgoladdin.cpp | 4 +++- src/windowmessages.cpp | 2 +- tests/run-messenger.cpp | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 8 15:43:50 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 08 Nov 2018 15:43:50 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-2.3.1-36-g289643c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 289643c1016d3e145329bedbc6bb91656f9e48f7 (commit) via f991946b93e763d8cfe5ad2c2cf3f07d1b863503 (commit) via db8f468e0462f2a4d600b41f8dd0e6b4135d38fa (commit) from 39f9f19fb8749b10bcdc9348f23bf5c61550994f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 289643c1016d3e145329bedbc6bb91656f9e48f7 Author: Andre Heinecke Date: Thu Nov 8 15:43:36 2018 +0100 Minor debug output improvements -- diff --git a/src/application-events.cpp b/src/application-events.cpp index 82b1b34..5d8b9a8 100644 --- a/src/application-events.cpp +++ b/src/application-events.cpp @@ -98,9 +98,8 @@ EVENT_SINK_INVOKE(ApplicationEvents) } case Quit: { - TSTART; - log_debug ("%s:%s: Quit event", SRCNAME, __func__); - TBREAK; + log_debug ("%s:%s: Quit event. Shutting down", + SRCNAME, __func__); } default: log_oom ("%s:%s: Unhandled Event: %lx \n", diff --git a/src/debug.h b/src/debug.h index 1d762b9..0de8a26 100644 --- a/src/debug.h +++ b/src/debug.h @@ -116,7 +116,7 @@ const char *anonstr (const char *data); const char *log_srcname (const char *s); #define SRCNAME log_srcname (__FILE__) -#define STRANGEPOINT log_debug ("%s:%s:%d:_trace_", \ +#define STRANGEPOINT log_debug ("%s:%s:%d:UNEXPECTED", \ SRCNAME, __func__, __LINE__); #define TRACEPOINT log_trace ("%s:%s:%d", \ SRCNAME, __func__, __LINE__); commit f991946b93e763d8cfe5ad2c2cf3f07d1b863503 Author: Andre Heinecke Date: Thu Nov 8 15:43:21 2018 +0100 Revert "Add InspectorEvents experiment" This reverts commit db8f468e0462f2a4d600b41f8dd0e6b4135d38fa. diff --git a/src/Makefile.am b/src/Makefile.am index dd8cbdf..369ce6d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -49,7 +49,6 @@ gpgol_SOURCES = \ gpgoladdin.cpp gpgoladdin.h \ gpgol.def \ gpgol-ids.h \ - inspector-events.cpp \ keycache.cpp keycache.h \ mail.h mail.cpp \ mailitem-events.cpp \ diff --git a/src/eventsinks.h b/src/eventsinks.h index dc62122..1508a62 100644 --- a/src/eventsinks.h +++ b/src/eventsinks.h @@ -32,6 +32,4 @@ LPDISPATCH install_ExplorersEvents_sink (LPDISPATCH obj); void detach_ExplorersEvents_sink (LPDISPATCH obj); LPDISPATCH install_FolderEvents_sink (LPDISPATCH obj); void detach_FolderEvents_sink (LPDISPATCH obj); -LPDISPATCH install_InspectorEvents_sink (LPDISPATCH obj); -void detach_InspectorEvents_sink (LPDISPATCH obj); #endif // EVENTSINKS_H diff --git a/src/inspector-events.cpp b/src/inspector-events.cpp deleted file mode 100644 index dbf684b..0000000 --- a/src/inspector-events.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* inspector-events.cpp - Event handling for an inspector. - * Copyright (C) 2018 Intevation GmBH - * - * This file is part of GpgOL. - * - * GpgOL is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * GpgOL 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 Lesser General Public License - * along with this program; if not, see . - */ - -/* The event handler classes defined in this file follow the - general pattern that they implment the IDispatch interface - through the eventsink macros and handle event invocations - in their invoke methods. -*/ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "eventsink.h" -#include "ocidl.h" -#include "common.h" -#include "oomhelp.h" -#include "mail.h" - -/* Folder Events */ -BEGIN_EVENT_SINK(InspectorEvents, IDispatch) -EVENT_SINK_DEFAULT_CTOR(InspectorEvents) -EVENT_SINK_DEFAULT_DTOR(InspectorEvents) -typedef enum - { - Activate = 0xF001, - AttachmentSelectionChange = 0xFC79, - BeforeMaximize = 0xFA11, - BeforeMinimize = 0xFA12, - BeforeMove = 0xFA13, - BeforeSize = 0xFA14, - Close = 0xF008, - Deactivate = 0xF006, - PageChange = 0xFBF4, - } InspectorEvent; - -EVENT_SINK_INVOKE(InspectorEvents) -{ - USE_INVOKE_ARGS - switch(dispid) - { - case Close: - { - TSTART; - log_oom ("%s:%s Close event in inspector %p", - SRCNAME, __func__, this); - /* Get the mail object belonging to us */ - auto mailitem = MAKE_SHARED (get_oom_object (m_object, "CurrentItem")); - - if (!mailitem) - { - STRANGEPOINT; - TBREAK; - } - - char *uid = get_unique_id (mailitem.get (), 0, nullptr); - mailitem = nullptr; - if (!uid) - { - log_debug ("%s:%s: Failed to find uid for %p \n", - SRCNAME, __func__, mailitem); - TBREAK; - } - auto mail = Mail::getMailForUUID (uid); - xfree (uid); - - if (!mail) - { - STRANGEPOINT; - TBREAK; - } - - if (!mail->isCryptoMail()) - { - STRANGEPOINT; - TBREAK; - } - - if (mail->getCloseTriggered ()) - { - log_debug ("%s:%s: Passing our close for item %p", - SRCNAME, __func__, mail); - TBREAK; - } - mail->setCloseTriggered (true); - Mail::closeInspector_o (mail); - Mail::close (mail); - } - default: - break; -#if 1 - log_oom ("%s:%s: Unhandled Event: %lx \n", - SRCNAME, __func__, dispid); -#endif - } - return S_OK; -} -END_EVENT_SINK(InspectorEvents, IID_InspectorEvents) diff --git a/src/mail.cpp b/src/mail.cpp index e1d8214..eafa3ef 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -108,8 +108,7 @@ Mail::Mail (LPDISPATCH mailitem) : m_locate_count(0), m_is_about_to_be_moved(false), m_locate_in_progress(false), - m_is_junk(false), - m_inspector_events(nullptr) + m_is_junk(false) { TSTART; if (getMailForItem (mailitem)) @@ -221,12 +220,6 @@ Mail::~Mail() m_parser = nullptr; m_crypter = nullptr; - if (m_inspector_events) - { - log_oom ("%s:%s: Detaching inspector event handler", - SRCNAME, __func__); - detach_InspectorEvents_sink (m_inspector_events); - } releaseCurrentItem(); gpgol_unlock (&dtor_lock); log_oom ("%s:%s: returning", @@ -1101,17 +1094,6 @@ Mail::decryptVerify_o () TRETURN 1; } - auto inspector = get_oom_object (m_mailitem, "GetInspector"); - if (!inspector) - { - STRANGEPOINT; - } - else - { - m_inspector_events = install_InspectorEvents_sink (inspector); - gpgol_release (inspector); - } - setUUID_o (); m_processed = true; diff --git a/src/mail.h b/src/mail.h index cbbb59a..170770c 100644 --- a/src/mail.h +++ b/src/mail.h @@ -655,6 +655,5 @@ private: std::string m_store_id; /* Store id for categories */ std::string m_verify_category; /* The category string for the verify result */ bool m_is_junk; /* Mail is in the junk folder */ - LPDISPATCH m_inspector_events; /* Inspector event sink */ }; #endif // MAIL_H diff --git a/src/oomhelp.h b/src/oomhelp.h index 5c8865b..762f578 100644 --- a/src/oomhelp.h +++ b/src/oomhelp.h @@ -77,9 +77,6 @@ DEFINE_GUID(IID_ExplorersEvents, 0x00063078, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); DEFINE_GUID(IID_MailItemEvents, 0x0006302B, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); -DEFINE_GUID(IID_InspectorEvents, 0x0006302A, 0x0000, 0x0000, - 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); - DEFINE_GUID(IID_MailItem, 0x00063034, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); DEFINE_GUID(IID_IMAPISecureMessage, 0x253cc320, 0xeab6, 0x11d0, commit db8f468e0462f2a4d600b41f8dd0e6b4135d38fa Author: Andre Heinecke Date: Thu Nov 8 15:42:25 2018 +0100 Add InspectorEvents experiment -- This commit is just an experiment to check the order of events when closing. diff --git a/src/Makefile.am b/src/Makefile.am index 369ce6d..dd8cbdf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -49,6 +49,7 @@ gpgol_SOURCES = \ gpgoladdin.cpp gpgoladdin.h \ gpgol.def \ gpgol-ids.h \ + inspector-events.cpp \ keycache.cpp keycache.h \ mail.h mail.cpp \ mailitem-events.cpp \ diff --git a/src/eventsinks.h b/src/eventsinks.h index 1508a62..dc62122 100644 --- a/src/eventsinks.h +++ b/src/eventsinks.h @@ -32,4 +32,6 @@ LPDISPATCH install_ExplorersEvents_sink (LPDISPATCH obj); void detach_ExplorersEvents_sink (LPDISPATCH obj); LPDISPATCH install_FolderEvents_sink (LPDISPATCH obj); void detach_FolderEvents_sink (LPDISPATCH obj); +LPDISPATCH install_InspectorEvents_sink (LPDISPATCH obj); +void detach_InspectorEvents_sink (LPDISPATCH obj); #endif // EVENTSINKS_H diff --git a/src/inspector-events.cpp b/src/inspector-events.cpp new file mode 100644 index 0000000..dbf684b --- /dev/null +++ b/src/inspector-events.cpp @@ -0,0 +1,113 @@ +/* inspector-events.cpp - Event handling for an inspector. + * Copyright (C) 2018 Intevation GmBH + * + * This file is part of GpgOL. + * + * GpgOL is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * GpgOL 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 Lesser General Public License + * along with this program; if not, see . + */ + +/* The event handler classes defined in this file follow the + general pattern that they implment the IDispatch interface + through the eventsink macros and handle event invocations + in their invoke methods. +*/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "eventsink.h" +#include "ocidl.h" +#include "common.h" +#include "oomhelp.h" +#include "mail.h" + +/* Folder Events */ +BEGIN_EVENT_SINK(InspectorEvents, IDispatch) +EVENT_SINK_DEFAULT_CTOR(InspectorEvents) +EVENT_SINK_DEFAULT_DTOR(InspectorEvents) +typedef enum + { + Activate = 0xF001, + AttachmentSelectionChange = 0xFC79, + BeforeMaximize = 0xFA11, + BeforeMinimize = 0xFA12, + BeforeMove = 0xFA13, + BeforeSize = 0xFA14, + Close = 0xF008, + Deactivate = 0xF006, + PageChange = 0xFBF4, + } InspectorEvent; + +EVENT_SINK_INVOKE(InspectorEvents) +{ + USE_INVOKE_ARGS + switch(dispid) + { + case Close: + { + TSTART; + log_oom ("%s:%s Close event in inspector %p", + SRCNAME, __func__, this); + /* Get the mail object belonging to us */ + auto mailitem = MAKE_SHARED (get_oom_object (m_object, "CurrentItem")); + + if (!mailitem) + { + STRANGEPOINT; + TBREAK; + } + + char *uid = get_unique_id (mailitem.get (), 0, nullptr); + mailitem = nullptr; + if (!uid) + { + log_debug ("%s:%s: Failed to find uid for %p \n", + SRCNAME, __func__, mailitem); + TBREAK; + } + auto mail = Mail::getMailForUUID (uid); + xfree (uid); + + if (!mail) + { + STRANGEPOINT; + TBREAK; + } + + if (!mail->isCryptoMail()) + { + STRANGEPOINT; + TBREAK; + } + + if (mail->getCloseTriggered ()) + { + log_debug ("%s:%s: Passing our close for item %p", + SRCNAME, __func__, mail); + TBREAK; + } + mail->setCloseTriggered (true); + Mail::closeInspector_o (mail); + Mail::close (mail); + } + default: + break; +#if 1 + log_oom ("%s:%s: Unhandled Event: %lx \n", + SRCNAME, __func__, dispid); +#endif + } + return S_OK; +} +END_EVENT_SINK(InspectorEvents, IID_InspectorEvents) diff --git a/src/mail.cpp b/src/mail.cpp index eafa3ef..e1d8214 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -108,7 +108,8 @@ Mail::Mail (LPDISPATCH mailitem) : m_locate_count(0), m_is_about_to_be_moved(false), m_locate_in_progress(false), - m_is_junk(false) + m_is_junk(false), + m_inspector_events(nullptr) { TSTART; if (getMailForItem (mailitem)) @@ -220,6 +221,12 @@ Mail::~Mail() m_parser = nullptr; m_crypter = nullptr; + if (m_inspector_events) + { + log_oom ("%s:%s: Detaching inspector event handler", + SRCNAME, __func__); + detach_InspectorEvents_sink (m_inspector_events); + } releaseCurrentItem(); gpgol_unlock (&dtor_lock); log_oom ("%s:%s: returning", @@ -1094,6 +1101,17 @@ Mail::decryptVerify_o () TRETURN 1; } + auto inspector = get_oom_object (m_mailitem, "GetInspector"); + if (!inspector) + { + STRANGEPOINT; + } + else + { + m_inspector_events = install_InspectorEvents_sink (inspector); + gpgol_release (inspector); + } + setUUID_o (); m_processed = true; diff --git a/src/mail.h b/src/mail.h index 170770c..cbbb59a 100644 --- a/src/mail.h +++ b/src/mail.h @@ -655,5 +655,6 @@ private: std::string m_store_id; /* Store id for categories */ std::string m_verify_category; /* The category string for the verify result */ bool m_is_junk; /* Mail is in the junk folder */ + LPDISPATCH m_inspector_events; /* Inspector event sink */ }; #endif // MAIL_H diff --git a/src/oomhelp.h b/src/oomhelp.h index 762f578..5c8865b 100644 --- a/src/oomhelp.h +++ b/src/oomhelp.h @@ -77,6 +77,9 @@ DEFINE_GUID(IID_ExplorersEvents, 0x00063078, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); DEFINE_GUID(IID_MailItemEvents, 0x0006302B, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); +DEFINE_GUID(IID_InspectorEvents, 0x0006302A, 0x0000, 0x0000, + 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); + DEFINE_GUID(IID_MailItem, 0x00063034, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); DEFINE_GUID(IID_IMAPISecureMessage, 0x253cc320, 0xeab6, 0x11d0, ----------------------------------------------------------------------- Summary of changes: src/application-events.cpp | 5 ++--- src/debug.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 8 22:32:11 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Thu, 08 Nov 2018 22:32:11 +0100 Subject: [git] NTBTLS - branch, master, updated. ntbtls-0.1.2-17-gac406d3 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Not Too Bad TLS". The branch, master has been updated via ac406d38e49d4bbe2c6b41680abf7c717ce9b393 (commit) from 4b7c6a91f56c2bd5baa859146298f8f20519313f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ac406d38e49d4bbe2c6b41680abf7c717ce9b393 Author: NIIBE Yutaka Date: Fri Nov 9 06:21:25 2018 +0900 ntbtls-cli: Use union to access hostent addr. * src/ntbtls-cli.c (connect_server): Use union. -- Unfortunately, the API of gethostbyname was designed in old style of C. Modern compiler emits warnings for its access to h_addr of char * on a machine of different alignment requirement for other objects. (It should be defined as void *, in new style.) As a workaround, we use union here. Signed-off-by: NIIBE Yutaka diff --git a/src/ntbtls-cli.c b/src/ntbtls-cli.c index 67affc1..555961b 100644 --- a/src/ntbtls-cli.c +++ b/src/ntbtls-cli.c @@ -200,6 +200,10 @@ connect_server (const char *server, unsigned short port) int sock = -1; struct sockaddr_in addr; struct hostent *host; + union { + char *addr; + struct in_addr *in_addr; + } addru; addr.sin_family = AF_INET; addr.sin_port = htons (port); @@ -211,7 +215,8 @@ connect_server (const char *server, unsigned short port) return -1; } - addr.sin_addr = *(struct in_addr*)host->h_addr; + addru.addr = host->h_addr; + addr.sin_addr = *addru.in_addr; sock = socket (AF_INET, SOCK_STREAM, 0); if (sock == -1) ----------------------------------------------------------------------- Summary of changes: src/ntbtls-cli.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) hooks/post-receive -- Not Too Bad TLS http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 9 11:24:11 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Fri, 09 Nov 2018 11:24:11 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-2.3.1-37-gbe57fa9 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via be57fa9d9f52cdd52151c5a0a874abf108932c51 (commit) from 289643c1016d3e145329bedbc6bb91656f9e48f7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit be57fa9d9f52cdd52151c5a0a874abf108932c51 Author: Andre Heinecke Date: Fri Nov 9 11:20:05 2018 +0100 Override file close cmd to trigger shutdown * src/gpgoladdin.cpp (GpgolRibbonExtender::GetIDsOfNames) (GpgolRibbonExtender::Invoke): Hookup override. (GetCustomUI_MIME): Override File->Close command. * src/ribbon-callbacks.cpp (override_file_close): New. * src/ribbon-callbacks.h: Update accordingly. -- There are two ways Outlook can be closed. Either through a Windowmessage (which wie handled already) or through the FileClose Command. We now also handle the FileClose to shutdown. Doing the shutdown later does not work for us because before we get any events or shutdown notifications we already have to close / discard our decrypted contents. GnuPG-Bug-Id: T4236 diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp index bd9cdb8..c098a0b 100644 --- a/src/gpgoladdin.cpp +++ b/src/gpgoladdin.cpp @@ -717,6 +717,7 @@ GpgolRibbonExtender::GetIDsOfNames (REFIID riid, LPOLESTR *rgszNames, ID_MAPPER (L"getIsCrypto", ID_GET_IS_CRYPTO_MAIL) ID_MAPPER (L"printDecrypted", ID_CMD_PRINT_DECRYPTED) ID_MAPPER (L"openContactKey", ID_CMD_OPEN_CONTACT_KEY) + ID_MAPPER (L"overrideFileClose", ID_CMD_FILE_CLOSE) } if (cNames > 1) @@ -808,6 +809,8 @@ GpgolRibbonExtender::Invoke (DISPID dispid, REFIID riid, LCID lcid, return get_is_crypto_mail (parms->rgvarg[0].pdispVal, result); case ID_CMD_OPEN_CONTACT_KEY: return open_contact_key (parms->rgvarg[0].pdispVal); + case ID_CMD_FILE_CLOSE : + return override_file_close (); case ID_BTN_ENCRYPT: case ID_BTN_DECRYPT: case ID_BTN_DECRYPT_LARGE: @@ -958,6 +961,10 @@ GetCustomUI_MIME (BSTR RibbonID, BSTR * RibbonXml) gpgrt_asprintf (&buffer, "" + " " + " " + " " " " " " " " diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp index fc5d79a..8cafc9a 100644 --- a/src/ribbon-callbacks.cpp +++ b/src/ribbon-callbacks.cpp @@ -842,3 +842,18 @@ HRESULT open_contact_key (LPDISPATCH ctrl) gpgol_release (contact); return S_OK; } + +HRESULT override_file_close () +{ + TSTART; + auto inst = GpgolAddin::get_instance (); + /* We need to get it first as shutdown releases the reference */ + auto app = inst->get_application (); + app->AddRef (); + inst->shutdown(); + log_debug ("%s:%s: Shutdown complete. Quitting.", + SRCNAME, __func__); + invoke_oom_method (app, "Quit", nullptr); + + TRETURN S_OK; +} diff --git a/src/ribbon-callbacks.h b/src/ribbon-callbacks.h index ce71c1a..83fd5d1 100644 --- a/src/ribbon-callbacks.h +++ b/src/ribbon-callbacks.h @@ -50,6 +50,7 @@ #define ID_CMD_PRINT_DECRYPTED 34 #define ID_GET_IS_CRYPTO_MAIL 35 #define ID_CMD_OPEN_CONTACT_KEY 36 +#define ID_CMD_FILE_CLOSE 37 #define ID_BTN_DECRYPT IDI_DECRYPT_16_PNG #define ID_BTN_DECRYPT_LARGE IDI_DECRYPT_48_PNG @@ -88,4 +89,6 @@ HRESULT get_is_crypto_mail (LPDISPATCH ctrl, VARIANT *result); HRESULT print_decrypted (LPDISPATCH ctrl); /* Open key configuration for a contact */ HRESULT open_contact_key (LPDISPATCH ctrl); +/* An explorer is closed by File->Close */ +HRESULT override_file_close (); #endif ----------------------------------------------------------------------- Summary of changes: src/gpgoladdin.cpp | 7 +++++++ src/ribbon-callbacks.cpp | 15 +++++++++++++++ src/ribbon-callbacks.h | 3 +++ 3 files changed, 25 insertions(+) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 9 13:33:54 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 09 Nov 2018 13:33:54 +0100 Subject: [git] gnupg-doc - branch, master, updated. ca9070dd6f5092724b212b8bfcd0b81d8f6cc583 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GnuPG website and other docs". The branch, master has been updated via ca9070dd6f5092724b212b8bfcd0b81d8f6cc583 (commit) from 8ea539b320dc27225bbdf09e4cdc7158f4260c5b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ca9070dd6f5092724b212b8bfcd0b81d8f6cc583 Author: Werner Koch Date: Fri Nov 9 13:33:52 2018 +0100 web: Release announcement for 2.2.11 diff --git a/web/index.org b/web/index.org index 5e57df4..13c50d6 100644 --- a/web/index.org +++ b/web/index.org @@ -65,6 +65,11 @@ The latest release news:\\ # GnuPG's latest news are available as [[http://feedvalidator.org/check.cgi?url%3Dhttps://www.gnupg.org/news.en.rss][RSS 2.0 compliant]] feed. Just # point or paste the [[news.en.rss][RSS file]] into your aggregator. +** GnuPG 2.2.11 released (2018-11-06) + +We are pleased to announce the availability of GnuPG version 2.2.11. +This is a maintenance release fixing a few problems. {[[https://lists.gnupg.org/pipermail/gnupg-announce/2018q4/000432.html][more]]} + ** GnuPG Made Easy 1.12.0 released (2018-10-08) [[file:software/gpgme/index.org][GPGME]] is a library that allows to add support for cryptography to a ----------------------------------------------------------------------- Summary of changes: web/index.org | 5 +++++ 1 file changed, 5 insertions(+) hooks/post-receive -- The GnuPG website and other docs http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 9 15:48:39 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Fri, 09 Nov 2018 15:48:39 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-2.3.1-38-gc702eed Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via c702eede029cc80841172871d7fb674819d6a081 (commit) from be57fa9d9f52cdd52151c5a0a874abf108932c51 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c702eede029cc80841172871d7fb674819d6a081 Author: Andre Heinecke Date: Fri Nov 9 15:44:21 2018 +0100 Pass write for closed mails * src/folder-events.cpp (Invoke): Set is now implicit in close. * src/mail.cpp: Change isAboutToBeMoved to passWrite. (decryptVerify_o): Stop passing write when processing. * src/mailitem-events.cpp (Write): Pass it when a mail was closed by us. -- After closing with discard changes it should be ok to write as long as we are not decrypted again. This can be helpful after an external close was triggered and is basically the same as what we do for a move. GnuPG-Bug-Id: T4241 diff --git a/src/folder-events.cpp b/src/folder-events.cpp index d9e7c13..a970afa 100644 --- a/src/folder-events.cpp +++ b/src/folder-events.cpp @@ -115,7 +115,6 @@ EVENT_SINK_INVOKE(FolderEvents) log_debug ("%s:%s: Detected move of crypto mail. %p Closing", SRCNAME, __func__, mail); - mail->setIsAboutToBeMoved (true); if (Mail::close (mail)) { log_error ("%s:%s: Failed to close.", diff --git a/src/mail.cpp b/src/mail.cpp index eafa3ef..a75225f 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -106,7 +106,7 @@ Mail::Mail (LPDISPATCH mailitem) : m_manual_crypto_opts(false), m_first_autosecure_check(true), m_locate_count(0), - m_is_about_to_be_moved(false), + m_pass_write(false), m_locate_in_progress(false), m_is_junk(false) { @@ -1096,6 +1096,7 @@ Mail::decryptVerify_o () setUUID_o (); m_processed = true; + m_pass_write = false; /* Insert placeholder */ char *placeholder_buf = nullptr; @@ -2045,6 +2046,12 @@ Mail::close (Mail *mail) int rc = invoke_oom_method_with_parms (mail->item(), "Close", NULL, &dispparams); + if (!rc) + { + log_debug ("%s:%s: Close successful. Next write may pass.", + SRCNAME, __func__); + mail->setPassWrite (true); + } log_oom ("%s:%s: returned from close", SRCNAME, __func__); TRETURN rc; diff --git a/src/mail.h b/src/mail.h index 170770c..9a10cbf 100644 --- a/src/mail.h +++ b/src/mail.h @@ -590,8 +590,8 @@ public: void installFolderEventHandler_o (); /* Marker for a "Move" of this mail */ - bool isAboutToBeMoved () { return m_is_about_to_be_moved; } - void setIsAboutToBeMoved (bool value) { m_is_about_to_be_moved = value; } + bool passWrite () { return m_pass_write; } + void setPassWrite(bool value) { m_pass_write = value; } /* Releases the current item ref obtained in update oom data */ void releaseCurrentItem (); @@ -650,7 +650,7 @@ private: bool m_manual_crypto_opts; /* Crypto options (sign/encrypt) have been set manually. */ bool m_first_autosecure_check; /* This is the first autoresolve check */ int m_locate_count; /* The number of key locates pending for this mail. */ - bool m_is_about_to_be_moved; + bool m_pass_write; /* Danger the next write will be passed. This is for closed mails */ bool m_locate_in_progress; /* Simplified state variable for locate */ std::string m_store_id; /* Store id for categories */ std::string m_verify_category; /* The category string for the verify result */ diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp index 84bd887..485d6f6 100644 --- a/src/mailitem-events.cpp +++ b/src/mailitem-events.cpp @@ -576,9 +576,9 @@ EVENT_SINK_INVOKE(MailItemEvents) TBREAK; } - if (m_mail->isAboutToBeMoved()) + if (m_mail->passWrite()) { - log_debug ("%s:%s: Mail is about to be moved. Passing write for %p", + log_debug ("%s:%s: Passing write because passNextWrite was set for %p", SRCNAME, __func__, m_mail); TBREAK; } ----------------------------------------------------------------------- Summary of changes: src/folder-events.cpp | 1 - src/mail.cpp | 9 ++++++++- src/mail.h | 6 +++--- src/mailitem-events.cpp | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 9 17:05:02 2018 From: cvs at cvs.gnupg.org (by Jussi Kivilinna) Date: Fri, 09 Nov 2018 17:05:02 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-263-g643ec7c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 643ec7c642dc75191e712963d2bb460ac247e09b (commit) via e8142cc69a2ae5a5d0a238bc9f88841067359af8 (commit) via e486d4f0259f27906d2c2869cc01b3aa31aaa0a6 (commit) via 2b5718c1f76851160115f455c3a9383b04521347 (commit) via 47424881b27d4b3bae2925265b2008cda0c2933f (commit) via a571bb8df52d6f2727876e086790dd037c9948ad (commit) via 5d6c080522e1666943b75c99124fb69b985b6941 (commit) via e2b9095de35ac4d402b077d5484b4131700a9925 (commit) from 69930f6884a934207f7aa523cf6d2b8e22dfe666 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 643ec7c642dc75191e712963d2bb460ac247e09b Author: Jussi Kivilinna Date: Thu Nov 8 21:31:12 2018 +0200 g10/armor: optimize radix64 to binary conversion * g10/armor.c (asctobin): Larger look-up table for fast path. (initialize): Update 'asctobin' initialization. (radix64_read): Add fast path for radix64 to binary conversion. -- This patch adds fast path for radix64 to binary conversion in armored decryption. Benchmark results below, tested on Intel Core i7-4790K (turbo off). Encrypted 2 GiB through pipe to ramfs file using AES128. Decrypt ramfs file out through pipe to /dev/null. before patch-set ---------------- gpg process armor: user time pipe transfer rate encrypt-aead: 13.8 140 MB/s decrypt-aead: 30.6 68 MB/s encrypt-cfb: 17.4 114 MB/s decrypt-cfb: 32.6 64 MB/s after (decrypt+iobuf+crc+radix64 opt) ------------------------------------- gpg process armor: user time pipe transfer rate decrypt-aead: 9.8 200 MB/s decrypt-cfb: 11.9 168 MB/s Signed-off-by: Jussi Kivilinna diff --git a/g10/armor.c b/g10/armor.c index 95293d9..9727665 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -40,7 +40,7 @@ static const byte bintoasc[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/"; -static byte asctobin[256]; /* runtime initialized */ +static u32 asctobin[4][256]; /* runtime initialized */ static int is_initialized; @@ -171,11 +171,16 @@ initialize(void) u32 i; const byte *s; - /* build the helptable for radix64 to bin conversion */ - for(i=0; i < 256; i++ ) - asctobin[i] = 255; /* used to detect invalid characters */ + /* Build the helptable for radix64 to bin conversion. Value 0xffffffff is + used to detect invalid characters. */ + memset (asctobin, 0xff, sizeof(asctobin)); for(s=bintoasc,i=0; *s; s++,i++ ) - asctobin[*s] = i; + { + asctobin[0][*s] = i << (0 * 6); + asctobin[1][*s] = i << (1 * 6); + asctobin[2][*s] = i << (2 * 6); + asctobin[3][*s] = i << (3 * 6); + } is_initialized=1; } @@ -802,11 +807,13 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, byte *buf, size_t size ) { byte val; - int c, c2; + int c; + u32 binc; int checkcrc=0; int rc = 0; size_t n = 0; - int idx, onlypad=0; + int idx, onlypad=0; + int skip_fast = 0; idx = afx->idx; val = afx->radbuf[0]; @@ -827,6 +834,122 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, } again: + binc = asctobin[0][c]; + + if( binc != 0xffffffffUL ) + { + if( idx == 0 && skip_fast == 0 + && afx->buffer_pos + (16 - 1) < afx->buffer_len + && n + 12 < size) + { + /* Fast path for radix64 to binary conversion. */ + u32 b0,b1,b2,b3; + + /* Speculatively load 15 more input bytes. */ + b0 = binc << (3 * 6); + b0 |= asctobin[2][afx->buffer[afx->buffer_pos + 0]]; + b0 |= asctobin[1][afx->buffer[afx->buffer_pos + 1]]; + b0 |= asctobin[0][afx->buffer[afx->buffer_pos + 2]]; + b1 = asctobin[3][afx->buffer[afx->buffer_pos + 3]]; + b1 |= asctobin[2][afx->buffer[afx->buffer_pos + 4]]; + b1 |= asctobin[1][afx->buffer[afx->buffer_pos + 5]]; + b1 |= asctobin[0][afx->buffer[afx->buffer_pos + 6]]; + b2 = asctobin[3][afx->buffer[afx->buffer_pos + 7]]; + b2 |= asctobin[2][afx->buffer[afx->buffer_pos + 8]]; + b2 |= asctobin[1][afx->buffer[afx->buffer_pos + 9]]; + b2 |= asctobin[0][afx->buffer[afx->buffer_pos + 10]]; + b3 = asctobin[3][afx->buffer[afx->buffer_pos + 11]]; + b3 |= asctobin[2][afx->buffer[afx->buffer_pos + 12]]; + b3 |= asctobin[1][afx->buffer[afx->buffer_pos + 13]]; + b3 |= asctobin[0][afx->buffer[afx->buffer_pos + 14]]; + + /* Check if any of the input bytes were invalid. */ + if( (b0 | b1 | b2 | b3) != 0xffffffffUL ) + { + /* All 16 bytes are valid. */ + buf[n + 0] = b0 >> (2 * 8); + buf[n + 1] = b0 >> (1 * 8); + buf[n + 2] = b0 >> (0 * 8); + buf[n + 3] = b1 >> (2 * 8); + buf[n + 4] = b1 >> (1 * 8); + buf[n + 5] = b1 >> (0 * 8); + buf[n + 6] = b2 >> (2 * 8); + buf[n + 7] = b2 >> (1 * 8); + buf[n + 8] = b2 >> (0 * 8); + buf[n + 9] = b3 >> (2 * 8); + buf[n + 10] = b3 >> (1 * 8); + buf[n + 11] = b3 >> (0 * 8); + afx->buffer_pos += 16 - 1; + n += 12; + continue; + } + else if( b0 == 0xffffffffUL ) + { + /* byte[1..3] have invalid character(s). Switch to slow + path. */ + skip_fast = 1; + } + else if( b1 == 0xffffffffUL ) + { + /* byte[4..7] have invalid character(s), first 4 bytes are + valid. */ + buf[n + 0] = b0 >> (2 * 8); + buf[n + 1] = b0 >> (1 * 8); + buf[n + 2] = b0 >> (0 * 8); + afx->buffer_pos += 4 - 1; + n += 3; + skip_fast = 1; + continue; + } + else if( b2 == 0xffffffffUL ) + { + /* byte[8..11] have invalid character(s), first 8 bytes are + valid. */ + buf[n + 0] = b0 >> (2 * 8); + buf[n + 1] = b0 >> (1 * 8); + buf[n + 2] = b0 >> (0 * 8); + buf[n + 3] = b1 >> (2 * 8); + buf[n + 4] = b1 >> (1 * 8); + buf[n + 5] = b1 >> (0 * 8); + afx->buffer_pos += 8 - 1; + n += 6; + skip_fast = 1; + continue; + } + else /*if( b3 == 0xffffffffUL )*/ + { + /* byte[12..15] have invalid character(s), first 12 bytes + are valid. */ + buf[n + 0] = b0 >> (2 * 8); + buf[n + 1] = b0 >> (1 * 8); + buf[n + 2] = b0 >> (0 * 8); + buf[n + 3] = b1 >> (2 * 8); + buf[n + 4] = b1 >> (1 * 8); + buf[n + 5] = b1 >> (0 * 8); + buf[n + 6] = b2 >> (2 * 8); + buf[n + 7] = b2 >> (1 * 8); + buf[n + 8] = b2 >> (0 * 8); + afx->buffer_pos += 12 - 1; + n += 9; + skip_fast = 1; + continue; + } + } + + switch(idx) + { + case 0: val = binc << 2; break; + case 1: val |= (binc>>4)&3; buf[n++]=val;val=(binc<<4)&0xf0;break; + case 2: val |= (binc>>2)&15; buf[n++]=val;val=(binc<<6)&0xc0;break; + case 3: val |= binc&0x3f; buf[n++] = val; break; + } + idx = (idx+1) % 4; + + continue; + } + + skip_fast = 0; + if( c == '\n' || c == ' ' || c == '\r' || c == '\t' ) continue; else if( c == '=' ) { /* pad character: stop */ @@ -857,10 +980,10 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, if (afx->buffer_pos + 6 < afx->buffer_len && afx->buffer[afx->buffer_pos + 0] == '3' && afx->buffer[afx->buffer_pos + 1] == 'D' - && asctobin[afx->buffer[afx->buffer_pos + 2]] != 255 - && asctobin[afx->buffer[afx->buffer_pos + 3]] != 255 - && asctobin[afx->buffer[afx->buffer_pos + 4]] != 255 - && asctobin[afx->buffer[afx->buffer_pos + 5]] != 255 + && asctobin[0][afx->buffer[afx->buffer_pos + 2]] != 0xffffffffUL + && asctobin[0][afx->buffer[afx->buffer_pos + 3]] != 0xffffffffUL + && asctobin[0][afx->buffer[afx->buffer_pos + 4]] != 0xffffffffUL + && asctobin[0][afx->buffer[afx->buffer_pos + 5]] != 0xffffffffUL && afx->buffer[afx->buffer_pos + 6] == '\n') { afx->buffer_pos += 2; @@ -875,17 +998,10 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, checkcrc++; break; } - else if( (c = asctobin[(c2=c)]) == 255 ) { - log_error(_("invalid radix64 character %02X skipped\n"), c2); + else { + log_error(_("invalid radix64 character %02X skipped\n"), c); continue; } - switch(idx) { - case 0: val = c << 2; break; - case 1: val |= (c>>4)&3; buf[n++]=val;val=(c<<4)&0xf0;break; - case 2: val |= (c>>2)&15; buf[n++]=val;val=(c<<6)&0xc0;break; - case 3: val |= c&0x3f; buf[n++] = val; break; - } - idx = (idx+1) % 4; } afx->idx = idx; @@ -924,13 +1040,13 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, u32 mycrc = 0; idx = 0; do { - if( (c = asctobin[c]) == 255 ) + if( (binc = asctobin[0][c]) == 0xffffffffUL ) break; switch(idx) { - case 0: val = c << 2; break; - case 1: val |= (c>>4)&3; mycrc |= val << 16;val=(c<<4)&0xf0;break; - case 2: val |= (c>>2)&15; mycrc |= val << 8;val=(c<<6)&0xc0;break; - case 3: val |= c&0x3f; mycrc |= val; break; + case 0: val = binc << 2; break; + case 1: val |= (binc>>4)&3; mycrc |= val << 16;val=(binc<<4)&0xf0;break; + case 2: val |= (binc>>2)&15; mycrc |= val << 8;val=(binc<<6)&0xc0;break; + case 3: val |= binc&0x3f; mycrc |= val; break; } for(;;) { if( afx->buffer_pos < afx->buffer_len ) commit e8142cc69a2ae5a5d0a238bc9f88841067359af8 Author: Jussi Kivilinna Date: Thu Nov 8 21:31:12 2018 +0200 g10/armor: optimize binary to radix64 conversion * g10/armor.c (bintoasc): Change to read-only. (initialize): Use const pointer for 'bintoasc'. (armor_output_buf_as_radix64): New function for faster binary to radix64 conversion. (armor_filter): Use new conversion function. -- This patch adds faster binary to radix64 conversion to speed up armored encryption. Benchmark results below, tested on Intel Core i7-4790K (turbo off). Encrypted 2 GiB through pipe to ramfs file using AES128. Decrypt ramfs file out through pipe to /dev/null. before patch-set ---------------- gpg process armor: user time pipe transfer rate encrypt-aead: 13.8 140 MB/s decrypt-aead: 30.6 68 MB/s encrypt-cfb: 17.4 114 MB/s decrypt-cfb: 32.6 64 MB/s after (decrypt+iobuf+crc+radix64 opt) ------------------------------------- gpg process armor: user time pipe transfer rate encrypt-aead: 2.7 523 MB/s encrypt-cfb: 6.7 264 MB/s Signed-off-by: Jussi Kivilinna diff --git a/g10/armor.c b/g10/armor.c index 9da135a..95293d9 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -37,9 +37,9 @@ #define MAX_LINELEN 20000 -static byte bintoasc[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789+/"; +static const byte bintoasc[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/"; static byte asctobin[256]; /* runtime initialized */ static int is_initialized; @@ -169,7 +169,8 @@ static void initialize(void) { u32 i; - byte *s; + const byte *s; + /* build the helptable for radix64 to bin conversion */ for(i=0; i < 256; i++ ) asctobin[i] = 255; /* used to detect invalid characters */ @@ -1003,6 +1004,121 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, return rc; } +static void +armor_output_buf_as_radix64 (armor_filter_context_t *afx, IOBUF a, + byte *buf, size_t size) +{ + byte radbuf[sizeof (afx->radbuf)]; + byte outbuf[64 + sizeof (afx->eol)]; + unsigned int eollen = strlen (afx->eol); + u32 in, in2; + int idx, idx2; + int i; + + idx = afx->idx; + idx2 = afx->idx2; + memcpy (radbuf, afx->radbuf, sizeof (afx->radbuf)); + + if (size && (idx || idx2)) + { + /* preload eol to outbuf buffer */ + memcpy (outbuf + 4, afx->eol, sizeof (afx->eol)); + + for (; size && (idx || idx2); buf++, size--) + { + radbuf[idx++] = *buf; + if (idx > 2) + { + idx = 0; + in = (u32)radbuf[0] << (2 * 8); + in |= (u32)radbuf[1] << (1 * 8); + in |= (u32)radbuf[2] << (0 * 8); + outbuf[0] = bintoasc[(in >> 18) & 077]; + outbuf[1] = bintoasc[(in >> 12) & 077]; + outbuf[2] = bintoasc[(in >> 6) & 077]; + outbuf[3] = bintoasc[(in >> 0) & 077]; + if (++idx2 >= (64/4)) + { /* pgp doesn't like 72 here */ + idx2=0; + iobuf_write (a, outbuf, 4 + eollen); + } + else + { + iobuf_write (a, outbuf, 4); + } + } + } + } + + if (size >= (64/4)*3) + { + /* preload eol to outbuf buffer */ + memcpy (outbuf + 64, afx->eol, sizeof(afx->eol)); + + do + { + /* idx and idx2 == 0 */ + + for (i = 0; i < (64/8); i++) + { + in = (u32)buf[0] << (2 * 8); + in |= (u32)buf[1] << (1 * 8); + in |= (u32)buf[2] << (0 * 8); + in2 = (u32)buf[3] << (2 * 8); + in2 |= (u32)buf[4] << (1 * 8); + in2 |= (u32)buf[5] << (0 * 8); + outbuf[i*8+0] = bintoasc[(in >> 18) & 077]; + outbuf[i*8+1] = bintoasc[(in >> 12) & 077]; + outbuf[i*8+2] = bintoasc[(in >> 6) & 077]; + outbuf[i*8+3] = bintoasc[(in >> 0) & 077]; + outbuf[i*8+4] = bintoasc[(in2 >> 18) & 077]; + outbuf[i*8+5] = bintoasc[(in2 >> 12) & 077]; + outbuf[i*8+6] = bintoasc[(in2 >> 6) & 077]; + outbuf[i*8+7] = bintoasc[(in2 >> 0) & 077]; + buf+=6; + size-=6; + } + + /* pgp doesn't like 72 here */ + iobuf_write (a, outbuf, 64 + eollen); + } + while (size >= (64/4)*3); + + /* restore eol for tail handling */ + if (size) + memcpy (outbuf + 4, afx->eol, sizeof (afx->eol)); + } + + for (; size; buf++, size--) + { + radbuf[idx++] = *buf; + if (idx > 2) + { + idx = 0; + in = (u32)radbuf[0] << (2 * 8); + in |= (u32)radbuf[1] << (1 * 8); + in |= (u32)radbuf[2] << (0 * 8); + outbuf[0] = bintoasc[(in >> 18) & 077]; + outbuf[1] = bintoasc[(in >> 12) & 077]; + outbuf[2] = bintoasc[(in >> 6) & 077]; + outbuf[3] = bintoasc[(in >> 0) & 077]; + if (++idx2 >= (64/4)) + { /* pgp doesn't like 72 here */ + idx2=0; + iobuf_write (a, outbuf, 4 + eollen); + } + else + { + iobuf_write (a, outbuf, 4); + } + } + } + + memcpy (afx->radbuf, radbuf, sizeof (afx->radbuf)); + afx->idx = idx; + afx->idx2 = idx2; +} + /**************** * This filter is used to handle the armor stuff */ @@ -1012,7 +1128,7 @@ armor_filter( void *opaque, int control, { size_t size = *ret_len; armor_filter_context_t *afx = opaque; - int rc=0, i, c; + int rc=0, c; byte radbuf[3]; int idx, idx2; size_t n=0; @@ -1196,37 +1312,11 @@ armor_filter( void *opaque, int control, afx->idx2 = 0; gcry_md_reset (afx->crc_md); } - idx = afx->idx; - idx2 = afx->idx2; - for(i=0; i < idx; i++ ) - radbuf[i] = afx->radbuf[i]; - - if( size ) - gcry_md_write (afx->crc_md, buf, size); - - for( ; size; buf++, size-- ) { - radbuf[idx++] = *buf; - if( idx > 2 ) { - idx = 0; - c = bintoasc[(*radbuf >> 2) & 077]; - iobuf_put(a, c); - c = bintoasc[(((*radbuf<<4)&060)|((radbuf[1] >> 4)&017))&077]; - iobuf_put(a, c); - c = bintoasc[(((radbuf[1]<<2)&074)|((radbuf[2]>>6)&03))&077]; - iobuf_put(a, c); - c = bintoasc[radbuf[2]&077]; - iobuf_put(a, c); - if( ++idx2 >= (64/4) ) - { /* pgp doesn't like 72 here */ - iobuf_writestr(a,afx->eol); - idx2=0; - } - } - } - for(i=0; i < idx; i++ ) - afx->radbuf[i] = radbuf[i]; - afx->idx = idx; - afx->idx2 = idx2; + + if( size ) { + gcry_md_write (afx->crc_md, buf, size); + armor_output_buf_as_radix64 (afx, a, buf, size); + } } else if( control == IOBUFCTRL_INIT ) { commit e486d4f0259f27906d2c2869cc01b3aa31aaa0a6 Author: Jussi Kivilinna Date: Thu Nov 8 21:31:12 2018 +0200 g10/armor: use libgcrypt's CRC24 implementation * g10/armor.c (CRCINIT, CRCPOLY, CRCUPDATE, crc_table): Remove. (new_armor_context): Open libgcrypt CRC24 context. (release_armor_context): Close CRC24 context. (initialize): Remove CRC table generation. (get_afx_crc): New. (check_input, fake_packet, radix64_read, armor_filter): Update to use CRC24 context. * g10/filter.h (armor_filter_context_t): Replace crc intermediate value with libgcrypt md context pointer. -- This patch changes armor filter to use optimized CRC24 implementation from libgcrypt to speed up encryption and decryption. Benchmark results below, tested on Intel Core i7-4790K (turbo off). Encrypted 2 GiB through pipe to ramfs file using AES128. Decrypt ramfs file out through pipe to /dev/null. before patch-set ---------------- gpg process armor: user time pipe transfer rate encrypt-aead: 13.8 140 MB/s decrypt-aead: 30.6 68 MB/s encrypt-cfb: 17.4 114 MB/s decrypt-cfb: 32.6 64 MB/s after (decrypt+iobuf+crc opt) ----------------------------- gpg process armor: user time pipe transfer rate encrypt-aead: 8.7 211 MB/s decrypt-aead: 17.6 116 MB/s encrypt-cfb: 12.6 153 MB/s decrypt-cfb: 19.6 105 MB/s Signed-off-by: Jussi Kivilinna diff --git a/g10/armor.c b/g10/armor.c index 714282f..9da135a 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -37,13 +37,6 @@ #define MAX_LINELEN 20000 -#define CRCINIT 0xB704CE -#define CRCPOLY 0X864CFB -#define CRCUPDATE(a,c) do { \ - a = ((a) << 8) ^ crc_table[((a)&0xff >> 16) ^ (c)]; \ - a &= 0x00ffffff; \ - } while(0) -static u32 crc_table[256]; static byte bintoasc[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/"; @@ -121,9 +114,22 @@ armor_filter_context_t * new_armor_context (void) { armor_filter_context_t *afx; + gpg_error_t err; afx = xcalloc (1, sizeof *afx); - afx->refcount = 1; + if (afx) + { + err = gcry_md_open (&afx->crc_md, GCRY_MD_CRC24_RFC2440, 0); + if (err != 0) + { + log_error ("gcry_md_open failed for GCRY_MD_CRC24_RFC2440: %s", + gpg_strerror (err)); + xfree (afx); + return NULL; + } + + afx->refcount = 1; + } return afx; } @@ -138,6 +144,7 @@ release_armor_context (armor_filter_context_t *afx) log_assert (afx->refcount); if ( --afx->refcount ) return; + gcry_md_close (afx->crc_md); xfree (afx); } @@ -161,25 +168,8 @@ push_armor_filter (armor_filter_context_t *afx, iobuf_t iobuf) static void initialize(void) { - int i, j; - u32 t; + u32 i; byte *s; - - /* init the crc lookup table */ - crc_table[0] = 0; - for(i=j=0; j < 128; j++ ) { - t = crc_table[j]; - if( t & 0x00800000 ) { - t <<= 1; - crc_table[i++] = t ^ CRCPOLY; - crc_table[i++] = t; - } - else { - t <<= 1; - crc_table[i++] = t; - crc_table[i++] = t ^ CRCPOLY; - } - } /* build the helptable for radix64 to bin conversion */ for(i=0; i < 256; i++ ) asctobin[i] = 255; /* used to detect invalid characters */ @@ -190,6 +180,24 @@ initialize(void) } +static inline u32 +get_afx_crc (armor_filter_context_t *afx) +{ + const byte *crc_buf; + u32 crc; + + crc_buf = gcry_md_read (afx->crc_md, GCRY_MD_CRC24_RFC2440); + + crc = crc_buf[0]; + crc <<= 8; + crc |= crc_buf[1]; + crc <<= 8; + crc |= crc_buf[2]; + + return crc; +} + + /* * Check whether this is an armored file. See also * parse-packet.c for details on this code. @@ -592,7 +600,7 @@ check_input( armor_filter_context_t *afx, IOBUF a ) afx->faked = 1; else { afx->inp_checked = 1; - afx->crc = CRCINIT; + gcry_md_reset (afx->crc_md); afx->idx = 0; afx->radbuf[0] = 0; } @@ -768,7 +776,7 @@ fake_packet( armor_filter_context_t *afx, IOBUF a, } } afx->inp_checked = 1; - afx->crc = CRCINIT; + gcry_md_reset (afx->crc_md); afx->idx = 0; afx->radbuf[0] = 0; } @@ -797,10 +805,8 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, int checkcrc=0; int rc = 0; size_t n = 0; - int idx, i, onlypad=0; - u32 crc; + int idx, onlypad=0; - crc = afx->crc; idx = afx->idx; val = afx->radbuf[0]; for( n=0; n < size; ) { @@ -881,14 +887,14 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, idx = (idx+1) % 4; } - for(i=0; i < n; i++ ) - crc = (crc << 8) ^ crc_table[((crc >> 16)&0xff) ^ buf[i]]; - crc &= 0x00ffffff; - afx->crc = crc; afx->idx = idx; afx->radbuf[0] = val; + if( n ) + gcry_md_write (afx->crc_md, buf, n); + if( checkcrc ) { + gcry_md_final (afx->crc_md); afx->any_data = 1; afx->inp_checked=0; afx->faked = 0; @@ -957,10 +963,10 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, log_info(_("malformed CRC\n")); rc = invalid_crc(); } - else if( mycrc != afx->crc ) { - log_info (_("CRC error; %06lX - %06lX\n"), - (ulong)afx->crc, (ulong)mycrc); - rc = invalid_crc(); + else if( mycrc != get_afx_crc (afx) ) { + log_info (_("CRC error; %06lX - %06lX\n"), + (ulong)get_afx_crc (afx), (ulong)mycrc); + rc = invalid_crc(); } else { rc = 0; @@ -1188,18 +1194,15 @@ armor_filter( void *opaque, int control, afx->status++; afx->idx = 0; afx->idx2 = 0; - afx->crc = CRCINIT; - + gcry_md_reset (afx->crc_md); } - crc = afx->crc; idx = afx->idx; idx2 = afx->idx2; for(i=0; i < idx; i++ ) radbuf[i] = afx->radbuf[i]; - for(i=0; i < size; i++ ) - crc = (crc << 8) ^ crc_table[((crc >> 16)&0xff) ^ buf[i]]; - crc &= 0x00ffffff; + if( size ) + gcry_md_write (afx->crc_md, buf, size); for( ; size; buf++, size-- ) { radbuf[idx++] = *buf; @@ -1224,7 +1227,6 @@ armor_filter( void *opaque, int control, afx->radbuf[i] = radbuf[i]; afx->idx = idx; afx->idx2 = idx2; - afx->crc = crc; } else if( control == IOBUFCTRL_INIT ) { @@ -1250,7 +1252,8 @@ armor_filter( void *opaque, int control, if( afx->cancel ) ; else if( afx->status ) { /* pad, write cecksum, and bottom line */ - crc = afx->crc; + gcry_md_final (afx->crc_md); + crc = get_afx_crc (afx); idx = afx->idx; idx2 = afx->idx2; if( idx ) { diff --git a/g10/filter.h b/g10/filter.h index fa1f5a2..b2ef382 100644 --- a/g10/filter.h +++ b/g10/filter.h @@ -61,7 +61,7 @@ typedef struct { byte radbuf[4]; int idx, idx2; - u32 crc; + gcry_md_hd_t crc_md; int status; /* an internal state flag */ int cancel; commit 2b5718c1f76851160115f455c3a9383b04521347 Author: Jussi Kivilinna Date: Thu Nov 8 21:31:12 2018 +0200 common/iobuf: optimize iobuf_read_line * common/iobuf.c (iobuf_read_line): Add fast path for finding '\n' character in buffer. -- This patch reduce per byte overhead in iobuf_read_line by avoiding using iobuf_get when possible and use memchr to find '\n'. This speeds armored decryption. Benchmark results below, tested on Intel Core i7-4790K (turbo off). Encrypted 2 GiB through pipe to ramfs file using AES128. Decrypt ramfs file out through pipe to /dev/null. before patch-set ---------------- gpg process armor: user time pipe transfer rate encrypt-aead: 13.8 140 MB/s decrypt-aead: 30.6 68 MB/s encrypt-cfb: 17.4 114 MB/s decrypt-cfb: 32.6 64 MB/s after (decrypt+iobuf opt) ------------------------- gpg process armor: user time pipe transfer rate decrypt-aead: 22.5 92 MB/s decrypt-cfb: 24.4 85 MB/s Signed-off-by: Jussi Kivilinna diff --git a/common/iobuf.c b/common/iobuf.c index 18a458e..5eeba8f 100644 --- a/common/iobuf.c +++ b/common/iobuf.c @@ -2610,12 +2610,50 @@ iobuf_read_line (iobuf_t a, byte ** addr_of_buffer, } p = buffer; - while ((c = iobuf_get (a)) != -1) + while (1) { - *p++ = c; - nbytes++; - if (c == '\n') - break; + if (!a->nofast && a->d.start < a->d.len && nbytes < length - 1) + /* Fast path for finding '\n' by using standard C library's optimized + memchr. */ + { + unsigned size = a->d.len - a->d.start; + byte *newline_pos; + + if (size > length - 1 - nbytes) + size = length - 1 - nbytes; + + newline_pos = memchr (a->d.buf + a->d.start, '\n', size); + if (newline_pos) + { + /* Found newline, copy buffer and return. */ + size = (newline_pos - (a->d.buf + a->d.start)) + 1; + memcpy (p, a->d.buf + a->d.start, size); + p += size; + nbytes += size; + a->d.start += size; + a->nbytes += size; + break; + } + else + { + /* No newline, copy buffer and continue. */ + memcpy (p, a->d.buf + a->d.start, size); + p += size; + nbytes += size; + a->d.start += size; + a->nbytes += size; + } + } + else + { + c = iobuf_readbyte (a); + if (c == -1) + break; + *p++ = c; + nbytes++; + if (c == '\n') + break; + } if (nbytes == length - 1) /* We don't have enough space to add a \n and a \0. Increase commit 47424881b27d4b3bae2925265b2008cda0c2933f Author: Jussi Kivilinna Date: Thu Nov 8 21:31:12 2018 +0200 g10/armor: remove unused unarmor_pump code * g10/armor.c (unarmor_state_e, unarmor_pump_s, unarmor_pump_new) (unarmor_pump_release, unarmor_pump): Remove. * g10/filter.h (UnarmorPump, unarmor_pump_new, unarmor_pump_release) (unarmor_pump): Remove. -- Signed-off-by: Jussi Kivilinna diff --git a/g10/armor.c b/g10/armor.c index 1b02a23..714282f 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -1350,221 +1350,3 @@ make_radix64_string( const byte *data, size_t len ) *p = 0; return buffer; } - - -/*********************************************** - * For the pipemode command we can't use the armor filter for various - * reasons, so we use this new unarmor_pump stuff to remove the armor - */ - -enum unarmor_state_e { - STA_init = 0, - STA_bypass, - STA_wait_newline, - STA_wait_dash, - STA_first_dash, - STA_compare_header, - STA_found_header_wait_newline, - STA_skip_header_lines, - STA_skip_header_lines_non_ws, - STA_read_data, - STA_wait_crc, - STA_read_crc, - STA_ready -}; - -struct unarmor_pump_s { - enum unarmor_state_e state; - byte val; - int checkcrc; - int pos; /* counts from 0..3 */ - u32 crc; - u32 mycrc; /* the one store in the data */ -}; - - - -UnarmorPump -unarmor_pump_new (void) -{ - UnarmorPump x; - - if( !is_initialized ) - initialize(); - x = xmalloc_clear (sizeof *x); - return x; -} - -void -unarmor_pump_release (UnarmorPump x) -{ - xfree (x); -} - -/* - * Get the next character from the ascii armor taken from the IOBUF - * created earlier by unarmor_pump_new(). - * Return: c = Character - * 256 = ignore this value - * -1 = End of current armor - * -2 = Premature EOF (not used) - * -3 = Invalid armor - */ -int -unarmor_pump (UnarmorPump x, int c) -{ - int rval = 256; /* default is to ignore the return value */ - - switch (x->state) { - case STA_init: - { - byte tmp[2]; - tmp[0] = c; - tmp[1] = 0; - if ( is_armored (tmp) ) - x->state = c == '-'? STA_first_dash : STA_wait_newline; - else { - x->state = STA_bypass; - return c; - } - } - break; - case STA_bypass: - return c; /* return here to avoid crc calculation */ - case STA_wait_newline: - if (c == '\n') - x->state = STA_wait_dash; - break; - case STA_wait_dash: - x->state = c == '-'? STA_first_dash : STA_wait_newline; - break; - case STA_first_dash: /* just need for initialization */ - x->pos = 0; - x->state = STA_compare_header; /* fall through */ - case STA_compare_header: - if ( "-----BEGIN PGP SIGNATURE-----"[++x->pos] == c ) { - if ( x->pos == 28 ) - x->state = STA_found_header_wait_newline; - } - else - x->state = c == '\n'? STA_wait_dash : STA_wait_newline; - break; - case STA_found_header_wait_newline: - /* to make CR,LF issues easier we simply allow for white space - behind the 5 dashes */ - if ( c == '\n' ) - x->state = STA_skip_header_lines; - else if ( c != '\r' && c != ' ' && c != '\t' ) - x->state = STA_wait_dash; /* garbage after the header line */ - break; - case STA_skip_header_lines: - /* i.e. wait for one empty line */ - if ( c == '\n' ) { - x->state = STA_read_data; - x->crc = CRCINIT; - x->val = 0; - x->pos = 0; - } - else if ( c != '\r' && c != ' ' && c != '\t' ) - x->state = STA_skip_header_lines_non_ws; - break; - case STA_skip_header_lines_non_ws: - /* like above but we already encountered non white space */ - if ( c == '\n' ) - x->state = STA_skip_header_lines; - break; - case STA_read_data: - /* fixme: we don't check for the trailing dash lines but rely - * on the armor stop characters */ - if( c == '\n' || c == ' ' || c == '\r' || c == '\t' ) - break; /* skip all kind of white space */ - - if( c == '=' ) { /* pad character: stop */ - if( x->pos == 1 ) /* in this case val has some value */ - rval = x->val; - x->state = STA_wait_crc; - break; - } - - { - int c2; - if( (c = asctobin[(c2=c)]) == 255 ) { - log_error(_("invalid radix64 character %02X skipped\n"), c2); - break; - } - } - - switch(x->pos) { - case 0: - x->val = c << 2; - break; - case 1: - x->val |= (c>>4)&3; - rval = x->val; - x->val = (c<<4)&0xf0; - break; - case 2: - x->val |= (c>>2)&15; - rval = x->val; - x->val = (c<<6)&0xc0; - break; - case 3: - x->val |= c&0x3f; - rval = x->val; - break; - } - x->pos = (x->pos+1) % 4; - break; - case STA_wait_crc: - if( c == '\n' || c == ' ' || c == '\r' || c == '\t' || c == '=' ) - break; /* skip ws and pad characters */ - /* assume that we are at the next line */ - x->state = STA_read_crc; - x->pos = 0; - x->mycrc = 0; /* fall through */ - case STA_read_crc: - if( (c = asctobin[c]) == 255 ) { - rval = -1; /* ready */ - if( x->crc != x->mycrc ) { - log_info (_("CRC error; %06lX - %06lX\n"), - (ulong)x->crc, (ulong)x->mycrc); - if ( invalid_crc() ) - rval = -3; - } - x->state = STA_ready; /* not sure whether this is correct */ - break; - } - - switch(x->pos) { - case 0: - x->val = c << 2; - break; - case 1: - x->val |= (c>>4)&3; - x->mycrc |= x->val << 16; - x->val = (c<<4)&0xf0; - break; - case 2: - x->val |= (c>>2)&15; - x->mycrc |= x->val << 8; - x->val = (c<<6)&0xc0; - break; - case 3: - x->val |= c&0x3f; - x->mycrc |= x->val; - break; - } - x->pos = (x->pos+1) % 4; - break; - case STA_ready: - rval = -1; - break; - } - - if ( !(rval & ~255) ) { /* compute the CRC */ - x->crc = (x->crc << 8) ^ crc_table[((x->crc >> 16)&0xff) ^ rval]; - x->crc &= 0x00ffffff; - } - - return rval; -} diff --git a/g10/filter.h b/g10/filter.h index 6daf273..fa1f5a2 100644 --- a/g10/filter.h +++ b/g10/filter.h @@ -69,8 +69,6 @@ typedef struct { int pending_lf; /* used together with faked */ } armor_filter_context_t; -struct unarmor_pump_s; -typedef struct unarmor_pump_s *UnarmorPump; struct compress_filter_context_s { @@ -172,9 +170,6 @@ armor_filter_context_t *new_armor_context (void); void release_armor_context (armor_filter_context_t *afx); int push_armor_filter (armor_filter_context_t *afx, iobuf_t iobuf); int use_armor_filter( iobuf_t a ); -UnarmorPump unarmor_pump_new (void); -void unarmor_pump_release (UnarmorPump x); -int unarmor_pump (UnarmorPump x, int c); /*-- compress.c --*/ gpg_error_t push_compress_filter (iobuf_t out, compress_filter_context_t *zfx, commit a571bb8df52d6f2727876e086790dd037c9948ad Author: Jussi Kivilinna Date: Thu Nov 8 21:31:12 2018 +0200 g10/armor: fix eof checks in radix64_read * g10/armor.c (radix64_read): Check EOF with '!afx->buffer_len' instead of 'c == -1', as 'c' is never set to this value. -- Signed-off-by: Jussi Kivilinna diff --git a/g10/armor.c b/g10/armor.c index 98b870a..1b02a23 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -793,7 +793,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, byte *buf, size_t size ) { byte val; - int c=0, c2; /*init c because gcc is not clever enough for the continue*/ + int c, c2; int checkcrc=0; int rc = 0; size_t n = 0; @@ -911,7 +911,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, continue; break; } - if( c == -1 ) + if( !afx->buffer_len ) log_error(_("premature eof (no CRC)\n")); else { u32 mycrc = 0; @@ -945,7 +945,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, if( !afx->buffer_len ) break; /* eof */ } while( ++idx < 4 ); - if( c == -1 ) { + if( !afx->buffer_len ) { log_info(_("premature eof (in CRC)\n")); rc = invalid_crc(); } commit 5d6c080522e1666943b75c99124fb69b985b6941 Author: Jussi Kivilinna Date: Thu Nov 8 21:31:12 2018 +0200 g10/decrypt-data: use iobuf_read for higher performance * g10/decrypt-data.c (fill_buffer): Use iobuf_read instead of iobuf_get for reading data. -- This patch reduces iobuf_read per byte processing overhead and speeds up decryption. Benchmark results below, tested on Intel Core i7-4790K (turbo off). Encrypted 2 GiB through pipe to ramfs file using AES128. Decrypt ramfs file out through pipe to /dev/null. before patch-set ---------------- gpg process no-armor: user time pipe transfer rate encrypt-aead: 1.02 1.0 GB/s decrypt-aead: 10.8 185 MB/s encrypt-cfb: 4.8 342 MB/s decrypt-cfb: 12.7 157 MB/s gpg process armor: user time pipe transfer rate encrypt-aead: 13.8 140 MB/s decrypt-aead: 30.6 68 MB/s encrypt-cfb: 17.4 114 MB/s decrypt-cfb: 32.6 64 MB/s after (decrypt opt) ------------------- gpg process no-armor: user time pipe transfer rate decrypt-aead: 7.3 263 MB/s decrypt-cfb: 9.3 211 MB/s gpg process armor: user time pipe transfer rate decrypt-aead: 27.0 77 MB/s decrypt-cfb: 29.0 72 MB/s Note: decryption results are much slower than encryption because of extra SHA1 & RIPEMD160 hashing. GnuPG-bug-id: 3786 Signed-off-by: Jussi Kivilinna diff --git a/g10/decrypt-data.c b/g10/decrypt-data.c index a3c9b80..4d9dc86 100644 --- a/g10/decrypt-data.c +++ b/g10/decrypt-data.c @@ -551,31 +551,42 @@ fill_buffer (decode_filter_ctx_t dfx, iobuf_t stream, byte *buffer, size_t nbytes, size_t offset) { size_t nread = offset; - int c; + size_t curr; + int ret; if (dfx->partial) { - for (; nread < nbytes; nread++ ) + while (nread < nbytes) { - if ((c = iobuf_get (stream)) == -1) + curr = nbytes - nread; + + ret = iobuf_read (stream, &buffer[nread], curr); + if (ret == -1) { dfx->eof_seen = 1; /* Normal EOF. */ break; } - buffer[nread] = c; + + nread += ret; } } else { - for (; nread < nbytes && dfx->length; nread++, dfx->length--) + while (nread < nbytes && dfx->length) { - c = iobuf_get (stream); - if (c == -1) + curr = nbytes - nread; + if (curr > dfx->length) + curr = dfx->length; + + ret = iobuf_read (stream, &buffer[nread], curr); + if (ret == -1) { dfx->eof_seen = 3; /* Premature EOF. */ break; } - buffer[nread] = c; + + nread += ret; + dfx->length -= ret; } if (!dfx->length) dfx->eof_seen = 1; /* Normal EOF. */ commit e2b9095de35ac4d402b077d5484b4131700a9925 Author: Jussi Kivilinna Date: Thu Nov 8 21:31:12 2018 +0200 g10/decrypt-data: use fill_buffer in more places * g10/decrypt-data.c (mdc_decode_filter, decode_filter): Use fill_buffer. -- Signed-off-by: Jussi Kivilinna diff --git a/g10/decrypt-data.c b/g10/decrypt-data.c index 61e0112..a3c9b80 100644 --- a/g10/decrypt-data.c +++ b/g10/decrypt-data.c @@ -873,7 +873,6 @@ mdc_decode_filter (void *opaque, int control, IOBUF a, decode_filter_ctx_t dfx = opaque; size_t n, size = *ret_len; int rc = 0; - int c; /* Note: We need to distinguish between a partial and a fixed length packet. The first is the usual case as created by GPG. However @@ -894,25 +893,7 @@ mdc_decode_filter (void *opaque, int control, IOBUF a, log_assert (size > 44); /* Our code requires at least this size. */ /* Get at least 22 bytes and put it ahead in the buffer. */ - if (dfx->partial) - { - for (n=22; n < 44; n++) - { - if ( (c = iobuf_get(a)) == -1 ) - break; - buf[n] = c; - } - } - else - { - for (n=22; n < 44 && dfx->length; n++, dfx->length--) - { - c = iobuf_get (a); - if (c == -1) - break; /* Premature EOF. */ - buf[n] = c; - } - } + n = fill_buffer (dfx, a, buf, 44, 22); if (n == 44) { /* We have enough stuff - flush the holdback buffer. */ @@ -923,37 +904,11 @@ mdc_decode_filter (void *opaque, int control, IOBUF a, } else { - memcpy (buf, dfx->holdback, 22); } + /* Fill up the buffer. */ - if (dfx->partial) - { - for (; n < size; n++ ) - { - if ( (c = iobuf_get(a)) == -1 ) - { - dfx->eof_seen = 1; /* Normal EOF. */ - break; - } - buf[n] = c; - } - } - else - { - for (; n < size && dfx->length; n++, dfx->length--) - { - c = iobuf_get(a); - if (c == -1) - { - dfx->eof_seen = 3; /* Premature EOF. */ - break; - } - buf[n] = c; - } - if (!dfx->length) - dfx->eof_seen = 1; /* Normal EOF. */ - } + n = fill_buffer (dfx, a, buf, size, n); /* Move the trailing 22 bytes back to the holdback buffer. We have at least 44 bytes thus a memmove is not needed. */ @@ -1008,7 +963,7 @@ decode_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len) decode_filter_ctx_t fc = opaque; size_t size = *ret_len; size_t n; - int c, rc = 0; + int rc = 0; if ( control == IOBUFCTRL_UNDERFLOW && fc->eof_seen ) @@ -1020,34 +975,7 @@ decode_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len) { log_assert (a); - if (fc->partial) - { - for (n=0; n < size; n++ ) - { - c = iobuf_get(a); - if (c == -1) - { - fc->eof_seen = 1; /* Normal EOF. */ - break; - } - buf[n] = c; - } - } - else - { - for (n=0; n < size && fc->length; n++, fc->length--) - { - c = iobuf_get(a); - if (c == -1) - { - fc->eof_seen = 3; /* Premature EOF. */ - break; - } - buf[n] = c; - } - if (!fc->length) - fc->eof_seen = 1; /* Normal EOF. */ - } + n = fill_buffer (fc, a, buf, size, 0); if (n) { if (fc->cipher_hd) ----------------------------------------------------------------------- Summary of changes: common/iobuf.c | 48 +++- g10/armor.c | 641 ++++++++++++++++++++++++++--------------------------- g10/decrypt-data.c | 109 ++------- g10/filter.h | 7 +- 4 files changed, 384 insertions(+), 421 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 9 17:08:11 2018 From: cvs at cvs.gnupg.org (by Jussi Kivilinna) Date: Fri, 09 Nov 2018 17:08:11 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-264-gb46382d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via b46382dd47731231ff49b59c486110a25e08e985 (commit) from 643ec7c642dc75191e712963d2bb460ac247e09b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b46382dd47731231ff49b59c486110a25e08e985 Author: Jussi Kivilinna Date: Fri Nov 9 18:07:38 2018 +0200 g10/mainproc: avoid extra hash contexts when decrypting AEAD input * g10/mainproc.c (mainproc_context): New member 'seen_pkt_encrypted_aead'. (release_list): Clear 'seen_pkt_encrypted_aead'. (proc_encrypted): Set 'seen_pkt_encrypted_aead'. (have_seen_pkt_encrypted_aead): New. (proc_plaintext): Do not enable extra hash contexts when decryption AEAD input. -- Signed-off-by: Jussi Kivilinna diff --git a/g10/mainproc.c b/g10/mainproc.c index 5b7bc95..7eceb7e 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -86,6 +86,7 @@ struct mainproc_context int trustletter; /* Temporary usage in list_node. */ ulong symkeys; /* Number of symmetrically encrypted session keys. */ struct pubkey_enc_list *pkenc_list; /* List of encryption packets. */ + int seen_pkt_encrypted_aead; /* PKT_ENCRYPTED_AEAD packet seen. */ struct { unsigned int sig_seen:1; /* Set to true if a signature packet has been seen. */ @@ -137,6 +138,7 @@ release_list( CTX c ) c->any.data = 0; c->any.uncompress_failed = 0; c->last_was_session_key = 0; + c->seen_pkt_encrypted_aead = 0; xfree (c->dek); c->dek = NULL; } @@ -536,6 +538,9 @@ proc_encrypted (CTX c, PACKET *pkt) int result = 0; int early_plaintext = literals_seen; + if (pkt->pkttype == PKT_ENCRYPTED_AEAD) + c->seen_pkt_encrypted_aead = 1; + if (early_plaintext) { log_info (_("WARNING: multiple plaintexts seen\n")); @@ -704,7 +709,6 @@ proc_encrypted (CTX c, PACKET *pkt) } - if (!result) result = decrypt_data (c->ctrl, c, pkt->pkt.encrypted, c->dek ); @@ -804,6 +808,21 @@ proc_encrypted (CTX c, PACKET *pkt) } +static int +have_seen_pkt_encrypted_aead( CTX c ) +{ + CTX cc; + + for (cc = c; cc; cc = cc->anchor) + { + if (cc->seen_pkt_encrypted_aead) + return 1; + } + + return 0; +} + + static void proc_plaintext( CTX c, PACKET *pkt ) { @@ -874,7 +893,7 @@ proc_plaintext( CTX c, PACKET *pkt ) } } - if (!any && !opt.skip_verify) + if (!any && !opt.skip_verify && !have_seen_pkt_encrypted_aead(c)) { /* This is for the old GPG LITERAL+SIG case. It's not legal according to 2440, so hopefully it won't come up that often. ----------------------------------------------------------------------- Summary of changes: g10/mainproc.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 9 18:19:25 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Fri, 09 Nov 2018 18:19:25 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-2.3.1-39-gd27f609 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via d27f609e7f606b6f85c483f15091fa2a5cb204ba (commit) from c702eede029cc80841172871d7fb674819d6a081 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d27f609e7f606b6f85c483f15091fa2a5cb204ba Author: Andre Heinecke Date: Fri Nov 9 18:17:36 2018 +0100 Add explicit decrypt as WindowMessage handler * src/mail.cpp (decryptVerify_o): Remove obsolete safeguard against double decryption. * src/windowmessages.cpp (EXT_API_DECRYPT): Add new command. -- This is nice to have a close -> do something with the encrypted mail -> decrypt again workflow. GnuPG-Bug-Id: T4241 diff --git a/src/mail.cpp b/src/mail.cpp index a75225f..e44dcde 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -1066,12 +1066,6 @@ Mail::decryptVerify_o () SRCNAME, __func__, m_mailitem); TRETURN 0; } - if (m_needs_wipe) - { - log_error ("%s:%s: Decrypt verify called for msg that needs wipe: %p", - SRCNAME, __func__, m_mailitem); - TRETURN 1; - } auto cipherstream = get_attachment_stream_o (m_mailitem, m_moss_position); if (!cipherstream) diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp index d39cd2b..b311030 100644 --- a/src/windowmessages.cpp +++ b/src/windowmessages.cpp @@ -340,6 +340,25 @@ gpgol_window_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) mail->releaseCurrentItem(); TRETURN 0; } + else if (cds->dwData == EXT_API_DECRYPT) + { + log_debug ("%s:%s CopyData with external decrypt. Payload: %.*s", + SRCNAME, __func__, (int)cds->cbData, (char *) cds->lpData); + + std::string uid ((char*) cds->lpData, cds->cbData); + auto mail = Mail::getMailForUUID (uid.c_str ()); + if (!mail) + { + log_error ("%s:%s Failed to find mail for: %s", + SRCNAME, __func__, uid.c_str() ); + TRETURN DefWindowProc(hWnd, message, wParam, lParam); + } + + log_debug ("%s:%s: Decrypting %p again.", + SRCNAME, __func__, mail); + mail->decryptVerify_o (); + TRETURN 0; + } } return DefWindowProc(hWnd, message, wParam, lParam); diff --git a/src/windowmessages.h b/src/windowmessages.h index a8d24de..4e2ea56 100644 --- a/src/windowmessages.h +++ b/src/windowmessages.h @@ -59,6 +59,7 @@ typedef enum _gpgol_wmsg_type /* External API, keep it stable! */ EXT_API_CLOSE = 1301, EXT_API_CLOSE_ALL = 1302, + EXT_API_DECRYPT = 1303, } gpgol_wmsg_type; typedef struct ----------------------------------------------------------------------- Summary of changes: src/mail.cpp | 6 ------ src/windowmessages.cpp | 19 +++++++++++++++++++ src/windowmessages.h | 1 + 3 files changed, 20 insertions(+), 6 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 9 18:37:52 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Fri, 09 Nov 2018 18:37:52 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-2.3.1-40-gc921d50 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via c921d50a3c6659c8b1ba4bc47762035be395f104 (commit) from d27f609e7f606b6f85c483f15091fa2a5cb204ba (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c921d50a3c6659c8b1ba4bc47762035be395f104 Author: Andre Heinecke Date: Fri Nov 9 18:36:12 2018 +0100 Disable async crypt for mails without subject * src/mail.cpp (Mail::check_inline_response): Disable also for empty subject. -- For mails with an empty subject Outlook asks if the mail should be sent anyway. If we do async crypto it also asks on our triggered send event. In that case the overlay blocks it. So better just disable async in that case so that there are no two questions. GnuPG-Bug-Id: T4150 diff --git a/src/mail.cpp b/src/mail.cpp index e44dcde..dbb7731 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -3334,6 +3334,19 @@ Mail::check_inline_response () m_async_crypt_disabled = false; + const auto subject = getSubject_o (); + + /* Check for an empty subject. Otherwise the question for it + might be hidden behind our overlay. */ + if (subject.empty()) + { + log_debug ("%s:%s: Detected empty subject. " + "Disabling async crypt due to T4150.", + SRCNAME, __func__); + m_async_crypt_disabled = true; + TRETURN m_async_crypt_disabled; + } + LPDISPATCH attachments = get_oom_object (m_mailitem, "Attachments"); if (attachments) { @@ -3417,7 +3430,6 @@ Mail::check_inline_response () char * inlineSubject = get_oom_string (inlineResponse, "Subject"); gpgol_release (inlineResponse); - const auto subject = getSubject_o (); if (inlineResponse && !subject.empty() && !strcmp (subject.c_str (), inlineSubject)) { log_debug ("%s:%s: Detected inline response for '%p'", ----------------------------------------------------------------------- Summary of changes: src/mail.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Sun Nov 11 12:02:09 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Sun, 11 Nov 2018 12:02:09 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-265-gb3095c9 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via b3095c95ef9d2d76b49a6ad1b946fca590380dc9 (commit) from b46382dd47731231ff49b59c486110a25e08e985 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b3095c95ef9d2d76b49a6ad1b946fca590380dc9 Author: Werner Koch Date: Sun Nov 11 12:01:42 2018 +0100 common: Add --filter option to t-mbox-util. * common/t-mbox-util.c (run_filter): New. (main): Add option parser. diff --git a/common/t-mbox-util.c b/common/t-mbox-util.c index fb1ac12..e9cf412 100644 --- a/common/t-mbox-util.c +++ b/common/t-mbox-util.c @@ -25,6 +25,9 @@ #include "util.h" #include "mbox-util.h" +#define PGM "t-mbox-util" + + #define pass() do { ; } while(0) #define fail(a) do { fprintf (stderr, "%s:%d: test %d failed\n",\ __FILE__,__LINE__, (a)); \ @@ -32,6 +35,10 @@ } while(0) +static int verbose; +static int debug; + + static void run_mbox_test (void) { @@ -143,14 +150,97 @@ run_dns_test (void) } +static void +run_filter (void) +{ + char buf[4096]; + int c; + char *p, *mbox; + unsigned int count1 = 0; + unsigned int count2 = 0; + + while (fgets (buf, sizeof buf, stdin)) + { + p = strchr (buf, '\n'); + if (p) + *p = 0; + else + { + /* Skip to the end of the line. */ + while ((c = getc (stdin)) != EOF && c != '\n') + ; + } + count1++; + trim_spaces (buf); + mbox = mailbox_from_userid (buf); + if (mbox) + { + printf ("%s\n", mbox); + xfree (mbox); + count2++; + } + } + if (verbose) + fprintf (stderr, PGM ": lines=%u mboxes=%u\n", count1, count2); +} + + int main (int argc, char **argv) { - (void)argc; - (void)argv; + int last_argc = -1; + int opt_filter = 0; - run_mbox_test (); - run_dns_test (); + if (argc) + { argc--; argv++; } + while (argc && last_argc != argc ) + { + last_argc = argc; + if (!strcmp (*argv, "--")) + { + argc--; argv++; + break; + } + else if (!strcmp (*argv, "--help")) + { + fputs ("usage: " PGM " [FILE]\n" + "Options:\n" + " --verbose Print timings etc.\n" + " --debug Flyswatter\n" + " --filter Filter mboxes from input lines\n" + , stdout); + exit (0); + } + else if (!strcmp (*argv, "--verbose")) + { + verbose++; + argc--; argv++; + } + else if (!strcmp (*argv, "--debug")) + { + verbose += 2; + debug++; + argc--; argv++; + } + else if (!strcmp (*argv, "--filter")) + { + opt_filter = 1; + argc--; argv++; + } + else if (!strncmp (*argv, "--", 2)) + { + fprintf (stderr, PGM ": unknown option '%s'\n", *argv); + exit (1); + } + } + + if (opt_filter) + run_filter (); + else + { + run_mbox_test (); + run_dns_test (); + } return 0; } ----------------------------------------------------------------------- Summary of changes: common/t-mbox-util.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 94 insertions(+), 4 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Sun Nov 11 12:20:42 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Sun, 11 Nov 2018 12:20:42 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-266-gbbed474 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via bbed4746edcd20946ef9f90d25a69c151238de0a (commit) from b3095c95ef9d2d76b49a6ad1b946fca590380dc9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bbed4746edcd20946ef9f90d25a69c151238de0a Author: Werner Koch Date: Sun Nov 11 12:20:34 2018 +0100 gpg: Fix format string in gpgcompose.c -- For size_t use "%zu" For ssize_t use "%zd" Signed-off-by: Werner Koch diff --git a/g10/gpgcompose.c b/g10/gpgcompose.c index 9b69015..6f573ce 100644 --- a/g10/gpgcompose.c +++ b/g10/gpgcompose.c @@ -2292,7 +2292,7 @@ sk_esk (const char *option, int argc, char *argv[], void *cookie) log_fatal ("encrypt_seskey failed: %s\n", gpg_strerror (err)); if (enckeylen - 1 > sesdek.keylen) - log_fatal ("key size is too big: %z\n", enckeylen); + log_fatal ("key size is too big: %zu\n", enckeylen); else { ske->seskeylen = (byte)enckeylen; ----------------------------------------------------------------------- Summary of changes: g10/gpgcompose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 12 01:13:41 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Mon, 12 Nov 2018 01:13:41 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-49-gf3e6052 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via f3e60521899e6126229b6efedc9f011b84122e11 (commit) from 2557d0ae6ff0336b041129b7bf5c1e3a8c20a805 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f3e60521899e6126229b6efedc9f011b84122e11 Author: NIIBE Yutaka Date: Mon Nov 12 09:03:49 2018 +0900 build: Provide gpgme.pc, generated by configure. * configure.ac: Generate src/gpgme.pc. * src/Makefile.am (pkgconfigdir, pkgconfig_DATA): New. (EXTRA_DIST): Add gpgme.pc.in. * src/gpgme.pc.in: New. * src/gpgme-config.in: Use variables. -- Some usages of gpgme-config is not compatible to pkg-config style; The --glib option and --thread option which affect the output by --cflags or --libs are not supported by gpgme.pc. gpgme-config's embedding information for gpg-error and libassuan at the build time of gpgme is considered inflexible than pkg-config style. It is now handled by dependency of gpgme.pc (Requires field). To use gpgme.pc, newer libgpg-error (>= 1.33) and libassuan (>= 2.5.3) are required, which provide gpg-error.pc and libassuan.pc respectively. Signed-off-by: NIIBE Yutaka diff --git a/configure.ac b/configure.ac index 688a4b3..faa5261 100644 --- a/configure.ac +++ b/configure.ac @@ -855,6 +855,7 @@ AC_CONFIG_FILES(Makefile src/Makefile tests/opassuan/Makefile doc/Makefile src/versioninfo.rc + src/gpgme.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) diff --git a/src/Makefile.am b/src/Makefile.am index 276d976..e6148fc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,8 +18,11 @@ ## Process this file with automake to produce Makefile.in +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = gpgme.pc + EXTRA_DIST = gpgme-config.in gpgme.m4 libgpgme.vers ChangeLog-2011 \ - gpgme.h.in versioninfo.rc.in gpgme.def + gpgme.h.in versioninfo.rc.in gpgme.def gpgme.pc.in bin_SCRIPTS = gpgme-config m4datadir = $(datadir)/aclocal diff --git a/src/gpgme-config.in b/src/gpgme-config.in index a4d152e..56b98f8 100644 --- a/src/gpgme-config.in +++ b/src/gpgme-config.in @@ -9,8 +9,11 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -prefix=@prefix@ -exec_prefix=@exec_prefix@ +prefix="@prefix@" +exec_prefix="@exec_prefix@" +version="@PACKAGE_VERSION@" +api_version="@GPGME_CONFIG_API_VERSION@" +my_host="@GPGME_CONFIG_HOST@" # Make sure that no weird locale setting messes up our sed regexps etc. LC_COLLATE=C @@ -96,15 +99,15 @@ while test $# -gt 0; do with_glib=yes ;; --version) - echo "@VERSION@" + echo "$version" exit 0 ;; --api-version) - echo "@GPGME_CONFIG_API_VERSION@" + echo "$api_version" exit 0 ;; --host) - echo "@GPGME_CONFIG_HOST@" + echo "$my_host" exit 0 ;; --cflags) diff --git a/src/gpgme.pc.in b/src/gpgme.pc.in new file mode 100644 index 0000000..35d8564 --- /dev/null +++ b/src/gpgme.pc.in @@ -0,0 +1,15 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +includedir=@includedir@ +libdir=@libdir@ +host=@GPGME_CONFIG_HOST@ +api_version=@GPGME_CONFIG_API_VERSION@ +avail_lang=c @GPGME_CONFIG_AVAIL_LANG@ + +Name: gpgme +Description: GnuPG Made Easy to access GnuPG +Requires: gpg-error, libassuan +Version: @PACKAGE_VERSION@ +Cflags: @GPGME_CONFIG_CFLAGS@ +Libs: @GPGME_CONFIG_LIBS@ +URL: https://www.gnupg.org/software/gpgme/index.html ----------------------------------------------------------------------- Summary of changes: configure.ac | 1 + src/Makefile.am | 5 ++++- src/gpgme-config.in | 13 ++++++++----- src/gpgme.pc.in | 15 +++++++++++++++ 4 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 src/gpgme.pc.in hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 12 02:05:23 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Mon, 12 Nov 2018 02:05:23 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-51-g60828a5 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 60828a505a1c74fd34476c181df2a588ea6f9c83 (commit) via a76e145a1057e11953b71f804cf3a499c3ad5362 (commit) from f3e60521899e6126229b6efedc9f011b84122e11 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 60828a505a1c74fd34476c181df2a588ea6f9c83 Author: NIIBE Yutaka Date: Mon Nov 12 10:01:16 2018 +0900 build: Make gpgme.m4 use gpgrt-config with *.pc. * src/gpgme.m4 (_AM_PATH_GPGME_CONFIG): Use gpgrt-config with gpgme.pc when possible. (AM_PATH_GPGME_GLIB): Likewise with gpgme-glib.pc. -- Keeping AM_PATH_GPGME_PTHREAD, as is, untouched. Signed-off-by: NIIBE Yutaka diff --git a/src/gpgme.m4 b/src/gpgme.m4 index 6c2be44..2a72f18 100644 --- a/src/gpgme.m4 +++ b/src/gpgme.m4 @@ -1,5 +1,5 @@ # gpgme.m4 - autoconf macro to detect GPGME. -# Copyright (C) 2002, 2003, 2004, 2014 g10 Code GmbH +# Copyright (C) 2002, 2003, 2004, 2014, 2018 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 @@ -9,7 +9,7 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Last-changed: 2014-10-02 +# Last-changed: 2018-11-12 AC_DEFUN([_AM_PATH_GPGME_CONFIG], @@ -36,10 +36,24 @@ AC_DEFUN([_AM_PATH_GPGME_CONFIG], fi fi - AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no) + use_gpgrt_config="" + if test x"${GPGME_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then + if $GPGRT_CONFIG gpgme --exists; then + GPGME_CONFIG="$GPGRT_CONFIG gpgme" + AC_MSG_NOTICE([Use gpgrt-config as gpgme-config]) + use_gpgrt_config=yes + fi + fi + if test -z "$use_gpgrt_config"; then + AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no) + fi if test "$GPGME_CONFIG" != "no" ; then - gpgme_version=`$GPGME_CONFIG --version` + if test -z "$use_gpgrt_config"; then + gpgme_version=`$GPGME_CONFIG --version` + else + gpgme_version=`$GPGME_CONFIG --modversion` + fi fi gpgme_version_major=`echo $gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` @@ -52,12 +66,16 @@ AC_DEFUN([_AM_PATH_GPGME_CONFIG], AC_DEFUN([_AM_PATH_GPGME_CONFIG_HOST_CHECK], [ - gpgme_config_host=`$GPGME_CONFIG --host 2>/dev/null || echo none` + if test -z "$use_gpgrt_config"; then + gpgme_config_host=`$GPGME_CONFIG --host 2>/dev/null || echo none` + else + gpgme_config_host=`$GPGME_CONFIG --variable=host 2>/dev/null || echo none` + fi if test x"$gpgme_config_host" != xnone ; then if test x"$gpgme_config_host" != x"$host" ; then AC_MSG_WARN([[ *** -*** The config script $GPGME_CONFIG was +*** The config script "$GPGME_CONFIG" was *** built for $gpgme_config_host and thus may not match the *** used host $host. *** You may want to use the configure option --with-gpgme-prefix @@ -118,7 +136,11 @@ AC_DEFUN([AM_PATH_GPGME], # If we have a recent GPGME, we should also check that the # API is compatible. if test "$req_gpgme_api" -gt 0 ; then - tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0` + if test -z "$use_gpgrt_config"; then + tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0` + else + tmp=`$GPGME_CONFIG --variable=api_version 2>/dev/null || echo 0` + fi if test "$tmp" -gt 0 ; then if test "$req_gpgme_api" -ne "$tmp" ; then ok=no @@ -258,7 +280,11 @@ AC_DEFUN([AM_PATH_GPGME_GLIB], # If we have a recent GPGME, we should also check that the # API is compatible. if test "$req_gpgme_api" -gt 0 ; then - tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0` + if test -z "$use_gpgrt_config"; then + tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0` + else + tmp=`$GPGME_CONFIG --variable=api_version 2>/dev/null || echo 0` + fi if test "$tmp" -gt 0 ; then if test "$req_gpgme_api" -ne "$tmp" ; then ok=no @@ -267,8 +293,20 @@ AC_DEFUN([AM_PATH_GPGME_GLIB], fi fi if test $ok = yes; then - GPGME_GLIB_CFLAGS=`$GPGME_CONFIG --glib --cflags` - GPGME_GLIB_LIBS=`$GPGME_CONFIG --glib --libs` + if test -z "$use_gpgrt_config"; then + GPGME_GLIB_CFLAGS=`$GPGME_CONFIG --glib --cflags` + GPGME_GLIB_LIBS=`$GPGME_CONFIG --glib --libs` + else + if $GPGRT_CONFIG gpgme-glib --exists; then + GPGME_CONFIG="$GPGRT_CONFIG gpgme-glib" + GPGME_GLIB_CFLAGS=`$GPGME_CONFIG --cflags` + GPGME_GLIB_LIBS=`$GPGME_CONFIG --libs` + else + ok = no + fi + fi + fi + if test $ok = yes; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) _AM_PATH_GPGME_CONFIG_HOST_CHECK commit a76e145a1057e11953b71f804cf3a499c3ad5362 Author: NIIBE Yutaka Date: Mon Nov 12 09:59:05 2018 +0900 build: Provide gpgme-glib.pc too. * src/gpgme-glib.pc.in: New. * src/gpgme.pc.in (avail_lang): Remove. -- Provide gpgme-glib.pc for gpgme-glib library. The avial_lang information is no use because *.pc is for C. Signed-off-by: NIIBE Yutaka diff --git a/src/Makefile.am b/src/Makefile.am index e6148fc..435544a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,10 +19,11 @@ ## Process this file with automake to produce Makefile.in pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = gpgme.pc +pkgconfig_DATA = gpgme.pc gpgme-glib.pc EXTRA_DIST = gpgme-config.in gpgme.m4 libgpgme.vers ChangeLog-2011 \ - gpgme.h.in versioninfo.rc.in gpgme.def gpgme.pc.in + gpgme.h.in versioninfo.rc.in gpgme.def \ + gpgme.pc.in gpgme-glib.pc.in bin_SCRIPTS = gpgme-config m4datadir = $(datadir)/aclocal diff --git a/src/gpgme.pc.in b/src/gpgme-glib.pc.in similarity index 69% copy from src/gpgme.pc.in copy to src/gpgme-glib.pc.in index 35d8564..bd42a31 100644 --- a/src/gpgme.pc.in +++ b/src/gpgme-glib.pc.in @@ -4,11 +4,10 @@ includedir=@includedir@ libdir=@libdir@ host=@GPGME_CONFIG_HOST@ api_version=@GPGME_CONFIG_API_VERSION@ -avail_lang=c @GPGME_CONFIG_AVAIL_LANG@ -Name: gpgme -Description: GnuPG Made Easy to access GnuPG -Requires: gpg-error, libassuan +Name: gpgme-glib +Description: GnuPG Made Easy to access GnuPG with Glib +Requires: gpg-error, libassuan, glib-2.0 Version: @PACKAGE_VERSION@ Cflags: @GPGME_CONFIG_CFLAGS@ Libs: @GPGME_CONFIG_LIBS@ diff --git a/src/gpgme.pc.in b/src/gpgme.pc.in index 35d8564..be288b8 100644 --- a/src/gpgme.pc.in +++ b/src/gpgme.pc.in @@ -4,7 +4,6 @@ includedir=@includedir@ libdir=@libdir@ host=@GPGME_CONFIG_HOST@ api_version=@GPGME_CONFIG_API_VERSION@ -avail_lang=c @GPGME_CONFIG_AVAIL_LANG@ Name: gpgme Description: GnuPG Made Easy to access GnuPG ----------------------------------------------------------------------- Summary of changes: src/Makefile.am | 5 +-- src/{gpgme.pc.in => gpgme-glib.pc.in} | 7 ++--- src/gpgme.m4 | 58 +++++++++++++++++++++++++++++------ src/gpgme.pc.in | 1 - 4 files changed, 54 insertions(+), 17 deletions(-) copy src/{gpgme.pc.in => gpgme-glib.pc.in} (69%) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 12 07:44:38 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 12 Nov 2018 07:44:38 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-267-g6b9f772 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 6b9f772914624cc673ba26d49b6e3adc32dd7e0a (commit) from bbed4746edcd20946ef9f90d25a69c151238de0a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6b9f772914624cc673ba26d49b6e3adc32dd7e0a Author: Werner Koch Date: Mon Nov 12 07:44:33 2018 +0100 common: Prepare for parsing mail sub-addresses. * common/mbox-util.c (mailbox_from_userid): Add arg subaddress and implement. Change all callers to pass false for it. * common/t-mbox-util.c (run_mbox_no_sub_test): New. (run_filter): Add arg no_sub. (main): Call new test and add option --no-sub. -- Some stats: In the about 5300000 keys on the SKS servers we found 3055 unique mailboxes with a '+' in it. After removing leading and trailing '+' as well as multiple '+' (e.g. "c++" or "foo+bar+baz") 2697 were left which seem to be valid sub-addresses. To filter mailboxes out from a line delimited list with user-ids (e.g. an SQL output), the command t-mbox-util --verbose --filter can be used; to output w/o sub-addresses add --no-sub. GnuPG-bug-id: 4200 Signed-off-by: Werner Koch diff --git a/common/mbox-util.c b/common/mbox-util.c index 76255ba..a9086a3 100644 --- a/common/mbox-util.c +++ b/common/mbox-util.c @@ -173,11 +173,12 @@ is_valid_mailbox (const char *name) /* Return the mailbox (local-part at domain) form a standard user id. - All plain ASCII characters in the result are converted to - lowercase. Caller must free the result. Returns NULL if no valid - mailbox was found (or we are out of memory). */ + * All plain ASCII characters in the result are converted to + * lowercase. If SUBADDRESS is 1, '+' denoted sub-addresses are not + * included in the result. Caller must free the result. Returns NULL + * if no valid mailbox was found (or we are out of memory). */ char * -mailbox_from_userid (const char *userid) +mailbox_from_userid (const char *userid, int subaddress) { const char *s, *s_end; size_t len; @@ -226,6 +227,29 @@ mailbox_from_userid (const char *userid) else errno = EINVAL; + if (result && subaddress == 1) + { + char *atsign, *plus; + + if ((atsign = strchr (result, '@'))) + { + /* We consider a subaddress only if there is a single '+' + * in the local part and the '+' is not the first or last + * character. */ + *atsign = 0; + if ((plus = strchr (result, '+')) + && !strchr (plus+1, '+') + && result != plus + && plus[1] ) + { + *atsign = '@'; + memmove (plus, atsign, strlen (atsign)+1); + } + else + *atsign = '@'; + } + } + return result? ascii_strlwr (result): NULL; } diff --git a/common/mbox-util.h b/common/mbox-util.h index 7355cee..10ff2c4 100644 --- a/common/mbox-util.h +++ b/common/mbox-util.h @@ -22,7 +22,7 @@ int has_invalid_email_chars (const void *buffer, size_t length); int is_valid_mailbox (const char *name); int is_valid_mailbox_mem (const void *buffer, size_t length); -char *mailbox_from_userid (const char *userid); +char *mailbox_from_userid (const char *userid, int subaddress); int is_valid_user_id (const char *uid); int is_valid_domain_name (const char *string); diff --git a/common/t-mbox-util.c b/common/t-mbox-util.c index e9cf412..ae717f9 100644 --- a/common/t-mbox-util.c +++ b/common/t-mbox-util.c @@ -83,7 +83,86 @@ run_mbox_test (void) for (idx=0; testtbl[idx].userid; idx++) { - char *mbox = mailbox_from_userid (testtbl[idx].userid); + char *mbox = mailbox_from_userid (testtbl[idx].userid, 0); + + if (!testtbl[idx].mbox) + { + if (mbox) + fail (idx); + } + else if (!mbox) + fail (idx); + else if (strcmp (mbox, testtbl[idx].mbox)) + fail (idx); + + xfree (mbox); + } +} + + +static void +run_mbox_no_sub_test (void) +{ + static struct + { + const char *userid; + const char *mbox; + } testtbl[] = + { + { "foo+bar at example.org", "foo at example.org" }, + { "Werner Koch ", "wk at gnupg.org" }, + { "", "wk at gnupg.org" }, + { "wk at gnupg.org", "wk at gnupg.org" }, + { "wk at gnupg.org ", NULL }, + { " wk at gnupg.org", NULL }, + { "Werner Koch (test) ", "wk at gnupg.org" }, + { "Werner Koch (test)", "wk at gnupg.org" }, + { "Werner Koch ", NULL }, + { "Werner Koch ", NULL }, + { "", "foo at example.org" }, + { "", "foo. at example.org" }, + { "<.foo. at example.org>", ".foo. at example.org" }, + { "", "foo.. at example.org" }, + { "", "foo..bar at example.org" }, + { "", NULL }, + { "", NULL }, + { "", NULL }, + { "<@example.org>", NULL }, + { "", NULL }, + { "<@foo at example.org>", NULL }, + { " ()", "foo at example.org" }, + { " ()", "fo()o at example.org" }, + { " ()", "fo()o at example.org" }, + { "fo()o at example.org", NULL}, + { "Mr. Foo ", "foo at example.org"}, + { "foo+bar at example.org", "foo at example.org" }, + { "foo++bar at example.org", "foo++bar at example.org" }, + { "foo++ at example.org", "foo++ at example.org" }, + { "foo+ at example.org", "foo+ at example.org" }, + { "+foo at example.org", "+foo at example.org" }, + { "++foo at example.org", "++foo at example.org" }, + { "+foo+ at example.org", "+foo+ at example.org" }, + { "+ at example.org", "+ at example.org" }, + { "++ at example.org", "++ at example.org" }, + { "foo+b at example.org", "foo at example.org" }, + { "foo+ba at example.org", "foo at example.org" }, + { "foo+bar at example.org", "foo at example.org" }, + { "foo+barb at example.org", "foo at example.org" }, + { "foo+barba at example.org", "foo at example.org" }, + { "f+b at example.org", "f at example.org" }, + { "fo+b at example.org", "fo at example.org" }, + + { NULL, NULL } + }; + int idx; + + for (idx=0; testtbl[idx].userid; idx++) + { + char *mbox = mailbox_from_userid (testtbl[idx].userid, 1); if (!testtbl[idx].mbox) { @@ -151,7 +230,7 @@ run_dns_test (void) static void -run_filter (void) +run_filter (int no_sub) { char buf[4096]; int c; @@ -172,7 +251,7 @@ run_filter (void) } count1++; trim_spaces (buf); - mbox = mailbox_from_userid (buf); + mbox = mailbox_from_userid (buf, no_sub); if (mbox) { printf ("%s\n", mbox); @@ -190,6 +269,7 @@ main (int argc, char **argv) { int last_argc = -1; int opt_filter = 0; + int opt_no_sub = 0; if (argc) { argc--; argv++; } @@ -208,6 +288,7 @@ main (int argc, char **argv) " --verbose Print timings etc.\n" " --debug Flyswatter\n" " --filter Filter mboxes from input lines\n" + " --no-sub Ignore '+'-sub-addresses\n" , stdout); exit (0); } @@ -227,6 +308,11 @@ main (int argc, char **argv) opt_filter = 1; argc--; argv++; } + else if (!strcmp (*argv, "--no-sub")) + { + opt_no_sub = 1; + argc--; argv++; + } else if (!strncmp (*argv, "--", 2)) { fprintf (stderr, PGM ": unknown option '%s'\n", *argv); @@ -235,10 +321,11 @@ main (int argc, char **argv) } if (opt_filter) - run_filter (); + run_filter (opt_no_sub); else { run_mbox_test (); + run_mbox_no_sub_test (); run_dns_test (); } diff --git a/dirmngr/server.c b/dirmngr/server.c index 05a530b..a21e1ab 100644 --- a/dirmngr/server.c +++ b/dirmngr/server.c @@ -731,7 +731,7 @@ cmd_dns_cert (assuan_context_t ctx, char *line) /* We lowercase ascii characters but the DANE I-D does not allow this. FIXME: Check after the release of the RFC whether to change this. */ - mbox = mailbox_from_userid (line); + mbox = mailbox_from_userid (line, 0); if (!mbox || !(domain = strchr (mbox, '@'))) { err = set_error (GPG_ERR_INV_USER_ID, "no mailbox in user id"); @@ -855,7 +855,7 @@ proc_wkd_get (ctrl_t ctrl, assuan_context_t ctx, char *line) line = skip_options (line); is_wkd_query = !(opt_policy_flags || opt_submission_addr); - mbox = mailbox_from_userid (line); + mbox = mailbox_from_userid (line, 0); if (!mbox || !(domain = strchr (mbox, '@'))) { err = set_error (GPG_ERR_INV_USER_ID, "no mailbox in user id"); diff --git a/g10/export.c b/g10/export.c index 9477b75..d53be99 100644 --- a/g10/export.c +++ b/g10/export.c @@ -1469,7 +1469,7 @@ print_pka_or_dane_records (iobuf_t out, kbnode_t keyblock, PKT_public_key *pk, continue; xfree (mbox); - mbox = mailbox_from_userid (uid->name); + mbox = mailbox_from_userid (uid->name, 0); if (!mbox) continue; diff --git a/g10/getkey.c b/g10/getkey.c index 75ce9cb..c776a61 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1373,7 +1373,7 @@ pubkey_cmp (ctrl_t ctrl, const char *name, struct pubkey_cmp_cookie *old, n; n = find_next_kbnode (n, PKT_USER_ID)) { PKT_user_id *uid = n->pkt->pkt.user_id; - char *mbox = mailbox_from_userid (uid->name); + char *mbox = mailbox_from_userid (uid->name, 0); int match = mbox ? strcasecmp (name, mbox) == 0 : 0; xfree (mbox); diff --git a/g10/gpg.c b/g10/gpg.c index aeb9c6f..1102892 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -3130,7 +3130,7 @@ main (int argc, char **argv) break; case oSender: { - char *mbox = mailbox_from_userid (pargs.r.ret_str); + char *mbox = mailbox_from_userid (pargs.r.ret_str, 0); if (!mbox) log_error (_("\"%s\" is not a proper mail address\n"), pargs.r.ret_str); diff --git a/g10/import.c b/g10/import.c index 23258a0..8ea5144 100644 --- a/g10/import.c +++ b/g10/import.c @@ -1264,7 +1264,7 @@ impex_filter_getval (void *cookie, const char *propname) { if (!uid->mbox) { - uid->mbox = mailbox_from_userid (uid->name); + uid->mbox = mailbox_from_userid (uid->name, 0); } result = uid->mbox; } diff --git a/g10/keylist.c b/g10/keylist.c index 8b7da76..793f7da 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -1020,7 +1020,7 @@ list_keyblock_print (ctrl_t ctrl, kbnode_t keyblock, int secret, int fpr, char *mbox, *hash, *p; char hashbuf[32]; - mbox = mailbox_from_userid (uid->name); + mbox = mailbox_from_userid (uid->name, 0); if (mbox && (p = strchr (mbox, '@'))) { *p++ = 0; diff --git a/g10/keyserver.c b/g10/keyserver.c index a8c222d..44870a6 100644 --- a/g10/keyserver.c +++ b/g10/keyserver.c @@ -2053,7 +2053,7 @@ keyserver_import_wkd (ctrl_t ctrl, const char *name, int quick, /* We want to work on the mbox. That is what dirmngr will do anyway * and we need the mbox for the import filter anyway. */ - mbox = mailbox_from_userid (name); + mbox = mailbox_from_userid (name, 0); if (!mbox) { err = gpg_error_from_syserror (); diff --git a/g10/sign.c b/g10/sign.c index df88813..b2d1c18 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -153,7 +153,8 @@ mk_notation_policy_etc (PKT_signature *sig, char *mbox; /* For now we use the uid which was used to locate the key. */ - if (pksk->user_id && (mbox = mailbox_from_userid (pksk->user_id->name))) + if (pksk->user_id + && (mbox = mailbox_from_userid (pksk->user_id->name, 0))) { if (DBG_LOOKUP) log_debug ("setting Signer's UID to '%s'\n", mbox); diff --git a/g10/tofu.c b/g10/tofu.c index 762b19b..44f3545 100644 --- a/g10/tofu.c +++ b/g10/tofu.c @@ -3292,7 +3292,7 @@ show_warning (const char *fingerprint, strlist_t user_id_list) static char * email_from_user_id (const char *user_id) { - char *email = mailbox_from_userid (user_id); + char *email = mailbox_from_userid (user_id, 0); if (! email) { /* Hmm, no email address was provided or we are out of core. Just diff --git a/g10/trustdb.c b/g10/trustdb.c index c46dc50..a230a6c 100644 --- a/g10/trustdb.c +++ b/g10/trustdb.c @@ -1131,7 +1131,7 @@ tdb_get_validity_core (ctrl_t ctrl, if (sig && sig->signers_uid) /* Make sure the UID matches. */ { - char *email = mailbox_from_userid (user_id->name); + char *email = mailbox_from_userid (user_id->name, 0); if (!email || !*email || strcmp (sig->signers_uid, email) != 0) { if (DBG_TRUST) diff --git a/tools/gpg-wks-client.c b/tools/gpg-wks-client.c index bf6b119..0be5ea8 100644 --- a/tools/gpg-wks-client.c +++ b/tools/gpg-wks-client.c @@ -627,11 +627,11 @@ command_supported (char *userid) if (!strchr (userid, '@')) { char *tmp = xstrconcat ("foo@", userid, NULL); - addrspec = mailbox_from_userid (tmp); + addrspec = mailbox_from_userid (tmp, 0); xfree (tmp); } else - addrspec = mailbox_from_userid (userid); + addrspec = mailbox_from_userid (userid, 0); if (!addrspec) { log_error (_("\"%s\" is not a proper mail address\n"), userid); @@ -694,7 +694,7 @@ command_check (char *userid) uidinfo_list_t sl; int found = 0; - addrspec = mailbox_from_userid (userid); + addrspec = mailbox_from_userid (userid, 0); if (!addrspec) { log_error (_("\"%s\" is not a proper mail address\n"), userid); @@ -805,7 +805,7 @@ command_send (const char *fingerprint, const char *userid) goto leave; } - addrspec = mailbox_from_userid (userid); + addrspec = mailbox_from_userid (userid, 0); if (!addrspec) { log_error (_("\"%s\" is not a proper mail address\n"), userid); diff --git a/tools/gpg-wks-server.c b/tools/gpg-wks-server.c index 24b3312..1b53312 100644 --- a/tools/gpg-wks-server.c +++ b/tools/gpg-wks-server.c @@ -2020,7 +2020,7 @@ command_install_key (const char *fname, const char *userid) char *huname = NULL; int any; - addrspec = mailbox_from_userid (userid); + addrspec = mailbox_from_userid (userid, 0); if (!addrspec) { log_error ("\"%s\" is not a proper mail address\n", userid); @@ -2153,7 +2153,7 @@ fname_from_userid (const char *userid, char **r_fname, char **r_addrspec) if (r_addrspec) *r_addrspec = NULL; - addrspec = mailbox_from_userid (userid); + addrspec = mailbox_from_userid (userid, 0); if (!addrspec) { if (opt.verbose) diff --git a/tools/wks-util.c b/tools/wks-util.c index 729098a..cf80a25 100644 --- a/tools/wks-util.c +++ b/tools/wks-util.c @@ -104,7 +104,7 @@ append_to_uidinfo_list (uidinfo_list_t *list, const char *uid, time_t created) strcpy (sl->uid, uid); sl->created = created; - sl->mbox = mailbox_from_userid (uid); + sl->mbox = mailbox_from_userid (uid, 0); sl->next = NULL; if (!*list) *list = sl; ----------------------------------------------------------------------- Summary of changes: common/mbox-util.c | 32 ++++++++++++++--- common/mbox-util.h | 2 +- common/t-mbox-util.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++--- dirmngr/server.c | 4 +-- g10/export.c | 2 +- g10/getkey.c | 2 +- g10/gpg.c | 2 +- g10/import.c | 2 +- g10/keylist.c | 2 +- g10/keyserver.c | 2 +- g10/sign.c | 3 +- g10/tofu.c | 2 +- g10/trustdb.c | 2 +- tools/gpg-wks-client.c | 8 ++--- tools/gpg-wks-server.c | 4 +-- tools/wks-util.c | 2 +- 16 files changed, 139 insertions(+), 27 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 12 11:15:03 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Mon, 12 Nov 2018 11:15:03 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-52-g895176f Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 895176f42af3a1b13614f15dd537a426bb4ac16a (commit) from 60828a505a1c74fd34476c181df2a588ea6f9c83 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 895176f42af3a1b13614f15dd537a426bb4ac16a Author: NIIBE Yutaka Date: Mon Nov 12 19:11:49 2018 +0900 Fix the previous commit. Signed-off-by: NIIBE Yutaka diff --git a/configure.ac b/configure.ac index faa5261..b733a9c 100644 --- a/configure.ac +++ b/configure.ac @@ -856,6 +856,7 @@ AC_CONFIG_FILES(Makefile src/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) ----------------------------------------------------------------------- Summary of changes: configure.ac | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 12 12:42:38 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Mon, 12 Nov 2018 12:42:38 +0100 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.11-2-g00321a0 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 00321a025f90990a71b60b4689ede1f38fbde347 (commit) from 10157b41793247baa9c42c0450da146241a2c7b5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 00321a025f90990a71b60b4689ede1f38fbde347 Author: Andre Heinecke Date: Wed Oct 24 10:40:42 2018 +0200 dirmngr: Add FLUSHCRLs command Summary: * dirmngr/crlcache.c (crl_cache_flush): Also deinit the cache. * dirmngr/server.c (hlp_flushcrls, cmd_flushcrls): New. (register_commands): Add FLUSHCRLS. -- This allows it to flush the CRL cache of a running dirmngr server. This can be useful to debug / analyze CRL issues. GnuPG-Bug-Id: T3967 Differential Revision: https://dev.gnupg.org/D469 Signed-off-by: Andre Heinecke diff --git a/dirmngr/crlcache.c b/dirmngr/crlcache.c index 0b2fe16..52f49c0 100644 --- a/dirmngr/crlcache.c +++ b/dirmngr/crlcache.c @@ -1250,13 +1250,15 @@ crl_cache_deinit (void) } -/* Delete the cache from disk. Return 0 on success.*/ +/* Delete the cache from disk and memory. Return 0 on success.*/ int crl_cache_flush (void) { int rc; + crl_cache_deinit (); rc = cleanup_cache_dir (0)? -1 : 0; + crl_cache_init (); return rc; } diff --git a/dirmngr/server.c b/dirmngr/server.c index d414c0e..272b95a 100644 --- a/dirmngr/server.c +++ b/dirmngr/server.c @@ -2689,6 +2689,20 @@ cmd_reloaddirmngr (assuan_context_t ctx, char *line) } +static const char hlp_flushcrls[] = + "FLUSHCRLS\n" + "\n" + "Remove all cached CRLs from memory and\n" + "the file system."; +static gpg_error_t +cmd_flushcrls (assuan_context_t ctx, char *line) +{ + (void)line; + + return leave_cmd (ctx, crl_cache_flush () ? GPG_ERR_GENERAL : 0); +} + + /* Tell the assuan library about our commands. */ static int @@ -2719,6 +2733,7 @@ register_commands (assuan_context_t ctx) { "LOADSWDB", cmd_loadswdb, hlp_loadswdb }, { "KILLDIRMNGR",cmd_killdirmngr,hlp_killdirmngr }, { "RELOADDIRMNGR",cmd_reloaddirmngr,hlp_reloaddirmngr }, + { "FLUSHCRLS", cmd_flushcrls, hlp_flushcrls }, { NULL, NULL } }; int i, j, rc; ----------------------------------------------------------------------- Summary of changes: dirmngr/crlcache.c | 4 +++- dirmngr/server.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 12 14:00:45 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Mon, 12 Nov 2018 14:00:45 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-268-g678e470 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 678e4706ee614a6b7e543e2a80072d75405dd4db (commit) from 6b9f772914624cc673ba26d49b6e3adc32dd7e0a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 678e4706ee614a6b7e543e2a80072d75405dd4db Author: Andre Heinecke Date: Wed Oct 24 10:40:42 2018 +0200 dirmngr: Add FLUSHCRLs command Summary: * dirmngr/crlcache.c (crl_cache_flush): Also deinit the cache. * dirmngr/server.c (hlp_flushcrls, cmd_flushcrls): New. (register_commands): Add FLUSHCRLS. -- This allows it to flush the CRL cache of a running dirmngr server. This can be useful to debug / analyze CRL issues. GnuPG-Bug-Id: T3967 Differential Revision: https://dev.gnupg.org/D469 Signed-off-by: Andre Heinecke (cherry picked from commit 00321a025f90990a71b60b4689ede1f38fbde347) diff --git a/dirmngr/crlcache.c b/dirmngr/crlcache.c index a2867be..c9e5ca6 100644 --- a/dirmngr/crlcache.c +++ b/dirmngr/crlcache.c @@ -1250,13 +1250,15 @@ crl_cache_deinit (void) } -/* Delete the cache from disk. Return 0 on success.*/ +/* Delete the cache from disk and memory. Return 0 on success.*/ int crl_cache_flush (void) { int rc; + crl_cache_deinit (); rc = cleanup_cache_dir (0)? -1 : 0; + crl_cache_init (); return rc; } diff --git a/dirmngr/server.c b/dirmngr/server.c index a21e1ab..ac25620 100644 --- a/dirmngr/server.c +++ b/dirmngr/server.c @@ -2689,6 +2689,20 @@ cmd_reloaddirmngr (assuan_context_t ctx, char *line) } +static const char hlp_flushcrls[] = + "FLUSHCRLS\n" + "\n" + "Remove all cached CRLs from memory and\n" + "the file system."; +static gpg_error_t +cmd_flushcrls (assuan_context_t ctx, char *line) +{ + (void)line; + + return leave_cmd (ctx, crl_cache_flush () ? GPG_ERR_GENERAL : 0); +} + + /* Tell the assuan library about our commands. */ static int @@ -2719,6 +2733,7 @@ register_commands (assuan_context_t ctx) { "LOADSWDB", cmd_loadswdb, hlp_loadswdb }, { "KILLDIRMNGR",cmd_killdirmngr,hlp_killdirmngr }, { "RELOADDIRMNGR",cmd_reloaddirmngr,hlp_reloaddirmngr }, + { "FLUSHCRLS", cmd_flushcrls, hlp_flushcrls }, { NULL, NULL } }; int i, j, rc; ----------------------------------------------------------------------- Summary of changes: dirmngr/crlcache.c | 4 +++- dirmngr/server.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 13 02:17:51 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Tue, 13 Nov 2018 02:17:51 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.32-52-g8ed4853 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via 8ed48537de2b141a8f2050b15a65775374f1aa79 (commit) from b39b44b9acbed6d4889acba4fe9eae2556c80acc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8ed48537de2b141a8f2050b15a65775374f1aa79 Author: NIIBE Yutaka Date: Tue Nov 13 10:14:40 2018 +0900 gpgrt.m4: Don't support --with-*-prefix or SYSROOT. * src/gpgrt.m4: Remove old backward compatible support. -- Since this macro gpgrt.m4 has not yet been used by any, we can break now. The gpgrt-config script is for all hosts (switching by --libdir option), it's not switched by --with-*-prefix nor SYSROOT. Signed-off-by: NIIBE Yutaka diff --git a/src/gpgrt.m4 b/src/gpgrt.m4 index 55c3ff0..40fcd1f 100644 --- a/src/gpgrt.m4 +++ b/src/gpgrt.m4 @@ -10,8 +10,8 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # SPDX-License-Identifier: FSFULLR # -# Last-changed: 2018-11-02 -# Note: This is a kind of duplicate of gpg-error.m4 with uses the +# Last-changed: 2018-11-13 +# Note: This is a kind of duplicate of gpg-error.m4 which uses the # future name of libgpg-error to prepare for a smooth migration in # some distant time. @@ -22,53 +22,8 @@ dnl Test for libgpgrt and define GPGRT_CFLAGS, GPGRT_LIBS, dnl GPGRT_MT_CFLAGS, and GPGRT_MT_LIBS. The _MT_ variants are dnl used for programs requiring real multi thread support. dnl -dnl If a prefix option is not used, the config script is first -dnl searched in $SYSROOT/bin and then along $PATH. If the used -dnl config script does not match the host specification the script -dnl is added to the gpg_config_script_warn variable. -dnl AC_DEFUN([AM_PATH_GPGRT], [ AC_REQUIRE([AC_CANONICAL_HOST]) - gpgrt_config_prefix="" - dnl --with-libgpg-error-prefix=PFX is the preferred name for this option, - dnl since that is consistent with how our three siblings use the directory/ - dnl package name in --with-$dir_name-prefix=PFX. - AC_ARG_WITH(libgpg-error-prefix, - AC_HELP_STRING([--with-libgpg-error-prefix=PFX], - [prefix where GPG Error is installed (optional)]), - [gpgrt_config_prefix="$withval"]) - - dnl Accept --with-gpg-error-prefix and make it work the same as - dnl --with-libgpg-error-prefix above, for backwards compatibility, - dnl but do not document this old, inconsistently-named option. - AC_ARG_WITH(gpg-error-prefix,, - [gpgrt_config_prefix="$withval"]) - - dnl Also accept libgpgrt-prefix - AC_ARG_WITH(libgpgrt-prefix, - AC_HELP_STRING([--with-libgpgrt-prefix=PFX], - [prefix where GPG Runtime is installed (optional)]), - [gpgrt_config_prefix="$withval"]) - - if test x"${GPGRT_CONFIG}" = x ; then - if test x"${gpgrt_config_prefix}" != x ; then - GPGRT_CONFIG="${gpgrt_config_prefix}/bin/gpgrt-config" - else - case "${SYSROOT}" in - /*) - if test -x "${SYSROOT}/bin/gpgrt-config" ; then - GPGRT_CONFIG="${SYSROOT}/bin/gpgrt-config" - fi - ;; - '') - ;; - *) - AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) - ;; - esac - fi - fi - if test "$prefix" = NONE ; then prefix_option_expanded=/usr/local else @@ -136,11 +91,8 @@ AC_DEFUN([AM_PATH_GPGRT], if test x"$gpgrt_config_host" != x"$host" ; then AC_MSG_WARN([[ *** -*** The config script $GPGRT_CONFIG was -*** built for $gpgrt_config_host and thus may not match the -*** used host $host. -*** You may want to use the configure option --with-libgpgrt-prefix -*** to specify a matching config script or use \$SYSROOT. +*** The config script "$GPGRT_CONFIG" is for $gpgrt_config_host +*** and thus may not match the used host $host. ***]]) gpg_config_script_warn="$gpg_config_script_warn libgpgrt" fi ----------------------------------------------------------------------- Summary of changes: src/gpgrt.m4 | 56 ++++---------------------------------------------------- 1 file changed, 4 insertions(+), 52 deletions(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 13 03:19:58 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Tue, 13 Nov 2018 03:19:58 +0100 Subject: [git] Assuan - branch, master, updated. libassuan-2.5.1-24-g5e7988d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "IPC library used by GnuPG". The branch, master has been updated via 5e7988d2da3cdc36ebed3b598c0582028f3715ab (commit) from ea69c7126ff25d7d44950bf4a70467d577989a34 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5e7988d2da3cdc36ebed3b598c0582028f3715ab Author: NIIBE Yutaka Date: Tue Nov 13 09:34:56 2018 +0900 build: Update autogen.rc and autogen.sh. * autogen.sh: Update from libgpg-error, version 2018-07-10. * autogen.rc: Remove obsolete --with-gpg-error-prefix option. Signed-off-by: NIIBE Yutaka diff --git a/autogen.rc b/autogen.rc index 37e4321..b0284ac 100644 --- a/autogen.rc +++ b/autogen.rc @@ -2,15 +2,11 @@ case "$myhost" in w32) - configure_opts=" - --with-gpg-error-prefix=@SYSROOT@ - " + configure_opts="" ;; amd64) - configure_opts=" - --with-gpg-error-prefix=@SYSROOT@ - " + configure_opts="" ;; esac diff --git a/autogen.sh b/autogen.sh index e5ba5bf..9b36158 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,6 +1,6 @@ #! /bin/sh # autogen.sh -# Copyright (C) 2003, 2014, 2017 g10 Code GmbH +# Copyright (C) 2003, 2014, 2017, 2018 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: 2017-01-17 +# Version: 2018-07-10 configure_ac="configure.ac" @@ -74,7 +74,6 @@ PRINT_HOST=no PRINT_BUILD=no tmp=$(dirname "$0") tsdir=$(cd "${tmp}"; pwd) -version_parts=3 if [ -n "${AUTOGEN_SH_SILENT}" ]; then SILENT=" --silent" @@ -85,9 +84,10 @@ if test x"$1" = x"--help"; then echo " --silent Silent operation" echo " --force Pass --force to autoconf" echo " --find-version Helper for configure.ac" - echo " --build-TYPE Configure to cross build for TYPE" + 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" @@ -159,6 +159,10 @@ case "$1" in SILENT=" --silent" shift ;; + --git-build) + myhost="git-build" + shift + ;; --build-w32) myhost="w32" shift @@ -187,6 +191,25 @@ 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 male check" + die_p + exit 0 +fi +# **** end GIT BUILD **** + + # Source our configuration if [ -f "${tsdir}/autogen.rc" ]; then . "${tsdir}/autogen.rc" @@ -215,18 +238,15 @@ if [ "$myhost" = "find-version" ]; then exit 1 fi - case "$version_parts" in - 2) - matchstr1="$package-$major.[0-9]*" - matchstr2="$package-$major-base" - vers="$major.$minor" - ;; - *) - matchstr1="$package-$major.$minor.[0-9]*" - matchstr2="$package-$major.$minor-base" - vers="$major.$minor.$micro" - ;; - esac + if [ -z "$micro" ]; then + matchstr1="$package-$major.[0-9]*" + matchstr2="$package-$major-base" + vers="$major.$minor" + else + matchstr1="$package-$major.$minor.[0-9]*" + matchstr2="$package-$major.$minor-base" + vers="$major.$minor.$micro" + fi beta=no if [ -e .git ]; then @@ -467,6 +487,10 @@ 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 ----------------------------------------------------------------------- Summary of changes: autogen.rc | 8 ++------ autogen.sh | 56 ++++++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 42 insertions(+), 22 deletions(-) hooks/post-receive -- IPC library used by GnuPG http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 13 03:20:37 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Tue, 13 Nov 2018 03:20:37 +0100 Subject: [git] GCRYPT - branch, master, updated. libgcrypt-1.8.1-127-g8522453 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, master has been updated via 852245390ef7fd8ca9e36010886a4cf42cf710bf (commit) via bea193446351c24b10a4342466978d57bd53f599 (commit) from 3f76319803a4abcd33fa29a0ac39f8ed9d646226 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 852245390ef7fd8ca9e36010886a4cf42cf710bf Author: NIIBE Yutaka Date: Tue Nov 13 10:30:39 2018 +0900 libgcrypt.m4: Prefer gpgrt-config to SYSROOT support. * libgcrypt.m4: Move SYSROOT support after check of GPGRT_CONFIG. Signed-off-by: NIIBE Yutaka diff --git a/src/libgcrypt.m4 b/src/libgcrypt.m4 index 40ea01c..37dfbea 100644 --- a/src/libgcrypt.m4 +++ b/src/libgcrypt.m4 @@ -9,7 +9,7 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Last-changed: 2018-11-02 +# Last-changed: 2018-11-13 dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION, @@ -36,19 +36,6 @@ AC_DEFUN([AM_PATH_LIBGCRYPT], if test x"${LIBGCRYPT_CONFIG}" = x ; then if test x"${libgcrypt_config_prefix}" != x ; then LIBGCRYPT_CONFIG="${libgcrypt_config_prefix}/bin/libgcrypt-config" - else - case "${SYSROOT}" in - /*) - if test -x "${SYSROOT}/bin/libgcrypt-config" ; then - LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config" - fi - ;; - '') - ;; - *) - AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) - ;; - esac fi fi @@ -61,6 +48,20 @@ AC_DEFUN([AM_PATH_LIBGCRYPT], fi fi if test -z "$use_gpgrt_config"; then + if test x"${LIBGCRYPT_CONFIG}" = x ; then + case "${SYSROOT}" in + /*) + if test -x "${SYSROOT}/bin/libgcrypt-config" ; then + LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config" + fi + ;; + '') + ;; + *) + AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) + ;; + esac + fi AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no) fi commit bea193446351c24b10a4342466978d57bd53f599 Author: NIIBE Yutaka Date: Tue Nov 13 09:36:37 2018 +0900 build: Update autogen.rc. * autogen.rc: Remove obsolete --with-gpg-error-prefix option. Signed-off-by: NIIBE Yutaka diff --git a/autogen.rc b/autogen.rc index 09a9b9c..646f659 100644 --- a/autogen.rc +++ b/autogen.rc @@ -2,15 +2,11 @@ case "$myhost" in w32) - configure_opts=" - --with-gpg-error-prefix=@SYSROOT@ - " + configure_opts="" ;; amd64) - configure_opts=" - --with-gpg-error-prefix=@SYSROOT@ - " + configure_opts="" ;; esac ----------------------------------------------------------------------- Summary of changes: autogen.rc | 8 ++------ src/libgcrypt.m4 | 29 +++++++++++++++-------------- 2 files changed, 17 insertions(+), 20 deletions(-) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 13 03:21:09 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Tue, 13 Nov 2018 03:21:09 +0100 Subject: [git] KSBA - branch, master, updated. libksba-1.3.5-33-gc37cdbd Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "KSBA is a library to access X.509 certificates and CMS data.". The branch, master has been updated via c37cdbd0f1b4a682799e0661178e392227cca938 (commit) from 3f5dcb5ff6721b0c70c8b0e320e4fd58f1c2cada (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c37cdbd0f1b4a682799e0661178e392227cca938 Author: NIIBE Yutaka Date: Tue Nov 13 09:38:13 2018 +0900 build: Update autogen.rc. * autogen.rc: Remove obsolete --with-gpg-error-prefix option. Signed-off-by: NIIBE Yutaka diff --git a/autogen.rc b/autogen.rc index 850d4e7..396794a 100644 --- a/autogen.rc +++ b/autogen.rc @@ -11,15 +11,11 @@ esac case "$myhost" in w32) - configure_opts=" - --with-gpg-error-prefix=@SYSROOT@ - " + configure_opts="" ;; amd64) - configure_opts=" - --with-gpg-error-prefix=@SYSROOT@ - " + configure_opts="" ;; esac ----------------------------------------------------------------------- Summary of changes: autogen.rc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) hooks/post-receive -- KSBA is a library to access X.509 certificates and CMS data. http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 13 03:21:50 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Tue, 13 Nov 2018 03:21:50 +0100 Subject: [git] NTBTLS - branch, master, updated. ntbtls-0.1.2-20-g838f833 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Not Too Bad TLS". The branch, master has been updated via 838f83398d728031ea9cab1e7fed5950f4faefa5 (commit) via 1fbb2f544c145f271ea929b05b3d5d0399eaa16a (commit) via 005e61e7c20352e070f53edbe82b8a2338576b43 (commit) from ac406d38e49d4bbe2c6b41680abf7c717ce9b393 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 838f83398d728031ea9cab1e7fed5950f4faefa5 Author: NIIBE Yutaka Date: Tue Nov 13 11:01:51 2018 +0900 build: Update m4/libgcrypt.m4. * m4/libgcrypt.m4: Update libgcrypt master. Signed-off-by: NIIBE Yutaka diff --git a/m4/libgcrypt.m4 b/m4/libgcrypt.m4 index 40ea01c..37dfbea 100644 --- a/m4/libgcrypt.m4 +++ b/m4/libgcrypt.m4 @@ -9,7 +9,7 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Last-changed: 2018-11-02 +# Last-changed: 2018-11-13 dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION, @@ -36,19 +36,6 @@ AC_DEFUN([AM_PATH_LIBGCRYPT], if test x"${LIBGCRYPT_CONFIG}" = x ; then if test x"${libgcrypt_config_prefix}" != x ; then LIBGCRYPT_CONFIG="${libgcrypt_config_prefix}/bin/libgcrypt-config" - else - case "${SYSROOT}" in - /*) - if test -x "${SYSROOT}/bin/libgcrypt-config" ; then - LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config" - fi - ;; - '') - ;; - *) - AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) - ;; - esac fi fi @@ -61,6 +48,20 @@ AC_DEFUN([AM_PATH_LIBGCRYPT], fi fi if test -z "$use_gpgrt_config"; then + if test x"${LIBGCRYPT_CONFIG}" = x ; then + case "${SYSROOT}" in + /*) + if test -x "${SYSROOT}/bin/libgcrypt-config" ; then + LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config" + fi + ;; + '') + ;; + *) + AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) + ;; + esac + fi AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no) fi commit 1fbb2f544c145f271ea929b05b3d5d0399eaa16a Author: NIIBE Yutaka Date: Tue Nov 13 10:50:53 2018 +0900 ntbtls.m4: Prefer gpgrt-config to SYSROOT support. * src/ntbtls.m4: Move SYSROOT support after checking GPGRT_CONFIG. Signed-off-by: NIIBE Yutaka diff --git a/src/ntbtls.m4 b/src/ntbtls.m4 index 7bbd569..18b43d9 100644 --- a/src/ntbtls.m4 +++ b/src/ntbtls.m4 @@ -8,6 +8,8 @@ dnl dnl This file is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +dnl +dnl Last-changed: 2018-11-13 dnl AM_PATH_NTBTLS([MINIMUM-VERSION, @@ -30,19 +32,6 @@ AC_DEFUN([AM_PATH_NTBTLS], if test x"${NTBTLS_CONFIG}" = x ; then if test x"${ntbtls_config_prefix}" != x ; then NTBTLS_CONFIG="${ntbtls_config_prefix}/bin/ntbtls-config" - else - case "${SYSROOT}" in - /*) - if test -x "${SYSROOT}/bin/ntbtls-config" ; then - NTBTLS_CONFIG="${SYSROOT}/bin/ntbtls-config" - fi - ;; - '') - ;; - *) - AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) - ;; - esac fi fi @@ -55,6 +44,20 @@ AC_DEFUN([AM_PATH_NTBTLS], fi fi if test -z "$use_gpgrt_config"; then + if test x"${NTBTLS_CONFIG}" = x ; then + case "${SYSROOT}" in + /*) + if test -x "${SYSROOT}/bin/ntbtls-config" ; then + NTBTLS_CONFIG="${SYSROOT}/bin/ntbtls-config" + fi + ;; + '') + ;; + *) + AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) + ;; + esac + fi AC_PATH_PROG(NTBTLS_CONFIG, ntbtls-config, no) fi commit 005e61e7c20352e070f53edbe82b8a2338576b43 Author: NIIBE Yutaka Date: Tue Nov 13 10:49:03 2018 +0900 build: Update autogen.rc. * autogen.rc: Remove obsolete --with-gpg-error-prefix, --with-ksba-prefix, and --with-libgcrypt-prefix options. Signed-off-by: NIIBE Yutaka diff --git a/autogen.rc b/autogen.rc index a159fb8..f1d1504 100644 --- a/autogen.rc +++ b/autogen.rc @@ -11,9 +11,6 @@ esac case "$myhost" in w32) configure_opts=" - --with-gpg-error-prefix=@SYSROOT@ - --with-ksba-prefix=@SYSROOT@ - --with-libgcrypt-prefix=@SYSROOT@ --with-zlib=@SYSROOT@ " ;; ----------------------------------------------------------------------- Summary of changes: autogen.rc | 3 --- m4/libgcrypt.m4 | 29 +++++++++++++++-------------- src/ntbtls.m4 | 29 ++++++++++++++++------------- 3 files changed, 31 insertions(+), 30 deletions(-) hooks/post-receive -- Not Too Bad TLS http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 13 03:25:28 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Tue, 13 Nov 2018 03:25:28 +0100 Subject: [git] GCRYPT - branch, LIBGCRYPT-1.8-BRANCH, updated. libgcrypt-1.8.4-4-g4141caa Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, LIBGCRYPT-1.8-BRANCH has been updated via 4141caabe76ad092f3487b4516ee481fba837adb (commit) from 0216418ab23a690662764098a17002754202a2c2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4141caabe76ad092f3487b4516ee481fba837adb Author: NIIBE Yutaka Date: Tue Nov 13 11:24:32 2018 +0900 libgcrypt.m4: Update from master. * src/libgcrypt.m4: Update from master. Signed-off-by: NIIBE Yutaka diff --git a/src/libgcrypt.m4 b/src/libgcrypt.m4 index 2646e96..37dfbea 100644 --- a/src/libgcrypt.m4 +++ b/src/libgcrypt.m4 @@ -9,7 +9,7 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Last-changed: 2018-10-29 +# Last-changed: 2018-11-13 dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION, @@ -36,19 +36,6 @@ AC_DEFUN([AM_PATH_LIBGCRYPT], if test x"${LIBGCRYPT_CONFIG}" = x ; then if test x"${libgcrypt_config_prefix}" != x ; then LIBGCRYPT_CONFIG="${libgcrypt_config_prefix}/bin/libgcrypt-config" - else - case "${SYSROOT}" in - /*) - if test -x "${SYSROOT}/bin/libgcrypt-config" ; then - LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config" - fi - ;; - '') - ;; - *) - AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) - ;; - esac fi fi @@ -56,10 +43,25 @@ AC_DEFUN([AM_PATH_LIBGCRYPT], if test x"${LIBGCRYPT_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then if $GPGRT_CONFIG libgcrypt --exists; then LIBGCRYPT_CONFIG="$GPGRT_CONFIG libgcrypt" + AC_MSG_NOTICE([Use gpgrt-config as libgcrypt-config]) use_gpgrt_config=yes fi fi if test -z "$use_gpgrt_config"; then + if test x"${LIBGCRYPT_CONFIG}" = x ; then + case "${SYSROOT}" in + /*) + if test -x "${SYSROOT}/bin/libgcrypt-config" ; then + LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config" + fi + ;; + '') + ;; + *) + AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) + ;; + esac + fi AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no) fi ----------------------------------------------------------------------- Summary of changes: src/libgcrypt.m4 | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 13 03:39:33 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Tue, 13 Nov 2018 03:39:33 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-269-gd58fe69 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via d58fe697acefd435ec01503dae574d6c99dfedae (commit) from 678e4706ee614a6b7e543e2a80072d75405dd4db (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d58fe697acefd435ec01503dae574d6c99dfedae Author: NIIBE Yutaka Date: Tue Nov 13 11:37:37 2018 +0900 build: Update libgcrypt.m4 and ntbtls.m4. * m4/libgcrypt.m4: Update from master. * m4/ntbtls.m4: Update from master. Signed-off-by: NIIBE Yutaka diff --git a/m4/libgcrypt.m4 b/m4/libgcrypt.m4 index 40ea01c..37dfbea 100644 --- a/m4/libgcrypt.m4 +++ b/m4/libgcrypt.m4 @@ -9,7 +9,7 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Last-changed: 2018-11-02 +# Last-changed: 2018-11-13 dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION, @@ -36,19 +36,6 @@ AC_DEFUN([AM_PATH_LIBGCRYPT], if test x"${LIBGCRYPT_CONFIG}" = x ; then if test x"${libgcrypt_config_prefix}" != x ; then LIBGCRYPT_CONFIG="${libgcrypt_config_prefix}/bin/libgcrypt-config" - else - case "${SYSROOT}" in - /*) - if test -x "${SYSROOT}/bin/libgcrypt-config" ; then - LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config" - fi - ;; - '') - ;; - *) - AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) - ;; - esac fi fi @@ -61,6 +48,20 @@ AC_DEFUN([AM_PATH_LIBGCRYPT], fi fi if test -z "$use_gpgrt_config"; then + if test x"${LIBGCRYPT_CONFIG}" = x ; then + case "${SYSROOT}" in + /*) + if test -x "${SYSROOT}/bin/libgcrypt-config" ; then + LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config" + fi + ;; + '') + ;; + *) + AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) + ;; + esac + fi AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no) fi diff --git a/m4/ntbtls.m4 b/m4/ntbtls.m4 index 7bbd569..18b43d9 100644 --- a/m4/ntbtls.m4 +++ b/m4/ntbtls.m4 @@ -8,6 +8,8 @@ dnl dnl This file is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +dnl +dnl Last-changed: 2018-11-13 dnl AM_PATH_NTBTLS([MINIMUM-VERSION, @@ -30,19 +32,6 @@ AC_DEFUN([AM_PATH_NTBTLS], if test x"${NTBTLS_CONFIG}" = x ; then if test x"${ntbtls_config_prefix}" != x ; then NTBTLS_CONFIG="${ntbtls_config_prefix}/bin/ntbtls-config" - else - case "${SYSROOT}" in - /*) - if test -x "${SYSROOT}/bin/ntbtls-config" ; then - NTBTLS_CONFIG="${SYSROOT}/bin/ntbtls-config" - fi - ;; - '') - ;; - *) - AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) - ;; - esac fi fi @@ -55,6 +44,20 @@ AC_DEFUN([AM_PATH_NTBTLS], fi fi if test -z "$use_gpgrt_config"; then + if test x"${NTBTLS_CONFIG}" = x ; then + case "${SYSROOT}" in + /*) + if test -x "${SYSROOT}/bin/ntbtls-config" ; then + NTBTLS_CONFIG="${SYSROOT}/bin/ntbtls-config" + fi + ;; + '') + ;; + *) + AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) + ;; + esac + fi AC_PATH_PROG(NTBTLS_CONFIG, ntbtls-config, no) fi ----------------------------------------------------------------------- Summary of changes: m4/libgcrypt.m4 | 29 +++++++++++++++-------------- m4/ntbtls.m4 | 29 ++++++++++++++++------------- 2 files changed, 31 insertions(+), 27 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 13 03:46:23 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Tue, 13 Nov 2018 03:46:23 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-53-gc4aa4af Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via c4aa4af50f3102b251cfff9c9755e2dde8d1bd1f (commit) from 895176f42af3a1b13614f15dd537a426bb4ac16a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c4aa4af50f3102b251cfff9c9755e2dde8d1bd1f Author: NIIBE Yutaka Date: Tue Nov 13 11:44:24 2018 +0900 build: Update gpg-error.m4 and libassuan.m4. * m4/gpg-error.m4: Update from master. * m4/libassuan.m4: Update from master. Signed-off-by: NIIBE Yutaka diff --git a/m4/gpg-error.m4 b/m4/gpg-error.m4 index 8ba24b7..a9d572f 100644 --- a/m4/gpg-error.m4 +++ b/m4/gpg-error.m4 @@ -1,5 +1,5 @@ # gpg-error.m4 - autoconf macro to detect libgpg-error. -# Copyright (C) 2002, 2003, 2004, 2011, 2014 g10 Code GmbH +# Copyright (C) 2002, 2003, 2004, 2011, 2014, 2018 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 @@ -9,7 +9,7 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Last-changed: 2014-10-02 +# Last-changed: 2018-11-02 dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION, @@ -17,7 +17,7 @@ dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) dnl dnl Test for libgpg-error and define GPG_ERROR_CFLAGS, GPG_ERROR_LIBS, dnl GPG_ERROR_MT_CFLAGS, and GPG_ERROR_MT_LIBS. The _MT_ variants are -dnl used for programs requiring real multi thread support. +dnl used for programs requireing real multi thread support. dnl dnl If a prefix option is not used, the config script is first dnl searched in $SYSROOT/bin and then along $PATH. If the used @@ -61,16 +61,55 @@ AC_DEFUN([AM_PATH_GPG_ERROR], fi AC_PATH_PROG(GPG_ERROR_CONFIG, gpg-error-config, no) - min_gpg_error_version=ifelse([$1], ,0.0,$1) - AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version) + min_gpg_error_version=ifelse([$1], ,1.33,$1) ok=no - if test "$GPG_ERROR_CONFIG" != "no" \ - && test -f "$GPG_ERROR_CONFIG" ; then + + if test "$prefix" = NONE ; then + prefix_option_expanded=/usr/local + else + prefix_option_expanded="$prefix" + fi + if test "$exec_prefix" = NONE ; then + exec_prefix_option_expanded=$prefix_option_expanded + else + exec_prefix_option_expanded=$(prefix=$prefix_option_expanded eval echo $exec_prefix) + fi + libdir_option_expanded=$(prefix=$prefix_option_expanded exec_prefix=$exec_prefix_option_expanded eval echo $libdir) + + if test -f $libdir_option_expanded/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$libdir_option_expanded + else + if crt1_path=$(${CC:-cc} -print-file-name=crt1.o 2>/dev/null); then + if possible_libdir=$(cd ${crt1_path%/*} && pwd 2>/dev/null); then + if test -f $possible_libdir/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$possible_libdir + fi + fi + fi + fi + + if test "$GPG_ERROR_CONFIG" = "no" -a -n "$gpgrt_libdir"; then + AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) + if test "$GPGRT_CONFIG" = "no"; then + unset GPGRT_CONFIG + else + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" + if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then + GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" + AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) + gpg_error_config_version=`$GPG_ERROR_CONFIG --modversion` + else + unset GPGRT_CONFIG + fi + fi + else + gpg_error_config_version=`$GPG_ERROR_CONFIG --version` + fi + if test "$GPG_ERROR_CONFIG" != "no"; then req_major=`echo $min_gpg_error_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` req_minor=`echo $min_gpg_error_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` - gpg_error_config_version=`$GPG_ERROR_CONFIG $gpg_error_config_args --version` major=`echo $gpg_error_config_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` minor=`echo $gpg_error_config_version | \ @@ -84,23 +123,51 @@ AC_DEFUN([AM_PATH_GPG_ERROR], fi fi fi + if test -z "$GPGRT_CONFIG" -a -n "$gpgrt_libdir"; then + if test "$major" -gt 1 -o "$major" -eq 1 -a "$minor" -ge 33; then + AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) + if test "$GPGRT_CONFIG" = "no"; then + unset GPGRT_CONFIG + else + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" + if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then + GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" + AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) + else + unset GPGRT_CONFIG + fi + fi + fi + fi fi + AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version) if test $ok = yes; then - GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --cflags` - GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --libs` - GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --mt --cflags 2>/dev/null` - GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --mt --libs 2>/dev/null` + GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG --cflags` + GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG --libs` + if test -z "$GPGRT_CONFIG"; then + GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG --mt --cflags 2>/dev/null` + GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG --mt --libs 2>/dev/null` + else + GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG --variable=mtcflags 2>/dev/null` + GPG_ERROR_MT_CFLAGS="$GPG_ERROR_CFLAGS${GPG_ERROR_CFLAGS:+ }$GPG_ERROR_MT_CFLAGS" + GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG --variable=mtlibs 2>/dev/null` + GPG_ERROR_MT_LIBS="$GPG_ERROR_LIBS${GPG_ERROR_LIBS:+ }$GPG_ERROR_MT_LIBS" + fi AC_MSG_RESULT([yes ($gpg_error_config_version)]) ifelse([$2], , :, [$2]) - gpg_error_config_host=`$GPG_ERROR_CONFIG $gpg_error_config_args --host 2>/dev/null || echo none` + if test -z "$GPGRT_CONFIG"; then + gpg_error_config_host=`$GPG_ERROR_CONFIG --host 2>/dev/null || echo none` + else + gpg_error_config_host=`$GPG_ERROR_CONFIG --variable=host 2>/dev/null || echo none` + fi if test x"$gpg_error_config_host" != xnone ; then if test x"$gpg_error_config_host" != x"$host" ; then AC_MSG_WARN([[ *** -*** The config script $GPG_ERROR_CONFIG was +*** The config script "$GPG_ERROR_CONFIG" was *** built for $gpg_error_config_host and thus may not match the *** used host $host. -*** You may want to use the configure option --with-gpg-error-prefix +*** You may want to use the configure option --with-libgpg-error-prefix *** to specify a matching config script or use \$SYSROOT. ***]]) gpg_config_script_warn="$gpg_config_script_warn libgpg-error" diff --git a/m4/libassuan.m4 b/m4/libassuan.m4 index 4b196a5..4af2d04 100644 --- a/m4/libassuan.m4 +++ b/m4/libassuan.m4 @@ -8,6 +8,7 @@ dnl dnl This file is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +dnl SPDX-License-Identifier: FSFULLR dnl dnl Common code used for libassuan detection [internal] @@ -20,13 +21,22 @@ AC_DEFUN([_AM_PATH_LIBASSUAN_COMMON], [prefix where LIBASSUAN is installed (optional)]), libassuan_config_prefix="$withval", libassuan_config_prefix="") if test x$libassuan_config_prefix != x ; then - libassuan_config_args="$libassuan_config_args --prefix=$libassuan_config_prefix" if test x${LIBASSUAN_CONFIG+set} != xset ; then LIBASSUAN_CONFIG=$libassuan_config_prefix/bin/libassuan-config fi fi - AC_PATH_TOOL(LIBASSUAN_CONFIG, libassuan-config, no) + use_gpgrt_config="" + if test x"${LIBASSUAN_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then + if $GPGRT_CONFIG libassuan --exists; then + LIBASSUAN_CONFIG="$GPGRT_CONFIG libassuan" + AC_MSG_NOTICE([Use gpgrt-config as libassuan-config]) + use_gpgrt_config=yes + fi + fi + if test -z "$use_gpgrt_config"; then + AC_PATH_PROG(LIBASSUAN_CONFIG, libassuan-config, no) + fi tmp=ifelse([$1], ,1:0.9.2,$1) if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then @@ -39,8 +49,7 @@ AC_DEFUN([_AM_PATH_LIBASSUAN_COMMON], AC_MSG_CHECKING(for LIBASSUAN - version >= $min_libassuan_version) ok=no - if test "$LIBASSUAN_CONFIG" != "no" \ - && test -f "$LIBASSUAN_CONFIG" ; then + if test "$LIBASSUAN_CONFIG" != "no"; then req_major=`echo $min_libassuan_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` req_minor=`echo $min_libassuan_version | \ @@ -48,7 +57,11 @@ AC_DEFUN([_AM_PATH_LIBASSUAN_COMMON], req_micro=`echo $min_libassuan_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` - libassuan_config_version=`$LIBASSUAN_CONFIG --version` + if test -z "$use_gpgrt_config"; then + libassuan_config_version=`$LIBASSUAN_CONFIG --version` + else + libassuan_config_version=`$LIBASSUAN_CONFIG --modversion` + fi major=`echo $libassuan_config_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` minor=`echo $libassuan_config_version | \ @@ -58,7 +71,7 @@ AC_DEFUN([_AM_PATH_LIBASSUAN_COMMON], if test "$major" -gt "$req_major"; then ok=yes - else + else if test "$major" -eq "$req_major"; then if test "$minor" -gt "$req_minor"; then ok=yes @@ -81,7 +94,11 @@ AC_DEFUN([_AM_PATH_LIBASSUAN_COMMON], if test $ok = yes; then if test "$req_libassuan_api" -gt 0 ; then - tmp=`$LIBASSUAN_CONFIG --api-version 2>/dev/null || echo 0` + if test -z "$use_gpgrt_config"; then + tmp=`$LIBASSUAN_CONFIG --api-version 2>/dev/null || echo 0` + else + tmp=`$LIBASSUAN_CONFIG --variable=api_version 2>/dev/null || echo 0` + fi if test "$tmp" -gt 0 ; then AC_MSG_CHECKING([LIBASSUAN API version]) if test "$req_libassuan_api" -eq "$tmp" ; then @@ -96,12 +113,16 @@ AC_DEFUN([_AM_PATH_LIBASSUAN_COMMON], if test $ok = yes; then if test x"$host" != x ; then - libassuan_config_host=`$LIBASSUAN_CONFIG --host 2>/dev/null || echo none` + if test -z "$use_gpgrt_config"; then + libassuan_config_host=`$LIBASSUAN_CONFIG --host 2>/dev/null || echo none` + else + libassuan_config_host=`$LIBASSUAN_CONFIG --variable=host 2>/dev/null || echo none` + fi if test x"$libassuan_config_host" != xnone ; then if test x"$libassuan_config_host" != x"$host" ; then AC_MSG_WARN([[ *** -*** The config script $LIBASSUAN_CONFIG was +*** The config script "$LIBASSUAN_CONFIG" was *** built for $libassuan_config_host and thus may not match the *** used host $host. *** You may want to use the configure option --with-libassuan-prefix @@ -137,8 +158,8 @@ dnl AC_DEFUN([AM_PATH_LIBASSUAN], [ _AM_PATH_LIBASSUAN_COMMON($1) if test $ok = yes; then - LIBASSUAN_CFLAGS=`$LIBASSUAN_CONFIG $libassuan_config_args --cflags` - LIBASSUAN_LIBS=`$LIBASSUAN_CONFIG $libassuan_config_args --libs` + LIBASSUAN_CFLAGS=`$LIBASSUAN_CONFIG --cflags` + LIBASSUAN_LIBS=`$LIBASSUAN_CONFIG --libs` ifelse([$2], , :, [$2]) else LIBASSUAN_CFLAGS="" ----------------------------------------------------------------------- Summary of changes: m4/gpg-error.m4 | 97 ++++++++++++++++++++++++++++++++++++++++++++++++--------- m4/libassuan.m4 | 43 ++++++++++++++++++------- 2 files changed, 114 insertions(+), 26 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 13 04:01:53 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Tue, 13 Nov 2018 04:01:53 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.32-53-g4b41cf3 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via 4b41cf3bd16c8afcb4ba152ab9d5d679a7cb91e7 (commit) from 8ed48537de2b141a8f2050b15a65775374f1aa79 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4b41cf3bd16c8afcb4ba152ab9d5d679a7cb91e7 Author: NIIBE Yutaka Date: Tue Nov 13 11:50:26 2018 +0900 Fix typo in the annotation. * src/init.c [DLL_EXPORT] (DllMain): Fix typo. Signed-off-by: NIIBE Yutaka diff --git a/src/init.c b/src/init.c index 81ebd0f..f104ec4 100644 --- a/src/init.c +++ b/src/init.c @@ -580,7 +580,7 @@ DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved) /* If we have not constructors (e.g. MSC) we call it here. */ _gpg_w32__init_gettext_module (); #endif - /* falltru. */ + /* fallthru. */ case DLL_THREAD_ATTACH: tls = LocalAlloc (LPTR, sizeof *tls); if (!tls) ----------------------------------------------------------------------- Summary of changes: src/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 13 09:15:20 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 13 Nov 2018 09:15:20 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-270-gb3a70b6 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via b3a70b67f33d3fd0c68dfe474285fb2b8b4ab134 (commit) from d58fe697acefd435ec01503dae574d6c99dfedae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b3a70b67f33d3fd0c68dfe474285fb2b8b4ab134 Author: Werner Koch Date: Mon Nov 12 18:13:31 2018 +0100 po: Clarify a translator's note. -- diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c index 048443a..3716e11 100644 --- a/agent/call-pinentry.c +++ b/agent/call-pinentry.c @@ -501,14 +501,16 @@ start_pinentry (ctrl_t ctrl) { /* Provide a few default strings for use by the pinentries. This - may help a pinentry to avoid implementing localization code. */ + * may help a pinentry to avoid implementing localization code. + * Note that gpg-agent has been set to utf-8 so that the strings + * are in the expected encoding. */ static const struct { const char *key, *value; int what; } tbl[] = { - /* TRANSLATORS: These are labels for buttons etc used in - Pinentries. An underscore indicates that the next letter - should be used as an accelerator. Double the underscore for - a literal one. The actual to be translated text starts after - the second vertical bar. Note that gpg-agent has been set to - utf-8 so that the strings are in the expected encoding. */ + /* TRANSLATORS: These are labels for buttons etc as used in + * Pinentries. In your translation copy the text before the + * second vertical bar verbatim; translate only the following + * text. An underscore indicates that the next letter should be + * used as an accelerator. Double the underscore to have + * pinentry display a literal underscore. */ { "ok", N_("|pinentry-label|_OK") }, { "cancel", N_("|pinentry-label|_Cancel") }, { "yes", N_("|pinentry-label|_Yes") }, ----------------------------------------------------------------------- Summary of changes: agent/call-pinentry.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 13 10:11:00 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 13 Nov 2018 10:11:00 +0100 Subject: [git] gnupg-doc - branch, master, updated. 08110351458a09797d0cf5ff53766c000560905f Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GnuPG website and other docs". The branch, master has been updated via 08110351458a09797d0cf5ff53766c000560905f (commit) from ca9070dd6f5092724b212b8bfcd0b81d8f6cc583 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 08110351458a09797d0cf5ff53766c000560905f Author: Andre Heinecke Date: Tue Nov 13 10:08:46 2018 +0100 swdb: Gpg4win-3.1.5 and GpgOL-2.3.2 -- diff --git a/web/swdb.mac b/web/swdb.mac index e9aadc3..b7ecd28 100644 --- a/web/swdb.mac +++ b/web/swdb.mac @@ -51,17 +51,17 @@ # # Gpg4win # -#+macro: gpg4win_ver 3.1.4 -#+macro: gpg4win_date 2018-10-18 -#+macro: gpg4win_src_size 5300k -#+macro: gpg4win_src_sha1 89ea985720b7b891b20822b60335f5920c86c478 -#+macro: gpg4win_src_sha2 eb68cfd593f12c50cc92aaaf616a3325a80beb8f60637e67a3296f687ab8b446 -#+macro: gpg4win_exe_size 27800k -#+macro: gpg4win_exe_sha1 64194f372418b879a708ce7cd3ff7ca8606e993c -#+macro: gpg4win_exe_sha2 0cf87835a914cb6fd1bcb32e8beee995b5da35c513f627356685c389df1be6cb -#+macro: gpg4win_isrc_size 223374k -#+macro: gpg4win_isrc_sha1 316dd82b75ef3b6d77bb56567d17e94e07ec9128 -#+macro: gpg4win_isrc_sha2 aae3f8ac81dd7d928778d3075a1b9bb0b20c4b5e29e96014a39503e1f4b5e5a7 +#+macro: gpg4win_ver 3.1.5 +#+macro: gpg4win_date 2018-11-13 +#+macro: gpg4win_src_size 5301k +#+macro: gpg4win_src_sha1 7bd3343f76a1d7df2d1d565cf3d1ede959286a4d +#+macro: gpg4win_src_sha2 456143b0542557701a5dbb96240e818573b00afadeb9e7eee194343ff4b839e4 +#+macro: gpg4win_exe_size 27820k +#+macro: gpg4win_exe_sha1 675b2261029ba54486eac08c9ac0fe09c7f1626c +#+macro: gpg4win_exe_sha2 4749ab2d02d384abc2b0fd045c86380e6f840b540a2081e6c0f7d538a3397b23 +#+macro: gpg4win_isrc_size 223311k +#+macro: gpg4win_isrc_sha1 7ff481557428ebc37fc91518375d6239540a7c74 +#+macro: gpg4win_isrc_sha2 5ee57522b0da38e3f4ed80e3e6262d7fc6a557b52e7cd42ec32a01db6d1889f1 # @@ -181,11 +181,11 @@ # # GpgOL # -#+macro: gpgol_ver 2.3.1 -#+macro: gpgol_date 2018-10-16 -#+macro: gpgol_size 759k -#+macro: gpgol_sha1 6c9dd34acc5b343b5dcca03b89de467e0ae59618 -#+macro: gpgol_sha2 2b2b4ef08fda8103cfbdcb3d988081d5d6c9ae6e8021bd2d237da1257efd5dc5 +#+macro: gpgol_ver 2.3.2 +#+macro: gpgol_date 2018-11-12 +#+macro: gpgol_size 766k +#+macro: gpgol_sha1 b2d48f17b2cf20f6c55b98dbad1f14ac6e3adfc4 +#+macro: gpgol_sha2 6c298c7a8787e0796a1984d3c1e948b55b9fff685dff3fe7e9d3012001b5b85f # ----------------------------------------------------------------------- Summary of changes: web/swdb.mac | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) hooks/post-receive -- The GnuPG website and other docs http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 13 10:57:50 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 13 Nov 2018 10:57:50 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-2.3.2-2-g287eaa6 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 287eaa69c04c8fbbf6f135c3f23f78cf15e77a9e (commit) from 42b022f076e6f131e01c966ee74b7bcf870b8025 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 287eaa69c04c8fbbf6f135c3f23f78cf15e77a9e Author: Andre Heinecke Date: Tue Nov 13 10:56:58 2018 +0100 Fix log_addins and use it to log all addins * src/mailitem-events.cpp (Read): call log_addins once. * src/oomhelp.cpp (log_addins): Fix by invoking directly. diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp index 0bac718..b251229 100644 --- a/src/mailitem-events.cpp +++ b/src/mailitem-events.cpp @@ -106,6 +106,7 @@ MailItemEvents::~MailItemEvents() static bool propchangeWarnShown = false; static bool attachRemoveWarnShown = false; +static bool addinsLogged = false; static DWORD WINAPI do_delayed_locate (LPVOID arg) @@ -191,6 +192,13 @@ EVENT_SINK_INVOKE(MailItemEvents) { log_oom ("%s:%s: Read : %p", SRCNAME, __func__, m_mail); + if (!addinsLogged) + { + // We do it here as this nearly always comes and we want to remove + // as much as possible from the startup time. + log_addins (); + addinsLogged = true; + } if (!m_mail->isCryptoMail ()) { log_debug ("%s:%s: Non crypto mail %p opened. Updating sigstatus.", diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp index ace525a..205eec5 100644 --- a/src/oomhelp.cpp +++ b/src/oomhelp.cpp @@ -2661,15 +2661,46 @@ log_addins () int count = get_oom_int (addins, "Count"); for (int i = 1; i <= count; i++) { - std::string item = std::string ("Item(") + std::to_string (i) + ")"; + VARIANT aVariant[1]; + VARIANT rVariant; + + VariantInit (&rVariant); + DISPPARAMS dispparams; + + dispparams.rgvarg = aVariant; + dispparams.rgvarg[0].vt = VT_INT; + dispparams.rgvarg[0].intVal = i; + dispparams.cArgs = 1; + dispparams.cNamedArgs = 0; + + /* We need this instead of get_oom_object item(1) as usual becase + the item method accepts a string or an int. String would + be the ProgID and int is just the index. So Fun. */ + if (invoke_oom_method_with_parms_type (addins, "Item", &rVariant, + &dispparams, + DISPATCH_METHOD | + DISPATCH_PROPERTYGET)) + { + log_error ("%s:%s: Failed to invoke item func.", + SRCNAME, __func__); + continue; + } + + if (rVariant.vt != (VT_DISPATCH)) + { + log_error ("%s:%s: Invalid ret val", + SRCNAME, __func__); + continue; + } - LPDISPATCH addin = get_oom_object (addins, item.c_str ()); + LPDISPATCH addin = rVariant.pdispVal; if (!addin) { TRACEPOINT; continue; } + memdbg_addRef (addin); bool connected = get_oom_bool (addin, "Connect"); if (!connected) { ----------------------------------------------------------------------- Summary of changes: src/mailitem-events.cpp | 8 ++++++++ src/oomhelp.cpp | 35 +++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 13 11:35:51 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 13 Nov 2018 11:35:51 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-271-g914fa3b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 914fa3be22bf8848a97a7dd405a040d6ef31e2fd (commit) from b3a70b67f33d3fd0c68dfe474285fb2b8b4ab134 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 914fa3be22bf8848a97a7dd405a040d6ef31e2fd Author: Werner Koch Date: Tue Nov 13 11:35:39 2018 +0100 dirmngr: Support the new WKD draft with the openpgpkey subdomain. * dirmngr/server.c (proc_wkd_get): Implement new openpgpkey subdomain method. Signed-off-by: Werner Koch diff --git a/dirmngr/dns-stuff.c b/dirmngr/dns-stuff.c index f86ccb0..7aa07c7 100644 --- a/dirmngr/dns-stuff.c +++ b/dirmngr/dns-stuff.c @@ -1056,16 +1056,17 @@ resolve_name_standard (ctrl_t ctrl, const char *name, unsigned short port, /* This a wrapper around getaddrinfo with slightly different semantics. - NAME is the name to resolve. - PORT is the requested port or 0. - WANT_FAMILY is either 0 (AF_UNSPEC), AF_INET6, or AF_INET4. - WANT_SOCKETTYPE is either SOCK_STREAM or SOCK_DGRAM. - - On success the result is stored in a linked list with the head - stored at the address R_AI; the caller must call gpg_addrinfo_free - on this. If R_CANONNAME is not NULL the official name of the host - is stored there as a malloced string; if that name is not available - NULL is stored. */ + * NAME is the name to resolve. + * PORT is the requested port or 0. + * WANT_FAMILY is either 0 (AF_UNSPEC), AF_INET6, or AF_INET4. + * WANT_SOCKETTYPE is either 0 for any socket type + * or SOCK_STREAM or SOCK_DGRAM. + * + * On success the result is stored in a linked list with the head + * stored at the address R_AI; the caller must call free_dns_addrinfo + * on this. If R_CANONNAME is not NULL the official name of the host + * is stored there as a malloced string; if that name is not available + * NULL is stored. */ gpg_error_t resolve_dns_name (ctrl_t ctrl, const char *name, unsigned short port, int want_family, int want_socktype, diff --git a/dirmngr/domaininfo.c b/dirmngr/domaininfo.c index a2effff..f6263b0 100644 --- a/dirmngr/domaininfo.c +++ b/dirmngr/domaininfo.c @@ -119,7 +119,7 @@ domaininfo_print_stats (void) } -/* Return true if DOMAIN definitely does not support WKD. Noet that +/* Return true if DOMAIN definitely does not support WKD. Note that * DOMAIN is expected to be lowercase. */ int domaininfo_is_wkd_not_supported (const char *domain) diff --git a/dirmngr/server.c b/dirmngr/server.c index ac25620..4a24253 100644 --- a/dirmngr/server.c +++ b/dirmngr/server.c @@ -837,8 +837,11 @@ proc_wkd_get (ctrl_t ctrl, assuan_context_t ctx, char *line) gpg_error_t err = 0; char *mbox = NULL; char *domainbuf = NULL; - char *domain; /* Points to mbox or domainbuf. */ - char *domain_orig;/* Points to mbox. */ + char *domain; /* Points to mbox or domainbuf. This is used to + * connect to the host. */ + char *domain_orig;/* Points to mbox. This is the used for the + * query; i.e. the domain part of the + * addrspec. */ char sha1buf[20]; char *uri = NULL; char *encodedhash = NULL; @@ -847,6 +850,7 @@ proc_wkd_get (ctrl_t ctrl, assuan_context_t ctx, char *line) int is_wkd_query; /* True if this is a real WKD query. */ int no_log = 0; char portstr[20] = { 0 }; + int subdomain_mode = 0; opt_submission_addr = has_option (line, "--submission-address"); opt_policy_flags = has_option (line, "--policy-flags"); @@ -864,7 +868,8 @@ proc_wkd_get (ctrl_t ctrl, assuan_context_t ctx, char *line) *domain++ = 0; domain_orig = domain; - /* First check whether we already know that the domain does not + + /* Let's check whether we already know that the domain does not * support WKD. */ if (is_wkd_query) { @@ -875,8 +880,41 @@ proc_wkd_get (ctrl_t ctrl, assuan_context_t ctx, char *line) } } - /* Check for SRV records. */ - if (1) + + /* First try the new "openpgp" subdomain. We check that the domain + * is valid because it is later used as an unescaped filename part + * of the URI. */ + if (is_valid_domain_name (domain_orig)) + { + dns_addrinfo_t aibuf; + + domainbuf = strconcat ( "openpgpkey.", domain_orig, NULL); + if (!domainbuf) + { + err = gpg_error_from_syserror (); + goto leave; + } + + /* FIXME: We should put a cache into dns-stuff because the same + * query (with a different port and socket type, though) will be + * done later by http function. */ + err = resolve_dns_name (ctrl, domainbuf, 0, 0, 0, &aibuf, NULL); + if (err) + { + err = 0; + xfree (domainbuf); + domainbuf = NULL; + } + else /* Got a subdomain. */ + { + free_dns_addrinfo (aibuf); + subdomain_mode = 1; + domain = domainbuf; + } + } + + /* Check for SRV records unless we have a subdomain. */ + if (!subdomain_mode) { struct srventry *srvs; unsigned int srvscount; @@ -931,6 +969,7 @@ proc_wkd_get (ctrl_t ctrl, assuan_context_t ctx, char *line) xfree (srvs); } + /* Prepare the hash of the local part. */ gcry_md_hash_buffer (GCRY_MD_SHA1, sha1buf, mbox, strlen (mbox)); encodedhash = zb32_encode (sha1buf, 8*20); if (!encodedhash) @@ -944,7 +983,10 @@ proc_wkd_get (ctrl_t ctrl, assuan_context_t ctx, char *line) uri = strconcat ("https://", domain, portstr, - "/.well-known/openpgpkey/submission-address", + "/.well-known/openpgpkey/", + subdomain_mode? domain_orig : "", + subdomain_mode? "/" : "", + "submission-address", NULL); } else if (opt_policy_flags) @@ -952,7 +994,10 @@ proc_wkd_get (ctrl_t ctrl, assuan_context_t ctx, char *line) uri = strconcat ("https://", domain, portstr, - "/.well-known/openpgpkey/policy", + "/.well-known/openpgpkey/", + subdomain_mode? domain_orig : "", + subdomain_mode? "/" : "", + "policy", NULL); } else @@ -965,7 +1010,10 @@ proc_wkd_get (ctrl_t ctrl, assuan_context_t ctx, char *line) uri = strconcat ("https://", domain, portstr, - "/.well-known/openpgpkey/hu/", + "/.well-known/openpgpkey/", + subdomain_mode? domain_orig : "", + subdomain_mode? "/" : "", + "hu/", encodedhash, "?l=", escapedmbox, ----------------------------------------------------------------------- Summary of changes: dirmngr/dns-stuff.c | 21 +++++++++-------- dirmngr/domaininfo.c | 2 +- dirmngr/server.c | 64 +++++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 68 insertions(+), 19 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 13 14:47:01 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 13 Nov 2018 14:47:01 +0100 Subject: [git] gnupg-doc - branch, master, updated. 7fba4187a5ef41114d8d8a357bedffae5e7243ff Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GnuPG website and other docs". The branch, master has been updated via 7fba4187a5ef41114d8d8a357bedffae5e7243ff (commit) via d7ea67d4682a9529c7948bcb1cfbafe78ebda346 (commit) from 08110351458a09797d0cf5ff53766c000560905f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7fba4187a5ef41114d8d8a357bedffae5e7243ff Author: Werner Koch Date: Tue Nov 13 14:46:34 2018 +0100 drafts,openpgp-webkey-service: Remove ununsed RFC reference. diff --git a/misc/id/openpgp-webkey-service/draft.org b/misc/id/openpgp-webkey-service/draft.org index e9ab38e..e2a5a99 100644 --- a/misc/id/openpgp-webkey-service/draft.org +++ b/misc/id/openpgp-webkey-service/draft.org @@ -11,7 +11,6 @@ - @@ -60,7 +59,6 @@ &rfc.2119; - &rfc.2782; &rfc.3156; &rfc.4880; &rfc.5785; commit d7ea67d4682a9529c7948bcb1cfbafe78ebda346 Author: Werner Koch Date: Tue Nov 13 13:06:49 2018 +0100 drafts,openpgp-webkey-service: Publish revision -07 diff --git a/.gitignore b/.gitignore index aa50428..31ad99b 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ scratch/ .DS_Store ._.DS_Store default.profraw +/misc/id/openpgp-webkey-service/draft.xml diff --git a/misc/id/openpgp-webkey-service/draft-koch-openpgp-webkey-service-07.txt b/misc/id/openpgp-webkey-service/draft-koch-openpgp-webkey-service-07.txt new file mode 100644 index 0000000..1e13663 --- /dev/null +++ b/misc/id/openpgp-webkey-service/draft-koch-openpgp-webkey-service-07.txt @@ -0,0 +1,1008 @@ + + + + +Network Working Group W. Koch +Internet-Draft GnuPG e.V. +Intended status: Informational November 13, 2018 +Expires: May 17, 2019 + + + OpenPGP Web Key Directory + draft-koch-openpgp-webkey-service-07 + +Abstract + + This specification describes a service to locate OpenPGP keys by mail + address using a Web service and the HTTPS protocol. It also provides + a method for secure communication between the key owner and the mail + provider to publish and revoke the public key. + +Status of This Memo + + This Internet-Draft is submitted in full conformance with the + provisions of BCP 78 and BCP 79. + + Internet-Drafts are working documents of the Internet Engineering + Task Force (IETF). Note that other groups may also distribute + working documents as Internet-Drafts. The list of current Internet- + Drafts is at http://datatracker.ietf.org/drafts/current/. + + Internet-Drafts are draft documents valid for a maximum of six months + and may be updated, replaced, or obsoleted by other documents at any + time. It is inappropriate to use Internet-Drafts as reference + material or to cite them other than as "work in progress." + + This Internet-Draft will expire on May 17, 2019. + +Copyright Notice + + Copyright (c) 2018 IETF Trust and the persons identified as the + document authors. All rights reserved. + + This document is subject to BCP 78 and the IETF Trust's Legal + Provisions Relating to IETF Documents + (http://trustee.ietf.org/license-info) in effect on the date of + publication of this document. Please review these documents + carefully, as they describe your rights and restrictions with respect + to this document. Code Components extracted from this document must + include Simplified BSD License text as described in Section 4.e of + the Trust Legal Provisions and are provided without warranty as + described in the Simplified BSD License. + + + + +Koch Expires May 17, 2019 [Page 1] + +Internet-Draft OpenPGP Web Key Directory November 2018 + + +Table of Contents + + 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 + 2. Notational Conventions . . . . . . . . . . . . . . . . . . . 2 + 3. Web Key Directory . . . . . . . . . . . . . . . . . . . . . . 2 + 3.1. Key Discovery . . . . . . . . . . . . . . . . . . . . . . 3 + 4. Web Key Directory Update Protocol . . . . . . . . . . . . . . 5 + 4.1. The Submission Address . . . . . . . . . . . . . . . . . 7 + 4.2. The Submission Mail . . . . . . . . . . . . . . . . . . . 7 + 4.3. The Confirmation Request . . . . . . . . . . . . . . . . 7 + 4.4. The Confirmation Response . . . . . . . . . . . . . . . . 9 + 4.5. Policy Flags . . . . . . . . . . . . . . . . . . . . . . 10 + 5. Security Considerations . . . . . . . . . . . . . . . . . . . 11 + 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11 + 6.1. Well-Known URI . . . . . . . . . . . . . . . . . . . . . 11 + 7. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 12 + 8. Normative References . . . . . . . . . . . . . . . . . . . . 12 + Appendix A. Sample Protocol Run . . . . . . . . . . . . . . . . 12 + A.1. Sample Keys . . . . . . . . . . . . . . . . . . . . . . . 13 + A.2. Sample Messages . . . . . . . . . . . . . . . . . . . . . 13 + Appendix B. Changes Since -06 . . . . . . . . . . . . . . . . . 17 + Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 18 + +1. Introduction + + This memo describes a method to associate OpenPGP keys with a mail + address and how to look them up using a web service with a well-known + URI. In addition a mail based protocol is given to allow a client to + setup such an association and to maintain it. + +2. Notational Conventions + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", + "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this + document are to be interpreted as described in [RFC2119]. + +3. Web Key Directory + + A major use case for OpenPGP is the encryption of mail. A common + difficulty of sending encrypted mails to a new communication partner + is to find the appropriate public key of the recipient. Unless an + off-channel key exchange has been done, there are no easy ways to + discover the required key. The common practice is to search the + network of public key servers for a key matching the recipient's mail + address. This practise bears the problem that the keyservers are not + able to give a positive confirmation that a key actually belongs to + the mail addresses given in the key. Further, there are often + several keys matching a mail address and thus one needs to pick a key + + + +Koch Expires May 17, 2019 [Page 2] + +Internet-Draft OpenPGP Web Key Directory November 2018 + + + on good luck. This is clearly not a secure way to setup an end-to- + end encryption. Even if the need for a trusted key for an initial + mail message is relinquished, a non-authenticated key may be a wrong + one and the actual recipient would receive a mail which she can't + decrypt, due to the use of a wrong key. + + Methods to overcome this problem are + + o sending an initial unencrypted message with the public key + attached, + + o using the OpenPGP DANE protocol to lookup the recipients key via + the DNS. + + The first method has the obvious problems of not even trying to + encrypt the initial mail, an extra mail round-trip, and problems with + unattended key discovery. + + The latter method works fine but requires that mail providers need to + set up a separate DNS resolver to provide the key. The + administration of a DNS zone is often not in the hands of small mail + installations. Thus an update of the DNS resource records needs to + be delegated to the ISP running the DNS service. Further, DNS + lookups are not encrypted and missing all confidentially. Even if + the participating MUAs are using STARTTLS to encrypt the mail + exchange, a DNS lookup for the key unnecessarily identifies the + local-part of the recipients mail address to any passive + eavesdroppers. + + This memo specified a new method for key discovery using an encrypted + https connection. + +3.1. Key Discovery + + Although URIs are able to encode all kind of characters, + straightforward implementations of a key directory may want to store + the local-part of a mail address directly in the file system. This + forbids the use of certain characters in the local-part. To allow + for such an implementation method the URI uses an encoded form of the + local-part which can be directly mapped to a file name. + + OpenPGP defines its User IDs, and thus the mail address, as UTF-8 + strings. To help with the common pattern of using capitalized names + (e.g. "Joe.Doe at example.org") for mail addresses, and under the + premise that almost all MTAs treat the local-part case-insensitive + and that the domain-part is required to be compared case-insensitive + anyway, all upper-case ASCII characters in a User ID are mapped to + lowercase. Non-ASCII characters are not changed. + + + +Koch Expires May 17, 2019 [Page 3] + +Internet-Draft OpenPGP Web Key Directory November 2018 + + + The so mapped local-part is hashed using the SHA-1 algorithm. The + resulting 160 bit digest is encoded using the Z-Base-32 method as + described in [RFC6189], section 5.1.6. The resulting string has a + fixed length of 32 octets. + + There are two variants on how to form the request URI: The advanced + and the direct method. Implementations MUST first try the advanced + method. Only if the required sub-domain does not exist, they SHOULD + fall back to the direct method. + + The advanced method requires a sub-domain with the fixed name + "openpgpkey" is created and queried. It constructs the URI from the + concatenation of these items: + + o The scheme "https://", + + o the domain-part, + + o the string "/.well-known/openpgpkey/", + + o the domain-part in lowercase, + + o the string "/hu/", + + o the above constructed 32 octet string, + + o the unchanged local-part as a parameter with name "l" using proper + percent escaping. + + An example for such an advanced method URI to lookup the key for + Joe.Doe at Example.ORG is: + + https://openpgpkey.example.org/.well-known/openpgpkey/ + example.org/hu/iy9q119eutrkn8s1mk4r39qejnbu3n5q?l=Joe.Doe + + (line has been wrapped for rendering purposes) + + The direct method requires no additional DNS entries and constructs + the URI from the concatenation of these items: + + o The scheme "https://", + + o the domain-part, + + o the string "/.well-known/openpgpkey/hu/", + + o the above constructed 32 octet string, + + + + +Koch Expires May 17, 2019 [Page 4] + +Internet-Draft OpenPGP Web Key Directory November 2018 + + + o the unchanged local-part as a parameter with name "l" using proper + percent escaping. + + Example for a direct method URI: + + https://example.org/.well-known/openpgpkey/ + hu/iy9q119eutrkn8s1mk4r39qejnbu3n5q?l=Joe.Doe + + (line has been wrapped for rendering purposes) + + The HTTP GET method MUST return the binary representation of the + OpenPGP key for the given mail address. The key needs to carry a + User ID packet ([RFC4880]) with that mail address. Note that the key + may be revoked or expired - it is up to the client to handle such + conditions. To ease distribution of revoked keys, a server may + return revoked keys in addition to a new key. The keys are returned + by a single request as concatenated key blocks. + + The server MUST accept the HTTP HEAD method to allow a client to + check for the existence of a key. + + The server SHOULD use "application/octet-stream" as the Content-Type + for the data but clients SHOULD also accept any other Content-Type. + The server MUST NOT return an ASCII armored version of the key. + + The server MUST serve a Policy Flags file as specified below. That + file is even required if the Web Key Directory Update Protocol is not + supported. + + The benefit of the advanced method is its greater flexibility in + setting up the Web Key Directory in environments where more than one + mail domain is hosted. DNS SRV resource records, as used in earlier + specifications of this protocol, posed a problem for implementations + which have only limited access to DNS resolvers. The direct method + is kept for backward compatibility and to allow providing a Web Key + Directory even with without DNS change requirements. + +4. Web Key Directory Update Protocol + + To put keys into the key directory a protocol to automate the task is + desirable. The protocol defined here is entirely based on mail and + the assumption that a mail provider can securely deliver mail to the + INBOX of a user (e.g. an IMAP folder). Note that the same protocol + may also be used for submitting keys for use with OpenPGP DANE. + + In the following sections the term "target key" denotes the to be + published key, the term "submission key" the key associated with the + submission-address of the mail provider. The string "WELLKNOWN" + + + +Koch Expires May 17, 2019 [Page 5] + +Internet-Draft OpenPGP Web Key Directory November 2018 + + + denotes the first part of an URI specific for a domain. In the + examples the domain "example.org" is assumed, thus: + + WELLKNOWN := https://openpgpkey.example.org/.well-known/ + example.org/openpgpkey + + (line has been wrapped for rendering purposes) + + or if the sub-domain "opengpgkey" does not exist (direct method): + + WELLKNOWN := https://example.org/.well-known/openpgpkey + + We assume that the user already created a key for her mail account + alice at example.org. To install the key at her provider's Web Key + Directory, she performs the following steps: + + 1. She retrieves a file which contains one line with the mail + address used to submit the key to the mail provider. The DNS SRV + rules described for the Web Key Directory apply here as well. + See below for the syntax of that file. For a mail address at the + domain "example.org" the URI of the file is + + WELLKNOWN/submission-address + + 2. She sends her key using SMTP (or any other transport mechanism) + to the provider using the submission address and key format as + specified by PGP/MIME. + + 3. The provider checks that the received key has a User ID which + matches an account name of the provider. + + 4. The provider sends an encrypted message containing a nonce and + the fingerprint of the key to the mail account of the user. Note + that a similar scheme is used by the well known caff(1) tool to + help with key signing parties. + + 5. A legitimate user will be able to decrypt the message because she + created the key and is in charge of the private key. This step + verifies that the submitted key has actually been created by the + owner of the account. + + 6. The user sends the decrypted nonce back to the submission address + as a confirmation that the private key is owned by her and that + the provider may now publish the key. Although technically not + required, it is suggested that the mail to the provider is + encrypted. The public key for this is retrieved using the key + lookup protocol described above. + + + + +Koch Expires May 17, 2019 [Page 6] + +Internet-Draft OpenPGP Web Key Directory November 2018 + + + 7. The provider receives the nonce, matches it with its database of + pending confirmations and then publishes the key. Finally the + provider sends a mail back to the user to notify her of the + publication of her key. + + The message data structures used for the above protocol are specified + in detail below. + +4.1. The Submission Address + + The address of the submission file is + + WELLKNOWN/submission-address + + The file consists of exactly one line, terminated by a LF, or the + sequence of CR and LF, with the full mail address to be used for + submission of a key to the mail provider. For example the content of + the file may be + + key-submission-example.org at directory.example.org + +4.2. The Submission Mail + + The mail used to submit a key to the mail provider MUST comply to the + PGP/MIME specification ([RFC3156], section 7), which states that the + Content-Type must be "application/pgp-keys", there are no required or + optional parameters, and the body part contains the ASCII-armored + transferable Public Key Packets as defined in [RFC4880], section + 11.1. + + The mail provider MUST publish a key capable of signing and + encryption for the submission-address in the Web Key Directory or via + DANE. The key to be published MUST be submitted using a PGP/MIME + encrypted message ([RFC3156], section 4). The message MUST NOT be + signed (because the authenticity of the signing key has not yet been + confirmed). After decryption of the message at the mail provider a + single "application/pgp-keys" part, as specified above, is expected. + +4.3. The Confirmation Request + + The mail provider sends a confirmation mail in response to a received + key publication request. The message MUST be sent from the + submission-address of the mail provider to the mail address extracted + from the target key. The message needs to be a PGP/MIME signed + message using the submission key of the provider for the signature. + The signed message MUST have two parts: + + + + + +Koch Expires May 17, 2019 [Page 7] + +Internet-Draft OpenPGP Web Key Directory November 2018 + + + The first part MUST have "text" as its Content-Type and can be used + to explain the purpose of the mail. For example it may point to this + RFC and explain on how to manually perform the protocol. + + The second part MUST have "application/vnd.gnupg.wkd" if the protocol + version of the server is 5 or later; without a known protocol version + or a version less than 5, "application/vnd.gnupg.wks" MUST be used as + its Content-Type and carry an OpenPGP encrypted message in ASCII + Armor format. The message MUST be encrypted to the target key and + MUST NOT be signed. After decryption a text file in the Web Key data + format must be yielded. + + That data format consists of name-value pairs with one name-value + pair per LF or CR+LF terminated line. Empty lines are allowed and + will be ignored by the receiver. A colon is used to terminate a + name. + + In a confirmation request the following names MUST be send in the + specified order: + + o "type": The value must be "confirmation-request". + + o "sender": This is the mailbox the user is expected to sent the + confirmation response to. The value must match the mailbox part + of the "From:" address of this request. Exactly one address MUST + be given. + + o "address": The value is the addr-spec part of the target key's + mail address. The value SHOULD match the addr-spec part of the + recipient's address. The value MUST be UTF-8 encoded as required + for an OpenPGP User ID. + + o "fingerprint": The value is the fingerprint of the target key. + The fingerprint is given in uppercase hex encoding without any + interleaving spaces. + + o "nonce": The value is a string with a minimum length of 16 octets + and a maximum length of 64 octets. The string must entirely be + made up of random ASCII letters or digits. This nonce will be + sent back to the mail provider as proof that the recipient is the + legitimate owner of the target-key. + + The receiver of that message is expected to verify the outer + signature and disregard the entire message if it can't be verified or + has not been signed by the key associated with the submission + address. + + + + + +Koch Expires May 17, 2019 [Page 8] + +Internet-Draft OpenPGP Web Key Directory November 2018 + + + After the message as been verified the receiver decrypts the second + part of the message, checks that the "fingerprint" matches the target + key, checks that the "address" matches a User ID of the target key, + and checks the other constrains of the request format. If any + constraint is not asserted, or the fingerprint or User ID do not + match the target key, or there is no pending publication requests + (i.e. a mail recently sent o the submission address), the user MAY be + notified about this fake confirmation attempt. + + In other cases the confirmation request is legitimate and the MUA + shall silently send a response as described in the next section. + + The rationale for the outer signature used with this request is to + allow early detection of spam mails. This can be done prior to the + decryption step and avoids asking the user to enter a passphrase to + perform the decryption for a non-legitimate message. The use of a + simple encrypted attachment, instead of using PGP/MIME encryption, is + to convey the Content-Type of that attachment in the clear and also + to prevent automatic decryption of that attachment by PGP/MIME aware + clients. The MUA may in fact detect this confirmation request and + present a customized dialog for confirming that request. + +4.4. The Confirmation Response + + A response to a confirmation request MUST only be send in the + positive case; there is no negative confirmation response. A mail + service provider is expected to cancel a pending key submission after + a suitable time without a confirmation. The mail service provider + SHOULD NOT retry the sending of a confirmation request after the + first request has been send successfully. + + The user MUST send the confirmation response from her target mail + address to the "from" address of the confirmation request. The + message MUST be signed and encrypted using the PGP/MIME Combined + format ([RFC3156], section 6.2). The signing key is the target key + and the encryption key is the key associated with the provider's + submission address. + + The Content-Type used for the plaintext message MUST match the + Content-Type of the request. The format is the same as described + above for the Confirmation Request. The body must contain three + name-value pairs in this order: + + o "type": The value must be "confirmation-response". + + o "sender": The value must match the mailbox part of the "From:" + address of this response. Exactly one address MUST be given. + + + + +Koch Expires May 17, 2019 [Page 9] + +Internet-Draft OpenPGP Web Key Directory November 2018 + + + o "nonce": The value is the value of the "nonce" parameter from the + confirmation request. + +4.5. Policy Flags + + For key generation and submission it is useful to tell the client + about certain properties of the mail provider in advance. This can + be done with a file at the URL + + WELLKNOWN/policy + + A site supporting the Web Key Directory MUST serve this file; it is + sufficient if that file has a zero length. Clients may use this file + to check for Web Key Directory support. + + The file contains keywords and optionally values, one per line with + each line terminated by a LF or the sequence of CR and LF. Empty + lines and lines starting with a '#' character are considered comment + lines. A keyword is made up of lowercase letters, digits, hyphens, + or dots. An underscore is allowed as a name space delimiters; see + below. The first character must be a letter. Keywords which are + defined to require a value are directly followed by a colon and then + after optional white space the value. Clients MUST use case- + insensitive matching for the keyword. + + Currently defined keywords are: + + o "mailbox-only": The mail server provider does only accept keys + with only a mailbox in the User ID. In particular User IDs with a + real name in addition to the mailbox will be rejected as invalid. + + o "dane-only": The mail server provider does not run a Web Key + Directory but only an OpenPGP DANE service. The Web Key Directory + Update protocol is used to update the keys for the DANE service. + + o "auth-submit": The submission of the mail to the server is done + using an authenticated connection. Thus the submitted key will be + published immediately without any confirmation request. + + o "protocol-version": This keyword can be used to explicitly claim + the support of a specific version of the Web Key Directory update + protocol. This is in general not needed but implementations may + have workarounds for providers which only support an old protocol + version. If these providers update to a newer version they should + add this keyword so that the implementation can disable the + workaround. The value is an integer corresponding to the + respective draft revision number. + + + + +Koch Expires May 17, 2019 [Page 10] + +Internet-Draft OpenPGP Web Key Directory November 2018 + + + o "submission-address": An alternative way to specify the submission + address. The value is the addr-spec part of the address to send + requests to this server. If this keyword is used in addition to + the "submission-address" file, both MUST have the same value. + + More keywords will be defined in updates to this I-D. There is no + registry except for this document. For experimental use of new + features or for provider specific settings, keywords MUST be prefixed + with a domain name and an underscore. + +5. Security Considerations + + The use of SHA-1 for the mapping of the local-part to a fixed string + is not a security feature but merely used to map the local-part to a + fixed-sized string made from a well defined set of characters. It is + not intended to conceal information about a mail address. + + The domain name part of the mail address is not part of the hash to + avoid problems with internationalized domain names. Instead a + separate URL is required for each domain name. + + The use of DNS SRV records reduces the certainty that a mail address + belongs to a domain. For example an attacker may change the target + to a host in a sub-domain under their control and thus gain full + control over all keys. An implementation may want to weight the + certainty of a mapping different if it has been retrieved via a sub- + domain and in particular if a non-recommended name is used for the + sub-domain. + + To make it a bit harder to test for published keys, the server + responsible to serve the WELLKNOWN directory SHOULD NOT create an + index file for that directory or any sub-directory. + + The mail provider MUST make sure to filter a key in a way that only + the User ID belonging to that user is returned and that confirmation + requests are only send for such User IDs. It is further recommended + that a client filters the key for a publication requests so that only + a key with the specific User ID of the provider is send. + +6. IANA Considerations + +6.1. Well-Known URI + + IANA is requested to assign a well-known URI in the "Well-Known URIs" + registry as defined by [RFC5785]: + + URI suffix: openpgpkey + + + + +Koch Expires May 17, 2019 [Page 11] + +Internet-Draft OpenPGP Web Key Directory November 2018 + + + Change controller: IETF + + Specification document: This + +7. Acknowledgments + + The author would like to acknowledge the help of the individuals who + kindly voiced their opinions on the GnuPG mailing lists, in + particular, the help of Bernhard Reiter and Guilhem Moulin. + +8. Normative References + + [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate + Requirement Levels", BCP 14, RFC 2119, March 1997. + + [RFC2782] Gulbrandsen, A., Vixie, P., and L. Esibov, "A DNS RR for + specifying the location of services (DNS SRV)", RFC 2782, + DOI 10.17487/RFC2782, February 2000, . + + [RFC3156] Elkins, M., Del Torto, D., Levien, R., and T. Roessler, + "MIME Security with OpenPGP", RFC 3156, August 2001. + + [RFC4880] Callas, J., Donnerhacke, L., Finney, H., Shaw, D., and R. + Thayer, "OpenPGP Message Format", RFC 4880, November 2007. + + [RFC5785] Nottingham, M. and E. Hammer-Lahav, "Defining Well-Known + Uniform Resource Identifiers (URIs)", RFC 5785, DOI + 10.17487/RFC5785, April 2010, + . + + [RFC6189] Zimmermann, P., Johnston, A., Ed., and J. Callas, "ZRTP: + Media Path Key Agreement for Unicast Secure RTP", RFC + 6189, DOI 10.17487/RFC6189, April 2011, + . + +Appendix A. Sample Protocol Run + + The following non-normative example can be used by implementors as + guidance. + + Note that GnuPG version 2.1.12 supports the key discovery described + in version -00 of this document (auto-key-locate method "wkd"). + Version 2.1.16 can run the protocol described in this document but is + also able to run the protocol version specified by -01. For backward + compatibility this example uses the Content-Type as required for + versions of this protocol prior to -04; if the client knows that the + server support -04 "vnd.gnupg.wkd" should be used. + + + +Koch Expires May 17, 2019 [Page 12] + +Internet-Draft OpenPGP Web Key Directory November 2018 + + +A.1. Sample Keys + + This is the provider's submission key: + + -----BEGIN PGP PRIVATE KEY BLOCK----- + + lFgEV/TAohYJKwYBBAHaRw8BAQdAB/k9YQfSTI8qQqqK1KimH/BsvzsowWItSQPT + FP+fOC4AAP46uJ3Snno3Vy+kORye3rf0VvWvuz82voEQLxG6WpfHhREEtBprZXkt + c3VibWlzc2lvbkBleGFtcGxlLm5ldIh5BBMWCAAhBQJX9MCiAhsDBQsJCAcCBhUI + CQoLAgQWAgMBAh4BAheAAAoJEKhtNooW0cqEWMUA/0e9XaeptszWC9ZvPg8INL6a + BvRqPBYGU7PGmuXsxBovAQDyckOykG0UAfHVyN1w4gSK/biMcnqVr857i8/HuvjW + C5xdBFf0wKISCisGAQQBl1UBBQEBB0Apvaoe4MtSEJ1fpds/4DFl2kXXBpnVji/s + Wg9btdthNQMBCAcAAP9FJX99T1LEJzBnvBBnc6bimnT6/1OKM9RdO4R0/uVP6BFL + iGEEGBYIAAkFAlf0wKICGwwACgkQqG02ihbRyoTlGwD9FBr92osjL7HkhhZZ7Z2D + My3b9zpoZeMjvPg5YPqpdKMA/jhZoHuZCRMBYf7YRFb8aXtuyetDFZYrkjnum+OG + HFAD + =Hnwd + -----END PGP PRIVATE KEY BLOCK----- + + This is the target key to be published: + + -----BEGIN PGP PRIVATE KEY BLOCK----- + + lFgEV2o9XRYJKwYBBAHaRw8BAQdAZ8zkuQDL9x7rcvvoo6s3iEF1j88Dknd9nZhL + nTEoBRkAAP94nCZMM4WY2IORXfM6phLGSz3RsHvs/vA1Opaus4+R3BKJtBtwYXRy + aWNlLmx1bXVtYmFAZXhhbXBsZS5uZXSIeQQTFggAIQUCV2o9XQIbAwULCQgHAgYV + CAkKCwIEFgIDAQIeAQIXgAAKCRATlWNoKgINCpkNAQDFDcwJUzsxu7aJUiPdpYXj + 4uVarrXakxEE8mGFotWhLAD9GH4rqLDYIE3NKEU0s+Okt4tEIwJaV8H1NNPPPMiK + 3g2cXQRXaj2NEgorBgEEAZdVAQUBAQdAFnnmZc99TuKk5iCq9wmYZUVF2RcXN2Cs + qAl8iGQQUWsDAQgHAAD/VN/VGmlcwGBPcLTya2hfU4t37nMcFCKdNSXjJ5DFA0AP + PohhBBgWCAAJBQJXaj2NAhsMAAoJEBOVY2gqAg0Ky4UA/0GmVaXzXemLvv1Xw4yx + Eaz/KfKKGc4RJ+38fyqUzw8NAQCohQ+ki3I5f84EXLZEiUiLsnVtOn1HNxvND/gW + TiFZBA== + =GHi7 + -----END PGP PRIVATE KEY BLOCK----- + +A.2. Sample Messages + + The first message triggeres the publication requests. + + + + + + + + + + + + +Koch Expires May 17, 2019 [Page 13] + +Internet-Draft OpenPGP Web Key Directory November 2018 + + + From: patrice.lumumba at example.net + To: key-submission at example.net + Subject: Key publishing request + MIME-Version: 1.0 + Content-Type: multipart/encrypted; + protocol="application/pgp-encrypted"; + boundary="=-=01-e8k41e11ob31eefa36wo=-=" + Date: Wed, 05 Oct 2016 10:15:51 +0000 + + + --=-=01-e8k41e11ob31eefa36wo=-= + Content-Type: application/pgp-encrypted + + Version: 1 + + --=-=01-e8k41e11ob31eefa36wo=-= + Content-Type: application/octet-stream + + -----BEGIN PGP MESSAGE----- + + hF4DUgLY5tvmW2sSAQdAR1AcqvFpQe/fHRZbf0xcnl9Tb+AtwaX2yZnZXGELGHsw + 1/e3E0JptwM5tpRAVe71ooF8Zq4jl76ZgQKfj/SyjpLJxyoEDy2N5wTQaqW4JtML + 0ukB1vh7dIRDxBJX/LQIJC0wz8o1Q3vjcLJKFFvDb7YrerABpPIzwOAupcgIbQHj + 5m1+2WU5CL8ffyJy2h1jV2X4OnvWF1Sn6J6SVD6DfZpOPRt9TxSemJrN1LJ3lG0N + ts8AuYmCOeC1H2r5TYyxqkC98JF8+Nvyxd/fwne8IOjK9uixkNMC5H9/ZOH0YWCb + wBnNB4iXuym4OIPxiLkDymsVF0ww/XrODE9Y259EGmO45VFNrJAX3HFs9/PcMCVk + n2qMyEkr8LHiXeEPun6Z54RHUPYv2cUkEZ0hhSJ+rtBxkc/5D/cAScCEXRKFSKEF + jLJAvLK/u/ga5DAzVai+vh6b6Bq+YVPaD9GWMhWj4CgR90p9LULi6S/Hzwhv9Wzf + 8fJoJOaDjyvRDgr09jYLWamxkS9NWxqwy6MXJvxwbNdd5XtqiW4Y4o0Ll1hDJhxR + ljn/XvotXKwhKN+4QGhIXDVt4Dl4XxS5ptWfVTau8W8DYqDsU2obEcfsirZv53M1 + Q9FCD8CD9+dkBt8VAJekCWVhEltcRHxlrznbk2jxm93xSD2o6gZ5X0VSaSUXyEhm + J+8F3gyTHGgbq/TgyjFoockWh5EtGgAFuWvmPJCF5PO/UaNeoKwgwSJBu6oTXkHx + R4nvvMRcj5UgTsKpZ79NiDQukbjG5ScNT5TCUiiZsBXBqBx3fD61EH6cAuh4P3Kr + iM7PY4fwAHo890Dx+Qlt + =WIhx + -----END PGP MESSAGE----- + + --=-=01-e8k41e11ob31eefa36wo=-=-- + + The server decrypts this message to + + + + + + + + + + + +Koch Expires May 17, 2019 [Page 14] + +Internet-Draft OpenPGP Web Key Directory November 2018 + + + Content-Type: application/pgp-keys + + -----BEGIN PGP PUBLIC KEY BLOCK----- + + mDMEV2o9XRYJKwYBBAHaRw8BAQdAZ8zkuQDL9x7rcvvoo6s3iEF1j88Dknd9nZhL + nTEoBRm0G3BhdHJpY2UubHVtdW1iYUBleGFtcGxlLm5ldIh5BBMWCAAhBQJXaj1d + AhsDBQsJCAcCBhUICQoLAgQWAgMBAh4BAheAAAoJEBOVY2gqAg0KmQ0BAMUNzAlT + OzG7tolSI92lhePi5VqutdqTEQTyYYWi1aEsAP0YfiuosNggTc0oRTSz46S3i0Qj + AlpXwfU00888yIreDbg4BFdqPY0SCisGAQQBl1UBBQEBB0AWeeZlz31O4qTmIKr3 + CZhlRUXZFxc3YKyoCXyIZBBRawMBCAeIYQQYFggACQUCV2o9jQIbDAAKCRATlWNo + KgINCsuFAP9BplWl813pi779V8OMsRGs/ynyihnOESft/H8qlM8PDQEAqIUPpIty + OX/OBFy2RIlIi7J1bTp9RzcbzQ/4Fk4hWQQ= + =qRfF + -----END PGP PUBLIC KEY BLOCK----- + + and returns this confirmation request + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Koch Expires May 17, 2019 [Page 15] + +Internet-Draft OpenPGP Web Key Directory November 2018 + + + From: key-submission at example.net + To: patrice.lumumba at example.net + Subject: Confirm your key publication + MIME-Version: 1.0 + Content-Type: multipart/encrypted; + protocol="application/pgp-encrypted"; + boundary="=-=01-wrzqued738dfx4x97u7y=-=" + Date: Wed, 05 Oct 2016 10:16:57 +0000 + + + --=-=01-wrzqued738dfx4x97u7y=-= + Content-Type: application/pgp-encrypted + + Version: 1 + + --=-=01-wrzqued738dfx4x97u7y=-= + Content-Type: application/octet-stream + + -----BEGIN PGP MESSAGE----- + + hF4DkYWHjk/NdMASAQdAluQeqhECpU2T0zEyBAEbFzhLkpubN160wjkFCrtUc0Mw + FwYgM2fp9cvTMdJ/xjkvmAcIEOT4AY/hn1yFQ4z0KG0gCkSac+8mkDylnPdxlXYw + 0sBSAXlbqpVA7eUpFuU2Zs10zbIXxlwe6osR5wUIJut/RCOsYQmfvxC55x8mUX5/ + zgTnNzlMzye5ws4pTgAeQm2x0Yv018L8IZgY5KxwJLBzlss0wLZ45ZcS80hR11Fx + NCow1fKF8lMnOJxagTEOih807nctz8vT5bR1gx0d7N3LM+th8nAg9/6Ghf1XTpLo + MzwGW0FtOG7Dg1Uxbw2bjaOuRBeh6IIpmNAw1pmIfnNu7PpoRydU5w1K/R8MT06z + MKdJ7IW5mVGes9EGnG3e4mjuILvNaZhfYy+a73IhDSaPm3oqdl1Qx7tbNg6lGjn6 + KStCYAcPGPp3m7aWkfsPGThOVRhEXqaFFywfwSVEj1pdIRjDFA== + =Cdjh + -----END PGP MESSAGE----- + + --=-=01-wrzqued738dfx4x97u7y=-=-- + + The client decrypts the attachment as + + Content-Type: application/vnd.gnupg.wks + Content-Transfer-Encoding: 8bit + + type: confirmation-request + sender: key-submission at example.net + address: patrice.lumumba at example.net + fingerprint: B21DEAB4F875FB3DA42F1D1D139563682A020D0A + nonce: f5pscz57zj6fk11wekk8gx4cmrb659a7 + + creates this response + + + + + + +Koch Expires May 17, 2019 [Page 16] + +Internet-Draft OpenPGP Web Key Directory November 2018 + + + Content-Type: application/vnd.gnupg.wks + Content-Transfer-Encoding: 8bit + + type: confirmation-response + sender: key-submission at example.net + address: patrice.lumumba at example.net + nonce: f5pscz57zj6fk11wekk8gx4cmrb659a7 + + and sends it encrypted to the server + + From: patrice.lumumba at example.net + To: key-submission at example.net + Subject: Key publication confirmation + MIME-Version: 1.0 + Content-Type: multipart/encrypted; + protocol="application/pgp-encrypted"; + boundary="=-=01-iacqg4og4pqz11a5cg1o=-=" + Date: Wed, 05 Oct 2016 10:18:52 +0000 + + + --=-=01-iacqg4og4pqz11a5cg1o=-= + Content-Type: application/pgp-encrypted + + Version: 1 + + --=-=01-iacqg4og4pqz11a5cg1o=-= + Content-Type: application/octet-stream + + -----BEGIN PGP MESSAGE----- + + hF4DUgLY5tvmW2sSAQdAnB1C3PMjS4AsGU0qaCqBdWQO5i6blWEyZrEsY+JZY1Qw + ooNq7zdVWOHhL9LPGAALAgoL3Qfz+dN2u5QamSQ/LJ2c8M0XipNs3lqlNH63yQN1 + 0sAmAc3W8xkwul+rf6OLK/gMi6WzM4fnUhd4D1LJGIJoNUN0l3636C7ecOt2lkMl + 5bVAYg/SyMT3ymyfQnvtiem2T5DSnPsS1g6n6QNXWvkqvX9yGxNsNDJEHTuGJB8k + OJoRlfWQTEo6pgA89febWl1EdeM1pPLstQ2uZE8NPjXoY1nMxAlu+iPYsR41/4sg + dqwOv5BPLh/GIat8hh9SPWCA9iKlgSQ/EIv5DpjQogEzpriT55dkgfvSVYIAcOdO + ShZ91YKkcZffevdY72omqTk10a1SUXehPooIlRFmroDsi3VDaRKrUIo= + =7uve + -----END PGP MESSAGE----- + + --=-=01-iacqg4og4pqz11a5cg1o=-=-- + +Appendix B. Changes Since -06 + + o Specify the advanced method with the openpgpkey sub-domain. + + o Specify the l=LOCAL-PART query parameter. + + + + +Koch Expires May 17, 2019 [Page 17] + +Internet-Draft OpenPGP Web Key Directory November 2018 + + + o Require the provider to filter the key for publication. + + o Drop the use of DNS SRV records. + +Author's Address + + Werner Koch + GnuPG e.V. + Rochusstr. 44 + 40479 Duesseldorf + Germany + + Email: wk at gnupg.org + URI: https://gnupg.org/verein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Koch Expires May 17, 2019 [Page 18] diff --git a/misc/id/openpgp-webkey-service/draft.org b/misc/id/openpgp-webkey-service/draft.org index f000e82..e9ab38e 100644 --- a/misc/id/openpgp-webkey-service/draft.org +++ b/misc/id/openpgp-webkey-service/draft.org @@ -20,7 +20,7 @@ ]> + docName="draft-koch-openpgp-webkey-service-07"> @@ -35,12 +35,17 @@ fullname="Werner Koch"> GnuPG e.V.
+ + Rochusstr. 44 + 40479 Duesseldorf + Germany + wk at gnupg.org https://gnupg.org/verein
- + Security @@ -150,35 +155,52 @@ Non-ASCII characters are not changed. The so mapped local-part is hashed using the SHA-1 algorithm. The resulting 160 bit digest is encoded using the Z-Base-32 method as described in {{{RFC(6189)}}}, section 5.1.6. The resulting string has -a fixed length of 32 octets. To form the URI, the following parts are -concatenated: +a fixed length of 32 octets. + +There are two variants on how to form the request URI: The advanced +and the direct method. Implementations MUST first try the advanced +method. Only if the required sub-domain does not exist, they SHOULD +fall back to the direct method. + +The advanced method requires a sub-domain with the fixed name +~openpgpkey~ is created and queried. It constructs the URI from the +concatenation of these items: - The scheme {{{https_scheme}}}, - the domain-part, -- the string ~/.well-known/openpgpkey/hu/~, -- and the above constructed 32 octet string. +- the string ~/.well-known/openpgpkey/~, +- the domain-part in lowercase, +- the string ~/hu/~, +- the above constructed 32 octet string, +- the unchanged local-part as a parameter with name ~l~ using proper + percent escaping. -For example the URI to lookup the key for Joe.Doe at Example.ORG is: +An example for such an advanced method URI to lookup the key for +Joe.Doe at Example.ORG is: #+BEGIN_EXAMPLE - https://example.org/.well-known/openpgpkey/ - hu/iy9q119eutrkn8s1mk4r39qejnbu3n5q + https://openpgpkey.example.org/.well-known/openpgpkey/ + example.org/hu/iy9q119eutrkn8s1mk4r39qejnbu3n5q?l=Joe.Doe #+END_EXAMPLE - (line has been wrapped for rendering purposes) -DNS SRV resource records ({{{RFC(2782)}}}) may be used to query a -different host or a port other than 443. For example: +The direct method requires no additional DNS entries and constructs +the URI from the concatenation of these items: + +- The scheme {{{https_scheme}}}, +- the domain-part, +- the string ~/.well-known/openpgpkey/hu/~, +- the above constructed 32 octet string, +- the unchanged local-part as a parameter with name ~l~ using proper + percent escaping. + +Example for a direct method URI: #+BEGIN_EXAMPLE -_openpgpkey._tcp.example.org. IN SRV 0 0 8443 wkd.example.org. + https://example.org/.well-known/openpgpkey/ + hu/iy9q119eutrkn8s1mk4r39qejnbu3n5q?l=Joe.Doe #+END_EXAMPLE - -changes the above to query the host "wkd.example.org" at port -8443 instead of the host "example.org" at port 443. The target (in the -example "wkd.example.org") MUST be a sub-domain of the domain-part -(here "example.org"). If the target is not a sub-domain, the SRV RR -MUST be be ignored. The recommended name for the sub-domain is "wkd". +(line has been wrapped for rendering purposes) The HTTP GET method MUST return the binary representation of the OpenPGP key for the given mail address. The key needs to carry a User @@ -200,6 +222,13 @@ The server MUST serve a Policy Flags file as specified below. That file is even required if the Web Key Directory Update Protocol is not supported. +The benefit of the advanced method is its greater flexibility in +setting up the Web Key Directory in environments where more than one +mail domain is hosted. DNS SRV resource records, as used in earlier +specifications of this protocol, posed a problem for implementations +which have only limited access to DNS resolvers. The direct method is +kept for backward compatibility and to allow providing a Web Key +Directory even with without DNS change requirements. * Web Key Directory Update Protocol @@ -209,6 +238,23 @@ the assumption that a mail provider can securely deliver mail to the INBOX of a user (e.g. an IMAP folder). Note that the same protocol may also be used for submitting keys for use with OpenPGP DANE. +In the following sections the term "target key" denotes the to be +published key, the term "submission key" the key associated with the +submission-address of the mail provider. The string "WELLKNOWN" +denotes the first part of an URI specific for a domain. In the +examples the domain "example.org" is assumed, thus: + +#+BEGIN_EXAMPLE + WELLKNOWN := https://openpgpkey.example.org/.well-known/ + example.org/openpgpkey +#+END_EXAMPLE +(line has been wrapped for rendering purposes) + +or if the sub-domain ~opengpgkey~ does not exist (direct method): +#+BEGIN_EXAMPLE + WELLKNOWN := https://example.org/.well-known/openpgpkey +#+END_EXAMPLE + We assume that the user already created a key for her mail account alice at example.org. To install the key at her provider's Web Key Directory, she performs the following steps: @@ -219,7 +265,7 @@ Directory, she performs the following steps: for the syntax of that file. For a mail address at the domain "example.org" the URI of the file is #+begin_example - https://example.org/.well-known/openpgpkey/submission-address + WELLKNOWN/submission-address #+end_example 2. She sends her key using SMTP (or any other transport mechanism) to @@ -252,17 +298,7 @@ Directory, she performs the following steps: publication of her key. The message data structures used for the above protocol are specified in -detail below. In the following sections the string "WELLKNOWN" denotes -the first part of an URI specific for a domain. In the examples the -domain "example.org" is assumed, thus - -#+BEGIN_EXAMPLE - WELLKNOWN := https://example.org/.well-known/openpgpkey -#+END_EXAMPLE - -The term "target key" denotes the to be published key, the term -"submission key" the key associated with the submission-address of the -mail provider. +detail below. ** The Submission Address @@ -727,7 +763,9 @@ ShZ91YKkcZffevdY72omqTk10a1SUXehPooIlRFmroDsi3VDaRKrUIo= #+end_example -* Changes Since -05 +* Changes Since -06 -- Add a submission address to the Policy Flags. -- Add a suggestion to avoid creating an index file. +- Specify the advanced method with the openpgpkey sub-domain. +- Specify the l=LOCAL-PART query parameter. +- Require the provider to filter the key for publication. +- Drop the use of DNS SRV records. ----------------------------------------------------------------------- Summary of changes: .gitignore | 1 + ...xt => draft-koch-openpgp-webkey-service-07.txt} | 326 ++++++++++++--------- misc/id/openpgp-webkey-service/draft.org | 108 ++++--- 3 files changed, 264 insertions(+), 171 deletions(-) copy misc/id/openpgp-webkey-service/{draft-koch-openpgp-webkey-service-05.txt => draft-koch-openpgp-webkey-service-07.txt} (85%) hooks/post-receive -- The GnuPG website and other docs http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 13 21:57:03 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 13 Nov 2018 21:57:03 +0100 Subject: [git] gnupg-doc - branch, master, updated. 1543a050978b89e82072b9901314d77e831d5b04 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GnuPG website and other docs". The branch, master has been updated via 1543a050978b89e82072b9901314d77e831d5b04 (commit) from 7fba4187a5ef41114d8d8a357bedffae5e7243ff (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1543a050978b89e82072b9901314d77e831d5b04 Author: Werner Koch Date: Tue Nov 13 21:57:00 2018 +0100 drafts,openpgp-webkey-service: Insert missing string. diff --git a/misc/id/openpgp-webkey-service/draft.org b/misc/id/openpgp-webkey-service/draft.org index e2a5a99..66841ea 100644 --- a/misc/id/openpgp-webkey-service/draft.org +++ b/misc/id/openpgp-webkey-service/draft.org @@ -165,6 +165,7 @@ The advanced method requires a sub-domain with the fixed name concatenation of these items: - The scheme {{{https_scheme}}}, +- the string ~openpgpkey~, - the domain-part, - the string ~/.well-known/openpgpkey/~, - the domain-part in lowercase, ----------------------------------------------------------------------- Summary of changes: misc/id/openpgp-webkey-service/draft.org | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- The GnuPG website and other docs http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 14 01:43:59 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Wed, 14 Nov 2018 01:43:59 +0100 Subject: [git] Assuan - branch, master, updated. libassuan-2.5.1-25-g8153608 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "IPC library used by GnuPG". The branch, master has been updated via 8153608073b7859eed32b8963b4a052243b4858f (commit) from 5e7988d2da3cdc36ebed3b598c0582028f3715ab (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8153608073b7859eed32b8963b4a052243b4858f Author: NIIBE Yutaka Date: Wed Nov 14 09:12:59 2018 +0900 server: Don't call _assuan_waitpid on server side. * src/server.c (_assuan_server_finish): Never call waitpid here. * src/assuan-socket-server.c (accept_connection_bottom): Indentation. -- The waitpid/wait only makes sense by parent catching its child process. Since the commit 93595de1ede96dedfcaa93c7442536a2cde0b6ef (for version 0.6.5, in 2004-04-21), CTX->PID on server side has client PID. In the commit cb53f862ff2a864da822d1c16d3df6a02157608b (2009-11-19), call of _assuan_waitpid was introduced in assuan_server_finish, but this call always fails because the process is not a child process of server. (If we could catch exit of non-child process, it might cause a dead lock, since client does call waitpid too.) The indentation fix is to show the place where PID is assigned. Signed-off-by: NIIBE Yutaka diff --git a/src/assuan-socket-server.c b/src/assuan-socket-server.c index 4e255c2..e1e0c60 100644 --- a/src/assuan-socket-server.c +++ b/src/assuan-socket-server.c @@ -108,12 +108,12 @@ accept_connection_bottom (assuan_context_t ctx) socklen_t unpl = sizeof unp; if (getsockopt (fd, 0, LOCAL_PEEREID, &unp, &unpl) != -1) - { - ctx->peercred_valid = 1; - ctx->peercred.pid = unp.unp_pid; - ctx->peercred.uid = unp.unp_euid; - ctx->peercred.gid = unp.unp_egid; - } + { + ctx->peercred_valid = 1; + ctx->peercred.pid = unp.unp_pid; + ctx->peercred.uid = unp.unp_euid; + ctx->peercred.gid = unp.unp_egid; + } } #elif defined (HAVE_GETPEERUCRED) { /* Solaris */ diff --git a/src/server.c b/src/server.c index 7c82f02..5e96798 100644 --- a/src/server.c +++ b/src/server.c @@ -46,7 +46,6 @@ _assuan_server_finish (assuan_context_t ctx) } if (ctx->pid != ASSUAN_INVALID_PID && ctx->pid) { - _assuan_waitpid (ctx, ctx->pid, ctx->flags.no_waitpid, NULL, 0); ctx->pid = ASSUAN_INVALID_PID; } ----------------------------------------------------------------------- Summary of changes: src/assuan-socket-server.c | 12 ++++++------ src/server.c | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) hooks/post-receive -- IPC library used by GnuPG http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 14 02:28:17 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Wed, 14 Nov 2018 02:28:17 +0100 Subject: [git] Assuan - branch, master, updated. libassuan-2.5.1-26-geac43aa Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "IPC library used by GnuPG". The branch, master has been updated via eac43aadd7c3a249f35c7cce25eac78f4aaa85db (commit) from 8153608073b7859eed32b8963b4a052243b4858f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit eac43aadd7c3a249f35c7cce25eac78f4aaa85db Author: NIIBE Yutaka Date: Wed Nov 14 10:27:20 2018 +0900 libassuan.vers: Remove duplicates. Signed-off-by: NIIBE Yutaka diff --git a/src/libassuan.vers b/src/libassuan.vers index c9cd5d7..788bb92 100644 --- a/src/libassuan.vers +++ b/src/libassuan.vers @@ -51,7 +51,6 @@ LIBASSUAN_1.0 { assuan_inquire; assuan_inquire_ext; assuan_new; - assuan_new; assuan_new_ext; assuan_pending_line; assuan_pipe_connect; @@ -70,7 +69,6 @@ LIBASSUAN_1.0 { assuan_register_post_cmd_notify; assuan_register_reset_notify; assuan_release; - assuan_release; assuan_send_data; assuan_sendfd; assuan_set_assuan_log_prefix; ----------------------------------------------------------------------- Summary of changes: src/libassuan.vers | 2 -- 1 file changed, 2 deletions(-) hooks/post-receive -- IPC library used by GnuPG http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 14 03:18:16 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Wed, 14 Nov 2018 03:18:16 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-272-g804a77e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 804a77edd9472d44606641b7772550521e1ba271 (commit) from 914fa3be22bf8848a97a7dd405a040d6ef31e2fd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 804a77edd9472d44606641b7772550521e1ba271 Author: NIIBE Yutaka Date: Wed Nov 14 10:45:15 2018 +0900 agent: Simplify agent_popup_message_stop. * agent/call-pinentry.c (agent_popup_message_stop): Just kill it. -- By checking if it's alive or not, we can lower a risk of sending SIGINT to a wrong process on unusual condition when PID is re-used to a different process. That's true, however, since it's alive usually, simply sending SIGINT is enough here. Note that here is a race condition for detecting if process is active or not; A process can die just after being detected alive. Moreover, when the process of pinentry accidentally died already, it should have caused return of assuan_transact and the thread of popup_message_thread likely already set popup_finished=1. Signed-off-by: NIIBE Yutaka diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c index 3716e11..38c01e2 100644 --- a/agent/call-pinentry.c +++ b/agent/call-pinentry.c @@ -1543,14 +1543,6 @@ agent_popup_message_stop (ctrl_t ctrl) TerminateProcess (process, 1); } #else - else if (pid && ((rc=waitpid (pid, NULL, WNOHANG))==-1 || (rc == pid)) ) - { /* The daemon already died. No need to send a kill. However - because we already waited for the process, we need to tell - assuan that it should not wait again (done by - unlock_pinentry). */ - if (rc == pid) - assuan_set_flag (entry_ctx, ASSUAN_NO_WAITPID, 1); - } else if (pid > 0) kill (pid, SIGINT); #endif ----------------------------------------------------------------------- Summary of changes: agent/call-pinentry.c | 8 -------- 1 file changed, 8 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 14 11:51:38 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 14 Nov 2018 11:51:38 +0100 Subject: [git] GPGME - branch, aheinecke/json-test, created. gpgme-1.12.0-54-g0c31837 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, aheinecke/json-test has been created at 0c31837766e016227b3c8dfd44c476949cd4741e (commit) - Log ----------------------------------------------------------------- commit 0c31837766e016227b3c8dfd44c476949cd4741e Author: Andre Heinecke Date: Wed Nov 14 11:47:59 2018 +0100 tests: Add json testrunner * configure.ac: Configure makefile. * tests/Makefile.am: Run json tests if gpg tests are run. * tests/json/t-json.c: New testrunner for json tests. * tests/json/t-config.in, tests/json/t-config.out: First test. -- The idea of this test runner is that it only looks for parts in the output. This should allow it to write robust tests that check for the basics in the output but don't fail when the output is extended or slightly changed. diff --git a/configure.ac b/configure.ac index b733a9c..4976b5b 100644 --- a/configure.ac +++ b/configure.ac @@ -853,6 +853,7 @@ 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 diff --git a/tests/Makefile.am b/tests/Makefile.am index b5825d2..29e0c42 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -38,7 +38,7 @@ noinst_PROGRAMS = $(TESTS) run-keylist run-export run-import run-sign \ if RUN_GPG_TESTS -gpgtests = gpg +gpgtests = gpg json else gpgtests = endif diff --git a/tests/json/t-config.in b/tests/json/t-config.in new file mode 100644 index 0000000..22b37ee --- /dev/null +++ b/tests/json/t-config.in @@ -0,0 +1,4 @@ +{ + "op": "config", + "component": "gpg" +} diff --git a/tests/json/t-config.out b/tests/json/t-config.out new file mode 100644 index 0000000..fce36a0 --- /dev/null +++ b/tests/json/t-config.out @@ -0,0 +1,19 @@ +{ + "components": [{ + "name": "gpg", + "description": "OpenPGP", + "options": [{ + "name": "Monitor", + "flags": 1, + "level": 0, + "type": 0, + "alt_type": 0 + }, { + "name": "verbose", + "description": "verbose", + "level": 0, + "type": 0, + "alt_type": 0 + }] + }] +} diff --git a/tests/json/t-json.c b/tests/json/t-json.c new file mode 100644 index 0000000..ec294f7 --- /dev/null +++ b/tests/json/t-json.c @@ -0,0 +1,344 @@ +/* t-json.c - Regression test. + Copyright (C) 2018 Bundesamt f?r Sicherheit in der Informationstechnik + Software engineering by Intevation GmbH + + This file is part of GPGME. + + GPGME is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include +#include + +#include "../gpg/t-support.h" +#include "../../src/cJSON.h" + +/* Register tests here */ +static const char*tests[] = { "t-config", NULL }; + +static int verbose = 0; + +static char * +get_file (const char *fname) +{ + gpg_error_t err; + gpgrt_stream_t fp; + struct stat st; + char *buf; + size_t buflen; + + fp = gpgrt_fopen (fname, "r"); + if (!fp) + { + err = gpg_error_from_syserror (); + fprintf (stderr, "Error: can't open '%s': %s\n", fname, + gpg_strerror (err)); + return NULL; + } + + if (fstat (gpgrt_fileno(fp), &st)) + { + err = gpg_error_from_syserror (); + fprintf (stderr, "Error: can't stat '%s': %s\n", fname, + gpg_strerror (err)); + gpgrt_fclose (fp); + return NULL; + } + + buflen = st.st_size; + buf = malloc (buflen+1); + if (!buf) + { + fprintf (stderr, "Error: no mem\n"); + gpgrt_fclose (fp); + return NULL; + } + + if (gpgrt_fread (buf, buflen, 1, fp) != 1) + { + err = gpg_error_from_syserror (); + fprintf (stderr, "error reading '%s': %s\n", fname, gpg_strerror (err)); + gpgrt_fclose (fp); + free (buf); + return NULL; + } + buf[buflen] = 0; + gpgrt_fclose (fp); + + return buf; +} + +/* Check that the element needle exists in hay. Returns 0 if + the needle was found. */ +int +test_contains (cjson_t needle, cjson_t hay) +{ + /*fprintf (stderr, "checking \n%s\n -------against-------- \n%s\n", + cJSON_Print (needle), cJSON_Print (hay)); */ + + /* Type check. This automatically checks bool vals and NULL */ + if (needle->type != hay->type) + { + if (verbose) + fprintf (stderr, "type mismatch expected %i got %i\n", needle->type, + hay->type); + return 1; + } + + /* First the simple types */ + if (cjson_is_number (needle)) + { + if (needle->valueint != hay->valueint) + { + if (verbose) + fprintf (stderr, "Value mismatch. Expected %i got %i\n", + needle->valueint, hay->valueint); + return 1; + } + } + if (cjson_is_string (needle)) + { + if (strcmp (needle->valuestring, hay->valuestring)) + { + if (verbose) + fprintf (stderr, "String mismatch Expected '%s' got '%s'\n", + needle->valuestring, hay->valuestring); + return 1; + } + } + + /* Now the complex types */ + if (needle->child) + { + if (!hay->child) + { + fprintf (stderr, "Depth mismatch. Expected child for %s\n", + nonnull (needle->string)); + } + if (test_contains (needle->child, hay->child)) + { + return 1; + } + } + + if (needle->prev) + { + return 0; + } + + /* Walk elements of an array */ + for (cjson_t it = needle->next; it; it = it->next) + { + int found = 0; + if (!it->string && it->child) + { + /* Try out all other anonymous children on the same level */ + cjson_t hit = hay; + /* Return to the beginning */ + while (hit->prev) + { + hit = hit->prev; + } + for (; hit && hit->child; hit = hit->next) + { + found |= !test_contains (it->child, hit->child); + if (found) + { + break; + } + } + if (!found) + { + return 1; + } + continue; + } + + /* Try the children in the haystack */ + for (cjson_t hit = hay; hit; hit = hit->next) + { + if (hit->string && it->string && + !strcmp (hit->string, it->string)) + { + found = 1; + if (test_contains (it, hit)) + { + return 1; + } + } + } + if (!found) + { + if (verbose) + fprintf (stderr, "Failed to find '%s' in list\n", + nonnull (it->string)); + return 1; + } + } + return 0; +} + + +int +check_response (const char *response, const char *expected) +{ + cjson_t hay; + cjson_t needle; + int rc; + size_t erroff; + + hay = cJSON_Parse (response, &erroff); + + if (!hay) + { + fprintf (stderr, "Failed to parse json at %i:\n%s\n", (int) erroff, + response); + return 1; + } + needle = cJSON_Parse (expected, &erroff); + if (!needle) + { + fprintf (stderr, "Failed to parse json at %i:\n%s\n", (int) erroff, + expected); + cJSON_Delete (hay); + return 1; + } + + rc = test_contains (needle, hay); + + cJSON_Delete (needle); + cJSON_Delete (hay); + return rc; +} + + +int +run_test (const char *test, const char *gpgme_json) +{ + gpgme_ctx_t ctx; + gpgme_data_t json_stdin = NULL; + gpgme_data_t json_stdout = NULL; + gpgme_data_t json_stderr = NULL; + char *test_in; + char *test_out; + const char *argv[2]; + char *response; + char *expected; + size_t response_size; + int rc = 0; + const char *top_srcdir = getenv ("top_srcdir"); + + if (!top_srcdir) + { + fprintf (stderr, "Error top_srcdir environment variable not set\n"); + exit(1); + } + + gpgrt_asprintf (&test_in, "%s//tests//json//%s.in", + top_srcdir, test); + gpgrt_asprintf (&test_out, "%s//tests//json//%s.out", + top_srcdir, test); + + printf ("Running %s...\n", test); + + fail_if_err (gpgme_new (&ctx)); + + gpgme_set_protocol (ctx, GPGME_PROTOCOL_SPAWN); + + fail_if_err (gpgme_data_new_from_file (&json_stdin, test_in, 1)); + fail_if_err (gpgme_data_new (&json_stdout)); + fail_if_err (gpgme_data_new (&json_stderr)); + + argv[0] = gpgme_json; + argv[1] = "-s"; + + fail_if_err (gpgme_op_spawn (ctx, gpgme_json, argv, + json_stdin, + json_stdout, + json_stderr, + 0)); + response = gpgme_data_release_and_get_mem (json_stdout, + &response_size); + test (response_size); + + expected = get_file (test_out); + + test (expected); + + rc = check_response (response, expected); + + if (!rc) + { + printf (" success\n"); + gpgme_data_release (json_stderr); + } + else + { + char *buf; + size_t size; + + buf = gpgme_data_release_and_get_mem (json_stderr, &size); + printf (" failed\n"); + if (size) + { + printf ("gpgme-json stderr:\n%.*s\n", (int)size, buf); + } + free (buf); + } + + free (test_out); + free (test_in); + free (response); + free (expected); + gpgme_data_release (json_stdin); + gpgme_release (ctx); + + return rc; +} + +int +main (int argc, char *argv[]) +{ + const char *gpgme_json = getenv ("gpgme_json"); + + if (argc == 2 && !strcmp (argv[1], "--verbose")) + { + /* Note that verbose will print out lots of mismatchs + because we have to try trough anonymous objects */ + verbose = 1; + } + + + init_gpgme (GPGME_PROTOCOL_SPAWN); + + for (const char **test = tests; *test; test++) + { + if (run_test (*test, gpgme_json)) + { + exit(1); + } + } + return 0; +} ----------------------------------------------------------------------- hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 14 12:15:04 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Wed, 14 Nov 2018 12:15:04 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.32-54-g4a92763 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via 4a92763a6e529824f1c6043b75ac1346af41a926 (commit) from 4b41cf3bd16c8afcb4ba152ab9d5d679a7cb91e7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4a92763a6e529824f1c6043b75ac1346af41a926 Author: NIIBE Yutaka Date: Wed Nov 14 20:08:40 2018 +0900 gpgrt-config: Prepend PKG_CONFIG_LIBDIR to PKG_CONFIG_PATH. * src/gpgrt-config: Handle empty PKG_CONFIG_LIBDIR config, which should ignore --libdir option. Otherwise, prepend PKG_CONFIG_LIBDIR (instead of appending) to PKG_CONFIG_PATH. -- Suggested-by: Andre Heinecke Signed-off-by: NIIBE Yutaka diff --git a/src/gpgrt-config b/src/gpgrt-config index 9aec4f6..3a76869 100755 --- a/src/gpgrt-config +++ b/src/gpgrt-config @@ -451,17 +451,32 @@ while test $# -gt 0; do esac done -# --libdir option has precedence over the env var. -if [ -n "$libdir" ]; then - PKG_CONFIG_LIBDIR=$libdir/pkgconfig -fi - -if [ x"$PKG_CONFIG_PATH" = x -a x"$PKG_CONFIG_LIBDIR" = x ]; then - echo "Please use --libdir=LIBDIR option or set PKG_CONFIG_LIBDIR" 1>&2 +if [ x"${PKG_CONFIG_LIBDIR:+set}" = xset -a -z "$PKG_CONFIG_LIBDIR" ]; then + # The variable set as empty, we use PKG_CONFIG_PATH in this case, + # ignoring --libdir option + if [ -z "$PKG_CONFIG_PATH" ]; then + echo "Please have valid PKG_CONFIG_PATH if PKG_CONFIG_LIBDIR is empty" 1>&2 exit 1 + fi +else + if [ -n "$libdir" ]; then + # --libdir option is available, it overrides existing PKG_CONFIG_LIBDIR + PKG_CONFIG_LIBDIR=$libdir/pkgconfig + fi + if [ -z "$PKG_CONFIG_LIBDIR" ]; then + if [ -z "$PKG_CONFIG_PATH" ]; then + echo "Please use --libdir=LIBDIR option or set PKG_CONFIG_LIBDIR" 1>&2 + echo "Or set PKG_CONFIG_PATH" 1>&2 + exit 1 + fi + else + # PKG_CONFIG_LIBDIR is available here + # Modify PKG_CONFIG_PATH, prepending PKG_CONFIG_LIBDIR + PKG_CONFIG_PATH="$PKG_CONFIG_LIBDIR${PKG_CONFIG_PATH:+:}$PKG_CONFIG_PATH" + fi fi +# PKG_CONFIG_PATH is ready here -PKG_CONFIG_PATH="$PKG_CONFIG_PATH${PKG_CONFIG_PATH:+:}$PKG_CONFIG_LIBDIR" # if test $# -eq 0; then ----------------------------------------------------------------------- Summary of changes: src/gpgrt-config | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 14 13:31:44 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 14 Nov 2018 13:31:44 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-273-g8b8ea80 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 8b8ea802ca071c911158cab0203245a16a69125c (commit) from 804a77edd9472d44606641b7772550521e1ba271 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8b8ea802ca071c911158cab0203245a16a69125c Author: Werner Koch Date: Wed Nov 14 13:17:49 2018 +0100 Remove the gpg-zip script. * tools/gpg-zip.in: Remove. * m4/tar-ustar.m4: Remove. -- Note that the script was even not anymore installed. See also GnuPG-bug-id: 4252 Signed-off-by: Werner Koch diff --git a/configure.ac b/configure.ac index 795daa4..780a5e2 100644 --- a/configure.ac +++ b/configure.ac @@ -625,7 +625,6 @@ AC_ARG_VAR(YAT2M, [tool to convert texi to man pages]) AM_CONDITIONAL(HAVE_YAT2M, test -n "$ac_cv_path_YAT2M") AC_ISC_POSIX AC_SYS_LARGEFILE -GNUPG_CHECK_USTAR # We need to compile and run a program on the build machine. A @@ -2050,7 +2049,6 @@ agent/Makefile scd/Makefile g13/Makefile dirmngr/Makefile -tools/gpg-zip tools/Makefile doc/Makefile tests/Makefile diff --git a/m4/Makefile.am b/m4/Makefile.am index 3232413..250a4ac 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -1,6 +1,6 @@ EXTRA_DIST = intl.m4 intldir.m4 glibc2.m4 lock.m4 visibility.m4 intmax.m4 longdouble.m4 printf-posix.m4 signed.m4 size_max.m4 wchar_t.m4 wint_t.m4 xsize.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 intdiv0.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 progtest.m4 stdint_h.m4 uintmax_t.m4 -EXTRA_DIST += ldap.m4 libcurl.m4 libusb.m4 tar-ustar.m4 readline.m4 pkg.m4 +EXTRA_DIST += ldap.m4 libcurl.m4 libusb.m4 readline.m4 pkg.m4 EXTRA_DIST += gnupg-pth.m4 diff --git a/m4/tar-ustar.m4 b/m4/tar-ustar.m4 deleted file mode 100644 index 4ae9e63..0000000 --- a/m4/tar-ustar.m4 +++ /dev/null @@ -1,43 +0,0 @@ -dnl Check for a tar program that speaks ustar format -dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc. -dnl -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -AC_DEFUN([GNUPG_CHECK_USTAR], -[ - AC_ARG_WITH(tar, - AC_HELP_STRING([--with-tar=PATH],[look for a tar program in PATH]), - [_do_tar=$withval]) - - if test x$_do_tar != xno ; then - - if test x$_do_tar = x ; then - AC_PATH_PROG(TAR,"tar") - _mytar=$ac_cv_path_TAR - fi - - # Check if our tar is ustar format. If so, it's good. TODO: Add some - # code to check various options, etc, to try and create ustar - # format. - - if test x$_mytar != x ; then - AC_MSG_CHECKING([whether $_mytar speaks USTAR]) - echo hithere > conftest.txt - $_mytar -cf - conftest.txt | (dd skip=257 bs=1 count=5 2>/dev/null || cat) | grep ustar > /dev/null - _tar_bad=$? - rm conftest.txt - - if test x$_tar_bad = x0 ; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - fi - fi - - AM_CONDITIONAL(HAVE_USTAR, test x$_tar_bad = x0) -])dnl diff --git a/tools/Makefile.am b/tools/Makefile.am index 0c828a7..cedcbf4 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -34,11 +34,6 @@ AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(GPG_ERROR_CFLAGS) $(LIBASSUAN_CFLAGS) sbin_SCRIPTS = addgnupghome applygnupgdefaults -if HAVE_USTAR -# bin_SCRIPTS += gpg-zip -noinst_SCRIPTS = gpg-zip -endif - if BUILD_SYMCRYPTRUN symcryptrun = symcryptrun else diff --git a/tools/gpg-zip.in b/tools/gpg-zip.in deleted file mode 100644 index 48c4766..0000000 --- a/tools/gpg-zip.in +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/sh - -# gpg-archive - gpg-ized tar using the same format as PGP's PGP Zip. -# Copyright (C) 2005 Free Software Foundation, Inc. -# -# This file is part of GnuPG. -# -# GnuPG 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 3 of the License, or -# (at your option) any later version. -# -# GnuPG 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 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 . -# Despite the name, PGP Zip format is actually an OpenPGP-wrapped tar -# file. To be compatible with PGP itself, this must be a USTAR format -# tar file. Unclear on whether there is a distinction here between -# the GNU or POSIX variant of USTAR. - -VERSION=@VERSION@ -TAR=@TAR@ -GPG=gpg - -usage="\ -Usage: gpg-zip [--help] [--version] [--encrypt] [--decrypt] [--symmetric] - [--list-archive] [--output FILE] [--gpg GPG] [--gpg-args ARGS] - [--tar TAR] [--tar-args ARGS] filename1 [filename2, ...] - directory1 [directory2, ...] - -Encrypt or sign files into an archive." - -tar_verbose_opt="v" - -while test $# -gt 0 ; do - case $1 in - -h | --help | --h*) - echo "$usage" - exit 0 - ;; - --list-archive) - list=yes - create=no - unpack=no - shift - ;; - --encrypt | -e) - gpg_args="$gpg_args --encrypt" - list=no - create=yes - unpack=no - shift - ;; - --decrypt | -d) - gpg_args="$gpg_args --decrypt" - list=no - create=no - unpack=yes - shift - ;; - --symmetric | -c) - gpg_args="$gpg_args --symmetric" - list=no - create=yes - unpack=no - shift - ;; - --sign | -s) - gpg_args="$gpg_args --sign" - list=no - create=yes - unpack=no - shift - ;; - --recipient | -r) - gpg_args="$gpg_args --recipient $2" - shift - shift - ;; - --local-user | -u) - gpg_args="$gpg_args --local-user $2" - shift - shift - ;; - --output | -o) - gpg_args="$gpg_args --output $2" - shift - shift - ;; - --version) - echo "gpg-zip (GnuPG) $VERSION" - exit 0 - ;; - --gpg) - GPG=$2 - shift - shift - ;; - --gpg-args) - gpg_args="$gpg_args $2" - shift - shift - ;; - --tar) - TAR=$2 - shift - shift - ;; - --tar-args) - tar_args="$tar_args $2" - shift - shift - ;; - --quiet) - tar_verbose_opt="" - shift - ;; - --) - shift - break - ;; - -*) - echo "$usage" 1>&2 - exit 1 - ;; - *) - break - ;; - esac -done - -if test x$create = xyes ; then -# echo "$TAR $tar_args -cf - "$@" | $GPG --set-filename x.tar $gpg_args" 1>&2 - $TAR $tar_args -cf - "$@" | $GPG --set-filename x.tar $gpg_args -elif test x$list = xyes ; then -# echo "cat \"$1\" | $GPG $gpg_args | $TAR $tar_args -tf -" 1>&2 - cat "$1" | $GPG $gpg_args | $TAR $tar_args -tf - -elif test x$unpack = xyes ; then -# echo "cat \"$1\" | $GPG $gpg_args | $TAR $tar_args -xvf -" 1>&2 - cat "$1" | $GPG $gpg_args | $TAR $tar_args -x${tar_verbose_opt}f - -else - echo "$usage" 1>&2 - exit 1 -fi ----------------------------------------------------------------------- Summary of changes: configure.ac | 2 - m4/Makefile.am | 2 +- m4/tar-ustar.m4 | 43 ---------------- tools/Makefile.am | 5 -- tools/gpg-zip.in | 148 ------------------------------------------------------ 5 files changed, 1 insertion(+), 199 deletions(-) delete mode 100644 m4/tar-ustar.m4 delete mode 100644 tools/gpg-zip.in hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 14 13:43:41 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 14 Nov 2018 13:43:41 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-275-g56022fb Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 56022fb304cff884bb52a48e632b7045688786bf (commit) via faf3c70c7715ba86eb56fdccc6cf831bf87b2ee0 (commit) from 8b8ea802ca071c911158cab0203245a16a69125c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 56022fb304cff884bb52a48e632b7045688786bf Merge: 8b8ea80 faf3c70 Author: Werner Koch Date: Wed Nov 14 13:37:41 2018 +0100 Merge branch 'seckey-sync-work' into master -- ----------------------------------------------------------------------- Summary of changes: configure.ac | 1 + tools/Makefile.am | 10 +- tools/gpg-pair-tool.c | 2020 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 2030 insertions(+), 1 deletion(-) create mode 100644 tools/gpg-pair-tool.c hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 14 14:15:45 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 14 Nov 2018 14:15:45 +0100 Subject: [git] GCRYPT - branch, master, updated. libgcrypt-1.8.1-128-gaa686df Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, master has been updated via aa686dfc9b563ff79c01d2f8560b88f69c42ecba (commit) from 852245390ef7fd8ca9e36010886a4cf42cf710bf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit aa686dfc9b563ff79c01d2f8560b88f69c42ecba Author: Werner Koch Date: Wed Nov 14 14:14:23 2018 +0100 random: Initialize variable as requested by valgrind random/jitterentropy-base.c: Init. -- The variable ec does not need initialization for proper functioning of the analyzer code. However, valgrind complains about the uninitialized variable. Thus, initialize it. Original-repo: https://github.com/smuellerDD/jitterentropy-library.git Original-commit: 9048af7f06fc1488904f54852e0a2f8da45a4745 Original-Author:: Stephan Mueller Original-Date: Sun, 15 Jul 2018 19:14:02 +0200 Reported-by: Steve Grubb Signed-off-by: Werner Koch diff --git a/random/jitterentropy-base.c b/random/jitterentropy-base.c index dc907b2..32fdea4 100644 --- a/random/jitterentropy-base.c +++ b/random/jitterentropy-base.c @@ -642,6 +642,8 @@ int jent_entropy_init(void) int count_stuck = 0; struct rand_data ec; + memset(&ec, 0, sizeof(ec)); + /* We could perform statistical tests here, but the problem is * that we only have a few loop counts to do testing. These * loop counts may show some slight skew and we produce ----------------------------------------------------------------------- Summary of changes: random/jitterentropy-base.c | 2 ++ 1 file changed, 2 insertions(+) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 14 14:18:22 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 14 Nov 2018 14:18:22 +0100 Subject: [git] GCRYPT - branch, LIBGCRYPT-1.8-BRANCH, updated. libgcrypt-1.8.4-5-g35e002d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, LIBGCRYPT-1.8-BRANCH has been updated via 35e002d4b842f25e3fcb6036c21bdafc5214317e (commit) from 4141caabe76ad092f3487b4516ee481fba837adb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 35e002d4b842f25e3fcb6036c21bdafc5214317e Author: Werner Koch Date: Wed Nov 14 14:14:23 2018 +0100 random: Initialize variable as requested by valgrind random/jitterentropy-base.c: Init. -- The variable ec does not need initialization for proper functioning of the analyzer code. However, valgrind complains about the uninitialized variable. Thus, initialize it. Original-repo: https://github.com/smuellerDD/jitterentropy-library.git Original-commit: 9048af7f06fc1488904f54852e0a2f8da45a4745 Original-Author:: Stephan Mueller Original-Date: Sun, 15 Jul 2018 19:14:02 +0200 Reported-by: Steve Grubb Signed-off-by: Werner Koch (cherry picked from commit aa686dfc9b563ff79c01d2f8560b88f69c42ecba) GnuPG-bug-id: 4250 diff --git a/random/jitterentropy-base.c b/random/jitterentropy-base.c index dc907b2..32fdea4 100644 --- a/random/jitterentropy-base.c +++ b/random/jitterentropy-base.c @@ -642,6 +642,8 @@ int jent_entropy_init(void) int count_stuck = 0; struct rand_data ec; + memset(&ec, 0, sizeof(ec)); + /* We could perform statistical tests here, but the problem is * that we only have a few loop counts to do testing. These * loop counts may show some slight skew and we produce ----------------------------------------------------------------------- Summary of changes: random/jitterentropy-base.c | 2 ++ 1 file changed, 2 insertions(+) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 14 14:18:51 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 14 Nov 2018 14:18:51 +0100 Subject: [git] GCRYPT - branch, LIBGCRYPT-1.8-BRANCH, updated. libgcrypt-1.8.4-6-gbc05e16 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, LIBGCRYPT-1.8-BRANCH has been updated via bc05e16bb494bfef8b12d76f12afaa50a8e6e9dd (commit) from 35e002d4b842f25e3fcb6036c21bdafc5214317e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bc05e16bb494bfef8b12d76f12afaa50a8e6e9dd Author: Werner Koch Date: Wed Nov 14 14:18:46 2018 +0100 doc: Minor typo fix -- diff --git a/README b/README index 8a3f2aa..e73c8d0 100644 --- a/README +++ b/README @@ -189,7 +189,7 @@ Build Problems -------------- - If you have a problem with a a certain release, please first check + If you have a problem with a certain release, please first check the Release-info URL given in the NEWS file. We can't check all assembler files, so if you have problems ----------------------------------------------------------------------- Summary of changes: README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 14 15:16:02 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 14 Nov 2018 15:16:02 +0100 Subject: [git] GPGME - branch, aheinecke/json-test, updated. gpgme-1.12.0-61-gdd4b80a Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, aheinecke/json-test has been updated via dd4b80a5f640232bb44eb825ff5a74ec295fad10 (commit) via 9a31fdcb11d04d47dfcc38a8409b84436c549108 (commit) via e55e467d5ffb32c428566a876616d309ef2d15cd (commit) via ca2e2b3d6973b1f942571ba65bd8b57153847777 (commit) via 5b61c092e7444749b08e39ac5aa9fb0818e1a076 (commit) via 9933641cce595ba308d0f3a1f3ae8f13a9743dd1 (commit) via 3e5684d99b881787f9739e53fd8e8c22eadc2146 (commit) from 0c31837766e016227b3c8dfd44c476949cd4741e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit dd4b80a5f640232bb44eb825ff5a74ec295fad10 Author: Andre Heinecke Date: Wed Nov 14 15:15:21 2018 +0100 tests,json: Add the bulk of tests * t-json.c (tests): Register new tests. * t-createkey.in.json, t-createkey.out.json, t-decrypt-verify.in.json, t-decrypt-verify.out.json, t-decrypt.in.json, t-decrypt.out.json, t-delete.in.json, t-delete.out.json, t-encrypt-sign.in.json, t-encrypt-sign.out.json, t-encrypt.in.json, t-encrypt.out.json, t-export-secret-info.in.json, t-export-secret-info.out.json, t-export.in.json, t-export.out.json, t-json.c, t-keylist-secret.in.json, t-keylist-secret.out.json, t-keylist.in.json, t-keylist.out.json, t-verify.in.json, t-verify.out.json, t-version.in.json, t-version.out.json: New. -- Except for help and getmore there is now a test for each command. diff --git a/tests/json/t-createkey.in.json b/tests/json/t-createkey.in.json new file mode 100644 index 0000000..95dc92a --- /dev/null +++ b/tests/json/t-createkey.in.json @@ -0,0 +1,5 @@ +{ + "op": "createkey", + "userid": "foo at bar.baz", + "algo": "rsa1024" +} diff --git a/tests/json/t-createkey.out.json b/tests/json/t-createkey.out.json new file mode 100644 index 0000000..eb88671 --- /dev/null +++ b/tests/json/t-createkey.out.json @@ -0,0 +1,3 @@ +{ + "fingerprint": "*" +} diff --git a/tests/json/t-decrypt-verify.in.json b/tests/json/t-decrypt-verify.in.json new file mode 100644 index 0000000..c907106 --- /dev/null +++ b/tests/json/t-decrypt-verify.in.json @@ -0,0 +1,5 @@ +{ + "op": "decrypt", + "base64": true, + "data": "hQEOA2rm1+5GqHH4EAP+NCYW3vVuCLDTUYhBaKHNgp4fMq9TNACH2NiZyVSaYLe0VE+2LLurHN/XLwlP7xhl2XijBUe6Q7M+KyoPd9iNIgX9q914dPUN0Q3sJinSbujnFzsy0L2x6kgUJCK/XA7rp0VpmJGUWIQYAET8Xx6SaWd2XxIdIITUz2MqrTzWrgED/iOuRxuT4loNJ/DM2YrOZr0He25SxJskg0t1bik2nM+wHAbJrSa6BqPJYU4scnG6AH0RRxFV177ADjOcBLeutXw7DE+6YOExWZD2Fb0oax/ppDulMudrJnj6Wg5/EHbBLDF96Xd6vQX1rcHmrxImvaQNbavEKswlDZgoYwaV7PYPhQEOAwQHH7gHKHE0EAP/So0a3deCbXVSPkABRO3yZa6kHcVuO5+lTsunfxav1TwaMkBOiK6usRz2zt3rjozNrh3vXn3o2WpFKebwhIUF0q2qPw3OKIGq9jFT63t+DPjpbSorAevmVqXWdmaqDPJZ/QIY6NkBhprTdIGPSTFh66eggQLz+BBUVx2myM7AqgcD/3PnOGIiqINQzFkfa6lHiV/TZ8AaMNfvyx4FFG4Zi45ZnDwLCJZ+J7ATXzECauEDLzhjk8M9OP0PwFT1WsnWefKDSLzbO5hEnf8NYdY6i8f2MJKYcnpeI4PZA3OK9ovmAoJl31K+/vBJRP4kiJ4Weu7fzMi6Zz87tfHDEpbRR7N80qoBTlT7I044LG5OJKgQukb7HOv+c668i56UzZVgz+LCsFpjYEFTlrPVR5Me3PjSSb8M+tt9NUjenNnghJEcxeD902YJcqgRWPotouzx5fKDTay/LofFqckEWGlP5pnkeNfYIBIaSSrG/KcdQ0rPOAxKrZzIifYVwnJm/ISxU6uMpNfDJGOJppf4xqXgTKBdIsCljg5LlgNvGhNMYaXQkGQInzXvLSUbxLerWw==" +} diff --git a/tests/json/t-decrypt-verify.out.json b/tests/json/t-decrypt-verify.out.json new file mode 100644 index 0000000..fc60327 --- /dev/null +++ b/tests/json/t-decrypt-verify.out.json @@ -0,0 +1,56 @@ +{ + "dec_info": { + "symkey_algo": "TWOFISH.CFB", + "wrong_key_usage": false, + "is_de_vs": false, + "is_mime": false, + "legacy_cipher_nomdc": false, + "recipients": [{ + "keyid": "6AE6D7EE46A871F8", + "pubkey_algo_name": "ELG-E", + "status_string": "Success", + "status_code": 0 + }, { + "keyid": "04071FB807287134", + "pubkey_algo_name": "ELG-E", + "status_string": "No secret key", + "status_code": 117440529 + }] + }, + "info": { + "is_mime": false, + "signatures": [{ + "summary": { + "sigsum": [], + "valid": false, + "green": false, + "red": false, + "revoked": false, + "key-expired": false, + "sig-expired": false, + "key-missing": false, + "crl-missing": false, + "crl-too-old": false, + "bad-policy": false, + "sys-error": false + }, + "wrong_key_usage": false, + "chain_model": false, + "is_de_vs": false, + "status_string": "Success", + "fingerprint": "A0FF4590BB6122EDEF6E3C542D727CC768697734", + "validity_string": "unknown", + "pubkey_algo_name": "DSA", + "hash_algo_name": "RIPEMD160", + "status_code": 0, + "timestamp": 1542200353, + "exp_timestamp": 0, + "pka_trust": 0, + "validity": 0, + "validity_reason": 0 + }] + }, + "type": "plaintext", + "base64": false, + "data": "Hello world" +} diff --git a/tests/json/t-decrypt.in.json b/tests/json/t-decrypt.in.json new file mode 100644 index 0000000..52987d7 --- /dev/null +++ b/tests/json/t-decrypt.in.json @@ -0,0 +1,5 @@ +{ + "op": "decrypt", + "data": "hQEOA2rm1+5GqHH4EAQAhzzu7VYpE9vFVdqkAALRHSyz8698b8MES7j5ldzXGVnGSWmN0+YXGyWyeB5tnAXAvUiV10tzoiNaPXoNeOFrHQOWrDsQ1vYukdtblDc3FW/Ywf7aelcFIGh9qydmkPX/EPeULsbgdZp6sybGoPpEuxzb4CYeRjogB9VvPCRAPb4D/1hRdpoVgWI78JvaeI+xwrP71RuHggZEsM8FSYFBD8c5dY+iAHbPSBI6QSZMvMHCu8YVlV40rHFjjoKQ1ox9DHHyvaZkwAZbI/U7+CYZoPoXMAARjCCCW4TIB3VrM70QLjnLSVfWaCtTnYp2KWaRae0Ze7yPt/h1dYe4ofn/O3UH0kEBqJ99Srtrmr9UWdgikgrWCz5TAV27g2vsZubfMe8vC1QnqASazyBy74ibvrXrIvHnhHQvPCkZFRdbgYhV/+KQIQ==", + "base64": true +} diff --git a/tests/json/t-decrypt.out.json b/tests/json/t-decrypt.out.json new file mode 100644 index 0000000..eb52dc8 --- /dev/null +++ b/tests/json/t-decrypt.out.json @@ -0,0 +1,16 @@ +{ + "dec_info": { + "wrong_key_usage": false, + "is_de_vs": false, + "is_mime": false, + "legacy_cipher_nomdc": false, + "recipients": [{ + "pubkey_algo_name": "ELG-E", + "status_string": "Success", + "status_code": 0 + }] + }, + "type": "plaintext", + "base64": false, + "data": "Hello\n" +} diff --git a/tests/json/t-delete.in.json b/tests/json/t-delete.in.json new file mode 100644 index 0000000..a1e7d3d --- /dev/null +++ b/tests/json/t-delete.in.json @@ -0,0 +1,4 @@ +{ + "op": "delete", + "key": "E8143C489C8D41124DC40D0B47AF4B6961F04784" +} diff --git a/tests/json/t-delete.out.json b/tests/json/t-delete.out.json new file mode 100644 index 0000000..3041e49 --- /dev/null +++ b/tests/json/t-delete.out.json @@ -0,0 +1,3 @@ +{ + "success": true +} diff --git a/tests/json/t-encrypt-sign.in.json b/tests/json/t-encrypt-sign.in.json new file mode 100644 index 0000000..45e1d0b --- /dev/null +++ b/tests/json/t-encrypt-sign.in.json @@ -0,0 +1,8 @@ +{ + "op": "encrypt", + "keys": ["alpha at example.net", "victor at example.org"], + "signing_keys": ["A0FF4590BB6122EDEF6E3C542D727CC768697734"], + "data": "Hello world", + "armor": true, + "always-trust": true +} diff --git a/tests/json/t-encrypt-sign.out.json b/tests/json/t-encrypt-sign.out.json new file mode 100644 index 0000000..875ad08 --- /dev/null +++ b/tests/json/t-encrypt-sign.out.json @@ -0,0 +1,4 @@ +{ + "type": "ciphertext", + "base64": false +} diff --git a/tests/json/t-encrypt.in.json b/tests/json/t-encrypt.in.json new file mode 100644 index 0000000..35dc2c9 --- /dev/null +++ b/tests/json/t-encrypt.in.json @@ -0,0 +1,8 @@ +{ + "op": "encrypt", + "keys": ["bravo at example.net", "alpha at example.net"], + "data": "Hello world", + "file_name": "test.txt", + "armor": false, + "always-trust": true +} diff --git a/tests/json/t-encrypt.out.json b/tests/json/t-encrypt.out.json new file mode 100644 index 0000000..6fc4158 --- /dev/null +++ b/tests/json/t-encrypt.out.json @@ -0,0 +1,4 @@ +{ + "type": "ciphertext", + "base64": true +} diff --git a/tests/json/t-export-secret-info.in.json b/tests/json/t-export-secret-info.in.json new file mode 100644 index 0000000..d5c37f5 --- /dev/null +++ b/tests/json/t-export-secret-info.in.json @@ -0,0 +1,6 @@ +{ + "op": "export", + "keys": "alpha at example.net", + "armor": true, + "with-sec-fprs":true +} diff --git a/tests/json/t-export-secret-info.out.json b/tests/json/t-export-secret-info.out.json new file mode 100644 index 0000000..32ee650 --- /dev/null +++ b/tests/json/t-export-secret-info.out.json @@ -0,0 +1,6 @@ +{ + "type": "keys", + "base64": false, + "data": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQGiBDbjjp4RBAC2ZbFDX0wmJI8yLDYQdIiZeAuHLmfyHsqXaLGUMZtWiAvn/hNp\nctwahmzKm5oXinHUvUkLOQ0s8rOlu15nhw4azc30rTP1LsIkn5zORNnFdgYC6RKy\nhOeim/63+/yGtdnTm49lVfaCqwsEmBCEkXaeWDGq+ie1b89J89T6n/JquwCgoQkj\nVeVGG+B/SzJ6+yifdHWQVkcD/RXDyLXX4+WHGP2aet51XlKojWGwsZmc9LPPYhwU\n/RcUO7ce1QQb0XFlUVFBhY0JQpM/ty/kNi+aGWFzigbQ+HAWZkUvA8+VIAVneN+p\n+SHhGIyLTXKpAYTq46AwvllZ5Cpvf02Cp/+W1aVyA0qnBWMyeIxXmR9HOi6lxxn5\ncjajA/9VZufOXWqCXkBvz4Oy3Q5FbjQQ0/+ty8rDn8OTaiPi41FyUnEi6LO+qyBS\n09FjnZj++PkcRcXW99SNxmEJRY7MuNHt5wIvEH2jNEOJ9lszzZFBDbuwsjXHK35+\nlPbGEy69xCP26iEafysKKbRXJhE1C+tk8SnK+Gm62sivmK/5arQpQWxwaGEgVGVz\ndCAoZGVtbyBrZXkpIDxhbHBoYUBleGFtcGxlLm5ldD6IVQQTEQIAFQUCNuOOngML\nCgMDFQMCAxYCAQIXgAAKCRAtcnzHaGl3NDl4AKCBLmRplv/8ZfSqep5IjqEAuaXv\nWwCgl6NEzT+/WewPTGcwZY+pLkycLv2IVQQTEQIAFQUCNuOOngMLCgMDFQMCAxYC\nAQIXgAAKCRAtcnzHaGl3NDl4AJ4rouHB+LpCkNi5C59jHEa1kbANzACgmddtrNSj\n1yPyTCwUwRghPUomECS0EEFsaWNlIChkZW1vIGtleSmIVQQTEQIAFQUCNuO2qwML\nCgMDFQMCAxYCAQIXgAAKCRAtcnzHaGl3NCeMAJ9MeUVrago5Jc6PdwdeN5OMwby3\n7QCghW65cZTQlD1bBlIq/QM8bz9AN4G0J0FsZmEgVGVzdCAoZGVtbyBrZXkpIDxh\nbGZhQGV4YW1wbGUubmV0PohVBBMRAgAVBQI247hYAwsKAwMVAwIDFgIBAheAAAoJ\nEC1yfMdoaXc0t8IAoJPwa6j+Vm5Vi3Nvuo8JZri4PJ/DAJ9dqbmaJdB8FdJnHfGh\n1rXK3y/JcrkBDQQ2448PEAQAnI3XH1f0uyN9fZnw72zsHMw706g7EW29nD4UDQG4\nOzRZViSrUa5n39eI7QrfTO+1meVvs0y8F/PvFst5jH68rPLnGSrXz4sTl1T4cop1\nFBkquvCAKwPLy0lE7jjtCyItOSwIOo8xoTfY4JEEXmcqsbm+KHv9yYSF/YK4Cf7b\nIzcAAwcD/Rnl5jKxoucDA96pD2829TKsLFQSau+Xiy8bvOSSDdlyABsOkNBSaeKO\n3eAQEKgDM7dzjVNTnAlpQ0EQ8Y9Z8pxOWYEQYlaMrnRBC4DZ2IadzEhLlIOz5BVp\n/jfhrr8oVVBwKZXsrz9PZLz+e4Yn+siUUvlei9boD9L2ZgSOHakPiEYEGBECAAYF\nAjbjjw8ACgkQLXJ8x2hpdzQgqQCfcDXmD8uNVdKg/C9vqI3JSndqknsAnRxzVeHi\n/iJ73OCKtvFrHbV9Gogq\n=6f6v\n-----END PGP PUBLIC KEY BLOCK-----\n", + "sec-fprs": ["A0FF4590BB6122EDEF6E3C542D727CC768697734"] +} diff --git a/tests/json/t-export.in.json b/tests/json/t-export.in.json new file mode 100644 index 0000000..831369e --- /dev/null +++ b/tests/json/t-export.in.json @@ -0,0 +1,5 @@ +{ + "op": "export", + "keys": "victor at example.org", + "armor": true +} diff --git a/tests/json/t-export.out.json b/tests/json/t-export.out.json new file mode 100644 index 0000000..104fa43 --- /dev/null +++ b/tests/json/t-export.out.json @@ -0,0 +1,5 @@ +{ + "type": "keys", + "base64": false, + "data": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQGiBDbjs5oRBACjAxqGzA6j190iiN/1vJvS5jYLQ1H3xxhzXdZ6ZxjPJkslX1ox\nFqBINhjzBJnV9/7b1FFe5089NiCcGUVZa2xD3Vu+niLTAGNTQeNy6Y0E6wEfvplQ\nLJbpVGOmuVeZyShHNCKjrsZFtS1mr7o19SUb5QWS3gZHabFTbmhibcFBXwCg36qG\nVAnGcZzvnUTGpRy3xjp+zuED/2qTJNpnPhicKSksVwb6EJFXH7mQSZlyblAnOAVF\nMx19GUijW4MWP5FUdcTd5KzIDgkenRLBrpCLIFVkQ4/baP/hOiCLOmCoRu3xnFyo\nRPM/Jn94Qy3Jo2wigwkhQU+zyOU5C85QBD9ctkbYp/0mu9bpxmYTchHwD1v3dXUX\nEVajA/9lnEz1GiI0bwKpm8VKXp0YYP5hea8Jh5fNVb1QW2QqGd+XNHnRGSqX5smG\nyrs+xoYxD8+jv1FhmGaSv+6+n+JBVK4TuWrQpZ0cgZL5jZnX27TOYXeY4d5YKgE+\n7ZO57TwCIfF/P6puflGm+t5GcFwj4kkfohMEaeNhm1S+xf29q7QrVmljdG9yIFRl\nc3QgKGRlbW8ga2V5KSA8dmljdG9yQGV4YW1wbGUub3JnPohVBBMRAgAVBQI247Oa\nAwsKAwMVAwIDFgIBAheAAAoJEEevS2lh8EeEzEkAoMA+KfY9bA8EdfvWwa8zUM1S\nMs5rAKDS+6X3HVuCaLtVxzXOob+DKbB7b7kBDQQ247O+EAQAh5FAgdvaTJL3jBGc\njYiiJosxeTWf3L/dUY99fZN8R39DSVoUKf9Rt/EsS5DywXVnKAeJiUTYw8lbMRVF\n70VhSDHpMC9KtbB0lk3CcAqULPiyirT5g9ywN24W7k0naWIJisttUh+Hqbm6gc5P\nz9Nfd5ll8x4Ehi3lKE6Nze3gUNMAAwUD/AtUN1hqwWTTphVZctHq3JaUEb9agmu/\nOcsf24/bq9i8R8FaMwBF4fI5qIimcqAM+2BZ6dvZEdqrVaZR9aHjzchcHmaiI7Zm\nW4gmk+LHFFWf9y7mG8YDKFBXkaBuJpxFb1FIfJpmaLzJmRa76dLqI3A7H2E8dFQa\n/MGsYCa4NmILiEUEGBECAAYFAjbjs74ACgkQR69LaWHwR4RT3QCgnMlRAiGtvL5l\nD4Gdo5F0KEP5zZEAlA6Ri9WmZ9Xiqw5R3Bsg+As8sJ4=\n=FRd4\n-----END PGP PUBLIC KEY BLOCK-----\n" +} diff --git a/tests/json/t-json.c b/tests/json/t-json.c index f5b2793..1f45feb 100644 --- a/tests/json/t-json.c +++ b/tests/json/t-json.c @@ -36,7 +36,15 @@ #include "../../src/cJSON.h" /* Register tests here */ -static const char*tests[] = { "t-keylist", "t-config", "t-keylist", NULL }; +static const char*tests[] = { "t-config", "t-version", + "t-keylist", "t-keylist-secret", "t-decrypt", "t-config-opt", + "t-encrypt", "t-encrypt-sign", "t-sign", "t-verify", + "t-decrypt-verify", "t-export", "t-createkey", + "t-export-secret-info", + /* For these two the order is important + * as t-import imports the deleted key from t-delete */ + "t-delete", "t-import", + NULL }; static int verbose = 0; diff --git a/tests/json/t-keylist-secret.in.json b/tests/json/t-keylist-secret.in.json new file mode 100644 index 0000000..22292a7 --- /dev/null +++ b/tests/json/t-keylist-secret.in.json @@ -0,0 +1,5 @@ +{ + "op": "keylist", + "keys": [ "bravo at example.net", "alpha at example.net" ], + "with-secret": true +} diff --git a/tests/json/t-keylist-secret.out.json b/tests/json/t-keylist-secret.out.json new file mode 100644 index 0000000..5da20db --- /dev/null +++ b/tests/json/t-keylist-secret.out.json @@ -0,0 +1,163 @@ +{ + "keys": [{ + "revoked": false, + "expired": false, + "disabled": false, + "invalid": false, + "can_encrypt": true, + "can_sign": true, + "can_certify": true, + "can_authenticate": true, + "secret": true, + "is_qualified": false, + "protocol": "OpenPGP", + "fingerprint": "A0FF4590BB6122EDEF6E3C542D727CC768697734", + "subkeys": [{ + "revoked": false, + "expired": false, + "disabled": false, + "invalid": false, + "can_encrypt": false, + "can_sign": true, + "can_certify": true, + "can_authenticate": true, + "is_qualified": false, + "is_cardkey": false, + "is_de_vs": false, + "pubkey_algo_name": "DSA", + "pubkey_algo_string": "dsa1024", + "keyid": "2D727CC768697734", + "keygrip": "76F7E2B35832976B50A27A282D9B87E44577EB66", + "pubkey_algo": 17, + "length": 1024, + "timestamp": 920882846, + "expires": 0 + }, { + "revoked": false, + "expired": false, + "disabled": false, + "invalid": false, + "can_encrypt": true, + "can_sign": false, + "can_certify": false, + "can_authenticate": false, + "is_qualified": false, + "is_cardkey": false, + "is_de_vs": false, + "pubkey_algo_name": "ELG-E", + "pubkey_algo_string": "elg1024", + "keyid": "6AE6D7EE46A871F8", + "keygrip": "A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD", + "pubkey_algo": 16, + "length": 1024, + "timestamp": 920882959, + "expires": 0 + }], + "userids": [{ + "revoked": false, + "invalid": false, + "validity": "unknown", + "uid": "Alfa Test (demo key) ", + "name": "Alfa Test", + "email": "alfa at example.net", + "comment": "demo key", + "address": "alfa at example.net" + }, { + "revoked": false, + "invalid": false, + "validity": "unknown", + "uid": "Alpha Test (demo key) ", + "name": "Alpha Test", + "email": "alpha at example.net", + "comment": "demo key", + "address": "alpha at example.net" + }, { + "revoked": false, + "invalid": false, + "validity": "unknown", + "uid": "Alice (demo key)", + "name": "Alice", + "email": "", + "comment": "demo key", + "origin": 0, + "last_update": 0 + }] + }, { + "revoked": false, + "expired": false, + "disabled": false, + "invalid": false, + "can_encrypt": true, + "can_sign": true, + "can_certify": true, + "can_authenticate": true, + "secret": true, + "is_qualified": false, + "protocol": "OpenPGP", + "fingerprint": "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", + "owner_trust": "unknown", + "origin": 0, + "last_update": 0, + "subkeys": [{ + "revoked": false, + "expired": false, + "disabled": false, + "invalid": false, + "can_encrypt": false, + "can_sign": true, + "can_certify": true, + "can_authenticate": true, + "secret": false, + "is_qualified": false, + "is_cardkey": false, + "is_de_vs": false, + "pubkey_algo_name": "DSA", + "pubkey_algo_string": "dsa1024", + "keyid": "FE180B1DA9E3B0B2", + "keygrip": "6D62909991D2331E5F4F605BC4DD738F30E6D26B", + "pubkey_algo": 17, + "length": 1024, + "timestamp": 920888034, + "expires": 0 + }, { + "revoked": false, + "expired": false, + "disabled": false, + "invalid": false, + "can_encrypt": true, + "can_sign": false, + "can_certify": false, + "can_authenticate": false, + "secret": false, + "is_qualified": false, + "is_cardkey": false, + "is_de_vs": false, + "pubkey_algo_name": "ELG-E", + "pubkey_algo_string": "elg1024", + "keyid": "5381EA4EE29BA37F", + "keygrip": "6BBF325FADDC1109AE36CD535CA77AB9CFADD1F2", + "pubkey_algo": 16, + "length": 1024, + "timestamp": 920888071, + "expires": 0 + }], + "userids": [{ + "revoked": false, + "invalid": false, + "validity": "unknown", + "uid": "Bob (demo key)", + "name": "Bob", + "email": "", + "comment": "demo key" + }, { + "revoked": false, + "invalid": false, + "validity": "unknown", + "uid": "Bravo Test (demo key) ", + "name": "Bravo Test", + "email": "bravo at example.net", + "comment": "demo key", + "address": "bravo at example.net" + }] + }] +} diff --git a/tests/json/t-keylist.in.json b/tests/json/t-keylist.in.json new file mode 100644 index 0000000..6537709 --- /dev/null +++ b/tests/json/t-keylist.in.json @@ -0,0 +1,5 @@ +{ + "op": "keylist", + "keys": [ "zulu at example.net" ], + "with-secret": false +} diff --git a/tests/json/t-keylist.out.json b/tests/json/t-keylist.out.json new file mode 100644 index 0000000..eb85867 --- /dev/null +++ b/tests/json/t-keylist.out.json @@ -0,0 +1,65 @@ +{ + "keys": [{ + "revoked": false, + "expired": false, + "disabled": false, + "invalid": false, + "can_encrypt": true, + "can_sign": true, + "can_certify": true, + "can_authenticate": true, + "secret": false, + "is_qualified": false, + "protocol": "OpenPGP", + "fingerprint": "23FD347A419429BACCD5E72D6BC4778054ACD246", + "subkeys": [{ + "revoked": false, + "expired": false, + "disabled": false, + "invalid": false, + "can_encrypt": false, + "can_sign": true, + "can_certify": true, + "can_authenticate": true, + "secret": false, + "is_qualified": false, + "is_cardkey": false, + "is_de_vs": false, + "pubkey_algo_name": "DSA", + "pubkey_algo_string": "dsa1024", + "pubkey_algo": 17, + "length": 1024, + "timestamp": 920892875, + "expires": 0 + }, { + "revoked": false, + "expired": false, + "disabled": false, + "invalid": false, + "can_encrypt": true, + "can_sign": false, + "can_certify": false, + "can_authenticate": false, + "secret": false, + "is_qualified": false, + "is_cardkey": false, + "is_de_vs": false, + "pubkey_algo_name": "ELG-E", + "pubkey_algo_string": "elg1024", + "pubkey_algo": 16, + "length": 1024, + "timestamp": 920892914, + "expires": 0 + }], + "userids": [{ + "revoked": false, + "invalid": false, + "validity": "unknown", + "uid": "Zulu Test (demo key) ", + "name": "Zulu Test", + "email": "zulu at example.net", + "comment": "demo key", + "address": "zulu at example.net" + }] + }] +} diff --git a/tests/json/t-verify.in.json b/tests/json/t-verify.in.json new file mode 100644 index 0000000..1aa1639 --- /dev/null +++ b/tests/json/t-verify.in.json @@ -0,0 +1,5 @@ +{ + "op": "verify", + "data": "Hello world", + "signature": "-----BEGIN PGP SIGNATURE-----\n\niHAEABECADAWIQSg/0WQu2Ei7e9uPFQtcnzHaGl3NAUCW+we3RIcYWxwaGFAZXhh\nbXBsZS5uZXQACgkQLXJ8x2hpdzSwIgCfdfk+n6SsYwa9SYfBwr/o4FmWsa8Anj3V\n8p3ahr3rxNbK7cDbSk/p1zD0\n=oS5d\n-----END PGP SIGNATURE-----" +} diff --git a/tests/json/t-verify.out.json b/tests/json/t-verify.out.json new file mode 100644 index 0000000..e7d7c52 --- /dev/null +++ b/tests/json/t-verify.out.json @@ -0,0 +1,35 @@ +{ + "info": { + "is_mime": false, + "signatures": [{ + "summary": { + "sigsum": [], + "valid": false, + "green": false, + "red": false, + "revoked": false, + "key-expired": false, + "sig-expired": false, + "key-missing": false, + "crl-missing": false, + "crl-too-old": false, + "bad-policy": false, + "sys-error": false + }, + "wrong_key_usage": false, + "chain_model": false, + "is_de_vs": false, + "status_string": "Success", + "fingerprint": "A0FF4590BB6122EDEF6E3C542D727CC768697734", + "validity_string": "unknown", + "pubkey_algo_name": "DSA", + "hash_algo_name": "SHA1", + "status_code": 0, + "timestamp": 1542201053, + "exp_timestamp": 0, + "pka_trust": 0, + "validity": 0, + "validity_reason": 0 + }] + } +} diff --git a/tests/json/t-version.in.json b/tests/json/t-version.in.json new file mode 100644 index 0000000..08c96e5 --- /dev/null +++ b/tests/json/t-version.in.json @@ -0,0 +1,3 @@ +{ + "op": "version" +} diff --git a/tests/json/t-version.out.json b/tests/json/t-version.out.json new file mode 100644 index 0000000..1e418f3 --- /dev/null +++ b/tests/json/t-version.out.json @@ -0,0 +1,10 @@ +{ + "info": [{ + "protocol": "OpenPGP" + }, { + "protocol": "spawn", + "fname": "/nonexistent", + "version": "1.0.0", + "req_version": "1.0.0" + }] +} commit 9a31fdcb11d04d47dfcc38a8409b84436c549108 Author: Andre Heinecke Date: Wed Nov 14 14:57:40 2018 +0100 tests,json: Add wildcard string matching * tests/json/t-json.c (test_contains): When searching for "*" accept every string. -- This allows it to write tests that check for the existence of a string value but don't care about the contents. E.g. for Data. diff --git a/tests/json/t-json.c b/tests/json/t-json.c index 07b9984..f5b2793 100644 --- a/tests/json/t-json.c +++ b/tests/json/t-json.c @@ -125,7 +125,9 @@ test_contains (cjson_t needle, cjson_t hay) } if (cjson_is_string (needle)) { - if (strcmp (needle->valuestring, hay->valuestring)) + if (strcmp (needle->valuestring, hay->valuestring) && + /* Use * as a general don't care placeholder */ + strcmp (needle->valuestring, "*")) { if (verbose) fprintf (stderr, "%s: string mismatch Expected '%s' got '%s'\n", commit e55e467d5ffb32c428566a876616d309ef2d15cd Author: Andre Heinecke Date: Wed Nov 14 14:55:09 2018 +0100 tests,json: Skip tests for older GnuPG versions * tests/json/t-json.c (main): Skip if version is not at least 2.2.0 -- In the past new tests often failed when a modern GPGME was used with old GnuPG's. This should avoid the hassle for packagers without the requirement that we test against old versions. diff --git a/tests/json/t-json.c b/tests/json/t-json.c index 26f870c..07b9984 100644 --- a/tests/json/t-json.c +++ b/tests/json/t-json.c @@ -350,6 +350,14 @@ main (int argc, char *argv[]) } } + if (!check_gpg_version ("2.2.0")) + { + /* Lets not break too much or have to test all combinations */ + printf ("Testsuite skipped. Minimum GnuPG version (2.2.0) " + "not found.\n"); + exit(0); + } + init_gpgme (GPGME_PROTOCOL_SPAWN); for (const char **test = tests; *test; test++) commit ca2e2b3d6973b1f942571ba65bd8b57153847777 Author: Andre Heinecke Date: Wed Nov 14 14:53:28 2018 +0100 tests,json: Suffix .json to test pattern * tests/json/t-config.in, tests/json/t-config.out: Renamed. * t-json.c (run_test): Use new naming pattern. diff --git a/tests/json/t-config.in b/tests/json/t-config.in.json similarity index 100% rename from tests/json/t-config.in rename to tests/json/t-config.in.json diff --git a/tests/json/t-config.out b/tests/json/t-config.out.json similarity index 100% rename from tests/json/t-config.out rename to tests/json/t-config.out.json diff --git a/tests/json/t-json.c b/tests/json/t-json.c index 0bd35b5..26f870c 100644 --- a/tests/json/t-json.c +++ b/tests/json/t-json.c @@ -261,9 +261,9 @@ run_test (const char *test, const char *gpgme_json) exit(1); } - gpgrt_asprintf (&test_in, "%s/tests/json/%s.in", + gpgrt_asprintf (&test_in, "%s/tests/json/%s.in.json", top_srcdir, test); - gpgrt_asprintf (&test_out, "%s/tests/json/%s.out", + gpgrt_asprintf (&test_out, "%s/tests/json/%s.out.json", top_srcdir, test); printf ("Running %s...\n", test); commit 5b61c092e7444749b08e39ac5aa9fb0818e1a076 Author: Andre Heinecke Date: Wed Nov 14 14:50:57 2018 +0100 tests,gpg: Add version check hlp to t-support * t-support.h (parse_version_number, parse_version_string) (compare_versions): New. Copy&Paste from src/version.c (check_gpg_version): New helper to check for a gpg version. -- This should make it easier to write tests that e.g. rely on modern gnupg features. diff --git a/tests/gpg/t-support.h b/tests/gpg/t-support.h index ef5766a..a1536c1 100644 --- a/tests/gpg/t-support.h +++ b/tests/gpg/t-support.h @@ -23,6 +23,8 @@ #include #include #include +#include +#include #ifdef HAVE_W32_SYSTEM #include @@ -215,3 +217,105 @@ print_import_result (gpgme_import_result_t r) r->skipped_v3_keys); } + +/* Read the next number in the version string STR and return it in + *NUMBER. Return a pointer to the tail of STR after parsing, or + *NULL if the version string was invalid. */ +static const char * +parse_version_number (const char *str, int *number) +{ +#define MAXVAL ((INT_MAX - 10) / 10) + int val = 0; + + /* Leading zeros are not allowed. */ + if (*str == '0' && isdigit(str[1])) + return NULL; + + while (isdigit (*str) && val <= MAXVAL) + { + val *= 10; + val += *(str++) - '0'; + } + *number = val; + return val > MAXVAL ? NULL : str; +} + + +/* Parse the version string STR in the format MAJOR.MINOR.MICRO (for + example, 9.3.2) and return the components in MAJOR, MINOR and MICRO + as integers. The function returns the tail of the string that + follows the version number. This might be the empty string if there + is nothing following the version number, or a patchlevel. The + function returns NULL if the version string is not valid. */ +static const char * +parse_version_string (const char *str, int *major, int *minor, int *micro) +{ + str = parse_version_number (str, major); + if (!str || *str != '.') + return NULL; + str++; + + str = parse_version_number (str, minor); + if (!str || *str != '.') + return NULL; + str++; + + str = parse_version_number (str, micro); + if (!str) + return NULL; + + /* A patchlevel might follow. */ + return str; +} + + +/* Return true if MY_VERSION is at least REQ_VERSION, and false + otherwise. */ +static int +compare_versions (const char *my_version, + const char *rq_version) +{ + int my_major, my_minor, my_micro; + int rq_major, rq_minor, rq_micro; + const char *my_plvl, *rq_plvl; + + if (!rq_version) + return 1; + if (!my_version) + return 0; + + my_plvl = parse_version_string (my_version, &my_major, &my_minor, &my_micro); + if (!my_plvl) + return 0; + + rq_plvl = parse_version_string (rq_version, &rq_major, &rq_minor, &rq_micro); + if (!rq_plvl) + return 0; + + if (my_major > rq_major + || (my_major == rq_major && my_minor > rq_minor) + || (my_major == rq_major && my_minor == rq_minor + && my_micro > rq_micro) + || (my_major == rq_major && my_minor == rq_minor + && my_micro == rq_micro && strcmp (my_plvl, rq_plvl) >= 0)) + return 1; + + return 0; +} + +/* Return true if we have the required gpg version. */ +static int +check_gpg_version (const char *req_version) +{ + gpgme_engine_info_t engine_info; + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + fail_if_err (gpgme_get_engine_info (&engine_info)); + for (; engine_info; engine_info = engine_info->next) + if (engine_info->protocol == GPGME_PROTOCOL_OpenPGP) + break; + + test (engine_info); + + return compare_versions (engine_info->version, req_version); +} commit 9933641cce595ba308d0f3a1f3ae8f13a9743dd1 Author: Andre Heinecke Date: Wed Nov 14 13:14:52 2018 +0100 tests,json: Improve verbose mode and add verbose 2 * tests/json/t-json.c (main): Handle multiple verbose args. (test-contains): Improve verbose output diff --git a/tests/json/t-json.c b/tests/json/t-json.c index 53a5743..0bd35b5 100644 --- a/tests/json/t-json.c +++ b/tests/json/t-json.c @@ -36,7 +36,7 @@ #include "../../src/cJSON.h" /* Register tests here */ -static const char*tests[] = { "t-config", NULL }; +static const char*tests[] = { "t-keylist", "t-config", "t-keylist", NULL }; static int verbose = 0; @@ -95,14 +95,18 @@ get_file (const char *fname) int test_contains (cjson_t needle, cjson_t hay) { - /*fprintf (stderr, "checking \n%s\n -------against-------- \n%s\n", - cJSON_Print (needle), cJSON_Print (hay)); */ + if (verbose == 2) + fprintf (stderr, "%s: -------checking-------- " + "\n%s\n -------against-------- \n%s\n", + nonnull (needle->string), cJSON_Print (needle), + cJSON_Print (hay)); /* Type check. This automatically checks bool vals and NULL */ if (needle->type != hay->type) { if (verbose) - fprintf (stderr, "type mismatch expected %i got %i\n", needle->type, + fprintf (stderr, "%s: type mismatch expected %i got %i\n", + nonnull (needle->string), needle->type, hay->type); return 1; } @@ -113,8 +117,9 @@ test_contains (cjson_t needle, cjson_t hay) if (needle->valueint != hay->valueint) { if (verbose) - fprintf (stderr, "Value mismatch. Expected %i got %i\n", - needle->valueint, hay->valueint); + fprintf (stderr, "%s: value mismatch. Expected %i got %i\n", + nonnull (needle->string), needle->valueint, + hay->valueint); return 1; } } @@ -123,8 +128,8 @@ test_contains (cjson_t needle, cjson_t hay) if (strcmp (needle->valuestring, hay->valuestring)) { if (verbose) - fprintf (stderr, "String mismatch Expected '%s' got '%s'\n", - needle->valuestring, hay->valuestring); + fprintf (stderr, "%s: string mismatch Expected '%s' got '%s'\n", + needle->string, needle->valuestring, hay->valuestring); return 1; } } @@ -329,15 +334,22 @@ int main (int argc, char *argv[]) { const char *gpgme_json = getenv ("gpgme_json"); + int last_argc = -1; - if (argc == 2 && !strcmp (argv[1], "--verbose")) + if (argc) + { argc--; argv++; } + + + while (argc && last_argc != argc ) { - /* Note that verbose will print out lots of mismatchs - because we have to try trough anonymous objects */ - verbose = 1; + last_argc = argc; + if (!strcmp (*argv, "--verbose")) + { + verbose++; + argc--; argv++; + } } - init_gpgme (GPGME_PROTOCOL_SPAWN); for (const char **test = tests; *test; test++) commit 3e5684d99b881787f9739e53fd8e8c22eadc2146 Author: Andre Heinecke Date: Wed Nov 14 13:05:36 2018 +0100 tests,json: Fix and improve t-json * tests/json/t-json.c (run_test): Terminate argv array correctly. (run_test): Note and handle empty response. diff --git a/tests/json/t-json.c b/tests/json/t-json.c index ec294f7..53a5743 100644 --- a/tests/json/t-json.c +++ b/tests/json/t-json.c @@ -243,9 +243,9 @@ run_test (const char *test, const char *gpgme_json) gpgme_data_t json_stderr = NULL; char *test_in; char *test_out; - const char *argv[2]; + const char *argv[3]; char *response; - char *expected; + char *expected = NULL; size_t response_size; int rc = 0; const char *top_srcdir = getenv ("top_srcdir"); @@ -256,9 +256,9 @@ run_test (const char *test, const char *gpgme_json) exit(1); } - gpgrt_asprintf (&test_in, "%s//tests//json//%s.in", + gpgrt_asprintf (&test_in, "%s/tests/json/%s.in", top_srcdir, test); - gpgrt_asprintf (&test_out, "%s//tests//json//%s.out", + gpgrt_asprintf (&test_out, "%s/tests/json/%s.out", top_srcdir, test); printf ("Running %s...\n", test); @@ -273,6 +273,7 @@ run_test (const char *test, const char *gpgme_json) argv[0] = gpgme_json; argv[1] = "-s"; + argv[2] = NULL; fail_if_err (gpgme_op_spawn (ctx, gpgme_json, argv, json_stdin, @@ -281,13 +282,18 @@ run_test (const char *test, const char *gpgme_json) 0)); response = gpgme_data_release_and_get_mem (json_stdout, &response_size); - test (response_size); - - expected = get_file (test_out); + if (response_size) + { + expected = get_file (test_out); - test (expected); + test (expected); - rc = check_response (response, expected); + rc = check_response (response, expected); + } + else + { + rc = 1; + } if (!rc) { @@ -300,7 +306,8 @@ run_test (const char *test, const char *gpgme_json) size_t size; buf = gpgme_data_release_and_get_mem (json_stderr, &size); - printf (" failed\n"); + printf (" failed%s\n", response_size ? "" : + ", no response from gpgme-json"); if (size) { printf ("gpgme-json stderr:\n%.*s\n", (int)size, buf); ----------------------------------------------------------------------- Summary of changes: tests/gpg/t-support.h | 104 ++++++++++++++++ tests/json/{t-config.in => t-config.in.json} | 0 tests/json/{t-config.out => t-config.out.json} | 0 tests/json/t-createkey.in.json | 5 + tests/json/t-createkey.out.json | 3 + tests/json/t-decrypt-verify.in.json | 5 + tests/json/t-decrypt-verify.out.json | 56 +++++++++ tests/json/t-decrypt.in.json | 5 + tests/json/t-decrypt.out.json | 16 +++ tests/json/t-delete.in.json | 4 + tests/json/t-delete.out.json | 3 + tests/json/t-encrypt-sign.in.json | 8 ++ tests/json/t-encrypt-sign.out.json | 4 + tests/json/t-encrypt.in.json | 8 ++ tests/json/t-encrypt.out.json | 4 + tests/json/t-export-secret-info.in.json | 6 + tests/json/t-export-secret-info.out.json | 6 + tests/json/t-export.in.json | 5 + tests/json/t-export.out.json | 5 + tests/json/t-json.c | 83 +++++++++---- tests/json/t-keylist-secret.in.json | 5 + tests/json/t-keylist-secret.out.json | 163 +++++++++++++++++++++++++ tests/json/t-keylist.in.json | 5 + tests/json/t-keylist.out.json | 65 ++++++++++ tests/json/t-verify.in.json | 5 + tests/json/t-verify.out.json | 35 ++++++ tests/json/t-version.in.json | 3 + tests/json/t-version.out.json | 10 ++ 28 files changed, 598 insertions(+), 23 deletions(-) rename tests/json/{t-config.in => t-config.in.json} (100%) rename tests/json/{t-config.out => t-config.out.json} (100%) create mode 100644 tests/json/t-createkey.in.json create mode 100644 tests/json/t-createkey.out.json create mode 100644 tests/json/t-decrypt-verify.in.json create mode 100644 tests/json/t-decrypt-verify.out.json create mode 100644 tests/json/t-decrypt.in.json create mode 100644 tests/json/t-decrypt.out.json create mode 100644 tests/json/t-delete.in.json create mode 100644 tests/json/t-delete.out.json create mode 100644 tests/json/t-encrypt-sign.in.json create mode 100644 tests/json/t-encrypt-sign.out.json create mode 100644 tests/json/t-encrypt.in.json create mode 100644 tests/json/t-encrypt.out.json create mode 100644 tests/json/t-export-secret-info.in.json create mode 100644 tests/json/t-export-secret-info.out.json create mode 100644 tests/json/t-export.in.json create mode 100644 tests/json/t-export.out.json create mode 100644 tests/json/t-keylist-secret.in.json create mode 100644 tests/json/t-keylist-secret.out.json create mode 100644 tests/json/t-keylist.in.json create mode 100644 tests/json/t-keylist.out.json create mode 100644 tests/json/t-verify.in.json create mode 100644 tests/json/t-verify.out.json create mode 100644 tests/json/t-version.in.json create mode 100644 tests/json/t-version.out.json hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 14 15:19:16 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 14 Nov 2018 15:19:16 +0100 Subject: [git] GPGME - branch, aheinecke/json-test, updated. gpgme-1.12.0-62-g27ca12e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, aheinecke/json-test has been updated via 27ca12e815c0a582d357641a04b889d648b8766e (commit) from dd4b80a5f640232bb44eb825ff5a74ec295fad10 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 27ca12e815c0a582d357641a04b889d648b8766e Author: Andre Heinecke Date: Wed Nov 14 15:17:18 2018 +0100 tests,json: Fix match if the first child differs * tests/json/t-json.c (test_contains): Try all siblings of the haystack child. -- This fixes the case where we don't match against the first child because the order might have changed or a new element was inserted at the top. Then we have to try out also all the siblings. diff --git a/tests/json/t-json.c b/tests/json/t-json.c index 1f45feb..7a4d906 100644 --- a/tests/json/t-json.c +++ b/tests/json/t-json.c @@ -154,7 +154,19 @@ test_contains (cjson_t needle, cjson_t hay) } if (test_contains (needle->child, hay->child)) { - return 1; + int found = 0; + for (cjson_t hit = hay->child; hit; hit = hit->next) + { + found |= !test_contains (needle->child, hit); + if (found) + { + break; + } + } + if (!found) + { + return 1; + } } } ----------------------------------------------------------------------- Summary of changes: tests/json/t-json.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 14 15:57:08 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 14 Nov 2018 15:57:08 +0100 Subject: [git] GPGME - branch, aheinecke/json-test, updated. gpgme-1.12.0-63-g88b7221 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, aheinecke/json-test has been updated via 88b7221eb737a3102ec61ea385990b7ea7ef2b30 (commit) from 27ca12e815c0a582d357641a04b889d648b8766e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 88b7221eb737a3102ec61ea385990b7ea7ef2b30 Author: Andre Heinecke Date: Wed Nov 14 15:55:02 2018 +0100 tests,json: Add missing files and chunking test * tests/json/Makefile.am, tests/json/final.test, tests/json/initial.test: New. * tests/json/t-chunking.in.json, tests/json/t-chunking.out.json: New test. * tests/json/t-json.c: Register new test. -- Oops.. diff --git a/tests/json/Makefile.am b/tests/json/Makefile.am new file mode 100644 index 0000000..74c9c3e --- /dev/null +++ b/tests/json/Makefile.am @@ -0,0 +1,106 @@ +# Copyright (C) 2018 Bundesamt f?r Sicherheit in der Informationstechnik +# Software engineering by Intevation GmbH +# +# This file is part of GPGME. +# +# GPGME is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 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 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, 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 + +GPGME_JSON=$(abs_builddir)/../../src/gpgme-json +GPG = gpg + +GNUPGHOME=$(abs_builddir) +TESTS_ENVIRONMENT = GNUPGHOME=$(GNUPGHOME) LC_ALL=C GPG_AGENT_INFO= \ + top_srcdir=$(top_srcdir) gpgme_json=$(GPGME_JSON) + +c_tests = t-json + +TESTS = initial.test $(c_tests) final.test + +CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \ + gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \ + random_seed S.gpg-agent .gpg-v21-migrated pubring-stamp \ + gpg-sample.stamp tofu.db *.conf.gpgconf.bak + +private_keys = \ + $(top_srcdir)/tests/gpg/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD \ + $(top_srcdir)/tests/gpg/76F7E2B35832976B50A27A282D9B87E44577EB66 \ + $(top_srcdir)/tests/gpg/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD \ + $(top_srcdir)/tests/gpg/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F \ + $(top_srcdir)/tests/gpg/7A030357C0F253A5BBCD282FFC4E521B37558F5C + + +EXTRA_DIST = t-chunking.in.json t-chunking.out.json \ + t-config.in.json t-config-opt.in.json \ + t-config-opt.out.json t-config.out.json \ + t-createkey.in.json t-createkey.out.json \ + t-decrypt.in.json t-decrypt.out.json \ + t-decrypt-verify.in.json t-decrypt-verify.out.json \ + t-delete.in.json t-delete.out.json \ + t-encrypt.in.json t-encrypt.out.json \ + t-encrypt-sign.in.json t-encrypt-sign.out.json \ + t-export.in.json t-export.out.json \ + t-export-secret-info.in.json t-export-secret-info.out.json \ + t-import.in.json t-import.out.json \ + t-keylist.in.json t-keylist.out.json \ + t-keylist-secret.in.json t-keylist-secret.out.json \ + t-sign.in.json t-sign.out.json \ + t-verify.in.json t-verify.out.json \ + t-version.in.json t-version.out.json + +BUILT_SOURCES = gpg.conf gpg-agent.conf pubring-stamp \ + gpg-sample.stamp +t_json_SOURCES = t-json.c ../../src/cJSON.o +AM_LDFLAGS = -no-install +LDADD = ../../src/libgpgme.la +t_json_LDADD = ../../src/cJSON.o -lm ../../src/libgpgme.la @GPG_ERROR_LIBS@ + +AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ + +noinst_PROGRAMS = $(c_tests) + +clean-local: + -$(TESTS_ENVIRONMENT) $(top_srcdir)/tests/start-stop-agent --stop + -rm -fR private-keys-v1.d + +gpg-sample.stamp: $(private_keys) + -$(TESTS_ENVIRONMENT) gpgconf --kill all + $(MKDIR_P) ./private-keys-v1.d + for k in $(private_keys); do \ + cp $$k private-keys-v1.d/$$(basename $$k).key; \ + done + echo x > ./gpg-sample.stamp + +pubring-stamp: $(top_srcdir)/tests/gpg/pubdemo.asc gpg-sample.stamp + $(TESTS_ENVIRONMENT) $(GPG) --batch --no-permission-warning \ + --import $(top_srcdir)/tests/gpg/pubdemo.asc + -$(TESTS_ENVIRONMENT) $(GPG) --batch --no-permission-warning \ + --import $(top_srcdir)/tests/gpg/secdemo.asc + echo x > ./pubring-stamp + +gpg.conf: +# This is required for t-sig-notations. + echo no-force-v3-sigs > ./gpg.conf + +gpg-agent.conf: +# This is required for gpg2, which does not support command fd for the +# passphrase. disable-scdaemon is required so that we don't try using +# a key from a smartcard reader (error might be: Unusable secret key) + echo pinentry-program $(abs_srcdir)/../gpg/pinentry > ./gpg-agent.conf + echo disable-scdaemon >> ./gpg-agent.conf + + +# end-of-file diff --git a/tests/json/final.test b/tests/json/final.test new file mode 100755 index 0000000..5289396 --- /dev/null +++ b/tests/json/final.test @@ -0,0 +1,4 @@ +#!/bin/sh + +${top_srcdir}/tests/start-stop-agent --stop +exit 0 diff --git a/tests/json/initial.test b/tests/json/initial.test new file mode 100755 index 0000000..93c8621 --- /dev/null +++ b/tests/json/initial.test @@ -0,0 +1,4 @@ +#!/bin/sh + +${top_srcdir}/tests/start-stop-agent --start +exit 0 diff --git a/tests/json/t-chunking.in.json b/tests/json/t-chunking.in.json new file mode 100644 index 0000000..3ff655b --- /dev/null +++ b/tests/json/t-chunking.in.json @@ -0,0 +1,5 @@ +{ + "op": "keylist", + "keys": ["alpha at example.net", "bravo at example.net"], + "chunksize": 64 +} diff --git a/tests/json/t-chunking.out.json b/tests/json/t-chunking.out.json new file mode 100644 index 0000000..bdc2f0f --- /dev/null +++ b/tests/json/t-chunking.out.json @@ -0,0 +1,5 @@ +{ + "base64": true, + "more": true, + "response": "*" +} diff --git a/tests/json/t-json.c b/tests/json/t-json.c index 7a4d906..98bd862 100644 --- a/tests/json/t-json.c +++ b/tests/json/t-json.c @@ -40,7 +40,7 @@ static const char*tests[] = { "t-config", "t-version", "t-keylist", "t-keylist-secret", "t-decrypt", "t-config-opt", "t-encrypt", "t-encrypt-sign", "t-sign", "t-verify", "t-decrypt-verify", "t-export", "t-createkey", - "t-export-secret-info", + "t-export-secret-info", "t-chunking", /* For these two the order is important * as t-import imports the deleted key from t-delete */ "t-delete", "t-import", ----------------------------------------------------------------------- Summary of changes: tests/{gpg => json}/Makefile.am | 87 +++++++++++++++++--------------------- tests/{gpg => json}/final.test | 0 tests/{gpgsm => json}/initial.test | 0 tests/json/t-chunking.in.json | 5 +++ tests/json/t-chunking.out.json | 5 +++ tests/json/t-json.c | 2 +- 6 files changed, 50 insertions(+), 49 deletions(-) copy tests/{gpg => json}/Makefile.am (53%) copy tests/{gpg => json}/final.test (100%) copy tests/{gpgsm => json}/initial.test (100%) create mode 100644 tests/json/t-chunking.in.json create mode 100644 tests/json/t-chunking.out.json hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 14 17:22:31 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 14 Nov 2018 17:22:31 +0100 Subject: [git] GPGME - branch, aheinecke/json-test, updated. gpgme-1.12.0-65-gdef030e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, aheinecke/json-test has been updated via def030e843bd4576597272abe9fe12f846066576 (commit) via d0087d45f0207bf82a4f078d972c28c4d1cd2690 (commit) from 88b7221eb737a3102ec61ea385990b7ea7ef2b30 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit def030e843bd4576597272abe9fe12f846066576 Author: Andre Heinecke Date: Wed Nov 14 17:21:24 2018 +0100 tests,json: Fix distcheck * tests/json/Makefile.am (EXTRA_DIST): Add inital and final scripts. (t_json_SOURCES): Don't use cJSON.o as source. diff --git a/tests/json/Makefile.am b/tests/json/Makefile.am index 74c9c3e..b4e1698 100644 --- a/tests/json/Makefile.am +++ b/tests/json/Makefile.am @@ -43,7 +43,8 @@ private_keys = \ $(top_srcdir)/tests/gpg/7A030357C0F253A5BBCD282FFC4E521B37558F5C -EXTRA_DIST = t-chunking.in.json t-chunking.out.json \ +EXTRA_DIST = initial.test final.test \ + t-chunking.in.json t-chunking.out.json \ t-config.in.json t-config-opt.in.json \ t-config-opt.out.json t-config.out.json \ t-createkey.in.json t-createkey.out.json \ @@ -63,7 +64,7 @@ EXTRA_DIST = t-chunking.in.json t-chunking.out.json \ BUILT_SOURCES = gpg.conf gpg-agent.conf pubring-stamp \ gpg-sample.stamp -t_json_SOURCES = t-json.c ../../src/cJSON.o +t_json_SOURCES = t-json.c AM_LDFLAGS = -no-install LDADD = ../../src/libgpgme.la t_json_LDADD = ../../src/cJSON.o -lm ../../src/libgpgme.la @GPG_ERROR_LIBS@ commit d0087d45f0207bf82a4f078d972c28c4d1cd2690 Author: Andre Heinecke Date: Wed Nov 14 17:05:25 2018 +0100 tests,json: Add more tests * t-config-opt.in.json, t-config-opt.out.json, t-import.in.json, t-import.out.json, t-sign.in.json, t-sign.out.json: New. -- These should actually have been in a previous commit as they are already registered. diff --git a/tests/json/t-config-opt.in.json b/tests/json/t-config-opt.in.json new file mode 100644 index 0000000..b949803 --- /dev/null +++ b/tests/json/t-config-opt.in.json @@ -0,0 +1,5 @@ +{ + "op": "config_opt", + "component": "gpg", + "option": "default-key" +} diff --git a/tests/json/t-config-opt.out.json b/tests/json/t-config-opt.out.json new file mode 100644 index 0000000..57f1158 --- /dev/null +++ b/tests/json/t-config-opt.out.json @@ -0,0 +1,6 @@ +{ + "option": { + "name": "default-key", + "argname": "NAME" + } +} diff --git a/tests/json/t-import.in.json b/tests/json/t-import.in.json new file mode 100644 index 0000000..20b94f0 --- /dev/null +++ b/tests/json/t-import.in.json @@ -0,0 +1,4 @@ +{ + "op": "import", + "data": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQGiBDbjs5oRBACjAxqGzA6j190iiN/1vJvS5jYLQ1H3xxhzXdZ6ZxjPJkslX1ox\nFqBINhjzBJnV9/7b1FFe5089NiCcGUVZa2xD3Vu+niLTAGNTQeNy6Y0E6wEfvplQ\nLJbpVGOmuVeZyShHNCKjrsZFtS1mr7o19SUb5QWS3gZHabFTbmhibcFBXwCg36qG\nVAnGcZzvnUTGpRy3xjp+zuED/2qTJNpnPhicKSksVwb6EJFXH7mQSZlyblAnOAVF\nMx19GUijW4MWP5FUdcTd5KzIDgkenRLBrpCLIFVkQ4/baP/hOiCLOmCoRu3xnFyo\nRPM/Jn94Qy3Jo2wigwkhQU+zyOU5C85QBD9ctkbYp/0mu9bpxmYTchHwD1v3dXUX\nEVajA/9lnEz1GiI0bwKpm8VKXp0YYP5hea8Jh5fNVb1QW2QqGd+XNHnRGSqX5smG\nyrs+xoYxD8+jv1FhmGaSv+6+n+JBVK4TuWrQpZ0cgZL5jZnX27TOYXeY4d5YKgE+\n7ZO57TwCIfF/P6puflGm+t5GcFwj4kkfohMEaeNhm1S+xf29q7QrVmljdG9yIFRl\nc3QgKGRlbW8ga2V5KSA8dmljdG9yQGV4YW1wbGUub3JnPohVBBMRAgAVBQI247Oa\nAwsKAwMVAwIDFgIBAheAAAoJEEevS2lh8EeEzEkAoMA+KfY9bA8EdfvWwa8zUM1S\nMs5rAKDS+6X3HVuCaLtVxzXOob+DKbB7b7kBDQQ247O+EAQAh5FAgdvaTJL3jBGc\njYiiJosxeTWf3L/dUY99fZN8R39DSVoUKf9Rt/EsS5DywXVnKAeJiUTYw8lbMRVF\n70VhSDHpMC9KtbB0lk3CcAqULPiyirT5g9ywN24W7k0naWIJisttUh+Hqbm6gc5P\nz9Nfd5ll8x4Ehi3lKE6Nze3gUNMAAwUD/AtUN1hqwWTTphVZctHq3JaUEb9agmu/\nOcsf24/bq9i8R8FaMwBF4fI5qIimcqAM+2BZ6dvZEdqrVaZR9aHjzchcHmaiI7Zm\nW4gmk+LHFFWf9y7mG8YDKFBXkaBuJpxFb1FIfJpmaLzJmRa76dLqI3A7H2E8dFQa\n/MGsYCa4NmILiEUEGBECAAYFAjbjs74ACgkQR69LaWHwR4RT3QCgnMlRAiGtvL5l\nD4Gdo5F0KEP5zZEAlA6Ri9WmZ9Xiqw5R3Bsg+As8sJ4=\n=FRd4\n-----END PGP PUBLIC KEY BLOCK-----\n" +} diff --git a/tests/json/t-import.out.json b/tests/json/t-import.out.json new file mode 100644 index 0000000..1f029af --- /dev/null +++ b/tests/json/t-import.out.json @@ -0,0 +1,22 @@ +{ + "result": { + "considered": 1, + "no_user_id": 0, + "imported_rsa": 0, + "new_user_ids": 0, + "new_sub_keys": 0, + "new_signatures": 0, + "new_revocations": 0, + "secret_read": 0, + "secret_imported": 0, + "secret_unchanged": 0, + "skipped_new_keys": 0, + "not_imported": 0, + "skipped_v3_keys": 0, + "imports": [{ + "fingerprint": "E8143C489C8D41124DC40D0B47AF4B6961F04784", + "error_string": "Success", + "status": 1 + }] + } +} diff --git a/tests/json/t-sign.in.json b/tests/json/t-sign.in.json new file mode 100644 index 0000000..9e04442 --- /dev/null +++ b/tests/json/t-sign.in.json @@ -0,0 +1,8 @@ +{ + "op": "sign", + "keys": "A0FF4590BB6122EDEF6E3C542D727CC768697734", + "sender": "alpha at example.net", + "data": "Hello world", + "armor": true, + "base64": false +} diff --git a/tests/json/t-sign.out.json b/tests/json/t-sign.out.json new file mode 100644 index 0000000..37d7f68 --- /dev/null +++ b/tests/json/t-sign.out.json @@ -0,0 +1,5 @@ +{ + "type": "signature", + "base64": false, + "data": "*" +} ----------------------------------------------------------------------- Summary of changes: tests/json/Makefile.am | 5 +++-- tests/json/t-config-opt.in.json | 5 +++++ tests/json/t-config-opt.out.json | 6 ++++++ tests/json/t-import.in.json | 4 ++++ tests/json/t-import.out.json | 22 ++++++++++++++++++++++ tests/json/t-sign.in.json | 8 ++++++++ tests/json/t-sign.out.json | 5 +++++ 7 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 tests/json/t-config-opt.in.json create mode 100644 tests/json/t-config-opt.out.json create mode 100644 tests/json/t-import.in.json create mode 100644 tests/json/t-import.out.json create mode 100644 tests/json/t-sign.in.json create mode 100644 tests/json/t-sign.out.json hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 14 17:56:59 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 14 Nov 2018 17:56:59 +0100 Subject: [git] GPGME - branch, aheinecke/json-test, updated. gpgme-1.12.0-66-gd3dae4a Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, aheinecke/json-test has been updated via d3dae4a445d950c94c952ddf54e534ef71675bd1 (commit) from def030e843bd4576597272abe9fe12f846066576 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d3dae4a445d950c94c952ddf54e534ef71675bd1 Author: Andre Heinecke Date: Wed Nov 14 17:56:23 2018 +0100 tests,json: Add sig-notations test * tests/json/t-sig-notations.in.json, tests/json/t-sig-notations.out.json: New * tests/json/Makefile.am (EXTRA_DIST): Add files. * tests/json/t-json.c: Register it. diff --git a/tests/json/Makefile.am b/tests/json/Makefile.am index b4e1698..3439ff7 100644 --- a/tests/json/Makefile.am +++ b/tests/json/Makefile.am @@ -59,6 +59,7 @@ EXTRA_DIST = initial.test final.test \ t-keylist.in.json t-keylist.out.json \ t-keylist-secret.in.json t-keylist-secret.out.json \ t-sign.in.json t-sign.out.json \ + t-sig-notations.in.json t-sig-notations.out.json \ t-verify.in.json t-verify.out.json \ t-version.in.json t-version.out.json diff --git a/tests/json/t-json.c b/tests/json/t-json.c index 98bd862..024b255 100644 --- a/tests/json/t-json.c +++ b/tests/json/t-json.c @@ -40,7 +40,7 @@ static const char*tests[] = { "t-config", "t-version", "t-keylist", "t-keylist-secret", "t-decrypt", "t-config-opt", "t-encrypt", "t-encrypt-sign", "t-sign", "t-verify", "t-decrypt-verify", "t-export", "t-createkey", - "t-export-secret-info", "t-chunking", + "t-export-secret-info", "t-chunking", "t-sig-notations", /* For these two the order is important * as t-import imports the deleted key from t-delete */ "t-delete", "t-import", diff --git a/tests/json/t-sig-notations.in.json b/tests/json/t-sig-notations.in.json new file mode 100644 index 0000000..184f1c6 --- /dev/null +++ b/tests/json/t-sig-notations.in.json @@ -0,0 +1,4 @@ +{ + "op": "verify", + "data": "-----BEGIN PGP MESSAGE-----\n\nowGbwMvMwCSoW1RzPCOz3ITxtFASQ/SbgPceiTk5+Qo+qaUlqVwd51kYBJkY+sUU\nWRb8d52wO1Hp7fs8mxCYHlYmkAaDKQ0MQKDAwF5QlJqWWlSUmqKbmpuYmaObmpec\nn5KZl+5QkF6gl5yfC6RyM3NTlUXAGrgZ+HMSS9MzQApyU71Ki0sUggtLU1OrUhV8\nU2WkMkpKCoqt9PXLy8v10vNK9fKL0vUL8nMykyv1Gbg4BWBuYP7OMN9VdOep8HTD\nKQLOd+7+Cshs6jVTfsMwT3sje7Pmui779IU/657Lb575u9z/LgA=\n=iqJ/\n-----END PGP MESSAGE-----\n\n" +} diff --git a/tests/json/t-sig-notations.out.json b/tests/json/t-sig-notations.out.json new file mode 100644 index 0000000..1376b22 --- /dev/null +++ b/tests/json/t-sig-notations.out.json @@ -0,0 +1,56 @@ +{ + "info": { + "is_mime": false, + "signatures": [{ + "summary": { + "sigsum": [], + "valid": false, + "green": false, + "red": false, + "revoked": false, + "key-expired": false, + "sig-expired": false, + "key-missing": false, + "crl-missing": false, + "crl-too-old": false, + "bad-policy": false, + "sys-error": false + }, + "wrong_key_usage": false, + "chain_model": false, + "is_de_vs": false, + "status_string": "Success", + "fingerprint": "A0FF4590BB6122EDEF6E3C542D727CC768697734", + "validity_string": "unknown", + "pubkey_algo_name": "DSA", + "hash_algo_name": "SHA1", + "status_code": 0, + "timestamp": 1542213871, + "exp_timestamp": 0, + "pka_trust": 0, + "validity": 0, + "validity_reason": 0, + "notations": [{ + "human_readable": false, + "critical": false, + "value": "https://www.gnu.org/policy/", + "flags": 0 + }, { + "human_readable": true, + "critical": false, + "name": "laughing at me", + "value": "Just Squeeze Me", + "flags": 1 + }, { + "human_readable": true, + "critical": true, + "name": "preferred-email-encoding at pgp.com", + "value": "pgpmime", + "flags": 3 + }] + }] + }, + "type": "plaintext", + "base64": false, + "data": "Hallo Leute\n" +} ----------------------------------------------------------------------- Summary of changes: tests/json/Makefile.am | 1 + tests/json/t-json.c | 2 +- tests/json/t-sig-notations.in.json | 4 ++ ...pt-verify.out.json => t-sig-notations.out.json} | 44 +++++++++++----------- 4 files changed, 28 insertions(+), 23 deletions(-) create mode 100644 tests/json/t-sig-notations.in.json copy tests/json/{t-decrypt-verify.out.json => t-sig-notations.out.json} (57%) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 14 20:34:08 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 14 Nov 2018 20:34:08 +0100 Subject: [git] gnupg-doc - branch, master, updated. a365c72247325606eb46306a5fbc462584ea6e4e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GnuPG website and other docs". The branch, master has been updated via a365c72247325606eb46306a5fbc462584ea6e4e (commit) from 1543a050978b89e82072b9901314d77e831d5b04 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a365c72247325606eb46306a5fbc462584ea6e4e Author: Werner Koch Date: Wed Nov 14 20:34:01 2018 +0100 web: Fix GPGrelay URL and mark some software as active or obsolete. diff --git a/web/software/swlist.org b/web/software/swlist.org index 262474c..9c5135b 100644 --- a/web/software/swlist.org +++ b/web/software/swlist.org @@ -5,9 +5,9 @@ * Software list -This is the complete list of software we know to work with GnuPG. The -header line indicates the supported operating systems and the type of -the software: +This is the complete list of software we know to work or once used to +work with GnuPG. The header line indicates the supported operating +systems and the type of the software: - GUI :: A graphical user interface for GnuPG - MUA :: A Mail User Agent (mail program) or a Plugin for MUA @@ -17,13 +17,17 @@ the software: - SRV :: Software for use on servers. - MISC :: Other types of software -** [[http://www.claws-mail.org/][Claws Mail]] [Unix, Windows] MUA +The flag /Active/ indicates that we know that this software is +actively maintained. /Obsolete/ mean that the software is not anymore +useful. + + +** [[http://www.claws-mail.org/][Claws Mail]] [Unix, Windows] MUA /Active/ :PROPERTIES: :CUSTOM_ID: claws :END: -Is a very nice GTK+ based MUA with full support for GnuPG. The Windows -version is part of [[http://www.gpg4win.org/][Gpg4win]]. +Is a very nice GTK+ based MUA with full support for GnuPG. ** [[http://code.google.com/p/cryptophane/][Cryptophane]] [Windows] GUI :PROPERTIES: @@ -34,7 +38,7 @@ Cryptophane is an easy-to-use application for MS Windows. It allows users to encrypt, sign, decrypt, and perform key maintenance without having to deal with GnuPG's command-line interface. -** [[http://egd.sourceforge.net][EGD]] [Unix] MISC +** [[http://egd.sourceforge.net][EGD]] [Unix] MISC /Obsolete/ :PROPERTIES: :CUSTOM_ID: egd :END: @@ -51,7 +55,7 @@ Mozilla Firefox extension for HTTP+OpenPGP support (see [[#mod-auth-openpgp][mod_auth_openpgp]]). -** [[http://www.enigmail.net/][Enigmail]] [Unix, Windows, OSX] MUA +** [[http://www.enigmail.net/][Enigmail]] [Unix, Windows, OSX] MUA /Active/ :PROPERTIES: :CUSTOM_ID: enigmail :END: @@ -65,7 +69,7 @@ Is a plug-in for Mozilla's Thunderbird mailer. Is a plugin for the proprietary Eudora MUA. -** [[http://www.ximian.com/products/ximian_evolution][Evolution]] [Unix] MUA +** [[http://www.ximian.com/products/ximian_evolution][Evolution]] [Unix] MUA /Active/ :PROPERTIES: :CUSTOM_ID: evolution :END: @@ -103,7 +107,7 @@ instant messaging system. It does not rely on a single server, and the protocol is well documented. Jabber allows communication with many different instant messaging systems, including ICQ and AIM. -** [[http://www.gajim.org/][Gajim]] [Unix] CHAT +** [[http://www.gajim.org/][Gajim]] [Unix] CHAT /Active/ :PROPERTIES: :CUSTOM_ID: gajim :END: @@ -121,7 +125,7 @@ Is an outgoing mail processor, and an SMTP tunnel between the MUA and the MTA. It strongly uses the GnuPG via the GPGME interface. With this GNU tool you can encrypt or sign an outgoing mail on-the-fly. -** [[http://www.collaboration-world.com/gnumail/][GNUmail.app]] [Unix] MUA +** [[http://www.collaboration-world.com/gnumail/][GNUmail.app]] [Unix] MUA /Active/ :PROPERTIES: :CUSTOM_ID: gnumail :END: @@ -142,7 +146,7 @@ GnuPG Shell is a cross-platform graphical frontend for GnuPG. This is a Java binding for GPGME library. -** [[gpa/index.en.html][GPA]] [Unix, Windows] GUI +** [[gpa/index.en.html][GPA]] [Unix, Windows] GUI /Active/ :PROPERTIES: :CUSTOM_ID: gpa :END: @@ -169,7 +173,7 @@ be used to encrypt any data. This script is able to encode/sign emails in an automatic fashion. There is also a [[http://linux.choma.hu/gpg-script/][mirror site]] available. -** [[http://www.gpg4win.org/][Gpg4win]] [Windows] INST +** [[http://www.gpg4win.org/][Gpg4win]] [Windows] INST /Active/ :PROPERTIES: :CUSTOM_ID: gpg4win :END: @@ -177,14 +181,16 @@ fashion. There is also a [[http://linux.choma.hu/gpg-script/][mirror site]] avai Gpg4win is an installer package for Windows with computer programs and handbooks for email and file encryption. -** [[http://www.gpgtools.org/gpgmail.html][GPGMail]] [OSX] MUA +** [[http://www.gpgtools.org/gpgmail.html][GPGMail]] [OSX] MUA /Active/ :PROPERTIES: :CUSTOM_ID: gpgmail :END: -Is a mail program for MAC OS X. +Is a mail program for MAC OS X. Note that only the source code is +delivered without charge; a binary version requires a paid +subscription. -** [[gpgme/index.org][GPGME]] [Unix,Windows,OSX] LIB +** [[gpgme/index.org][GPGME]] [Unix,Windows,OSX] LIB /Active/ :PROPERTIES: :CUSTOM_ID: gpgme :END: @@ -192,7 +198,7 @@ Is a mail program for MAC OS X. GnuPG Made Easy is the standard library for applications to access most GnuPG functions. -** [[http://www.g10code.de/p-gpgol.html][GpgOL]] [Windows] MUA +** [[http://www.g10code.de/p-gpgol.html][GpgOL]] [Windows] MUA /Active/ :PROPERTIES: :CUSTOM_ID: gpgol :END: @@ -200,20 +206,22 @@ most GnuPG functions. A plug-in for the Windows version of Microsoft Outlook. It is part of [[http://www.gpg4win.org/][Gpg4win]]. -** [[http://sites.inka.de/tesla/gpgrelay.html][GPGrelay]] [Windows] MUA +** [[https://sourceforge.net/projects/gpgrelay/][GPGrelay]] [Windows] MUA :PROPERTIES: :CUSTOM_ID: gpgrelay :END: Is a Windows program which can be used to use GnuPG with all MUAs. -** [[http://gpgtools.org/][GPGTools]] [OSX] INST +** [[http://gpgtools.org/][GPGTools]] [OSX] INST /Active/ :PROPERTIES: :CUSTOM_ID: gpgtools :END: GPGTools is an installer package for Mac OS X. It integrates all -required modules for easy use of GnuPG on this OS. +required modules for easy use of GnuPG on this OS. Note that only the +source code is delivered without charge; a binary version requires a +paid subscription. ** [[https://www.dyne.org/software/jaro-mail][Jaro Mail]] [Unix,OSX] MUA @@ -241,7 +249,7 @@ Is a tool to fetch keys from keyservers. Is a KDE frontend for GnuPG. -** [[http://kmail.kde.org/][KMail]] [Unix] MUA +** [[http://kmail.kde.org/][KMail]] [Unix] MUA /Active/ :PROPERTIES: :CUSTOM_ID: kmail :END: @@ -275,7 +283,7 @@ The MacGPG project has information on using GnuPG on OS-X. Is yet another set of scripts to use GnuPG with Pine. -** [[http://www.pobox.com/~lbudney/linux/software/mailcrypt.html][Mailcrypt]] [Unix] MUA +** [[http://www.pobox.com/~lbudney/linux/software/mailcrypt.html][Mailcrypt]] [Unix] MUA /Obsolete/ :PROPERTIES: :CUSTOM_ID: mailcrypt :END: @@ -306,7 +314,7 @@ Apache module for HTTP+OpenPGP support (see also [[#enigform][Enigform]]). -** [[http://www.mutt.org/][Mutt]] [Unix] MUA +** [[http://www.mutt.org/][Mutt]] [Unix] MUA /Active/ :PROPERTIES: :CUSTOM_ID: mutt :END: @@ -368,7 +376,7 @@ PGP with GnuPG. Is a perl script to sign HTML pages. -** [[pinentry/index.org][Pinentry]] [Unix,Windows,OSX] MISC +** [[pinentry/index.org][Pinentry]] [Unix,Windows,OSX] MISC /Active/ :PROPERTIES: :CUSTOM_ID: pinentry :END: @@ -391,7 +399,7 @@ Is what the name says. Is a secure networking suite that uses GnuPG as part of its authentication and encryption scheme. -** [[http://psi.affinix.com/][PSI]] [Unix, Windows] CHAT +** [[http://psi.affinix.com/][PSI]] [Unix, Windows] CHAT /Active/ :PROPERTIES: :CUSTOM_ID: psi :END: ----------------------------------------------------------------------- Summary of changes: web/software/swlist.org | 58 ++++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 25 deletions(-) hooks/post-receive -- The GnuPG website and other docs http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 15 04:31:24 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Thu, 15 Nov 2018 04:31:24 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-276-ga5542a4 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via a5542a4a702c2210facf58a98bc8d3d16089b6ab (commit) from 56022fb304cff884bb52a48e632b7045688786bf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a5542a4a702c2210facf58a98bc8d3d16089b6ab Author: NIIBE Yutaka Date: Thu Nov 15 12:19:02 2018 +0900 card: Display if KDF is enabled or not. * g10/call-agent.h (kdf_do_enabled): New field. * g10/call-agent.c (learn_status_cb): Set kdf_do_enabled if available. * g10/card-util.c (current_card_status): Inform the availability. Signed-off-by: NIIBE Yutaka diff --git a/g10/call-agent.c b/g10/call-agent.c index e9ea82e..2dbacf4 100644 --- a/g10/call-agent.c +++ b/g10/call-agent.c @@ -707,6 +707,10 @@ learn_status_cb (void *opaque, const char *line) xfree (parm->private_do[no]); parm->private_do[no] = unescape_status_string (line); } + else if (keywordlen == 3 && !memcmp (keyword, "KDF", 3)) + { + parm->kdf_do_enabled = 1; + } return 0; } diff --git a/g10/call-agent.h b/g10/call-agent.h index 1055b5e..1d232f7 100644 --- a/g10/call-agent.h +++ b/g10/call-agent.h @@ -72,6 +72,7 @@ struct agent_card_info_s unsigned int bt:1; /* Button for confirmation available. */ } extcap; unsigned int status_indicator; + int kdf_do_enabled; /* Card has a KDF object */ }; @@ -193,14 +194,14 @@ gpg_error_t agent_keywrap_key (ctrl_t ctrl, int forexport, gpg_error_t agent_import_key (ctrl_t ctrl, const char *desc, char **cache_nonce_addr, const void *key, size_t keylen, int unattended, int force, - u32 *keyid, u32 *mainkeyid, int pubkey_algo); + u32 *keyid, u32 *mainkeyid, int pubkey_algo); /* Receive a key from the agent. */ gpg_error_t agent_export_key (ctrl_t ctrl, const char *keygrip, const char *desc, int openpgp_protected, char **cache_nonce_addr, unsigned char **r_result, size_t *r_resultlen, - u32 *keyid, u32 *mainkeyid, int pubkey_algo); + u32 *keyid, u32 *mainkeyid, int pubkey_algo); /* Delete a key from the agent. */ gpg_error_t agent_delete_key (ctrl_t ctrl, const char *hexkeygrip, diff --git a/g10/card-util.c b/g10/card-util.c index a1a099d..bfaac3b 100644 --- a/g10/card-util.c +++ b/g10/card-util.c @@ -618,6 +618,11 @@ current_card_status (ctrl_t ctrl, estream_t fp, tty_fprintf (fp, "PIN retry counter : %d %d %d\n", info.chvretry[0], info.chvretry[1], info.chvretry[2]); tty_fprintf (fp, "Signature counter : %lu\n", info.sig_counter); + if (info.extcap.kdf) + { + tty_fprintf (fp, "KDF setting ......: %s\n", + info.kdf_do_enabled ? "on" : "off"); + } tty_fprintf (fp, "Signature key ....:"); print_shax_fpr (fp, info.fpr1len? info.fpr1:NULL, info.fpr1len); if (info.fpr1len && info.fpr1time) ----------------------------------------------------------------------- Summary of changes: g10/call-agent.c | 4 ++++ g10/call-agent.h | 5 +++-- g10/card-util.c | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 15 06:00:50 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Thu, 15 Nov 2018 06:00:50 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-278-ge955ca2 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via e955ca245ea08e68ae2397f1583c8728d72acbd8 (commit) via 05d163aebc04db109ec5e004eb04a4b3796f6421 (commit) from a5542a4a702c2210facf58a98bc8d3d16089b6ab (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e955ca245ea08e68ae2397f1583c8728d72acbd8 Author: NIIBE Yutaka Date: Thu Nov 15 13:57:31 2018 +0900 card: Display UIF setting. * g10/call-agent.h (agent_card_info_s): Add UIF fields. * g10/call-agent.c (learn_status_cb): Put UIF DOs info. * g10/card-util.c (current_card_status): Output for UIF. Signed-off-by: NIIBE Yutaka diff --git a/g10/call-agent.c b/g10/call-agent.c index 2dbacf4..11011ae 100644 --- a/g10/call-agent.c +++ b/g10/call-agent.c @@ -711,6 +711,17 @@ learn_status_cb (void *opaque, const char *line) { parm->kdf_do_enabled = 1; } + else if (keywordlen == 5 && !memcmp (keyword, "UIF-", 4) + && strchr("123", keyword[4])) + { + unsigned char *data; + int no = keyword[4] - '1'; + + log_assert (no >= 0 && no <= 2); + data = unescape_status_string (line); + parm->uif[no] = (data[0] != 0xff); + xfree (data); + } return 0; } diff --git a/g10/call-agent.h b/g10/call-agent.h index 1d232f7..8ea8ffe 100644 --- a/g10/call-agent.h +++ b/g10/call-agent.h @@ -72,7 +72,8 @@ struct agent_card_info_s unsigned int bt:1; /* Button for confirmation available. */ } extcap; unsigned int status_indicator; - int kdf_do_enabled; /* Card has a KDF object */ + int kdf_do_enabled; /* True if card has a KDF object. */ + int uif[3]; /* True if User Interaction Flag is on. */ }; diff --git a/g10/card-util.c b/g10/card-util.c index 8de061a..eca2484 100644 --- a/g10/card-util.c +++ b/g10/card-util.c @@ -516,6 +516,11 @@ current_card_status (ctrl_t ctrl, estream_t fp, { es_fprintf (fp, "kdf:%s:\n", info.kdf_do_enabled ? "on" : "off"); } + if (info.extcap.bt) + { + es_fprintf (fp, "uif:%d:%d:%d:\n", + info.uif[0], info.uif[1], info.uif[2]); + } for (i=0; i < 4; i++) { @@ -627,6 +632,12 @@ current_card_status (ctrl_t ctrl, estream_t fp, tty_fprintf (fp, "KDF setting ......: %s\n", info.kdf_do_enabled ? "on" : "off"); } + if (info.extcap.bt) + { + tty_fprintf (fp, "UIF setting ......: Sign=%s Decrypt=%s Auth=%s\n", + info.uif[0] ? "on" : "off", info.uif[1] ? "on" : "off", + info.uif[2] ? "on" : "off"); + } tty_fprintf (fp, "Signature key ....:"); print_shax_fpr (fp, info.fpr1len? info.fpr1:NULL, info.fpr1len); if (info.fpr1len && info.fpr1time) commit 05d163aebc04db109ec5e004eb04a4b3796f6421 Author: NIIBE Yutaka Date: Thu Nov 15 13:31:12 2018 +0900 scd: Make "learn" report about KDF data object. * scd/app-openpgp.c (do_learn_status): Report KDF attr. * g10/card-util.c (current_card_status): Output KDF for with_colons. Signed-off-by: NIIBE Yutaka diff --git a/g10/card-util.c b/g10/card-util.c index bfaac3b..8de061a 100644 --- a/g10/card-util.c +++ b/g10/card-util.c @@ -512,6 +512,10 @@ current_card_status (ctrl_t ctrl, estream_t fp, es_fprintf (fp, "pinretry:%d:%d:%d:\n", info.chvretry[0], info.chvretry[1], info.chvretry[2]); es_fprintf (fp, "sigcount:%lu:::\n", info.sig_counter); + if (info.extcap.kdf) + { + es_fprintf (fp, "kdf:%s:\n", info.kdf_do_enabled ? "on" : "off"); + } for (i=0; i < 4; i++) { diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index 789b72f..9948c0b 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -1833,9 +1833,14 @@ do_learn_status (app_t app, ctrl_t ctrl, unsigned int flags) do_getattr (app, ctrl, "CA-FPR"); do_getattr (app, ctrl, "CHV-STATUS"); do_getattr (app, ctrl, "SIG-COUNTER"); - do_getattr (app, ctrl, "UIF-1"); - do_getattr (app, ctrl, "UIF-2"); - do_getattr (app, ctrl, "UIF-3"); + if (app->app_local->extcap.kdf_do) + do_getattr (app, ctrl, "KDF"); + if (app->app_local->extcap.has_button) + { + do_getattr (app, ctrl, "UIF-1"); + do_getattr (app, ctrl, "UIF-2"); + do_getattr (app, ctrl, "UIF-3"); + } if (app->app_local->extcap.private_dos) { do_getattr (app, ctrl, "PRIVATE-DO-1"); ----------------------------------------------------------------------- Summary of changes: g10/call-agent.c | 11 +++++++++++ g10/call-agent.h | 3 ++- g10/card-util.c | 15 +++++++++++++++ scd/app-openpgp.c | 11 ++++++++--- 4 files changed, 36 insertions(+), 4 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 15 10:36:08 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 15 Nov 2018 10:36:08 +0100 Subject: [git] GPGME - branch, aheinecke/json-test, updated. gpgme-1.12.0-68-g004e2ca Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, aheinecke/json-test has been updated via 004e2cad2f26250cd010684f11dc187f08e6f9e1 (commit) via 40d962b43a183070ba8602cac1e83f2292ebf2c3 (commit) from d3dae4a445d950c94c952ddf54e534ef71675bd1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 004e2cad2f26250cd010684f11dc187f08e6f9e1 Author: Andre Heinecke Date: Thu Nov 15 10:33:35 2018 +0100 tests,json: Clean openpgp-revocs.d * tests/json/clean-local: Remove revocs.d diff --git a/tests/json/Makefile.am b/tests/json/Makefile.am index 3439ff7..61c3e24 100644 --- a/tests/json/Makefile.am +++ b/tests/json/Makefile.am @@ -77,6 +77,7 @@ noinst_PROGRAMS = $(c_tests) clean-local: -$(TESTS_ENVIRONMENT) $(top_srcdir)/tests/start-stop-agent --stop -rm -fR private-keys-v1.d + -rm -fR openpgp-revocs.d gpg-sample.stamp: $(private_keys) -$(TESTS_ENVIRONMENT) gpgconf --kill all commit 40d962b43a183070ba8602cac1e83f2292ebf2c3 Author: Andre Heinecke Date: Thu Nov 15 10:31:22 2018 +0100 tests,json: Move version check into t-json * tests/gpg/t-support.h (check_gpg_version, compare_versions), (parse_version_string, parse_version_number): Remove version check code. * tests/json/t-json.c (check_gpg_version, compare_versions), (parse_version_string, parse_version_number): Add. -- t-support header was not a good place for this. It should go into a library e.g. gpgrt in the future. For now we can keep it close to where it is needed. diff --git a/tests/gpg/t-support.h b/tests/gpg/t-support.h index a1536c1..b6ad515 100644 --- a/tests/gpg/t-support.h +++ b/tests/gpg/t-support.h @@ -216,106 +216,3 @@ print_import_result (gpgme_import_result_t r) r->not_imported, r->skipped_v3_keys); } - - -/* Read the next number in the version string STR and return it in - *NUMBER. Return a pointer to the tail of STR after parsing, or - *NULL if the version string was invalid. */ -static const char * -parse_version_number (const char *str, int *number) -{ -#define MAXVAL ((INT_MAX - 10) / 10) - int val = 0; - - /* Leading zeros are not allowed. */ - if (*str == '0' && isdigit(str[1])) - return NULL; - - while (isdigit (*str) && val <= MAXVAL) - { - val *= 10; - val += *(str++) - '0'; - } - *number = val; - return val > MAXVAL ? NULL : str; -} - - -/* Parse the version string STR in the format MAJOR.MINOR.MICRO (for - example, 9.3.2) and return the components in MAJOR, MINOR and MICRO - as integers. The function returns the tail of the string that - follows the version number. This might be the empty string if there - is nothing following the version number, or a patchlevel. The - function returns NULL if the version string is not valid. */ -static const char * -parse_version_string (const char *str, int *major, int *minor, int *micro) -{ - str = parse_version_number (str, major); - if (!str || *str != '.') - return NULL; - str++; - - str = parse_version_number (str, minor); - if (!str || *str != '.') - return NULL; - str++; - - str = parse_version_number (str, micro); - if (!str) - return NULL; - - /* A patchlevel might follow. */ - return str; -} - - -/* Return true if MY_VERSION is at least REQ_VERSION, and false - otherwise. */ -static int -compare_versions (const char *my_version, - const char *rq_version) -{ - int my_major, my_minor, my_micro; - int rq_major, rq_minor, rq_micro; - const char *my_plvl, *rq_plvl; - - if (!rq_version) - return 1; - if (!my_version) - return 0; - - my_plvl = parse_version_string (my_version, &my_major, &my_minor, &my_micro); - if (!my_plvl) - return 0; - - rq_plvl = parse_version_string (rq_version, &rq_major, &rq_minor, &rq_micro); - if (!rq_plvl) - return 0; - - if (my_major > rq_major - || (my_major == rq_major && my_minor > rq_minor) - || (my_major == rq_major && my_minor == rq_minor - && my_micro > rq_micro) - || (my_major == rq_major && my_minor == rq_minor - && my_micro == rq_micro && strcmp (my_plvl, rq_plvl) >= 0)) - return 1; - - return 0; -} - -/* Return true if we have the required gpg version. */ -static int -check_gpg_version (const char *req_version) -{ - gpgme_engine_info_t engine_info; - init_gpgme (GPGME_PROTOCOL_OpenPGP); - - fail_if_err (gpgme_get_engine_info (&engine_info)); - for (; engine_info; engine_info = engine_info->next) - if (engine_info->protocol == GPGME_PROTOCOL_OpenPGP) - break; - - test (engine_info); - - return compare_versions (engine_info->version, req_version); -} diff --git a/tests/json/t-json.c b/tests/json/t-json.c index 024b255..77750ad 100644 --- a/tests/json/t-json.c +++ b/tests/json/t-json.c @@ -48,6 +48,112 @@ static const char*tests[] = { "t-config", "t-version", static int verbose = 0; + +/* Read the next number in the version string STR and return it in + *NUMBER. Return a pointer to the tail of STR after parsing, or + *NULL if the version string was invalid. */ +static const char * +parse_version_number (const char *str, int *number) +{ +#define MAXVAL ((INT_MAX - 10) / 10) + int val = 0; + + /* Leading zeros are not allowed. */ + if (*str == '0' && isdigit(str[1])) + return NULL; + + while (isdigit (*str) && val <= MAXVAL) + { + val *= 10; + val += *(str++) - '0'; + } + *number = val; + return val > MAXVAL ? NULL : str; +} + + +/* Parse the version string STR in the format MAJOR.MINOR.MICRO (for + example, 9.3.2) and return the components in MAJOR, MINOR and MICRO + as integers. The function returns the tail of the string that + follows the version number. This might be the empty string if there + is nothing following the version number, or a patchlevel. The + function returns NULL if the version string is not valid. */ +static const char * +parse_version_string (const char *str, int *major, int *minor, int *micro) +{ + str = parse_version_number (str, major); + if (!str || *str != '.') + return NULL; + str++; + + str = parse_version_number (str, minor); + if (!str || *str != '.') + return NULL; + str++; + + str = parse_version_number (str, micro); + if (!str) + return NULL; + + /* A patchlevel might follow. */ + return str; +} + + +/* Return true if MY_VERSION is at least REQ_VERSION, and false + otherwise. */ +static int +compare_versions (const char *my_version, + const char *rq_version) +{ + int my_major, my_minor, my_micro; + int rq_major, rq_minor, rq_micro; + const char *my_plvl, *rq_plvl; + + if (!rq_version) + return 1; + if (!my_version) + return 0; + + my_plvl = parse_version_string (my_version, &my_major, &my_minor, &my_micro); + if (!my_plvl) + return 0; + + rq_plvl = parse_version_string (rq_version, &rq_major, &rq_minor, &rq_micro); + if (!rq_plvl) + return 0; + + if (my_major > rq_major + || (my_major == rq_major && my_minor > rq_minor) + || (my_major == rq_major && my_minor == rq_minor + && my_micro > rq_micro) + || (my_major == rq_major && my_minor == rq_minor + && my_micro == rq_micro && strcmp (my_plvl, rq_plvl) >= 0)) + return 1; + + return 0; +} + +/* Return true if we have the required gpg version. + + This should probably go into gpgrt or gpgme proper. +*/ +static int +check_gpg_version (const char *req_version) +{ + gpgme_engine_info_t engine_info; + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + fail_if_err (gpgme_get_engine_info (&engine_info)); + for (; engine_info; engine_info = engine_info->next) + if (engine_info->protocol == GPGME_PROTOCOL_OpenPGP) + break; + + test (engine_info); + + return compare_versions (engine_info->version, req_version); +} + static char * get_file (const char *fname) { ----------------------------------------------------------------------- Summary of changes: tests/gpg/t-support.h | 103 ----------------------------------------------- tests/json/Makefile.am | 1 + tests/json/t-json.c | 106 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+), 103 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 15 10:46:09 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 15 Nov 2018 10:46:09 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-68-g004e2ca Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 004e2cad2f26250cd010684f11dc187f08e6f9e1 (commit) via 40d962b43a183070ba8602cac1e83f2292ebf2c3 (commit) via d3dae4a445d950c94c952ddf54e534ef71675bd1 (commit) via def030e843bd4576597272abe9fe12f846066576 (commit) via d0087d45f0207bf82a4f078d972c28c4d1cd2690 (commit) via 88b7221eb737a3102ec61ea385990b7ea7ef2b30 (commit) via 27ca12e815c0a582d357641a04b889d648b8766e (commit) via dd4b80a5f640232bb44eb825ff5a74ec295fad10 (commit) via 9a31fdcb11d04d47dfcc38a8409b84436c549108 (commit) via e55e467d5ffb32c428566a876616d309ef2d15cd (commit) via ca2e2b3d6973b1f942571ba65bd8b57153847777 (commit) via 5b61c092e7444749b08e39ac5aa9fb0818e1a076 (commit) via 9933641cce595ba308d0f3a1f3ae8f13a9743dd1 (commit) via 3e5684d99b881787f9739e53fd8e8c22eadc2146 (commit) via 0c31837766e016227b3c8dfd44c476949cd4741e (commit) from c4aa4af50f3102b251cfff9c9755e2dde8d1bd1f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: configure.ac | 1 + tests/Makefile.am | 2 +- tests/gpg/t-support.h | 3 +- tests/{gpg => json}/Makefile.am | 84 +++--- tests/{gpg => json}/final.test | 0 tests/{gpgsm => json}/initial.test | 0 tests/json/t-chunking.in.json | 5 + tests/json/t-chunking.out.json | 5 + tests/json/t-config-opt.in.json | 5 + tests/json/t-config-opt.out.json | 6 + tests/json/t-config.in.json | 4 + tests/json/t-config.out.json | 19 ++ tests/json/t-createkey.in.json | 5 + tests/json/t-createkey.out.json | 3 + tests/json/t-decrypt-verify.in.json | 5 + tests/json/t-decrypt-verify.out.json | 56 ++++ tests/json/t-decrypt.in.json | 5 + tests/json/t-decrypt.out.json | 16 + tests/json/t-delete.in.json | 4 + tests/json/t-delete.out.json | 3 + tests/json/t-encrypt-sign.in.json | 8 + tests/json/t-encrypt-sign.out.json | 4 + tests/json/t-encrypt.in.json | 8 + tests/json/t-encrypt.out.json | 4 + tests/json/t-export-secret-info.in.json | 6 + tests/json/t-export-secret-info.out.json | 6 + tests/json/t-export.in.json | 5 + tests/json/t-export.out.json | 5 + tests/json/t-import.in.json | 4 + tests/json/t-import.out.json | 22 ++ tests/json/t-json.c | 499 +++++++++++++++++++++++++++++++ tests/json/t-keylist-secret.in.json | 5 + tests/json/t-keylist-secret.out.json | 163 ++++++++++ tests/json/t-keylist.in.json | 5 + tests/json/t-keylist.out.json | 65 ++++ tests/json/t-sig-notations.in.json | 4 + tests/json/t-sig-notations.out.json | 56 ++++ tests/json/t-sign.in.json | 8 + tests/json/t-sign.out.json | 5 + tests/json/t-verify.in.json | 5 + tests/json/t-verify.out.json | 35 +++ tests/json/t-version.in.json | 3 + tests/json/t-version.out.json | 10 + 43 files changed, 1119 insertions(+), 47 deletions(-) copy tests/{gpg => json}/Makefile.am (53%) copy tests/{gpg => json}/final.test (100%) copy tests/{gpgsm => json}/initial.test (100%) create mode 100644 tests/json/t-chunking.in.json create mode 100644 tests/json/t-chunking.out.json create mode 100644 tests/json/t-config-opt.in.json create mode 100644 tests/json/t-config-opt.out.json create mode 100644 tests/json/t-config.in.json create mode 100644 tests/json/t-config.out.json create mode 100644 tests/json/t-createkey.in.json create mode 100644 tests/json/t-createkey.out.json create mode 100644 tests/json/t-decrypt-verify.in.json create mode 100644 tests/json/t-decrypt-verify.out.json create mode 100644 tests/json/t-decrypt.in.json create mode 100644 tests/json/t-decrypt.out.json create mode 100644 tests/json/t-delete.in.json create mode 100644 tests/json/t-delete.out.json create mode 100644 tests/json/t-encrypt-sign.in.json create mode 100644 tests/json/t-encrypt-sign.out.json create mode 100644 tests/json/t-encrypt.in.json create mode 100644 tests/json/t-encrypt.out.json create mode 100644 tests/json/t-export-secret-info.in.json create mode 100644 tests/json/t-export-secret-info.out.json create mode 100644 tests/json/t-export.in.json create mode 100644 tests/json/t-export.out.json create mode 100644 tests/json/t-import.in.json create mode 100644 tests/json/t-import.out.json create mode 100644 tests/json/t-json.c create mode 100644 tests/json/t-keylist-secret.in.json create mode 100644 tests/json/t-keylist-secret.out.json create mode 100644 tests/json/t-keylist.in.json create mode 100644 tests/json/t-keylist.out.json create mode 100644 tests/json/t-sig-notations.in.json create mode 100644 tests/json/t-sig-notations.out.json create mode 100644 tests/json/t-sign.in.json create mode 100644 tests/json/t-sign.out.json create mode 100644 tests/json/t-verify.in.json create mode 100644 tests/json/t-verify.out.json create mode 100644 tests/json/t-version.in.json create mode 100644 tests/json/t-version.out.json hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 15 12:00:29 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 15 Nov 2018 12:00:29 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-69-gd0402f8 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via d0402f886b720d03369887c807581bd980ee70cf (commit) from 004e2cad2f26250cd010684f11dc187f08e6f9e1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d0402f886b720d03369887c807581bd980ee70cf Author: Andre Heinecke Date: Thu Nov 15 11:57:27 2018 +0100 tests: Add run-threaded for multithread tests * tests/Makefile.am (run-threaded): Add. * tests/run-threaded.c: New. -- This test is intended to help detect race conditions or other multithread problems. It can also be used to put the whole GnuPG system under extreme load. diff --git a/tests/Makefile.am b/tests/Makefile.am index 29e0c42..1b990e6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -34,8 +34,9 @@ noinst_HEADERS = run-support.h noinst_PROGRAMS = $(TESTS) run-keylist run-export run-import run-sign \ run-verify run-encrypt run-identify run-decrypt run-genkey \ - run-keysign run-tofu run-swdb + run-keysign run-tofu run-swdb run-threaded +run_threaded_LDADD = ../src/libgpgme.la -lpthread @GPG_ERROR_LIBS@ if RUN_GPG_TESTS gpgtests = gpg json diff --git a/tests/run-threaded.c b/tests/run-threaded.c new file mode 100644 index 0000000..14a9cbe --- /dev/null +++ b/tests/run-threaded.c @@ -0,0 +1,678 @@ +/* run-threaded.c - Helper to put GPGME under multithread load. + Copyright (C) 2018 by Bundesamt f?r Sicherheit in der Informationstechnik + Software engineering by Intevation GmbH + + This file is part of GPGME. + + GPGME is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 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 + 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 . +*/ + +/* The idea of this test is not to be run as unit test but as part + * of development to find threading issues and resource leaks. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#define PGM "run-threaded" + +#include "run-support.h" + +static volatile int stop; +static volatile int thread_cnt; +static volatile int running_threads; +static int verbose; +static int data_type; +static int mem_only; + +#ifdef HAVE_W32_SYSTEM +# include +# define THREAD_RET DWORD CALLBACK + +static void +create_thread (THREAD_RET (*func) (void *), void *arg) +{ + running_threads++; + if (CloseHandle (CreateThread (NULL, 0, func, arg, 0, NULL))) + { + fprintf (stderr, "Failed to create thread!\n"); + exit (1); + } +} + +#else +# include +# define THREAD_RET void * + +static void +create_thread (THREAD_RET (func) (void *), void *arg) +{ + pthread_t handle; + running_threads++; + if (pthread_create (&handle, NULL, func, arg)) + { + fprintf (stderr, "Failed to create thread!\n"); + exit (1); + } +} +#endif + +#include + +GPGRT_LOCK_DEFINE (out_lock); + +#define out(format, ...) \ + { \ + gpgrt_lock_lock (&out_lock); \ + printf (format "\n", ##__VA_ARGS__); \ + gpgrt_lock_unlock (&out_lock); \ + } + +#define errpoint \ +{ \ + out ("Error on %i", __LINE__); \ + exit (1); \ +} + +#define log(format, ...) \ +if (verbose) \ + { \ + gpgrt_lock_lock (&out_lock); \ + printf (format "\n", ##__VA_ARGS__); \ + gpgrt_lock_unlock (&out_lock); \ + } + +/* Lazy mans signal */ +GPGRT_LOCK_DEFINE (threads_lock); + +void del_thread (void) +{ + if (--running_threads == 0) + { + gpgrt_lock_unlock (&threads_lock); + } +} + +static int +show_usage (int ex) +{ + fputs ("usage: " PGM " [options] [messages]\n\n" + "Options:\n" + " --verbose run in verbose mode\n" + " --no-list do not do keylistings\n" + " --data-type mem function to use one of:\n" + " 1: fstream\n" + " 2: posix fd\n" + " 3: memory\n" + " 4: gpgrt_stream\n" + " default: random\n" +/* " --mem-cache read data only once and then work on memory\n" + " exlusive with data-type option\n" */ + " --threads N use 4+N threads (4 are used for keylisting" +" default 1)\n" + " --repeat N do N repeats on the messages (default 1)\n\n" + "Note: The test does keylistings of both S/MIME and OpenPGP\n" + " in the background while running operations on the\n" + " messages, depending on their type.\n" + " (Currently decrypt / verify).\n\n" + " Without messages only keylistings will be done.\n" + , stderr); + exit (ex); +} + + +struct msg_list_s +{ + const char *file_name; + struct msg_list_s *next; +}; +typedef struct msg_list_s *msg_list_t; + +struct data_s +{ + int fd; + FILE *file; + gpgrt_stream_t stream; + unsigned char *mem; + gpgme_data_t dh; +}; +typedef struct data_s *data_t; + +struct keylist_args_s +{ + gpgme_protocol_t proto; + int secret; +}; +typedef struct keylist_args_s *keylist_args_t; + +static volatile int keylists; + +static THREAD_RET +do_keylist (void *keylist_args) +{ + gpgme_error_t err; + gpgme_ctx_t ctx; + gpgme_key_t key; + + keylist_args_t args = (keylist_args_t) keylist_args; + + log ("Keylist %i, Protocol: %s, Secret %i", + keylists++, + args->proto == GPGME_PROTOCOL_CMS ? "CMS" : "OpenPGP", + args->secret); + + err = gpgme_new (&ctx); + fail_if_err (err); + + err = gpgme_set_protocol (ctx, args->proto); + fail_if_err (err); + + err = gpgme_op_keylist_start (ctx, NULL, args->secret); + fail_if_err (err); + + while (!(err = gpgme_op_keylist_next (ctx, &key))) + { + gpgme_key_unref (key); + } + + if (gpgme_err_code (err) != GPG_ERR_EOF) + { + fail_if_err (err); + } + + gpgme_release (ctx); + + if (!stop) + { + create_thread (do_keylist, keylist_args); + } + del_thread (); + return 0; +} + + +static unsigned char * +get_file (const char *fname, size_t *r_size) +{ + gpg_error_t err; + gpgrt_stream_t fp; + struct stat st; + unsigned char *buf; + size_t buflen; + + fp = gpgrt_fopen (fname, "r"); + if (!fp) + { + err = gpg_error_from_syserror (); + fprintf (stderr, "Error: can't open '%s': %s\n", fname, + gpg_strerror (err)); + return NULL; + } + + if (fstat (gpgrt_fileno(fp), &st)) + { + err = gpg_error_from_syserror (); + fprintf (stderr, "Error: can't stat '%s': %s\n", fname, + gpg_strerror (err)); + gpgrt_fclose (fp); + return NULL; + } + + buflen = st.st_size; + buf = malloc (buflen+1); + if (!buf) + { + fprintf (stderr, "Error: no mem\n"); + gpgrt_fclose (fp); + return NULL; + } + + if (gpgrt_fread (buf, buflen, 1, fp) != 1) + { + err = gpg_error_from_syserror (); + fprintf (stderr, "error reading '%s': %s\n", fname, + gpg_strerror (err)); + gpgrt_fclose (fp); + free (buf); + return NULL; + } + buf[buflen] = 0; + gpgrt_fclose (fp); + + if (r_size) + { + *r_size = buflen; + } + + return buf; +} + +/** Lets use random data. This should also introduce a bit + of randomness into the system by changing the runtimes + of various data functions. Esp. Mem against the file ops. */ +data_t +random_data_new (const char *fname) +{ + data_t ret = calloc (1, sizeof (struct data_s)); + int data_rand; + if (data_type) + { + data_rand = data_type; + } + else + { + data_rand = rand () % 3; + } + + if (data_rand == 0) /* stream */ + { + FILE *f_stream = fopen (fname, "rb"); + if (!f_stream) + { + errpoint; + } + fail_if_err (gpgme_data_new_from_stream (&(ret->dh), f_stream)); + ret->file = f_stream; + return ret; + } + if (data_rand == 1) /* fd */ + { + int fd = open (fname, O_RDONLY); + gpgme_data_t dh; + if (fd == -1) + { + errpoint; + } + fail_if_err (gpgme_data_new_from_fd (&dh, fd)); + ret->fd = fd; + ret->dh = dh; + return ret; + } + if (data_rand == 2) /* mem */ + { + unsigned char *mem; + size_t size; + + mem = get_file (fname, &size); + if (!mem) + { + errpoint; + } + fail_if_err (gpgme_data_new_from_mem (&(ret->dh), + (const char *)mem, + size, 0)); + ret->mem = mem; + return ret; + } + if (data_rand == 3) /* estream */ + { + gpgrt_stream_t stream = gpgrt_fopen (fname, "rb"); + + if (!stream) + { + errpoint; + } + + fail_if_err (gpgme_data_new_from_estream (&(ret->dh), stream)); + ret->stream = stream; + return ret; + } + /* notreached */ + return ret; +} + +void +random_data_close (data_t data) +{ + if (data->dh) + { + gpgme_data_release (data->dh); + } + if (data->fd) + { + close (data->fd); + } + else if (data->file) + { + fclose (data->file); + } + else if (data->stream) + { + gpgrt_fclose (data->stream); + } + else if (data->mem) + { + free (data->mem); + } + free (data); +} + +void +verify (const char *fname, gpgme_protocol_t proto) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t out; + char *msg; + size_t msg_len; + data_t data = random_data_new (fname); + + log ("Starting verify on: %s with protocol %s", fname, + proto == GPGME_PROTOCOL_CMS ? "CMS" : "OpenPGP"); + + gpgme_data_new (&out); + + err = gpgme_new (&ctx); + fail_if_err (err); + + err = gpgme_set_protocol (ctx, proto); + fail_if_err (err); + + err = gpgme_op_verify (ctx, data->dh, NULL, out); + out ("Data: %p, %i %p %p %p", data->dh, + data->fd, data->file, data->stream, + data->mem); + fail_if_err (err); + + msg = gpgme_data_release_and_get_mem (out, &msg_len); + + if (msg_len) + { + log ("Verify result \n'%.*s'", (int)msg_len, msg); + } + + gpgme_release (ctx); + + random_data_close (data); +} + + +/* We randomize data access to put in a bit additional + entropy in this test and also to check if maybe + some data functions might not be properly thread + safe. */ +void +decrypt (const char *fname, gpgme_protocol_t proto) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t out; + char *msg; + size_t msg_len; + data_t data = random_data_new (fname); + + log ("Starting decrypt on: %s", fname); + + gpgme_data_new (&out); + + err = gpgme_new (&ctx); + fail_if_err (err); + + err = gpgme_set_protocol (ctx, proto); + fail_if_err (err); + + err = gpgme_op_decrypt (ctx, data->dh, out); + fail_if_err (err); + + gpgme_release (ctx); + + msg = gpgme_data_release_and_get_mem (out, &msg_len); + + if (msg_len) + { + log ("Decrypt result \n'%.*s'", (int)msg_len, msg); + } + + random_data_close (data); +} + + +static THREAD_RET +do_data_op (void *file_name) +{ + gpgme_data_t data; + const char *fname = (const char *) file_name; + FILE *f = fopen (fname, "rb"); + gpgme_data_type_t type; + + if (!f) + { + fprintf (stderr, "Failed to open '%s'\n", fname); + exit (1); + } + + fail_if_err (gpgme_data_new_from_stream (&data, f)); + + type = gpgme_data_identify (data, 0); + gpgme_data_release (data); + fclose (f); + + switch (type) + { + case GPGME_DATA_TYPE_INVALID: + case GPGME_DATA_TYPE_UNKNOWN: + { + fprintf (stderr, "Failed to identify '%s'", fname); + exit(1); + } + case GPGME_DATA_TYPE_PGP_SIGNED: + { + verify (fname, GPGME_PROTOCOL_OpenPGP); + break; + } + case GPGME_DATA_TYPE_CMS_SIGNED: + { + verify (fname, GPGME_PROTOCOL_CMS); + break; + } + case GPGME_DATA_TYPE_PGP_ENCRYPTED: + { + decrypt (fname, GPGME_PROTOCOL_OpenPGP); + break; + } + case GPGME_DATA_TYPE_CMS_ENCRYPTED: + { + decrypt (fname, GPGME_PROTOCOL_CMS); + break; + } + default: + { + fprintf (stderr, "Unhandled data type 0x%x for '%s'", type, fname); + exit(1); + } + } + + del_thread (); + return 0; +} + + +void +start_keylistings (void) +{ + static struct keylist_args_s args[4]; + + args[0].proto = GPGME_PROTOCOL_OpenPGP; + args[0].secret = 0; + + args[1].proto = GPGME_PROTOCOL_OpenPGP; + args[1].secret = 1; + + args[2].proto = GPGME_PROTOCOL_CMS; + args[2].secret = 0; + + args[3].proto = GPGME_PROTOCOL_CMS; + args[3].secret = 1; + + for (int i = 0; i < 4; i++) + { + thread_cnt--; + create_thread (do_keylist, &args[i]); + } +} + +int +main (int argc, char **argv) +{ + int last_argc = -1; + int repeats = 1; + int threads = 0; + int no_list = 0; + msg_list_t msgs = NULL; + msg_list_t msg_it = NULL; + stop = 0; + + srand (1 /* Somewhat deterministic results */); + + if (argc) + { argc--; argv++; } + + while (argc && last_argc != argc ) + { + last_argc = argc; + if (!strcmp (*argv, "--help")) + { + show_usage (0); + } + else if (!strcmp (*argv, "--verbose")) + { + verbose = 1; + argc--; argv++; + } + else if (!strcmp (*argv, "--no-list")) + { + no_list = 1; + argc--; argv++; + } + else if (!strcmp (*argv, "--mem-only")) + { + if (data_type) + { + show_usage (1); + } + mem_only = 1; + argc--; argv++; + } + else if (!strcmp (*argv, "--threads")) + { + argc--; argv++; + if (!argc) + { + show_usage (1); + } + threads = atoi (*argv); + if (!threads) + { + show_usage (1); + } + argc--; argv++; + } + else if (!strcmp (*argv, "--data-type")) + { + argc--; argv++; + if (!argc || mem_only) + { + show_usage (1); + } + data_type = atoi (*argv); + if (data_type > 4) + { + show_usage (1); + } + argc--; argv++; + } + else if (!strcmp (*argv, "--repeat")) + { + argc--; argv++; + if (!argc) + { + show_usage (1); + } + repeats = atoi (*argv); + if (!repeats) + { + show_usage (1); + } + argc--; argv++; + } + } + + init_gpgme_basic (); + + if (threads < argc) + { + /* Make sure we run once on each arg */ + threads += argc; + } + while (argc) + { + if (!msgs) + { + msgs = calloc (1, sizeof *msgs); + msg_it = msgs; + } + else + { + msg_it->next = calloc (1, sizeof *msgs); + msg_it = msg_it->next; + } + msg_it->file_name = *argv; + argc--; argv++; + } + + gpgrt_lock_lock (&threads_lock); + do + { + stop = 0; + thread_cnt = threads + 4; + out ("Repeats left: %i", repeats); + + if (!no_list) + { + start_keylistings (); + } + else + { + thread_cnt -= 4; + } + + while (thread_cnt) + { + log ("Thread %i", thread_cnt); + for (msg_it = msgs; msg_it && thread_cnt; msg_it = msg_it->next) + { + thread_cnt--; + create_thread (do_data_op, (void *)msg_it->file_name); + } + } + + stop = 1; + gpgrt_lock_lock (&threads_lock); + } + while (--repeats != 0); + + return 0; +} ----------------------------------------------------------------------- Summary of changes: tests/Makefile.am | 3 +- tests/run-threaded.c | 678 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 680 insertions(+), 1 deletion(-) create mode 100644 tests/run-threaded.c hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 15 16:13:57 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 15 Nov 2018 16:13:57 +0100 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.11-3-g2768293 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 2768293b1ee6f174f216f9006b5bc3e0c10265a2 (commit) from 00321a025f90990a71b60b4689ede1f38fbde347 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2768293b1ee6f174f216f9006b5bc3e0c10265a2 Author: Werner Koch Date: Thu Nov 15 16:13:52 2018 +0100 tools: Let gpg-zip print a deprecation warning. -- GnuPG-bug-id: 4251 Signed-off-by: Werner Koch diff --git a/tools/gpg-zip.in b/tools/gpg-zip.in index 48c4766..9047e36 100644 --- a/tools/gpg-zip.in +++ b/tools/gpg-zip.in @@ -34,6 +34,9 @@ Usage: gpg-zip [--help] [--version] [--encrypt] [--decrypt] [--symmetric] Encrypt or sign files into an archive." + +echo "gpg-zip: This script is deprecated - please use gpgtar instead." >&2 + tar_verbose_opt="v" while test $# -gt 0 ; do ----------------------------------------------------------------------- Summary of changes: tools/gpg-zip.in | 3 +++ 1 file changed, 3 insertions(+) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 15 19:30:10 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 15 Nov 2018 19:30:10 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.32-55-ga5d4a4b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via a5d4a4b32b11814d673241d62624ecec1d577571 (commit) from 4a92763a6e529824f1c6043b75ac1346af41a926 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a5d4a4b32b11814d673241d62624ecec1d577571 Author: Werner Koch Date: Thu Nov 15 19:18:53 2018 +0100 core: New API gpgrt_cmp_version * src/gpg-error.h.in: New API gpgrt_cmp_version. * src/visibility.c (gpgrt_cmp_version): New wrapper. * src/version.c (parse_version_string): Revamped. (do_cmp_version): New. (_gpgrt_cmp_version): New. (_gpg_error_check_version): Re-implemented using the new func. * tests/t-version.c: Include t-common.h. (t_gpgrt_cmp_version): New test. (main): Run new test. Change test for new version number to require a 2 level number. -- We have implementations of very similar functions in all out libs. Thus it makes sense to provide a generic version. This version is actually derived from the ftp-indexer.c we use for the gnupg website (see the gnupg-doc repo). Signed-off-by: Werner Koch diff --git a/Makefile.am b/Makefile.am index b602c7f..4991911 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,6 +15,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, see . +# SPDX-License-Identifier: LGPL-2.1-or-later # Location of the released tarball archives. Note that this is an # internal archive and before uploading this to the public server, diff --git a/NEWS b/NEWS index 8c605b2..f1facf4 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,11 @@ Noteworthy changes in version 1.33 (unreleased) [C24/A24/R_] ----------------------------------------------- + * Interface changes relative to the 1.28 release: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + gpgrt_cmp_version New. + + Noteworthy changes in version 1.32 (2018-07-12) [C24/A24/R3] ----------------------------------------------- diff --git a/src/gpg-error.def.in b/src/gpg-error.def.in index 67bb12e..c2fabb0 100644 --- a/src/gpg-error.def.in +++ b/src/gpg-error.def.in @@ -218,5 +218,7 @@ EXPORTS gpgrt_b64enc_write @167 gpgrt_b64enc_finish @168 + gpgrt_cmp_version @169 + ;; end of file with public symbols for Windows. diff --git a/src/gpg-error.h.in b/src/gpg-error.h.in index 8bcafcc..2bf6a6f 100644 --- a/src/gpg-error.h.in +++ b/src/gpg-error.h.in @@ -1271,6 +1271,15 @@ void gpgrt_set_strusage (const char *(*f)(int)); void gpgrt_set_usage_outfnc (int (*f)(int, const char *)); void gpgrt_set_fixed_string_mapper (const char *(*f)(const char*)); + +/* + * Various helper functions + */ + +/* Compare arbitrary version strings. For the standard m.n.o version + * numbering scheme a LEVEL of 3 is suitable; see the manual. */ +int gpgrt_cmp_version (const char *a, const char *b, int level); + #ifdef __cplusplus diff --git a/src/gpg-error.vers b/src/gpg-error.vers index 201b784..8c50a15 100644 --- a/src/gpg-error.vers +++ b/src/gpg-error.vers @@ -190,6 +190,7 @@ GPG_ERROR_1.0 { gpgrt_b64enc_write; gpgrt_b64enc_finish; + gpgrt_cmp_version; local: *; diff --git a/src/gpgrt-int.h b/src/gpgrt-int.h index 34e494c..b5a4dd1 100644 --- a/src/gpgrt-int.h +++ b/src/gpgrt-int.h @@ -742,6 +742,12 @@ void _gpgrt_set_usage_outfnc (int (*fnc)(int, const char *)); void _gpgrt_set_fixed_string_mapper (const char *(*f)(const char*)); +/* + * Various helper functions + */ +int _gpgrt_cmp_version (const char *a, const char *b, int level); + + /* * Internal platform abstraction functions (sysutils.c) diff --git a/src/version.c b/src/version.c index 94b75af..ac2f057 100644 --- a/src/version.c +++ b/src/version.c @@ -47,6 +47,10 @@ cright_blurb (void) } +/* This function parses the first portion of the version number S and + * stores it at NUMBER. On success, this function returns a pointer + * into S starting with the first character, which is not part of the + * initial number portion; on failure, NULL is returned. */ static const char* parse_version_number (const char *s, int *number) { @@ -64,45 +68,161 @@ parse_version_number (const char *s, int *number) } +/* This function breaks up the complete string-representation of the + * version number S, which is of the following struture: ... The major, + * minor and micro number components will be stored in *MAJOR, *MINOR + * and *MICRO. If MINOR or MICRO is NULL the version number is + * assumed to have just 1 respective 2 parts. + * + * On success, the last component, the patch level, will be returned; + * in failure, NULL will be returned. */ static const char * -parse_version_string (const char *s, int *major, int *minor) +parse_version_string (const char *s, int *major, int *minor, int *micro) { s = parse_version_number (s, major); - if (!s || *s != '.') - return NULL; - s++; - s = parse_version_number (s, minor); if (!s) return NULL; - return s; /* Patchlevel. */ + if (!minor) + { + if (*s == '.') + s++; + } + else + { + if (*s != '.') + return NULL; + s++; + s = parse_version_number (s, minor); + if (!s) + return NULL; + if (!micro) + { + if (*s == '.') + s++; + } + else + { + if (*s != '.') + return NULL; + s++; + s = parse_version_number (s, micro); + if (!s) + return NULL; + } + } + return s; /* patchlevel */ } -static const char * -compare_versions (const char *my_version, const char *req_version) +/* Helper for _gpgrt_cmp_version. */ +static int +do_cmp_version (const char *a, const char *b, int level) { - int my_major, my_minor; - int rq_major, rq_minor; - const char *my_plvl, *rq_plvl; + int a_major, a_minor, a_micro; + int b_major, b_minor, b_micro; + const char *a_plvl, *b_plvl; + int r; + int ignore_plvl; + int positive, negative; + + if (level < 0) + { + positive = -1; + negative = 1; + level = 0 - level; + } + else + { + positive = 1; + negative = -1; + } + if ((ignore_plvl = (level > 9))) + level %= 10; + + a_major = a_minor = a_micro = 0; + a_plvl = parse_version_string (a, &a_major, + level > 1? &a_minor : NULL, + level > 2? &a_micro : NULL); + if (!a_plvl) + a_major = a_minor = a_micro = 0; /* Error. */ + + b_major = b_minor = b_micro = 0; + b_plvl = parse_version_string (b, &b_major, + level > 1? &b_minor : NULL, + level > 2? &b_micro : NULL); + if (!b_plvl) + b_major = b_minor = b_micro = 0; + + if (!ignore_plvl) + { + if (!a_plvl && !b_plvl) + return negative; /* Put invalid strings at the end. */ + if (a_plvl && !b_plvl) + return positive; + if (!a_plvl && b_plvl) + return negative; + } - if (!req_version) - return my_version; - if (!my_version) - return NULL; + if (a_major > b_major) + return positive; + if (a_major < b_major) + return negative; + + if (a_minor > b_minor) + return positive; + if (a_minor < b_minor) + return negative; + + if (a_micro > b_micro) + return positive; + if (a_micro < b_micro) + return negative; - my_plvl = parse_version_string (my_version, &my_major, &my_minor); - if (!my_plvl) - return NULL; /* Very strange: our own version is bogus. */ - rq_plvl = parse_version_string(req_version, &rq_major, &rq_minor); - if (!rq_plvl) - return NULL; /* Requested version string is invalid. */ + if (ignore_plvl) + return 0; - if (my_major > rq_major - || (my_major == rq_major && my_minor >= rq_minor)) + for (; *a_plvl && *b_plvl; a_plvl++, b_plvl++) { - return my_version; - } - return NULL; + if (*a_plvl == '.' && *b_plvl == '.') + { + r = strcmp (a_plvl, b_plvl); + if (!r) + return 0; + else if ( r > 0 ) + return positive; + else + return negative; + } + else if (*a_plvl == '.') + return negative; /* B is larger. */ + else if (*b_plvl == '.') + return positive; /* A is larger. */ + else if (*a_plvl != *b_plvl) + break; + } + if (*a_plvl == *b_plvl) + return 0; + else if ((*(signed char *)a_plvl - *(signed char *)b_plvl) > 0) + return positive; + else + return negative; +} + + +/* Compare function for version strings. The return value is + * like strcmp(). LEVEL may be + * 0 - reserved + * 1 - format is "". + * 2 - format is ".". + * 3 - format is "..". + * To ignore the patchlevel in the comparison add 10 to LEVEL. To get + * a reverse sorting order use a negative number. + */ +int +_gpgrt_cmp_version (const char *a, const char *b, int level) +{ + return do_cmp_version (a, b, level); } @@ -115,7 +235,12 @@ compare_versions (const char *my_version, const char *req_version) const char * _gpg_error_check_version (const char *req_version) { + const char *my_version = PACKAGE_VERSION; + if (req_version && req_version[0] == 1 && req_version[1] == 1) return cright_blurb (); - return compare_versions (PACKAGE_VERSION, req_version); + if (!req_version) + return my_version; + return _gpgrt_cmp_version + (my_version, req_version, 12) >= 0 ? my_version : NULL; } diff --git a/src/visibility.c b/src/visibility.c index 6f8bb24..ab5e383 100644 --- a/src/visibility.c +++ b/src/visibility.c @@ -1123,6 +1123,15 @@ gpgrt_set_fixed_string_mapper (const char *(*f)(const char*)) +/* Compare program versions. */ +int +gpgrt_cmp_version (const char *a, const char *b, int level) +{ + return _gpgrt_cmp_version (a, b, level); +} + + + /* For consistency reasons we use function wrappers also for Windows * specific function despite that they are technically not needed. */ #ifdef HAVE_W32_SYSTEM diff --git a/src/visibility.h b/src/visibility.h index cfa32e5..d6933df 100644 --- a/src/visibility.h +++ b/src/visibility.h @@ -209,6 +209,8 @@ MARK_VISIBLE (gpgrt_set_strusage) MARK_VISIBLE (gpgrt_set_fixed_string_mapper); MARK_VISIBLE (gpgrt_set_usage_outfnc); +MARK_VISIBLE (gpgrt_cmp_version); + #undef MARK_VISIBLE #else /*!_GPGRT_INCL_BY_VISIBILITY_C*/ @@ -379,6 +381,8 @@ MARK_VISIBLE (gpgrt_set_usage_outfnc); #define gpgrt_set_usage_outfnc _gpgrt_USE_UNDERSCORED_FUNCTION #define gpgrt_set_fixed_string_mapper _gpgrt_USE_UNDERSCORED_FUNCTION +#define gpgrt_cmp_version _gpgrt_USE_UNDERSCORED_FUNCTION + /* Windows specific functions. */ #define gpgrt_w32_reg_query_string _gpgrt_USE_UNDERSCORED_FUNCTION diff --git a/tests/t-version.c b/tests/t-version.c index 4606dbc..240d4b4 100644 --- a/tests/t-version.c +++ b/tests/t-version.c @@ -26,12 +26,90 @@ #include #include -#include "../src/gpg-error.h" +#define PGM "t-version" +#include "t-common.h" + +static const char *logpfx = PGM; + + +static void +t_gpgrt_cmp_version (void) +{ + struct { int result; int level; const char *a; const char *b; } t[] = { + { 0, 1, "0", "0" }, + { -1, 1, "0", "1" }, + { 1, 1, "1", "0" }, + { -1, 1, "0.0", "0.1" }, + { -1, 1, "0.1", "1.2" }, + { 1, 1, "1.0", "0.9" }, + { -1, 1, "-1.0", "0.9" }, /* A is invalid */ + { 0, 1, "0rc0", "0rc0" }, + { 1, 1, "0rc1", "0rc0" }, + { -1, 1, "0rc1", "0rc2" }, + { 0, 1, "0.rc0", "0.rc0" }, + { 1, 1, "0.rc1", "0.rc0" }, + { -1, 1, "0.rc1", "0.rc2" }, + { 0, 1, "0.rc1", "0.rc1" }, + { -1, 1, "0qc1", "0rc0" }, + { -1, 1, "0.qc1", "0.rc0" }, + { 0, 2, "0.0", "0.0" }, + { -1, 2, "0.1", "0.2" }, + { -1, 2, "3.1", "3.2" }, + { -1, 2, "3.1", "4.0" }, + { 0, 2, "1.1rc0", "1.1rc0" }, + { 1, 2, "1.1rc1", "1.1rc0" }, + { -1, 2, "1.1rc0", "1.1rc1" }, + { 0, 3, "7.0.0", "7.0.0" }, + { -1, 3, "7.0.1", "7.0.2" }, + { -1, 3, "7.3.1", "7.3.2" }, + { -1, 3, "7.3.1", "7.4.0" }, + { 0, 3, "7.1.1rc0", "7.1.1rc0" }, + { 1, 3, "7.1.1rc1", "7.1.1rc0" }, + { -1, 3, "7.1.1rc0", "7.1.1rc1" }, + { 1, 3, "6.0.0", "5.0.0" }, + { 0, 3, "6.0.0", "6.0.0" }, + { 1, 3, "6.0.1", "6.0.0" }, + { 1, 3, "6.1.0", "6.0.0" }, + { 1, 3, "6.2.1", "6.2.0" }, + { -1, 3, "6.2.1", "6.2.2" }, + { -1, 3, "6.0.0", "6.0.2" }, + { -1, 3, "6.0.0", "6.1.0" }, + { -1, 3, "6.2.0", "6.2.1" }, + { 1, 3, "6.0.0-beta1", "6.0.0-beta0" }, + { 0, 3, "6.0.0-beta2", "6.0.0-beta2" }, + { 1, 3, "6.0.0-beta20", "6.0.0-beta19" }, + { -1, 3, "6.0.0-beta1", "6.0.0-beta2" }, + { 1, 3, "6.0.0-beta2", "6.0.0-beta1" }, + { -1, 3, "6.0.0-beta20", "6.0.0-beta21" }, + { 0,13, "6.0.0-beta1", "6.0.0-beta0" }, + { 0,13, "6.0.0-beta2", "6.0.0-beta2" }, + { 0,13, "6.0.0-beta20", "6.0.0-beta19" }, + { 0,13, "6.0.0-beta1", "6.0.0-beta2" }, + { 0,13, "6.0.0-beta2", "6.0.0-beta1" }, + { 0,13, "6.0.0-beta20", "6.0.0-beta21" } + }; + int i; + int result, expected; + + for (i=0; i < DIM (t); i++) + { + expected = t[i].result; + result = gpgrt_cmp_version (t[i].a, t[i].b, t[i].level); + if (result != expected) + fail ("test %d failed: cmp('%s','%s',%d) = %d expected %d", + i, t[i].a, t[i].b, t[i].level, result, expected); + } + for (i=0; i < DIM (t); i++) + { + expected = 0 - t[i].result; + result = gpgrt_cmp_version (t[i].a, t[i].b, -t[i].level); + if (result != expected) + fail ("test %d-rev failed: cmp('%s','%s',%d) = %d expected %d", + i, t[i].a, t[i].b, -t[i].level, result, expected); + } +} + -static const char *logpfx = ""; -static int verbose; -static int debug; -static int errorcount; int main (int argc, char **argv) @@ -40,7 +118,6 @@ main (int argc, char **argv) if (argc) { - logpfx = *argv; argc--; argv++; } while (argc && last_argc != argc ) @@ -68,6 +145,8 @@ main (int argc, char **argv) } } + t_gpgrt_cmp_version (); + if (!gpg_error_check_version (GPG_ERROR_VERSION)) { fprintf (stderr, "%s: gpg_error_check_version returned an error\n", @@ -80,7 +159,7 @@ main (int argc, char **argv) "error for an old version\n", logpfx); errorcount++; } - if (gpg_error_check_version ("15")) + if (gpg_error_check_version ("15.0")) { fprintf (stderr, "%s: gpg_error_check_version did not return an error" " for a newer version\n", logpfx); ----------------------------------------------------------------------- Summary of changes: Makefile.am | 1 + NEWS | 5 ++ src/gpg-error.def.in | 2 + src/gpg-error.h.in | 9 +++ src/gpg-error.vers | 1 + src/gpgrt-int.h | 6 ++ src/version.c | 179 +++++++++++++++++++++++++++++++++++++++++++-------- src/visibility.c | 9 +++ src/visibility.h | 4 ++ tests/t-version.c | 93 ++++++++++++++++++++++++-- 10 files changed, 275 insertions(+), 34 deletions(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 16 08:30:57 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 16 Nov 2018 08:30:57 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-279-gc8f79ce Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via c8f79cec743c60b03db4c6d1e901a42e41faa1bc (commit) from e955ca245ea08e68ae2397f1583c8728d72acbd8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c8f79cec743c60b03db4c6d1e901a42e41faa1bc Author: Werner Koch Date: Fri Nov 16 08:30:47 2018 +0100 doc: Add NEWS item from recent 2.2 releases. -- diff --git a/NEWS b/NEWS index 245cc70..cf096b6 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,66 @@ Noteworthy changes in version 2.3.0 (unreleased) ------------------------------------------------ + Changes also found in 2.2.11: + + * gpgsm: Fix CRL loading when intermediate certicates are not yet + trusted. + + * gpgsm: Fix an error message about the digest algo. [#4219] + + * gpg: Fix a wrong warning due to new sign usage check introduced + with 2.2.9. [#4014] + + * gpg: Print the "data source" even for an unsuccessful keyserver + query. + + * gpg: Do not store the TOFU trust model in the trustdb. This + allows to enable or disable a TOFO model without triggering a + trustdb rebuild. [#4134] + + * scd: Fix cases of "Bad PIN" after using "forcesig". [#4177] + + * agent: Fix possible hang in the ssh handler. [#4221] + + * dirmngr: Tack the unmodified mail address to a WKD request. See + commit a2bd4a64e5b057f291a60a9499f881dd47745e2f for details. + + * dirmngr: Tweak diagnostic about missing LDAP server file. + + * dirmngr: In verbose mode print the OCSP responder id. + + * dirmngr: Fix parsing of the LDAP port. [#4230] + + * wks: Add option --directory/-C to the server. Always build the + server on Unix systems. + + * wks: Add option --with-colons to the client. Support sites which + use the policy file instead of the submission-address file. + + * Fix EBADF when gpg et al. are called by broken CGI scripts. + + * Fix some minor memory leaks and bugs. + + Release-info: https://dev.gnupg.org/T4233 + See-also: gnupg-announce/2018q4/000432.html + + Changes also found in 2.2.10: + + * gpg: Refresh expired keys originating from the WKD. [#2917] + + * gpg: Use a 256 KiB limit for a WKD imported key. + + * gpg: New option --known-notation. [#4060] + + * scd: Add support for the Trustica Cryptoucan reader. + + * agent: Speed up starting during on-demand launching. [#3490] + + * dirmngr: Validate SRV records in WKD queries. + + Release-info: https://dev.gnupg.org/T4112 + See-also: gnupg-announce/2018q3/000428.html + Changes also found in 2.2.9: * dirmngr: Fix recursive resolver mode and other bugs in the libdns @@ -317,15 +377,17 @@ Noteworthy changes in version 2.3.0 (unreleased) Release dates of 2.2.x versions: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Version 2.2.1 (2017-09-19) - Version 2.2.2 (2017-11-07) - Version 2.2.3 (2017-11-20) - Version 2.2.4 (2017-12-20) - Version 2.2.5 (2018-02-22) - Version 2.2.6 (2018-04-09) - Version 2.2.7 (2018-05-02) - Version 2.2.8 (2018-06-08) - Version 2.2.9 (2018-07-12) + Version 2.2.1 (2017-09-19) + Version 2.2.2 (2017-11-07) + Version 2.2.3 (2017-11-20) + Version 2.2.4 (2017-12-20) + Version 2.2.5 (2018-02-22) + Version 2.2.6 (2018-04-09) + Version 2.2.7 (2018-05-02) + Version 2.2.8 (2018-06-08) + Version 2.2.9 (2018-07-12) + Version 2.2.10 (2018-08-30) + Version 2.2.11 (2018-11-06) Noteworthy changes in version 2.2.0 (2017-08-28) ----------------------------------------------------------------------- Summary of changes: NEWS | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 71 insertions(+), 9 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 16 09:19:25 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 16 Nov 2018 09:19:25 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-280-g1e70096 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 1e700961ddf4c54ec5a03a697fe00d7eb606fdff (commit) from c8f79cec743c60b03db4c6d1e901a42e41faa1bc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1e700961ddf4c54ec5a03a697fe00d7eb606fdff Author: Werner Koch Date: Fri Nov 16 09:19:10 2018 +0100 gpg: Start using OCB mode by default with Libgcrypt 1.9. * g10/main.h (GCRYPT_VERSION_NUMBER): Fix type in condition. -- GnuPG-bug-id: 4259 Signed-off-by: Werner Koch diff --git a/g10/main.h b/g10/main.h index 768f7cf..86f8589 100644 --- a/g10/main.h +++ b/g10/main.h @@ -41,7 +41,9 @@ # define DEFAULT_CIPHER_ALGO CIPHER_ALGO_3DES #endif -#if GCRYPT_VERSION_NUMBER < 0x019000 +/* We will start using OCB mode by default only if the yet to be + * released libgcrypt 1.9 is used. */ +#if GCRYPT_VERSION_NUMBER < 0x010900 # define DEFAULT_AEAD_ALGO AEAD_ALGO_OCB #else # define DEFAULT_AEAD_ALGO AEAD_ALGO_EAX ----------------------------------------------------------------------- Summary of changes: g10/main.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 16 18:20:40 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 16 Nov 2018 18:20:40 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-75-g7a1e700 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 7a1e7006d06fdbab86ea79a197c316744b09d933 (commit) via 7eda50a673d15320022375360fd220e8381b69ab (commit) from cf423864062a2677d0eeabbb11462a788f527b4c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7a1e7006d06fdbab86ea79a197c316744b09d933 Author: Werner Koch Date: Fri Nov 16 18:17:22 2018 +0100 core: Protect the trace macros for fun and profit. * src/debug.h: Protect macros using. (_trace_err, _trace_sysres, _trace_syserr): New helper inline functions. Signed-off-by: Werner Koch diff --git a/src/data-compat.c b/src/data-compat.c index 9091b96..64ed2d2 100644 --- a/src/data-compat.c +++ b/src/data-compat.c @@ -110,7 +110,8 @@ gpgme_data_new_from_filepart (gpgme_data_t *r_dh, const char *fname, (*r_dh)->data.mem.size = length; (*r_dh)->data.mem.length = length; - return TRACE_SUC ("r_dh=%p", *r_dh); + TRACE_SUC ("r_dh=%p", *r_dh); + return 0; } diff --git a/src/data-estream.c b/src/data-estream.c index 1f1a64e..1855e74 100644 --- a/src/data-estream.c +++ b/src/data-estream.c @@ -95,5 +95,6 @@ gpgme_data_new_from_estream (gpgme_data_t *r_dh, gpgrt_stream_t stream) return TRACE_ERR (err); (*r_dh)->data.e_stream = stream; - return TRACE_SUC ("dh=%p", *r_dh); + TRACE_SUC ("dh=%p", *r_dh); + return 0; } diff --git a/src/data-fd.c b/src/data-fd.c index 6a915fc..5c68130 100644 --- a/src/data-fd.c +++ b/src/data-fd.c @@ -82,5 +82,6 @@ gpgme_data_new_from_fd (gpgme_data_t *r_dh, int fd) return TRACE_ERR (err); (*r_dh)->data.fd = fd; - return TRACE_SUC ("dh=%p", *r_dh); + TRACE_SUC ("dh=%p", *r_dh); + return 0; } diff --git a/src/data-mem.c b/src/data-mem.c index 915c3e0..f51d2fd 100644 --- a/src/data-mem.c +++ b/src/data-mem.c @@ -177,7 +177,8 @@ gpgme_data_new (gpgme_data_t *r_dh) if (err) return TRACE_ERR (err); - return TRACE_SUC ("dh=%p", *r_dh); + TRACE_SUC ("dh=%p", *r_dh); + return 0; } @@ -214,7 +215,8 @@ gpgme_data_new_from_mem (gpgme_data_t *r_dh, const char *buffer, (*r_dh)->data.mem.size = size; (*r_dh)->data.mem.length = size; - return TRACE_SUC ("dh=%p", *r_dh); + TRACE_SUC ("dh=%p", *r_dh); + return 0; } @@ -282,13 +284,9 @@ gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *r_len) gpgme_data_release (dh); if (r_len) - { - TRACE_SUC ("buffer=%p, len=%zu", str, *r_len); - } + TRACE_SUC ("buffer=%p, len=%zu", str, *r_len); else - { - TRACE_SUC ("buffer=%p", str); - } + TRACE_SUC ("buffer=%p", str); return str; } diff --git a/src/data-stream.c b/src/data-stream.c index 19a5a07..1ffb621 100644 --- a/src/data-stream.c +++ b/src/data-stream.c @@ -104,5 +104,6 @@ gpgme_data_new_from_stream (gpgme_data_t *r_dh, FILE *stream) return TRACE_ERR (err); (*r_dh)->data.stream = stream; - return TRACE_SUC ("dh=%p", *r_dh); + TRACE_SUC ("dh=%p", *r_dh); + return 0; } diff --git a/src/data-user.c b/src/data-user.c index f5bd2ef..0111b2d 100644 --- a/src/data-user.c +++ b/src/data-user.c @@ -100,5 +100,6 @@ gpgme_data_new_from_cbs (gpgme_data_t *r_dh, gpgme_data_cbs_t cbs, void *handle) (*r_dh)->data.user.cbs = cbs; (*r_dh)->data.user.handle = handle; - return TRACE_SUC ("dh=%p", *r_dh); + TRACE_SUC ("dh=%p", *r_dh); + return 0; } diff --git a/src/debug.h b/src/debug.h index 06e6d02..7ef8cf2 100644 --- a/src/debug.h +++ b/src/debug.h @@ -113,68 +113,97 @@ _gpgme_trace_gpgme_error (gpgme_error_t err, const char *file, int line) void *_gpgme_trace_tag = (void *) (uintptr_t) tag; \ _gpgme_debug_frame_begin () -#define TRACE_BEG(lvl, name, tag, ...) \ +/* Note: We can't protect this with a do-while block. */ +#define TRACE_BEG(lvl, name, tag, ...) \ _TRACE (lvl, name, tag); \ - _gpgme_debug (_gpgme_trace_level, 1, \ + _gpgme_debug (_gpgme_trace_level, 1, \ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ __VA_ARGS__) -#define TRACE(lvl, name, tag, ...) \ - _gpgme_debug_frame_begin (), \ - _gpgme_debug (lvl, 0, \ - name, STRINGIFY (tag), (void *) (uintptr_t) tag, \ - __VA_ARGS__), \ - _gpgme_debug_frame_end () - -#define TRACE_ERR(err) \ - err == 0 ? (TRACE_SUC ("")) : \ - (_gpgme_debug (_gpgme_trace_level, -1, NULL, NULL, NULL, \ - "%s:%d: error: %s <%s>\n", \ - _gpgme_trace_func, __LINE__, gpgme_strerror (err), \ - gpgme_strsource (err)), _gpgme_debug_frame_end (), (err)) - - -/* The cast to void suppresses GCC warnings. */ -#define TRACE_SYSRES(res) \ - res >= 0 ? ((void) (TRACE_SUC ("result=%i", res)), (res)) : \ - (_gpgme_debug (_gpgme_trace_level, -1, NULL, NULL, NULL, \ - "%s: error: %s\n", \ - _gpgme_trace_func, strerror (errno)), \ - _gpgme_debug_frame_end (), (res)) -#define TRACE_SYSERR(res) \ - res == 0 ? ((void) (TRACE_SUC ("result=%i", res)), (res)) : \ - (_gpgme_debug (_gpgme_trace_level, -1, NULL, NULL, NULL, \ - "%s: error: %s\n", \ - _gpgme_trace_func, strerror (res)), \ - _gpgme_debug_frame_end (), (res)) -#define TRACE_SYSERR_NR(res) \ - do { res == 0 ? ((void) (TRACE_SUC ("result=%i", res)), (res)) : \ - (_gpgme_debug (_gpgme_trace_level, -1, NULL, NULL, NULL, \ - "%s: error: %s\n", \ - _gpgme_trace_func, strerror (res)), \ - _gpgme_debug_frame_end ()); } while (0) - -#define TRACE_SUC(...) \ - _gpgme_debug (_gpgme_trace_level, 3, _gpgme_trace_func, NULL, NULL, \ - __VA_ARGS__), _gpgme_debug_frame_end () - -#define TRACE_LOG(...) \ - _gpgme_debug (_gpgme_trace_level, 2, \ - _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ - __VA_ARGS__) - -#define TRACE_LOGBUF(buf, len) \ - _gpgme_debug_buffer (_gpgme_trace_level, "%s: check: %s", \ - _gpgme_trace_func, buf, len) - -#define TRACE_LOGBUFX(buf, len) \ - _gpgme_debug_buffer (_gpgme_trace_level+1, "%s: check: %s", \ - _gpgme_trace_func, buf, len) - -#define TRACE_SEQ(hlp,fmt) \ - _gpgme_debug_begin (&(hlp), _gpgme_trace_level, \ - "%s: check: %s=%p, " fmt, _gpgme_trace_func, \ - _gpgme_trace_tagname, _gpgme_trace_tag) +#define TRACE(lvl, name, tag, ...) do { \ + _gpgme_debug_frame_begin (); \ + _gpgme_debug (lvl, 0, name, STRINGIFY (tag), (void *)(uintptr_t)tag, \ + __VA_ARGS__); \ + _gpgme_debug_frame_end (); \ + } while (0) + + +/* Trace a gpg-error and return it. */ +#define TRACE_ERR(err) \ + _trace_err ((err), _gpgme_trace_level, _gpgme_trace_func, __LINE__) +static inline gpg_error_t +_trace_err (gpg_error_t err, int lvl, const char *func, int line) +{ + if (!err) + _gpgme_debug (lvl, 3, func, NULL, NULL, ""); + else + _gpgme_debug (lvl, -1, NULL, NULL, NULL, + "%s:%d: error: %s <%s>\n", + func, line, gpgme_strerror (err), gpgme_strsource (err)); + _gpgme_debug_frame_end (); + return err; +} + +/* Trace a system call result and return it. */ +#define TRACE_SYSRES(res) \ + _trace_sysres ((res), _gpgme_trace_level, _gpgme_trace_func, __LINE__) +static inline int +_trace_sysres (int res, int lvl, const char *func, int line) +{ + if (res >= 0) + _gpgme_debug (lvl, 3, func, NULL, NULL, "result=%d", res); + else + _gpgme_debug (lvl, -1, NULL, NULL, NULL, + "%s:%d: error: %s (%d)\n", + func, line, strerror (res), res); + _gpgme_debug_frame_end (); + return res; +} + +/* Trace a system call error and return it. */ +#define TRACE_SYSERR(rc) \ + _trace_syserr ((rc), _gpgme_trace_level, _gpgme_trace_func, __LINE__) +static inline int +_trace_syserr (int rc, int lvl, const char *func, int line) +{ + if (!rc) + _gpgme_debug (lvl, 3, func, NULL, NULL, "result=0"); + else + _gpgme_debug (lvl, -1, NULL, NULL, NULL, + "%s:%d: error: %s (%d)\n", + func, line, strerror (rc), rc); + _gpgme_debug_frame_end (); + return rc; +} + +#define TRACE_SUC(...) do { \ + _gpgme_debug (_gpgme_trace_level, 3, _gpgme_trace_func, NULL, NULL, \ + __VA_ARGS__); \ + _gpgme_debug_frame_end (); \ + } while (0) + +#define TRACE_LOG(...) do { \ + _gpgme_debug (_gpgme_trace_level, 2, \ + _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ + __VA_ARGS__); \ + } while (0) + +#define TRACE_LOGBUF(buf, len) do { \ + _gpgme_debug_buffer (_gpgme_trace_level, "%s: check: %s", \ + _gpgme_trace_func, buf, len); \ + } while (0) + +#define TRACE_LOGBUFX(buf, len) do { \ + _gpgme_debug_buffer (_gpgme_trace_level+1, "%s: check: %s", \ + _gpgme_trace_func, buf, len); \ + } while (0) + +#define TRACE_SEQ(hlp,fmt) do { \ + _gpgme_debug_begin (&(hlp), _gpgme_trace_level, \ + "%s: check: %s=%p, " fmt, _gpgme_trace_func, \ + _gpgme_trace_tagname, _gpgme_trace_tag); \ + } while (0) + #define TRACE_ADD0(hlp,fmt) \ _gpgme_debug_add (&(hlp), fmt) #define TRACE_ADD1(hlp,fmt,a) \ @@ -186,6 +215,7 @@ _gpgme_trace_gpgme_error (gpgme_error_t err, const char *file, int line) #define TRACE_END(hlp,fmt) \ _gpgme_debug_add (&(hlp), fmt); \ _gpgme_debug_end (&(hlp)) + #define TRACE_ENABLED(hlp) (!!(hlp)) /* And finally a simple macro to trace the location of an error code. diff --git a/src/gpgme.c b/src/gpgme.c index c4a1da1..a0a6c6b 100644 --- a/src/gpgme.c +++ b/src/gpgme.c @@ -159,7 +159,8 @@ gpgme_new (gpgme_ctx_t *r_ctx) *r_ctx = ctx; - return TRACE_SUC ("ctx=%p", ctx); + TRACE_SUC ("ctx=%p", ctx); + return 0; } diff --git a/src/keylist.c b/src/keylist.c index 7ea7b26..cdb115f 100644 --- a/src/keylist.c +++ b/src/keylist.c @@ -1235,9 +1235,10 @@ gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key) *r_key = queue_item->key; free (queue_item); - return TRACE_SUC ("key=%p (%s)", *r_key, - ((*r_key)->subkeys && (*r_key)->subkeys->fpr) ? - (*r_key)->subkeys->fpr : "invalid"); + TRACE_SUC ("key=%p (%s)", *r_key, + ((*r_key)->subkeys && (*r_key)->subkeys->fpr) ? + (*r_key)->subkeys->fpr : "invalid"); + return 0; } diff --git a/src/posix-io.c b/src/posix-io.c index 77ecde0..be08431 100644 --- a/src/posix-io.c +++ b/src/posix-io.c @@ -166,7 +166,8 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) if (err) return TRACE_SYSRES (err); - return TRACE_SUC ("read=0x%x, write=0x%x", filedes[0], filedes[1]); + TRACE_SUC ("read=0x%x, write=0x%x", filedes[0], filedes[1]); + return 0; } diff --git a/src/signers.c b/src/signers.c index 6a5ccd2..ac88aeb 100644 --- a/src/signers.c +++ b/src/signers.c @@ -89,7 +89,8 @@ gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key) gpgme_key_ref (key); ctx->signers[ctx->signers_len++] = key; - return TRACE_SUC (""); + TRACE_SUC (""); + return 0; } commit 7eda50a673d15320022375360fd220e8381b69ab Author: Werner Koch Date: Fri Nov 16 18:15:22 2018 +0100 core: Fix a LF problem in the new debug fucntion. * src/debug.c (_gpgme_debug): Print a LF for an empty FORMAT unless we are in legacy mode. diff --git a/src/debug.c b/src/debug.c index f0b0da0..81c2a90 100644 --- a/src/debug.c +++ b/src/debug.c @@ -254,11 +254,12 @@ _gpgme_debug (int level, int mode, const char *func, const char *tagname, { va_list arg_ptr; int saved_errno; + int need_lf; - saved_errno = errno; if (debug_level < level) return 0; + saved_errno = errno; va_start (arg_ptr, format); LOCK (debug_lock); { @@ -280,6 +281,7 @@ _gpgme_debug (int level, int mode, const char *func, const char *tagname, } #endif + need_lf = 0; switch (mode) { case -1: /* Do nothing. */ @@ -300,13 +302,14 @@ _gpgme_debug (int level, int mode, const char *func, const char *tagname, fprintf (errfp, "%s: leave: ", func); break; default: - fprintf (errfp, "%s: m=%d: %s=%p ", func, mode, tagname, tagvalue); + fprintf (errfp, "%s: ?(mode=%d): %s=%p ", func, mode, tagname, tagvalue); break; } + need_lf = (mode != -1 && (!format || !*format)); vfprintf (errfp, format, arg_ptr); va_end (arg_ptr); - if(format && *format && format[strlen (format) - 1] != '\n') + if (need_lf || (format && *format && format[strlen (format) - 1] != '\n')) putc ('\n', errfp); UNLOCK (debug_lock); fflush (errfp); ----------------------------------------------------------------------- Summary of changes: src/data-compat.c | 3 +- src/data-estream.c | 3 +- src/data-fd.c | 3 +- src/data-mem.c | 14 +++-- src/data-stream.c | 3 +- src/data-user.c | 3 +- src/debug.c | 9 ++-- src/debug.h | 146 ++++++++++++++++++++++++++++++++--------------------- src/gpgme.c | 3 +- src/keylist.c | 7 +-- src/posix-io.c | 3 +- src/signers.c | 3 +- 12 files changed, 120 insertions(+), 80 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 19 09:03:32 2018 From: cvs at cvs.gnupg.org (by Andreas Metzler) Date: Mon, 19 Nov 2018 09:03:32 +0100 Subject: [git] GCRYPT - branch, master, updated. libgcrypt-1.8.1-129-gaf0bbdb Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, master has been updated via af0bbdb9019e0b4a72e87e8b1b4a55506d349834 (commit) from aa686dfc9b563ff79c01d2f8560b88f69c42ecba (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit af0bbdb9019e0b4a72e87e8b1b4a55506d349834 Author: Andreas Metzler Date: Sun Nov 18 16:01:21 2018 +0100 doc: Fix library initialization examples Signed-off-by: Andreas Metzler diff --git a/doc/gcrypt.texi b/doc/gcrypt.texi index 4f4f973..5f20a54 100644 --- a/doc/gcrypt.texi +++ b/doc/gcrypt.texi @@ -382,10 +382,12 @@ memory is not a problem, you should initialize Libgcrypt this way: @example /* Version check should be the very first call because it - makes sure that important subsystems are initialized. */ - if (!gcry_check_version (GCRYPT_VERSION)) + makes sure that important subsystems are initialized. + #define NEED_LIBGCRYPT_VERSION to the minimum required version. */ + if (!gcry_check_version (NEED_LIBGCRYPT_VERSION)) @{ - fputs ("libgcrypt version mismatch\n", stderr); + fprintf (stderr, "libgcrypt is too old (need %s, have %s)\n", + NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL)); exit (2); @} @@ -405,10 +407,12 @@ and freed memory, you need to initialize Libgcrypt this way: @example /* Version check should be the very first call because it - makes sure that important subsystems are initialized. */ - if (!gcry_check_version (GCRYPT_VERSION)) + makes sure that important subsystems are initialized. + #define NEED_LIBGCRYPT_VERSION to the minimum required version. */ + if (!gcry_check_version (NEED_LIBGCRYPT_VERSION)) @{ - fputs ("libgcrypt version mismatch\n", stderr); + fprintf (stderr, "libgcrypt is too old (need %s, have %s)\n", + NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL)); exit (2); @} ----------------------------------------------------------------------- Summary of changes: doc/gcrypt.texi | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 19 09:03:40 2018 From: cvs at cvs.gnupg.org (by Andreas Metzler) Date: Mon, 19 Nov 2018 09:03:40 +0100 Subject: [git] GCRYPT - branch, LIBGCRYPT-1.8-BRANCH, updated. libgcrypt-1.8.4-7-g6faeca7 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, LIBGCRYPT-1.8-BRANCH has been updated via 6faeca72b455541ed6da45c5e71c8eb7b10b8c0b (commit) from bc05e16bb494bfef8b12d76f12afaa50a8e6e9dd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6faeca72b455541ed6da45c5e71c8eb7b10b8c0b Author: Andreas Metzler Date: Sun Nov 18 16:01:21 2018 +0100 doc: Fix library initialization examples Signed-off-by: Andreas Metzler diff --git a/doc/gcrypt.texi b/doc/gcrypt.texi index c32748f..be87d2c 100644 --- a/doc/gcrypt.texi +++ b/doc/gcrypt.texi @@ -382,10 +382,12 @@ memory is not a problem, you should initialize Libgcrypt this way: @example /* Version check should be the very first call because it - makes sure that important subsystems are initialized. */ - if (!gcry_check_version (GCRYPT_VERSION)) + makes sure that important subsystems are initialized. + #define NEED_LIBGCRYPT_VERSION to the minimum required version. */ + if (!gcry_check_version (NEED_LIBGCRYPT_VERSION)) @{ - fputs ("libgcrypt version mismatch\n", stderr); + fprintf (stderr, "libgcrypt is too old (need %s, have %s)\n", + NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL)); exit (2); @} @@ -405,10 +407,12 @@ and freed memory, you need to initialize Libgcrypt this way: @example /* Version check should be the very first call because it - makes sure that important subsystems are initialized. */ - if (!gcry_check_version (GCRYPT_VERSION)) + makes sure that important subsystems are initialized. + #define NEED_LIBGCRYPT_VERSION to the minimum required version. */ + if (!gcry_check_version (NEED_LIBGCRYPT_VERSION)) @{ - fputs ("libgcrypt version mismatch\n", stderr); + fprintf (stderr, "libgcrypt is too old (need %s, have %s)\n", + NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL)); exit (2); @} ----------------------------------------------------------------------- Summary of changes: doc/gcrypt.texi | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 19 11:06:21 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Mon, 19 Nov 2018 11:06:21 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-2.3.2-4-ge8c7a52 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via e8c7a5285420acd86ac97143747b78b6934151b3 (commit) via e6e29900ce0e9c0db681ac89c708f13415399905 (commit) from 287eaa69c04c8fbbf6f135c3f23f78cf15e77a9e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e8c7a5285420acd86ac97143747b78b6934151b3 Author: Andre Heinecke Date: Mon Nov 19 11:05:16 2018 +0100 Initalize pointer in mapi_get_header * src/mapihelp.cpp (mapi_get_header): Initialize stream. -- This would probably have avoided: GnuPG-Bug-Id: T4262 diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp index f259b98..4a1d532 100644 --- a/src/mapihelp.cpp +++ b/src/mapihelp.cpp @@ -493,7 +493,7 @@ mapi_get_header (LPMESSAGE message) { TSTART; HRESULT hr; - LPSTREAM stream; + LPSTREAM stream = nullptr; ULONG bRead; std::string ret; commit e6e29900ce0e9c0db681ac89c708f13415399905 Author: Andre Heinecke Date: Mon Nov 19 10:58:20 2018 +0100 Check for error in dbg decrated oom funcs * src/oomhelp.cpp (gpgol_openProperty, gpgol_queryInterface): Check result before calling memdbg_addRef. -- Calling something on the pointer on error is undefined so we may not do it. memdbg_addRef tries to get the name of the interface. That might then crash. Usually the returned pointer should be NULL so on error so it does not happen much. GnuPG-Bug-Id: T4262 diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp index 205eec5..bef4170 100644 --- a/src/oomhelp.cpp +++ b/src/oomhelp.cpp @@ -41,7 +41,12 @@ HRESULT gpgol_queryInterface (LPUNKNOWN pObj, REFIID riid, LPVOID FAR *ppvObj) { HRESULT ret = pObj->QueryInterface (riid, ppvObj); - if ((opt.enable_debug & DBG_MEMORY) && *ppvObj) + if (ret) + { + log_debug ("%s:%s: QueryInterface failed hr=%#lx", + SRCNAME, __func__, ret); + } + else if ((opt.enable_debug & DBG_MEMORY) && *ppvObj) { memdbg_addRef (*ppvObj); } @@ -56,7 +61,12 @@ gpgol_openProperty (LPMAPIPROP obj, ULONG ulPropTag, LPCIID lpiid, HRESULT ret = obj->OpenProperty (ulPropTag, lpiid, ulInterfaceOptions, ulFlags, lppUnk); - if ((opt.enable_debug & DBG_MEMORY) && *lppUnk) + if (ret) + { + log_debug ("%s:%s: OpenProperty failed hr=%#lx", + SRCNAME, __func__, ret); + } + else if ((opt.enable_debug & DBG_MEMORY) && *lppUnk) { memdbg_addRef (*lppUnk); log_debug ("%s:%s: OpenProperty on %p prop %lx result %p", ----------------------------------------------------------------------- Summary of changes: src/mapihelp.cpp | 2 +- src/oomhelp.cpp | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 19 11:43:11 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Mon, 19 Nov 2018 11:43:11 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-77-gfd34415 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via fd34415bdd57332424bd5a98d279e2331678a2fb (commit) via f773ad392da57e6be4ade93c44baa5d2057c40b6 (commit) from 7a1e7006d06fdbab86ea79a197c316744b09d933 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit fd34415bdd57332424bd5a98d279e2331678a2fb Author: Ben McGinnes Date: Mon Nov 19 21:38:50 2018 +1100 python: import type * Fixed bug T4242 and tested that dropping "Import" in favour of "import_type" does indeed work just fine. Tested-by: Ben McGinnes Signed-off-by: Ben McGinnes diff --git a/lang/python/src/constants/__init__.py b/lang/python/src/constants/__init__.py index 4e5ced2..f8a7308 100644 --- a/lang/python/src/constants/__init__.py +++ b/lang/python/src/constants/__init__.py @@ -32,13 +32,6 @@ from . import status, validity del absolute_import, print_function, unicode_literals, util -# This was a bad idea (though I get why it was done): -# -# # A complication arises because 'import' is a reserved keyword. -# # Import it as 'Import' instead. -# globals()['Import'] = getattr( -# __import__('', globals(), locals(), [str('import')], 1), "import") - __all__ = [ 'data', 'event', 'import_type', 'keysign', 'keylist', 'md', 'pk', 'protocol', 'sig', 'sigsum', 'status', 'tofu', 'validity', 'create' commit f773ad392da57e6be4ade93c44baa5d2057c40b6 Author: Ben McGinnes Date: Mon Nov 19 21:19:42 2018 +1100 python: import constant * lang/python/src/constants/__init__.py: dropped use of Import capitalisation and renamed lang/python/src/constants/import.py to lang/python/src/constants/import_type.py to address bug T4242. * lang/python/doc/src/gpgme-python-howto: minor docs updates. diff --git a/lang/python/doc/src/gpgme-python-howto b/lang/python/doc/src/gpgme-python-howto index e12dc36..7cc9770 100644 --- a/lang/python/doc/src/gpgme-python-howto +++ b/lang/python/doc/src/gpgme-python-howto @@ -16,11 +16,11 @@ :END: | Version: | 0.1.4 | -| GPGME Version: | 1.12.0 | +| GPGME Version: | 1.12.1 | | Author: | [[https://gnupg.org/people/index.html#sec-1-5][Ben McGinnes]] | | Author GPG Key: | DB4724E6FA4286C92B4E55C4321E4E2373590E5D | | Language: | Australian English, British English | -| xml:lang: | en-AU, en-GB, en | +| Language codes: | en-AU, en-GB, en | This document provides basic instruction in how to use the GPGME Python bindings to programmatically leverage the GPGME library. @@ -2925,8 +2925,6 @@ from the author at any of the following URLs: - [[http://files.au.adversary.org/crypto/gpgme-python-howto.info][GPGME Python Bindings HOWTO draft (Info file AWS S3 no SSL)]] - [[https://files.au.adversary.org/crypto/gpgme-python-howto.rst][GPGME Python Bindings HOWTO draft (reST file AWS S3 SSL)]] - [[http://files.au.adversary.org/crypto/gpgme-python-howto.rst][GPGME Python Bindings HOWTO draft (reST file AWS S3 no SSL)]] -- [[https://files.au.adversary.org/crypto/gpgme-python-howto.xml][GPGME Python Bindings HOWTO draft (Docbook 4.2 AWS S3 SSL)]] -- [[http://files.au.adversary.org/crypto/gpgme-python-howto.xml][GPGME Python Bindings HOWTO draft (Docbook 4.2 AWS S3 no SSL)]] All of these draft versions except for one have been generated from this document via Emacs [[https://orgmode.org/][Org mode]] and [[https://www.gnu.org/software/texinfo/][GNU Texinfo]]. Though it is likely @@ -2938,8 +2936,8 @@ using the latest version of Pandoc from the Org mode source file using either of the following two commands: #+BEGIN_SRC shell - pandoc -f org -t rst -o gpgme-python-howto.rst gpgme-python-howto.org - pandoc -f org -t rst -o gpgme-python-howto.rst gpgme-python-howto + pandoc -f org -t rst+smart -o gpgme-python-howto.rst gpgme-python-howto.org + pandoc -f org -t rst+smart -o gpgme-python-howto.rst gpgme-python-howto #+END_SRC In addition to these there is a significantly less frequently updated diff --git a/lang/python/src/constants/__init__.py b/lang/python/src/constants/__init__.py index 1f79f84..4e5ced2 100644 --- a/lang/python/src/constants/__init__.py +++ b/lang/python/src/constants/__init__.py @@ -27,19 +27,21 @@ util.process_constants('GPGME_', globals()) # For convenience, we import the modules here. from . import data, keylist, sig, tofu # The subdirs. # The remaining modules can no longer fit on one line. -from . import create, event, keysign, md, pk, protocol, sigsum, status -from . import validity +from . import create, event, import_type, keysign, md, pk, protocol, sigsum +from . import status, validity del absolute_import, print_function, unicode_literals, util -# A complication arises because 'import' is a reserved keyword. -# Import it as 'Import' instead. -globals()['Import'] = getattr( - __import__('', globals(), locals(), [str('import')], 1), "import") +# This was a bad idea (though I get why it was done): +# +# # A complication arises because 'import' is a reserved keyword. +# # Import it as 'Import' instead. +# globals()['Import'] = getattr( +# __import__('', globals(), locals(), [str('import')], 1), "import") __all__ = [ - 'data', 'event', 'import', 'keysign', 'keylist', 'md', 'pk', 'protocol', - 'sig', 'sigsum', 'status', 'tofu', 'validity', 'create' + 'data', 'event', 'import_type', 'keysign', 'keylist', 'md', 'pk', + 'protocol', 'sig', 'sigsum', 'status', 'tofu', 'validity', 'create' ] # GPGME 1.7 replaced gpgme_op_edit with gpgme_op_interact. We diff --git a/lang/python/src/constants/import.py b/lang/python/src/constants/import_type.py similarity index 100% rename from lang/python/src/constants/import.py rename to lang/python/src/constants/import_type.py ----------------------------------------------------------------------- Summary of changes: lang/python/doc/src/gpgme-python-howto | 10 ++++------ lang/python/src/constants/__init__.py | 13 ++++--------- lang/python/src/constants/{import.py => import_type.py} | 0 3 files changed, 8 insertions(+), 15 deletions(-) rename lang/python/src/constants/{import.py => import_type.py} (100%) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 19 12:49:49 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 19 Nov 2018 12:49:49 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-78-gb182838 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via b182838f71d8349d6cd7be9ecfb859b893d09127 (commit) from fd34415bdd57332424bd5a98d279e2331678a2fb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b182838f71d8349d6cd7be9ecfb859b893d09127 Author: Werner Koch Date: Mon Nov 19 12:49:40 2018 +0100 core: Fix format string errors in w32-io.c and use of TRACE_SUC. * src/w32-io.c: Fix use of TRACE_SUC. Fix some format strung errors. Signed-off-by: Werner Koch diff --git a/src/w32-io.c b/src/w32-io.c index 24e7e2b..919ca6f 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -469,12 +469,12 @@ reader (void *arg) break; } - TRACE_LOG ("got %u bytes (refcnt=%d)", nread, ctx->refcount); + TRACE_LOG ("got %lu bytes (refcnt=%d)", nread, ctx->refcount); ctx->writepos = (ctx->writepos + nread) % READBUF_SIZE; if (!SetEvent (ctx->have_data_ev)) { - TRACE_LOG ("SetEvent (0x%x) failed: ec=%d", ctx->have_data_ev, + TRACE_LOG ("SetEvent (%p) failed: ec=%d", ctx->have_data_ev, (int) GetLastError ()); } UNLOCK (ctx->mutex); @@ -482,7 +482,7 @@ reader (void *arg) /* Indicate that we have an error or EOF. */ if (!SetEvent (ctx->have_data_ev)) { - TRACE_LOG ("SetEvent (0x%x) failed: ec=%d", ctx->have_data_ev, + TRACE_LOG ("SetEvent (%p) failed: ec=%d", ctx->have_data_ev, (int) GetLastError ()); } @@ -497,7 +497,8 @@ reader (void *arg) DESTROY_LOCK (ctx->mutex); free (ctx); - return TRACE_SUC (""); + TRACE_SUC (""); + return 0; } @@ -523,7 +524,7 @@ create_reader (hddesc_t hdd) ctx = calloc (1, sizeof *ctx); if (!ctx) { - TRACE_SYSERR_NR (errno); + TRACE_SYSERR (errno); return NULL; } @@ -546,7 +547,7 @@ create_reader (hddesc_t hdd) close_handle (ctx->close_ev); release_hddesc (ctx->hdd); free (ctx); - TRACE_SYSERR_NR (EIO); + TRACE_SYSERR (EIO); return NULL; } @@ -566,7 +567,7 @@ create_reader (hddesc_t hdd) close_handle (ctx->close_ev); release_hddesc (ctx->hdd); free (ctx); - TRACE_SYSERR_NR (EIO); + TRACE_SYSERR (EIO); return NULL; } else @@ -621,7 +622,7 @@ destroy_reader (struct reader_context_s *ctx) { if (shutdown (ctx->hdd->sock, 2)) TRACE (DEBUG_SYSIO, "gpgme:destroy_reader", ctx, - "shutdown socket %d failed: %s", + "shutdown socket %d failed: ec=%d", ctx->hdd->sock, (int) WSAGetLastError ()); } @@ -639,7 +640,7 @@ find_reader (int fd) { struct reader_context_s *rd = NULL; - TRACE_BEG0 (DEBUG_SYSIO, "gpgme:find_reader", fd, ""); + TRACE_BEG (DEBUG_SYSIO, "gpgme:find_reader", fd, ""); LOCK (fd_table_lock); if (fd < 0 || fd >= fd_table_size || !fd_table[fd].used) @@ -733,7 +734,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) } if (!SetEvent (ctx->have_space_ev)) { - TRACE_LOG ("SetEvent (0x%x) failed: ec=%d", + TRACE_LOG ("SetEvent (%p) failed: ec=%d", ctx->have_space_ev, (int) GetLastError ()); UNLOCK (ctx->mutex); /* FIXME: Should translate the error code. */ @@ -855,7 +856,8 @@ writer (void *arg) DESTROY_LOCK (ctx->mutex); free (ctx); - return TRACE_SUC (""); + TRACE_SUC (""); + return 0; } @@ -878,7 +880,7 @@ TRACE_BEG (DEBUG_SYSIO, "gpgme:create_writer", hdd, ctx = calloc (1, sizeof *ctx); if (!ctx) { - TRACE_SYSERR_NR (errno); + TRACE_SYSERR (errno); return NULL; } @@ -901,7 +903,7 @@ TRACE_BEG (DEBUG_SYSIO, "gpgme:create_writer", hdd, close_handle (ctx->close_ev); release_hddesc (ctx->hdd); free (ctx); - TRACE_SYSERR_NR (EIO); + TRACE_SYSERR (EIO); return NULL; } @@ -920,7 +922,7 @@ TRACE_BEG (DEBUG_SYSIO, "gpgme:create_writer", hdd, close_handle (ctx->close_ev); release_hddesc (ctx->hdd); free (ctx); - TRACE_SYSERR_NR (EIO); + TRACE_SYSERR (EIO); return NULL; } else @@ -971,7 +973,7 @@ find_writer (int fd) { struct writer_context_s *wt = NULL; - TRACE_BEG0 (DEBUG_SYSIO, "gpgme:find_writer", fd, ""); + TRACE_BEG (DEBUG_SYSIO, "gpgme:find_writer", fd, ""); LOCK (fd_table_lock); if (fd < 0 || fd >= fd_table_size || !fd_table[fd].used) @@ -1200,9 +1202,10 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) filedes[0] = rfd; filedes[1] = wfd; - return TRACE_SUC ("read=0x%x (hdd=%p,hd=%p), write=0x%x (hdd=%p,hd=%p)", - rfd, fd_table[rfd].hdd, fd_table[rfd].hdd->hd, - wfd, fd_table[wfd].hdd, fd_table[wfd].hdd->hd); + TRACE_SUC ("read=0x%x (hdd=%p,hd=%p), write=0x%x (hdd=%p,hd=%p)", + rfd, fd_table[rfd].hdd, fd_table[rfd].hdd->hd, + wfd, fd_table[wfd].hdd, fd_table[wfd].hdd->hd); + return 0; } @@ -1971,5 +1974,6 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen) return TRACE_SYSRES (-1); } - return TRACE_SUC (""); + TRACE_SUC (""); + return 0; } ----------------------------------------------------------------------- Summary of changes: src/w32-io.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 20 20:17:52 2018 From: cvs at cvs.gnupg.org (by Jussi Kivilinna) Date: Tue, 20 Nov 2018 20:17:52 +0100 Subject: [git] GCRYPT - branch, master, updated. libgcrypt-1.8.1-131-g9d9c4fd Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, master has been updated via 9d9c4fd18b445ff414d11678285d54af3afdb222 (commit) via b42de67f34871a2520cfe370af513f2aab6e4f75 (commit) from af0bbdb9019e0b4a72e87e8b1b4a55506d349834 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9d9c4fd18b445ff414d11678285d54af3afdb222 Author: Jussi Kivilinna Date: Tue Nov 20 21:16:08 2018 +0200 Add clang target pragma for mixed C/assembly x86-64 implementations * cipher/cipher-gcm-intel-pclmul.c: Add target 'no-sse' attribute pragma for clang. * cipher/crc-intel-pclmul.c: Ditto. * cipher/rijndael-aesni.c: Ditto. * cipher/rijndael-ssse3-amd64.c: Ditto. * cipher/sha1-intel-shaext.c: Ditto. * cipher/sha256-intel-shaext.c: Ditto. -- Signed-off-by: Jussi Kivilinna diff --git a/cipher/cipher-gcm-intel-pclmul.c b/cipher/cipher-gcm-intel-pclmul.c index 0f26277..60ae7aa 100644 --- a/cipher/cipher-gcm-intel-pclmul.c +++ b/cipher/cipher-gcm-intel-pclmul.c @@ -37,6 +37,9 @@ /* Prevent compiler from issuing SSE instructions between asm blocks. */ # pragma GCC target("no-sse") #endif +#if __clang__ +# pragma clang attribute push (__attribute__((target("no-sse"))), apply_to = function) +#endif /* @@ -474,4 +477,8 @@ _gcry_ghash_intel_pclmul (gcry_cipher_hd_t c, byte *result, const byte *buf, return 0; } +#if __clang__ +# pragma clang attribute pop +#endif + #endif /* GCM_USE_INTEL_PCLMUL */ diff --git a/cipher/crc-intel-pclmul.c b/cipher/crc-intel-pclmul.c index 8ff08ec..482b260 100644 --- a/cipher/crc-intel-pclmul.c +++ b/cipher/crc-intel-pclmul.c @@ -39,6 +39,9 @@ /* Prevent compiler from issuing SSE instructions between asm blocks. */ # pragma GCC target("no-sse") #endif +#if __clang__ +# pragma clang attribute push (__attribute__((target("no-sse"))), apply_to = function) +#endif #define ALIGNED_16 __attribute__ ((aligned (16))) @@ -922,4 +925,8 @@ _gcry_crc24rfc2440_intel_pclmul (u32 *pcrc, const byte *inbuf, size_t inlen) #endif } +#if __clang__ +# pragma clang attribute pop +#endif + #endif /* USE_INTEL_PCLMUL */ diff --git a/cipher/rijndael-aesni.c b/cipher/rijndael-aesni.c index c1ebab0..483387c 100644 --- a/cipher/rijndael-aesni.c +++ b/cipher/rijndael-aesni.c @@ -39,6 +39,9 @@ /* Prevent compiler from issuing SSE instructions between asm blocks. */ # pragma GCC target("no-sse") #endif +#if __clang__ +# pragma clang attribute push (__attribute__((target("no-sse"))), apply_to = function) +#endif #define ALWAYS_INLINE inline __attribute__((always_inline)) @@ -3514,4 +3517,8 @@ _gcry_aes_aesni_xts_crypt (RIJNDAEL_context *ctx, unsigned char *tweak, _gcry_aes_aesni_xts_dec(ctx, tweak, outbuf, inbuf, nblocks); } +#if __clang__ +# pragma clang attribute pop +#endif + #endif /* USE_AESNI */ diff --git a/cipher/rijndael-ssse3-amd64.c b/cipher/rijndael-ssse3-amd64.c index fa481bb..0c1ae6e 100644 --- a/cipher/rijndael-ssse3-amd64.c +++ b/cipher/rijndael-ssse3-amd64.c @@ -55,6 +55,9 @@ /* Prevent compiler from issuing SSE instructions between asm blocks. */ # pragma GCC target("no-sse") #endif +#if __clang__ +# pragma clang attribute push (__attribute__((target("no-sse"))), apply_to = function) +#endif /* Copy of ocb_get_l needed here as GCC is unable to inline ocb_get_l @@ -726,4 +729,8 @@ _gcry_aes_ssse3_ocb_auth (gcry_cipher_hd_t c, const void *abuf_arg, return 0; } +#if __clang__ +# pragma clang attribute pop +#endif + #endif /* USE_SSSE3 */ diff --git a/cipher/sha1-intel-shaext.c b/cipher/sha1-intel-shaext.c index 5a2349e..d7e3d4f 100644 --- a/cipher/sha1-intel-shaext.c +++ b/cipher/sha1-intel-shaext.c @@ -29,6 +29,9 @@ /* Prevent compiler from issuing SSE instructions between asm blocks. */ # pragma GCC target("no-sse") #endif +#if __clang__ +# pragma clang attribute push (__attribute__((target("no-sse"))), apply_to = function) +#endif /* Two macros to be called prior and after the use of SHA-EXT instructions. There should be no external function calls between @@ -278,4 +281,8 @@ _gcry_sha1_transform_intel_shaext(void *state, const unsigned char *data, return 0; } +#if __clang__ +# pragma clang attribute pop +#endif + #endif /* HAVE_GCC_INLINE_ASM_SHA_EXT */ diff --git a/cipher/sha256-intel-shaext.c b/cipher/sha256-intel-shaext.c index 0c107bb..2eda42d 100644 --- a/cipher/sha256-intel-shaext.c +++ b/cipher/sha256-intel-shaext.c @@ -29,6 +29,9 @@ /* Prevent compiler from issuing SSE instructions between asm blocks. */ # pragma GCC target("no-sse") #endif +#if __clang__ +# pragma clang attribute push (__attribute__((target("no-sse"))), apply_to = function) +#endif /* Two macros to be called prior and after the use of SHA-EXT instructions. There should be no external function calls between @@ -349,4 +352,8 @@ _gcry_sha256_transform_intel_shaext(u32 state[8], const unsigned char *data, return 0; } +#if __clang__ +# pragma clang attribute pop +#endif + #endif /* HAVE_GCC_INLINE_ASM_SHA_EXT */ commit b42de67f34871a2520cfe370af513f2aab6e4f75 Author: Jussi Kivilinna Date: Tue Nov 20 21:16:08 2018 +0200 Optimizations for AES-NI OCB * cipher/cipher-internal.h (gcry_cipher_handle): New pre-computed OCB values L0L1 and L0L1L0; Swap dimensions for OCB L table. * cipher/cipher-ocb.c (_gcry_cipher_ocb_set_nonce): Setup L0L1 and L0L1L0 values. (ocb_crypt): Process input in 24KiB chunks for better cache locality for checksumming. * cipher/rijndael-aesni.c (ALWAYS_INLINE): New macro for always inlining functions, change all functions with 'inline' to use ALWAYS_INLINE. (NO_INLINE): New macro. (aesni_prepare_2_6_variable, aesni_prepare_7_15_variable): Rename to... (aesni_prepare_2_7_variable, aesni_prepare_8_15_variable): ...these and adjust accordingly (xmm7 moved from *_7_15 to *_2_7). (aesni_prepare_2_6, aesni_prepare_7_15): Rename to... (aesni_prepare_2_7, aesni_prepare_8_15): ...these and adjust accordingly. (aesni_cleanup_2_6, aesni_cleanup_7_15): Rename to... (aesni_cleanup_2_7, aesni_cleanup_8_15): ...these and adjust accordingly. (aesni_ocb_checksum): New. (aesni_ocb_enc, aesni_ocb_dec): Calculate OCB offsets in parallel with help of pre-computed offsets L0+L1 ja L0+L1+L0; Do checksum calculation as separate pass instead of inline; Use NO_INLINE. (_gcry_aes_aesni_ocb_auth): Calculate OCB offsets in parallel with help of pre-computed offsets L0+L1 ja L0+L1+L0. * cipher/rijndael-internal.h (RIJNDAEL_context_s) [USE_AESNI]: Add 'use_avx2' and 'use_avx'. * cipher/rijndael.c (do_setkey) [USE_AESNI]: Set 'use_avx2' if Intel AVX2 HW feature is available and 'use_avx' if Intel AVX HW feature is available. * tests/basic.c (do_check_ocb_cipher): New test vector; increase size of temporary buffers for new test vector. (check_ocb_cipher_largebuf_split): Make test plaintext non-uniform for better checksum testing. (check_ocb_cipher_checksum): New. (check_ocb_cipher_largebuf): Call check_ocb_cipher_checksum. (check_ocb_cipher): New expected tags for check_ocb_cipher_largebuf test runs. -- Benchmark on Haswell i7-4970k @ 4.0Ghz: Before: AES | nanosecs/byte mebibytes/sec cycles/byte OCB enc | 0.175 ns/B 5436 MiB/s 0.702 c/B OCB dec | 0.184 ns/B 5184 MiB/s 0.736 c/B OCB auth | 0.156 ns/B 6097 MiB/s 0.626 c/B After (enc +2% faster, dec +7% faster): OCB enc | 0.172 ns/B 5547 MiB/s 0.688 c/B OCB dec | 0.171 ns/B 5582 MiB/s 0.683 c/B OCB auth | 0.156 ns/B 6097 MiB/s 0.626 c/B Signed-off-by: Jussi Kivilinna diff --git a/cipher/cipher-internal.h b/cipher/cipher-internal.h index f93363b..8988696 100644 --- a/cipher/cipher-internal.h +++ b/cipher/cipher-internal.h @@ -319,7 +319,9 @@ struct gcry_cipher_handle /* Helper variables and pre-computed table of L values. */ unsigned char L_star[OCB_BLOCK_LEN]; unsigned char L_dollar[OCB_BLOCK_LEN]; - unsigned char L[OCB_BLOCK_LEN][OCB_L_TABLE_SIZE]; + unsigned char L0L1[OCB_BLOCK_LEN]; + unsigned char L0L1L0[OCB_BLOCK_LEN]; + unsigned char L[OCB_L_TABLE_SIZE][OCB_BLOCK_LEN]; /* The tag is valid if marks.tag has been set. */ unsigned char tag[OCB_BLOCK_LEN]; diff --git a/cipher/cipher-ocb.c b/cipher/cipher-ocb.c index f71520a..58f7be7 100644 --- a/cipher/cipher-ocb.c +++ b/cipher/cipher-ocb.c @@ -170,6 +170,11 @@ _gcry_cipher_ocb_set_nonce (gcry_cipher_hd_t c, const unsigned char *nonce, double_block_cpy (c->u_mode.ocb.L[0], c->u_mode.ocb.L_dollar); for (i = 1; i < OCB_L_TABLE_SIZE; i++) double_block_cpy (c->u_mode.ocb.L[i], c->u_mode.ocb.L[i-1]); + /* Precalculated offsets L0+L1, L0+L1+L0 */ + cipher_block_xor (c->u_mode.ocb.L0L1, + c->u_mode.ocb.L[0], c->u_mode.ocb.L[1], OCB_BLOCK_LEN); + cipher_block_xor (c->u_mode.ocb.L0L1L0, + c->u_mode.ocb.L[0], c->u_mode.ocb.L0L1, OCB_BLOCK_LEN); /* Prepare the nonce. */ memset (ktop, 0, (OCB_BLOCK_LEN - noncelen)); @@ -519,6 +524,12 @@ ocb_crypt (gcry_cipher_hd_t c, int encrypt, nblks = nblks < nmaxblks ? nblks : nmaxblks; + /* Since checksum xoring is done before/after encryption/decryption, + process input in 24KiB chunks to keep data loaded in L1 cache for + checksumming. */ + if (nblks > 24 * 1024 / OCB_BLOCK_LEN) + nblks = 24 * 1024 / OCB_BLOCK_LEN; + /* Use a bulk method if available. */ if (nblks && c->bulk.ocb_crypt) { diff --git a/cipher/rijndael-aesni.c b/cipher/rijndael-aesni.c index d190c0a..c1ebab0 100644 --- a/cipher/rijndael-aesni.c +++ b/cipher/rijndael-aesni.c @@ -41,6 +41,10 @@ #endif +#define ALWAYS_INLINE inline __attribute__((always_inline)) +#define NO_INLINE __attribute__((noinline)) + + typedef struct u128_s { u32 a, b, c, d; @@ -49,7 +53,7 @@ typedef struct u128_s /* Copy of ocb_get_l needed here as GCC is unable to inline ocb_get_l because of 'pragma target'. */ -static inline const unsigned char * +static ALWAYS_INLINE const unsigned char * aes_ocb_get_l (gcry_cipher_hd_t c, u64 n) { unsigned long ntz; @@ -71,78 +75,78 @@ aes_ocb_get_l (gcry_cipher_hd_t c, u64 n) the key or the data. */ #ifdef __WIN64__ /* XMM6-XMM15 are callee-saved registers on WIN64. */ -# define aesni_prepare_2_6_variable char win64tmp[16] -# define aesni_prepare_7_15_variable char win64tmp7_15[16 * 9] +# define aesni_prepare_2_7_variable char win64tmp[16 * 2] +# define aesni_prepare_8_15_variable char win64tmp8_15[16 * 8] # define aesni_prepare() do { } while (0) -# define aesni_prepare_2_6() \ +# define aesni_prepare_2_7() \ do { asm volatile ("movdqu %%xmm6, %0\n\t" \ - : "=m" (*win64tmp) \ + "movdqu %%xmm7, %1\n\t" \ + : "=m" (*win64tmp), "=m" (*(win64tmp+16)) \ : \ : "memory"); \ } while (0) -# define aesni_prepare_7_15() \ - do { asm volatile ("movdqu %%xmm7, 0*16(%0)\n\t" \ - "movdqu %%xmm8, 1*16(%0)\n\t" \ - "movdqu %%xmm9, 2*16(%0)\n\t" \ - "movdqu %%xmm10, 3*16(%0)\n\t" \ - "movdqu %%xmm11, 4*16(%0)\n\t" \ - "movdqu %%xmm12, 5*16(%0)\n\t" \ - "movdqu %%xmm13, 6*16(%0)\n\t" \ - "movdqu %%xmm14, 7*16(%0)\n\t" \ - "movdqu %%xmm15, 8*16(%0)\n\t" \ +# define aesni_prepare_8_15() \ + do { asm volatile ("movdqu %%xmm8, 0*16(%0)\n\t" \ + "movdqu %%xmm9, 1*16(%0)\n\t" \ + "movdqu %%xmm10, 2*16(%0)\n\t" \ + "movdqu %%xmm11, 3*16(%0)\n\t" \ + "movdqu %%xmm12, 4*16(%0)\n\t" \ + "movdqu %%xmm13, 5*16(%0)\n\t" \ + "movdqu %%xmm14, 6*16(%0)\n\t" \ + "movdqu %%xmm15, 7*16(%0)\n\t" \ : \ - : "r" (win64tmp7_15) \ + : "r" (win64tmp8_15) \ : "memory"); \ } while (0) # define aesni_cleanup() \ do { asm volatile ("pxor %%xmm0, %%xmm0\n\t" \ "pxor %%xmm1, %%xmm1\n" :: ); \ } while (0) -# define aesni_cleanup_2_6() \ +# define aesni_cleanup_2_7() \ do { asm volatile ("movdqu %0, %%xmm6\n\t" \ + "movdqu %1, %%xmm7\n\t" \ "pxor %%xmm2, %%xmm2\n" \ "pxor %%xmm3, %%xmm3\n" \ "pxor %%xmm4, %%xmm4\n" \ "pxor %%xmm5, %%xmm5\n" \ : \ - : "m" (*win64tmp) \ + : "m" (*win64tmp), "m" (*(win64tmp+16)) \ : "memory"); \ } while (0) -# define aesni_cleanup_7_15() \ - do { asm volatile ("movdqu 0*16(%0), %%xmm7\n\t" \ - "movdqu 1*16(%0), %%xmm8\n\t" \ - "movdqu 2*16(%0), %%xmm9\n\t" \ - "movdqu 3*16(%0), %%xmm10\n\t" \ - "movdqu 4*16(%0), %%xmm11\n\t" \ - "movdqu 5*16(%0), %%xmm12\n\t" \ - "movdqu 6*16(%0), %%xmm13\n\t" \ - "movdqu 7*16(%0), %%xmm14\n\t" \ - "movdqu 8*16(%0), %%xmm15\n\t" \ +# define aesni_cleanup_8_15() \ + do { asm volatile ("movdqu 0*16(%0), %%xmm8\n\t" \ + "movdqu 1*16(%0), %%xmm9\n\t" \ + "movdqu 2*16(%0), %%xmm10\n\t" \ + "movdqu 3*16(%0), %%xmm11\n\t" \ + "movdqu 4*16(%0), %%xmm12\n\t" \ + "movdqu 5*16(%0), %%xmm13\n\t" \ + "movdqu 6*16(%0), %%xmm14\n\t" \ + "movdqu 7*16(%0), %%xmm15\n\t" \ : \ - : "r" (win64tmp7_15) \ + : "r" (win64tmp8_15) \ : "memory"); \ } while (0) #else -# define aesni_prepare_2_6_variable +# define aesni_prepare_2_7_variable # define aesni_prepare() do { } while (0) -# define aesni_prepare_2_6() do { } while (0) +# define aesni_prepare_2_7() do { } while (0) # define aesni_cleanup() \ do { asm volatile ("pxor %%xmm0, %%xmm0\n\t" \ "pxor %%xmm1, %%xmm1\n" :: ); \ } while (0) -# define aesni_cleanup_2_6() \ - do { asm volatile ("pxor %%xmm2, %%xmm2\n\t" \ +# define aesni_cleanup_2_7() \ + do { asm volatile ("pxor %%xmm7, %%xmm7\n\t" \ + "pxor %%xmm2, %%xmm2\n\t" \ "pxor %%xmm3, %%xmm3\n" \ "pxor %%xmm4, %%xmm4\n" \ "pxor %%xmm5, %%xmm5\n" \ "pxor %%xmm6, %%xmm6\n":: ); \ } while (0) # ifdef __x86_64__ -# define aesni_prepare_7_15_variable -# define aesni_prepare_7_15() do { } while (0) -# define aesni_cleanup_7_15() \ - do { asm volatile ("pxor %%xmm7, %%xmm7\n\t" \ - "pxor %%xmm8, %%xmm8\n" \ +# define aesni_prepare_8_15_variable +# define aesni_prepare_8_15() do { } while (0) +# define aesni_cleanup_8_15() \ + do { asm volatile ("pxor %%xmm8, %%xmm8\n" \ "pxor %%xmm9, %%xmm9\n" \ "pxor %%xmm10, %%xmm10\n" \ "pxor %%xmm11, %%xmm11\n" \ @@ -157,10 +161,10 @@ aes_ocb_get_l (gcry_cipher_hd_t c, u64 n) void _gcry_aes_aesni_do_setkey (RIJNDAEL_context *ctx, const byte *key) { - aesni_prepare_2_6_variable; + aesni_prepare_2_7_variable; aesni_prepare(); - aesni_prepare_2_6(); + aesni_prepare_2_7(); if (ctx->rounds < 12) { @@ -383,12 +387,12 @@ _gcry_aes_aesni_do_setkey (RIJNDAEL_context *ctx, const byte *key) } aesni_cleanup(); - aesni_cleanup_2_6(); + aesni_cleanup_2_7(); } /* Make a decryption key from an encryption key. */ -static inline void +static ALWAYS_INLINE void do_aesni_prepare_decryption (RIJNDAEL_context *ctx) { /* The AES-NI decrypt instructions use the Equivalent Inverse @@ -447,7 +451,7 @@ _gcry_aes_aesni_prepare_decryption (RIJNDAEL_context *ctx) /* Encrypt one block using the Intel AES-NI instructions. Block is input * and output through SSE register xmm0. */ -static inline void +static ALWAYS_INLINE void do_aesni_enc (const RIJNDAEL_context *ctx) { #define aesenc_xmm1_xmm0 ".byte 0x66, 0x0f, 0x38, 0xdc, 0xc1\n\t" @@ -500,7 +504,7 @@ do_aesni_enc (const RIJNDAEL_context *ctx) /* Decrypt one block using the Intel AES-NI instructions. Block is input * and output through SSE register xmm0. */ -static inline void +static ALWAYS_INLINE void do_aesni_dec (const RIJNDAEL_context *ctx) { #define aesdec_xmm1_xmm0 ".byte 0x66, 0x0f, 0x38, 0xde, 0xc1\n\t" @@ -553,7 +557,7 @@ do_aesni_dec (const RIJNDAEL_context *ctx) /* Encrypt four blocks using the Intel AES-NI instructions. Blocks are input * and output through SSE registers xmm1 to xmm4. */ -static inline void +static ALWAYS_INLINE void do_aesni_enc_vec4 (const RIJNDAEL_context *ctx) { #define aesenc_xmm0_xmm1 ".byte 0x66, 0x0f, 0x38, 0xdc, 0xc8\n\t" @@ -662,7 +666,7 @@ do_aesni_enc_vec4 (const RIJNDAEL_context *ctx) /* Decrypt four blocks using the Intel AES-NI instructions. Blocks are input * and output through SSE registers xmm1 to xmm4. */ -static inline void +static ALWAYS_INLINE void do_aesni_dec_vec4 (const RIJNDAEL_context *ctx) { #define aesdec_xmm0_xmm1 ".byte 0x66, 0x0f, 0x38, 0xde, 0xc8\n\t" @@ -773,7 +777,7 @@ do_aesni_dec_vec4 (const RIJNDAEL_context *ctx) /* Encrypt eight blocks using the Intel AES-NI instructions. Blocks are input * and output through SSE registers xmm1 to xmm4 and xmm8 to xmm11. */ -static inline void +static ALWAYS_INLINE void do_aesni_enc_vec8 (const RIJNDAEL_context *ctx) { asm volatile ("movdqa (%[key]), %%xmm0\n\t" @@ -925,7 +929,7 @@ do_aesni_enc_vec8 (const RIJNDAEL_context *ctx) /* Decrypt eight blocks using the Intel AES-NI instructions. Blocks are input * and output through SSE registers xmm1 to xmm4 and xmm8 to xmm11. */ -static inline void +static ALWAYS_INLINE void do_aesni_dec_vec8 (const RIJNDAEL_context *ctx) { asm volatile ("movdqa (%[key]), %%xmm0\n\t" @@ -1757,10 +1761,10 @@ _gcry_aes_aesni_cbc_enc (RIJNDAEL_context *ctx, unsigned char *iv, unsigned char *outbuf, const unsigned char *inbuf, size_t nblocks, int cbc_mac) { - aesni_prepare_2_6_variable; + aesni_prepare_2_7_variable; aesni_prepare (); - aesni_prepare_2_6(); + aesni_prepare_2_7(); asm volatile ("movdqu %[iv], %%xmm5\n\t" : /* No output */ @@ -1794,7 +1798,7 @@ _gcry_aes_aesni_cbc_enc (RIJNDAEL_context *ctx, unsigned char *iv, : "memory" ); aesni_cleanup (); - aesni_cleanup_2_6 (); + aesni_cleanup_2_7 (); } @@ -1805,10 +1809,10 @@ _gcry_aes_aesni_ctr_enc (RIJNDAEL_context *ctx, unsigned char *ctr, { static const unsigned char be_mask[16] __attribute__ ((aligned (16))) = { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; - aesni_prepare_2_6_variable; + aesni_prepare_2_7_variable; aesni_prepare (); - aesni_prepare_2_6(); + aesni_prepare_2_7(); asm volatile ("movdqa %[mask], %%xmm6\n\t" /* Preload mask */ "movdqa %[ctr], %%xmm5\n\t" /* Preload CTR */ @@ -1820,9 +1824,9 @@ _gcry_aes_aesni_ctr_enc (RIJNDAEL_context *ctx, unsigned char *ctr, #ifdef __x86_64__ if (nblocks >= 8) { - aesni_prepare_7_15_variable; + aesni_prepare_8_15_variable; - aesni_prepare_7_15(); + aesni_prepare_8_15(); for ( ;nblocks >= 8 ; nblocks -= 8 ) { @@ -1831,7 +1835,7 @@ _gcry_aes_aesni_ctr_enc (RIJNDAEL_context *ctx, unsigned char *ctr, inbuf += 8*BLOCKSIZE; } - aesni_cleanup_7_15(); + aesni_cleanup_8_15(); } #endif @@ -1848,7 +1852,7 @@ _gcry_aes_aesni_ctr_enc (RIJNDAEL_context *ctx, unsigned char *ctr, inbuf += BLOCKSIZE; } aesni_cleanup (); - aesni_cleanup_2_6 (); + aesni_cleanup_2_7 (); } @@ -1876,10 +1880,10 @@ _gcry_aes_aesni_cfb_dec (RIJNDAEL_context *ctx, unsigned char *iv, unsigned char *outbuf, const unsigned char *inbuf, size_t nblocks) { - aesni_prepare_2_6_variable; + aesni_prepare_2_7_variable; aesni_prepare (); - aesni_prepare_2_6(); + aesni_prepare_2_7(); asm volatile ("movdqu %[iv], %%xmm6\n\t" : /* No output */ @@ -1891,9 +1895,9 @@ _gcry_aes_aesni_cfb_dec (RIJNDAEL_context *ctx, unsigned char *iv, #ifdef __x86_64__ if (nblocks >= 8) { - aesni_prepare_7_15_variable; + aesni_prepare_8_15_variable; - aesni_prepare_7_15(); + aesni_prepare_8_15(); for ( ;nblocks >= 8; nblocks -= 8) { @@ -1953,7 +1957,7 @@ _gcry_aes_aesni_cfb_dec (RIJNDAEL_context *ctx, unsigned char *iv, inbuf += 8*BLOCKSIZE; } - aesni_cleanup_7_15(); + aesni_cleanup_8_15(); } #endif @@ -2022,7 +2026,7 @@ _gcry_aes_aesni_cfb_dec (RIJNDAEL_context *ctx, unsigned char *iv, : "memory" ); aesni_cleanup (); - aesni_cleanup_2_6 (); + aesni_cleanup_2_7 (); } @@ -2031,10 +2035,10 @@ _gcry_aes_aesni_cbc_dec (RIJNDAEL_context *ctx, unsigned char *iv, unsigned char *outbuf, const unsigned char *inbuf, size_t nblocks) { - aesni_prepare_2_6_variable; + aesni_prepare_2_7_variable; aesni_prepare (); - aesni_prepare_2_6(); + aesni_prepare_2_7(); if ( !ctx->decryption_prepared ) { @@ -2051,9 +2055,9 @@ _gcry_aes_aesni_cbc_dec (RIJNDAEL_context *ctx, unsigned char *iv, #ifdef __x86_64__ if (nblocks >= 8) { - aesni_prepare_7_15_variable; + aesni_prepare_8_15_variable; - aesni_prepare_7_15(); + aesni_prepare_8_15(); for ( ;nblocks >= 8 ; nblocks -= 8 ) { @@ -2113,7 +2117,7 @@ _gcry_aes_aesni_cbc_dec (RIJNDAEL_context *ctx, unsigned char *iv, inbuf += 8*BLOCKSIZE; } - aesni_cleanup_7_15(); + aesni_cleanup_8_15(); } #endif @@ -2187,11 +2191,175 @@ _gcry_aes_aesni_cbc_dec (RIJNDAEL_context *ctx, unsigned char *iv, : "memory"); aesni_cleanup (); - aesni_cleanup_2_6 (); + aesni_cleanup_2_7 (); } -static void +static ALWAYS_INLINE void +aesni_ocb_checksum (gcry_cipher_hd_t c, const unsigned char *plaintext, + size_t nblocks) +{ + RIJNDAEL_context *ctx = (void *)&c->context.c; + + /* Calculate checksum */ + asm volatile ("movdqu %[checksum], %%xmm6\n\t" + "pxor %%xmm1, %%xmm1\n\t" + "pxor %%xmm2, %%xmm2\n\t" + "pxor %%xmm3, %%xmm3\n\t" + : + :[checksum] "m" (*c->u_ctr.ctr) + : "memory" ); + + if (0) {} +#if defined(HAVE_GCC_INLINE_ASM_AVX2) + else if (nblocks >= 16 && ctx->use_avx2) + { + /* Use wider 256-bit registers for fast xoring of plaintext. */ + asm volatile ("vzeroupper\n\t" + "vpxor %%xmm0, %%xmm0, %%xmm0\n\t" + "vpxor %%xmm4, %%xmm4, %%xmm4\n\t" + "vpxor %%xmm5, %%xmm5, %%xmm5\n\t" + "vpxor %%xmm7, %%xmm7, %%xmm7\n\t" + : + : + : "memory"); + + for (;nblocks >= 16; nblocks -= 16) + { + asm volatile ("vpxor %[ptr0], %%ymm6, %%ymm6\n\t" + "vpxor %[ptr1], %%ymm1, %%ymm1\n\t" + "vpxor %[ptr2], %%ymm2, %%ymm2\n\t" + "vpxor %[ptr3], %%ymm3, %%ymm3\n\t" + "vpxor %[ptr4], %%ymm0, %%ymm0\n\t" + "vpxor %[ptr5], %%ymm4, %%ymm4\n\t" + "vpxor %[ptr6], %%ymm5, %%ymm5\n\t" + "vpxor %[ptr7], %%ymm7, %%ymm7\n\t" + : + : [ptr0] "m" (*(plaintext + 0 * BLOCKSIZE * 2)), + [ptr1] "m" (*(plaintext + 1 * BLOCKSIZE * 2)), + [ptr2] "m" (*(plaintext + 2 * BLOCKSIZE * 2)), + [ptr3] "m" (*(plaintext + 3 * BLOCKSIZE * 2)), + [ptr4] "m" (*(plaintext + 4 * BLOCKSIZE * 2)), + [ptr5] "m" (*(plaintext + 5 * BLOCKSIZE * 2)), + [ptr6] "m" (*(plaintext + 6 * BLOCKSIZE * 2)), + [ptr7] "m" (*(plaintext + 7 * BLOCKSIZE * 2)) + : "memory" ); + plaintext += BLOCKSIZE * 16; + } + + asm volatile ("vpxor %%ymm0, %%ymm6, %%ymm6\n\t" + "vpxor %%ymm4, %%ymm1, %%ymm1\n\t" + "vpxor %%ymm5, %%ymm2, %%ymm2\n\t" + "vpxor %%ymm7, %%ymm3, %%ymm3\n\t" + "vextracti128 $1, %%ymm6, %%xmm0\n\t" + "vextracti128 $1, %%ymm1, %%xmm4\n\t" + "vextracti128 $1, %%ymm2, %%xmm5\n\t" + "vextracti128 $1, %%ymm3, %%xmm7\n\t" + "vpxor %%xmm0, %%xmm6, %%xmm6\n\t" + "vpxor %%xmm4, %%xmm1, %%xmm1\n\t" + "vpxor %%xmm5, %%xmm2, %%xmm2\n\t" + "vpxor %%xmm7, %%xmm3, %%xmm3\n\t" + "vzeroupper\n\t" + : + : + : "memory" ); + } +#endif +#if defined(HAVE_GCC_INLINE_ASM_AVX) + else if (nblocks >= 16 && ctx->use_avx) + { + /* Same as AVX2, except using 256-bit floating point instructions. */ + asm volatile ("vzeroupper\n\t" + "vxorpd %%xmm0, %%xmm0, %%xmm0\n\t" + "vxorpd %%xmm4, %%xmm4, %%xmm4\n\t" + "vxorpd %%xmm5, %%xmm5, %%xmm5\n\t" + "vxorpd %%xmm7, %%xmm7, %%xmm7\n\t" + : + : + : "memory"); + + for (;nblocks >= 16; nblocks -= 16) + { + asm volatile ("vxorpd %[ptr0], %%ymm6, %%ymm6\n\t" + "vxorpd %[ptr1], %%ymm1, %%ymm1\n\t" + "vxorpd %[ptr2], %%ymm2, %%ymm2\n\t" + "vxorpd %[ptr3], %%ymm3, %%ymm3\n\t" + "vxorpd %[ptr4], %%ymm0, %%ymm0\n\t" + "vxorpd %[ptr5], %%ymm4, %%ymm4\n\t" + "vxorpd %[ptr6], %%ymm5, %%ymm5\n\t" + "vxorpd %[ptr7], %%ymm7, %%ymm7\n\t" + : + : [ptr0] "m" (*(plaintext + 0 * BLOCKSIZE * 2)), + [ptr1] "m" (*(plaintext + 1 * BLOCKSIZE * 2)), + [ptr2] "m" (*(plaintext + 2 * BLOCKSIZE * 2)), + [ptr3] "m" (*(plaintext + 3 * BLOCKSIZE * 2)), + [ptr4] "m" (*(plaintext + 4 * BLOCKSIZE * 2)), + [ptr5] "m" (*(plaintext + 5 * BLOCKSIZE * 2)), + [ptr6] "m" (*(plaintext + 6 * BLOCKSIZE * 2)), + [ptr7] "m" (*(plaintext + 7 * BLOCKSIZE * 2)) + : "memory" ); + plaintext += BLOCKSIZE * 16; + } + + asm volatile ("vxorpd %%ymm0, %%ymm6, %%ymm6\n\t" + "vxorpd %%ymm4, %%ymm1, %%ymm1\n\t" + "vxorpd %%ymm5, %%ymm2, %%ymm2\n\t" + "vxorpd %%ymm7, %%ymm3, %%ymm3\n\t" + "vextractf128 $1, %%ymm6, %%xmm0\n\t" + "vextractf128 $1, %%ymm1, %%xmm4\n\t" + "vextractf128 $1, %%ymm2, %%xmm5\n\t" + "vextractf128 $1, %%ymm3, %%xmm7\n\t" + "vxorpd %%xmm0, %%xmm6, %%xmm6\n\t" + "vxorpd %%xmm4, %%xmm1, %%xmm1\n\t" + "vxorpd %%xmm5, %%xmm2, %%xmm2\n\t" + "vxorpd %%xmm7, %%xmm3, %%xmm3\n\t" + "vzeroupper\n\t" + : + : + : "memory" ); + } +#endif + + for (;nblocks >= 4; nblocks -= 4) + { + asm volatile ("movdqu %[ptr0], %%xmm0\n\t" + "movdqu %[ptr1], %%xmm4\n\t" + "movdqu %[ptr2], %%xmm5\n\t" + "movdqu %[ptr3], %%xmm7\n\t" + "pxor %%xmm0, %%xmm6\n\t" + "pxor %%xmm4, %%xmm1\n\t" + "pxor %%xmm5, %%xmm2\n\t" + "pxor %%xmm7, %%xmm3\n\t" + : + : [ptr0] "m" (*(plaintext + 0 * BLOCKSIZE)), + [ptr1] "m" (*(plaintext + 1 * BLOCKSIZE)), + [ptr2] "m" (*(plaintext + 2 * BLOCKSIZE)), + [ptr3] "m" (*(plaintext + 3 * BLOCKSIZE)) + : "memory" ); + plaintext += BLOCKSIZE * 4; + } + + for (;nblocks >= 1; nblocks -= 1) + { + asm volatile ("movdqu %[ptr0], %%xmm0\n\t" + "pxor %%xmm0, %%xmm6\n\t" + : + : [ptr0] "m" (*(plaintext + 0 * BLOCKSIZE)) + : "memory" ); + plaintext += BLOCKSIZE; + } + + asm volatile ("pxor %%xmm1, %%xmm6\n\t" + "pxor %%xmm2, %%xmm6\n\t" + "pxor %%xmm3, %%xmm6\n\t" + "movdqu %%xmm6, %[checksum]\n\t" + : [checksum] "=m" (*c->u_ctr.ctr) + : + : "memory" ); +} + + +static unsigned int NO_INLINE aesni_ocb_enc (gcry_cipher_hd_t c, void *outbuf_arg, const void *inbuf_arg, size_t nblocks) { @@ -2200,31 +2368,28 @@ aesni_ocb_enc (gcry_cipher_hd_t c, void *outbuf_arg, const unsigned char *inbuf = inbuf_arg; u64 n = c->u_mode.ocb.data_nblocks; const unsigned char *l; - aesni_prepare_2_6_variable; + aesni_prepare_2_7_variable; aesni_prepare (); - aesni_prepare_2_6 (); + aesni_prepare_2_7 (); + + aesni_ocb_checksum (c, inbuf_arg, nblocks); - /* Preload Offset and Checksum */ + /* Preload Offset */ asm volatile ("movdqu %[iv], %%xmm5\n\t" - "movdqu %[ctr], %%xmm6\n\t" : /* No output */ - : [iv] "m" (*c->u_iv.iv), - [ctr] "m" (*c->u_ctr.ctr) + : [iv] "m" (*c->u_iv.iv) : "memory" ); - for ( ;nblocks && n % 4; nblocks-- ) { l = aes_ocb_get_l(c, ++n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ - /* Checksum_i = Checksum_{i-1} xor P_i */ /* C_i = Offset_i xor ENCIPHER(K, P_i xor Offset_i) */ asm volatile ("movdqu %[l], %%xmm1\n\t" "movdqu %[inbuf], %%xmm0\n\t" "pxor %%xmm1, %%xmm5\n\t" - "pxor %%xmm0, %%xmm6\n\t" "pxor %%xmm5, %%xmm0\n\t" : : [l] "m" (*l), @@ -2246,11 +2411,11 @@ aesni_ocb_enc (gcry_cipher_hd_t c, void *outbuf_arg, #ifdef __x86_64__ if (nblocks >= 8) { - aesni_prepare_7_15_variable; + aesni_prepare_8_15_variable; - aesni_prepare_7_15(); + aesni_prepare_8_15(); - asm volatile ("movdqu %[l0], %%xmm7\n\t" + asm volatile ("movdqu %[l0], %%xmm6\n\t" : : [l0] "m" (*c->u_mode.ocb.L[0]) : "memory" ); @@ -2260,78 +2425,78 @@ aesni_ocb_enc (gcry_cipher_hd_t c, void *outbuf_arg, n += 4; l = aes_ocb_get_l(c, n); - /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ - /* Checksum_i = Checksum_{i-1} xor P_i */ - /* C_i = Offset_i xor ENCIPHER(K, P_i xor Offset_i) */ - - asm volatile ("movdqu %[l1], %%xmm10\n\t" - "movdqu %[inbuf0], %%xmm1\n\t" - "pxor %%xmm7, %%xmm5\n\t" - "pxor %%xmm1, %%xmm6\n\t" - "pxor %%xmm5, %%xmm1\n\t" - "movdqa %%xmm5, %%xmm12\n\t" + asm volatile ("movdqu %[l0l1], %%xmm10\n\t" + "movdqu %[l0l1l0], %%xmm11\n\t" + "movdqu %[l3], %%xmm15\n\t" : - : [l1] "m" (*c->u_mode.ocb.L[1]), - [inbuf0] "m" (*(inbuf + 0 * BLOCKSIZE)) + : [l0l1] "m" (*c->u_mode.ocb.L0L1), + [l0l1l0] "m" (*c->u_mode.ocb.L0L1L0), + [l3] "m" (*l) : "memory" ); - asm volatile ("movdqu %[inbuf1], %%xmm2\n\t" - "pxor %%xmm10, %%xmm5\n\t" - "pxor %%xmm2, %%xmm6\n\t" - "pxor %%xmm5, %%xmm2\n\t" - "movdqa %%xmm5, %%xmm13\n\t" + + n += 4; + l = aes_ocb_get_l(c, n); + + /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ + /* P_i = Offset_i xor ENCIPHER(K, C_i xor Offset_i) */ + asm volatile ("movdqu %[inbuf0], %%xmm1\n\t" + "movdqu %[inbuf1], %%xmm2\n\t" + "movdqu %[inbuf2], %%xmm3\n\t" : - : [inbuf1] "m" (*(inbuf + 1 * BLOCKSIZE)) + : [inbuf0] "m" (*(inbuf + 0 * BLOCKSIZE)), + [inbuf1] "m" (*(inbuf + 1 * BLOCKSIZE)), + [inbuf2] "m" (*(inbuf + 2 * BLOCKSIZE)) : "memory" ); - asm volatile ("movdqu %[inbuf2], %%xmm3\n\t" - "pxor %%xmm7, %%xmm5\n\t" - "pxor %%xmm3, %%xmm6\n\t" - "pxor %%xmm5, %%xmm3\n\t" - "movdqa %%xmm5, %%xmm14\n\t" + asm volatile ("movdqu %[inbuf3], %%xmm4\n\t" + "movdqu %[inbuf4], %%xmm8\n\t" + "movdqu %[inbuf5], %%xmm9\n\t" : - : [inbuf2] "m" (*(inbuf + 2 * BLOCKSIZE)) + : [inbuf3] "m" (*(inbuf + 3 * BLOCKSIZE)), + [inbuf4] "m" (*(inbuf + 4 * BLOCKSIZE)), + [inbuf5] "m" (*(inbuf + 5 * BLOCKSIZE)) : "memory" ); - asm volatile ("movdqu %[l3], %%xmm15\n\t" - "movdqu %[inbuf3], %%xmm4\n\t" + asm volatile ("movdqa %%xmm6, %%xmm12\n\t" + "pxor %%xmm5, %%xmm12\n\t" + "pxor %%xmm12, %%xmm1\n\t" + + "movdqa %%xmm10, %%xmm13\n\t" + "pxor %%xmm5, %%xmm13\n\t" + "pxor %%xmm13, %%xmm2\n\t" + + "movdqa %%xmm11, %%xmm14\n\t" + "pxor %%xmm5, %%xmm14\n\t" + "pxor %%xmm14, %%xmm3\n\t" + + "pxor %%xmm11, %%xmm5\n\t" "pxor %%xmm15, %%xmm5\n\t" - "pxor %%xmm4, %%xmm6\n\t" "pxor %%xmm5, %%xmm4\n\t" "movdqa %%xmm5, %%xmm15\n\t" - : - : [l3] "m" (*l), - [inbuf3] "m" (*(inbuf + 3 * BLOCKSIZE)) - : "memory" ); - n += 4; - l = aes_ocb_get_l(c, n); - - asm volatile ("movdqu %[inbuf4], %%xmm8\n\t" - "pxor %%xmm7, %%xmm5\n\t" - "pxor %%xmm8, %%xmm6\n\t" - "pxor %%xmm5, %%xmm8\n\t" - "movdqu %%xmm5, %[outbuf4]\n\t" - : [outbuf4] "=m" (*(outbuf + 4 * BLOCKSIZE)) - : [inbuf4] "m" (*(inbuf + 4 * BLOCKSIZE)) - : "memory" ); - asm volatile ("movdqu %[inbuf5], %%xmm9\n\t" - "pxor %%xmm10, %%xmm5\n\t" - "pxor %%xmm9, %%xmm6\n\t" - "pxor %%xmm5, %%xmm9\n\t" - "movdqu %%xmm5, %[outbuf5]\n\t" - : [outbuf5] "=m" (*(outbuf + 5 * BLOCKSIZE)) - : [inbuf5] "m" (*(inbuf + 5 * BLOCKSIZE)) + "movdqa %%xmm5, %%xmm0\n\t" + "pxor %%xmm6, %%xmm0\n\t" + "pxor %%xmm0, %%xmm8\n\t" + "movdqu %%xmm0, %[outbuf4]\n\t" + + "movdqa %%xmm10, %%xmm0\n\t" + "pxor %%xmm5, %%xmm0\n\t" + "pxor %%xmm0, %%xmm9\n\t" + "movdqu %%xmm0, %[outbuf5]\n\t" + : [outbuf4] "=m" (*(outbuf + 4 * BLOCKSIZE)), + [outbuf5] "=m" (*(outbuf + 5 * BLOCKSIZE)) + : : "memory" ); asm volatile ("movdqu %[inbuf6], %%xmm10\n\t" - "pxor %%xmm7, %%xmm5\n\t" - "pxor %%xmm10, %%xmm6\n\t" - "pxor %%xmm5, %%xmm10\n\t" - "movdqu %%xmm5, %[outbuf6]\n\t" + "movdqa %%xmm11, %%xmm0\n\t" + "pxor %%xmm5, %%xmm0\n\t" + "pxor %%xmm0, %%xmm10\n\t" + "movdqu %%xmm0, %[outbuf6]\n\t" : [outbuf6] "=m" (*(outbuf + 6 * BLOCKSIZE)) : [inbuf6] "m" (*(inbuf + 6 * BLOCKSIZE)) : "memory" ); - asm volatile ("movdqu %[l7], %%xmm11\n\t" + asm volatile ("movdqu %[l7], %%xmm0\n\t" "pxor %%xmm11, %%xmm5\n\t" + "pxor %%xmm0, %%xmm5\n\t" "movdqu %[inbuf7], %%xmm11\n\t" - "pxor %%xmm11, %%xmm6\n\t" "pxor %%xmm5, %%xmm11\n\t" : : [l7] "m" (*l), @@ -2374,7 +2539,7 @@ aesni_ocb_enc (gcry_cipher_hd_t c, void *outbuf_arg, inbuf += 8*BLOCKSIZE; } - aesni_cleanup_7_15(); + aesni_cleanup_8_15(); } #endif @@ -2384,44 +2549,46 @@ aesni_ocb_enc (gcry_cipher_hd_t c, void *outbuf_arg, l = aes_ocb_get_l(c, n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ - /* Checksum_i = Checksum_{i-1} xor P_i */ /* C_i = Offset_i xor ENCIPHER(K, P_i xor Offset_i) */ - asm volatile ("movdqu %[l0], %%xmm4\n\t" + asm volatile ("movdqu %[l0], %%xmm0\n\t" "movdqu %[inbuf0], %%xmm1\n\t" - "pxor %%xmm4, %%xmm5\n\t" - "pxor %%xmm1, %%xmm6\n\t" - "pxor %%xmm5, %%xmm1\n\t" - "movdqu %%xmm5, %[outbuf0]\n\t" - : [outbuf0] "=m" (*(outbuf + 0 * BLOCKSIZE)) + "movdqu %[l0l1], %%xmm3\n\t" + : : [l0] "m" (*c->u_mode.ocb.L[0]), + [l0l1] "m" (*c->u_mode.ocb.L0L1), [inbuf0] "m" (*(inbuf + 0 * BLOCKSIZE)) : "memory" ); - asm volatile ("movdqu %[l1], %%xmm0\n\t" - "movdqu %[inbuf1], %%xmm2\n\t" - "pxor %%xmm0, %%xmm5\n\t" - "pxor %%xmm2, %%xmm6\n\t" - "pxor %%xmm5, %%xmm2\n\t" - "movdqu %%xmm5, %[outbuf1]\n\t" - : [outbuf1] "=m" (*(outbuf + 1 * BLOCKSIZE)) - : [l1] "m" (*c->u_mode.ocb.L[1]), - [inbuf1] "m" (*(inbuf + 1 * BLOCKSIZE)) + asm volatile ("movdqu %[l0l1l0], %%xmm4\n\t" + "movdqu %[l3], %%xmm6\n\t" + "pxor %%xmm5, %%xmm0\n\t" + "pxor %%xmm0, %%xmm1\n\t" + "movdqu %%xmm0, %[outbuf0]\n\t" + : [outbuf0] "=m" (*(outbuf + 0 * BLOCKSIZE)) + : [l0l1l0] "m" (*c->u_mode.ocb.L0L1L0), + [l3] "m" (*l) : "memory" ); - asm volatile ("movdqu %[inbuf2], %%xmm3\n\t" - "pxor %%xmm4, %%xmm5\n\t" - "pxor %%xmm3, %%xmm6\n\t" + asm volatile ("movdqu %[inbuf1], %%xmm2\n\t" "pxor %%xmm5, %%xmm3\n\t" - "movdqu %%xmm5, %[outbuf2]\n\t" + "pxor %%xmm3, %%xmm2\n\t" + "movdqu %%xmm3, %[outbuf1]\n\t" + : [outbuf1] "=m" (*(outbuf + 1 * BLOCKSIZE)) + : [inbuf1] "m" (*(inbuf + 1 * BLOCKSIZE)) + : "memory" ); + asm volatile ("movdqa %%xmm4, %%xmm0\n\t" + "movdqu %[inbuf2], %%xmm3\n\t" + "pxor %%xmm5, %%xmm0\n\t" + "pxor %%xmm0, %%xmm3\n\t" + "movdqu %%xmm0, %[outbuf2]\n\t" : [outbuf2] "=m" (*(outbuf + 2 * BLOCKSIZE)) - : [inbuf2] "m" (*(inbuf + 2 * BLOCKSIZE)) + : + [inbuf2] "m" (*(inbuf + 2 * BLOCKSIZE)) : "memory" ); - asm volatile ("movdqu %[l3], %%xmm4\n\t" + asm volatile ("pxor %%xmm6, %%xmm5\n\t" "pxor %%xmm4, %%xmm5\n\t" "movdqu %[inbuf3], %%xmm4\n\t" - "pxor %%xmm4, %%xmm6\n\t" "pxor %%xmm5, %%xmm4\n\t" : - : [l3] "m" (*l), - [inbuf3] "m" (*(inbuf + 3 * BLOCKSIZE)) + : [inbuf3] "m" (*(inbuf + 3 * BLOCKSIZE)) : "memory" ); do_aesni_enc_vec4 (ctx); @@ -2453,12 +2620,10 @@ aesni_ocb_enc (gcry_cipher_hd_t c, void *outbuf_arg, l = aes_ocb_get_l(c, ++n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ - /* Checksum_i = Checksum_{i-1} xor P_i */ /* C_i = Offset_i xor ENCIPHER(K, P_i xor Offset_i) */ asm volatile ("movdqu %[l], %%xmm1\n\t" "movdqu %[inbuf], %%xmm0\n\t" "pxor %%xmm1, %%xmm5\n\t" - "pxor %%xmm0, %%xmm6\n\t" "pxor %%xmm5, %%xmm0\n\t" : : [l] "m" (*l), @@ -2479,30 +2644,31 @@ aesni_ocb_enc (gcry_cipher_hd_t c, void *outbuf_arg, c->u_mode.ocb.data_nblocks = n; asm volatile ("movdqu %%xmm5, %[iv]\n\t" - "movdqu %%xmm6, %[ctr]\n\t" - : [iv] "=m" (*c->u_iv.iv), - [ctr] "=m" (*c->u_ctr.ctr) + : [iv] "=m" (*c->u_iv.iv) : : "memory" ); aesni_cleanup (); - aesni_cleanup_2_6 (); + aesni_cleanup_2_7 (); + + return 0; } -static void +static unsigned int NO_INLINE aesni_ocb_dec (gcry_cipher_hd_t c, void *outbuf_arg, - const void *inbuf_arg, size_t nblocks) + const void *inbuf_arg, size_t nblocks_arg) { RIJNDAEL_context *ctx = (void *)&c->context.c; unsigned char *outbuf = outbuf_arg; const unsigned char *inbuf = inbuf_arg; u64 n = c->u_mode.ocb.data_nblocks; const unsigned char *l; - aesni_prepare_2_6_variable; + size_t nblocks = nblocks_arg; + aesni_prepare_2_7_variable; aesni_prepare (); - aesni_prepare_2_6 (); + aesni_prepare_2_7 (); if ( !ctx->decryption_prepared ) { @@ -2510,12 +2676,10 @@ aesni_ocb_dec (gcry_cipher_hd_t c, void *outbuf_arg, ctx->decryption_prepared = 1; } - /* Preload Offset and Checksum */ + /* Preload Offset */ asm volatile ("movdqu %[iv], %%xmm5\n\t" - "movdqu %[ctr], %%xmm6\n\t" : /* No output */ - : [iv] "m" (*c->u_iv.iv), - [ctr] "m" (*c->u_ctr.ctr) + : [iv] "m" (*c->u_iv.iv) : "memory" ); for ( ;nblocks && n % 4; nblocks-- ) @@ -2524,7 +2688,6 @@ aesni_ocb_dec (gcry_cipher_hd_t c, void *outbuf_arg, /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ /* P_i = Offset_i xor DECIPHER(K, C_i xor Offset_i) */ - /* Checksum_i = Checksum_{i-1} xor P_i */ asm volatile ("movdqu %[l], %%xmm1\n\t" "movdqu %[inbuf], %%xmm0\n\t" "pxor %%xmm1, %%xmm5\n\t" @@ -2537,7 +2700,6 @@ aesni_ocb_dec (gcry_cipher_hd_t c, void *outbuf_arg, do_aesni_dec (ctx); asm volatile ("pxor %%xmm5, %%xmm0\n\t" - "pxor %%xmm0, %%xmm6\n\t" "movdqu %%xmm0, %[outbuf]\n\t" : [outbuf] "=m" (*outbuf) : @@ -2550,11 +2712,11 @@ aesni_ocb_dec (gcry_cipher_hd_t c, void *outbuf_arg, #ifdef __x86_64__ if (nblocks >= 8) { - aesni_prepare_7_15_variable; + aesni_prepare_8_15_variable; - aesni_prepare_7_15(); + aesni_prepare_8_15(); - asm volatile ("movdqu %[l0], %%xmm7\n\t" + asm volatile ("movdqu %[l0], %%xmm6\n\t" : : [l0] "m" (*c->u_mode.ocb.L[0]) : "memory" ); @@ -2564,70 +2726,78 @@ aesni_ocb_dec (gcry_cipher_hd_t c, void *outbuf_arg, n += 4; l = aes_ocb_get_l(c, n); - /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ - /* P_i = Offset_i xor DECIPHER(K, C_i xor Offset_i) */ - /* Checksum_i = Checksum_{i-1} xor P_i */ - - asm volatile ("movdqu %[l1], %%xmm10\n\t" - "movdqu %[inbuf0], %%xmm1\n\t" - "pxor %%xmm7, %%xmm5\n\t" - "pxor %%xmm5, %%xmm1\n\t" - "movdqa %%xmm5, %%xmm12\n\t" + asm volatile ("movdqu %[l0l1], %%xmm10\n\t" + "movdqu %[l0l1l0], %%xmm11\n\t" + "movdqu %[l3], %%xmm15\n\t" : - : [l1] "m" (*c->u_mode.ocb.L[1]), - [inbuf0] "m" (*(inbuf + 0 * BLOCKSIZE)) + : [l0l1] "m" (*c->u_mode.ocb.L0L1), + [l0l1l0] "m" (*c->u_mode.ocb.L0L1L0), + [l3] "m" (*l) : "memory" ); - asm volatile ("movdqu %[inbuf1], %%xmm2\n\t" - "pxor %%xmm10, %%xmm5\n\t" - "pxor %%xmm5, %%xmm2\n\t" - "movdqa %%xmm5, %%xmm13\n\t" + + n += 4; + l = aes_ocb_get_l(c, n); + + /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ + /* P_i = Offset_i xor DECIPHER(K, C_i xor Offset_i) */ + asm volatile ("movdqu %[inbuf0], %%xmm1\n\t" + "movdqu %[inbuf1], %%xmm2\n\t" + "movdqu %[inbuf2], %%xmm3\n\t" : - : [inbuf1] "m" (*(inbuf + 1 * BLOCKSIZE)) + : [inbuf0] "m" (*(inbuf + 0 * BLOCKSIZE)), + [inbuf1] "m" (*(inbuf + 1 * BLOCKSIZE)), + [inbuf2] "m" (*(inbuf + 2 * BLOCKSIZE)) : "memory" ); - asm volatile ("movdqu %[inbuf2], %%xmm3\n\t" - "pxor %%xmm7, %%xmm5\n\t" - "pxor %%xmm5, %%xmm3\n\t" - "movdqa %%xmm5, %%xmm14\n\t" + asm volatile ("movdqu %[inbuf3], %%xmm4\n\t" + "movdqu %[inbuf4], %%xmm8\n\t" + "movdqu %[inbuf5], %%xmm9\n\t" : - : [inbuf2] "m" (*(inbuf + 2 * BLOCKSIZE)) + : [inbuf3] "m" (*(inbuf + 3 * BLOCKSIZE)), + [inbuf4] "m" (*(inbuf + 4 * BLOCKSIZE)), + [inbuf5] "m" (*(inbuf + 5 * BLOCKSIZE)) : "memory" ); - asm volatile ("movdqu %[l3], %%xmm0\n\t" - "movdqu %[inbuf3], %%xmm4\n\t" - "pxor %%xmm0, %%xmm5\n\t" + asm volatile ("movdqa %%xmm6, %%xmm12\n\t" + "pxor %%xmm5, %%xmm12\n\t" + "pxor %%xmm12, %%xmm1\n\t" + + "movdqa %%xmm10, %%xmm13\n\t" + "pxor %%xmm5, %%xmm13\n\t" + "pxor %%xmm13, %%xmm2\n\t" + + "movdqa %%xmm11, %%xmm14\n\t" + "pxor %%xmm5, %%xmm14\n\t" + "pxor %%xmm14, %%xmm3\n\t" + + "pxor %%xmm11, %%xmm5\n\t" + "pxor %%xmm15, %%xmm5\n\t" "pxor %%xmm5, %%xmm4\n\t" "movdqa %%xmm5, %%xmm15\n\t" - : - : [l3] "m" (*l), - [inbuf3] "m" (*(inbuf + 3 * BLOCKSIZE)) - : "memory" ); - - n += 4; - l = aes_ocb_get_l(c, n); - asm volatile ("movdqu %[inbuf4], %%xmm8\n\t" - "pxor %%xmm7, %%xmm5\n\t" - "pxor %%xmm5, %%xmm8\n\t" - "movdqu %%xmm5, %[outbuf4]\n\t" - : [outbuf4] "=m" (*(outbuf + 4 * BLOCKSIZE)) - : [inbuf4] "m" (*(inbuf + 4 * BLOCKSIZE)) - : "memory" ); - asm volatile ("movdqu %[inbuf5], %%xmm9\n\t" - "pxor %%xmm10, %%xmm5\n\t" - "pxor %%xmm5, %%xmm9\n\t" - "movdqu %%xmm5, %[outbuf5]\n\t" - : [outbuf5] "=m" (*(outbuf + 5 * BLOCKSIZE)) - : [inbuf5] "m" (*(inbuf + 5 * BLOCKSIZE)) + "movdqa %%xmm5, %%xmm0\n\t" + "pxor %%xmm6, %%xmm0\n\t" + "pxor %%xmm0, %%xmm8\n\t" + "movdqu %%xmm0, %[outbuf4]\n\t" + + "movdqa %%xmm10, %%xmm0\n\t" + "pxor %%xmm5, %%xmm0\n\t" + "pxor %%xmm0, %%xmm9\n\t" + "movdqu %%xmm0, %[outbuf5]\n\t" + : [outbuf4] "=m" (*(outbuf + 4 * BLOCKSIZE)), + [outbuf5] "=m" (*(outbuf + 5 * BLOCKSIZE)) + : : "memory" ); asm volatile ("movdqu %[inbuf6], %%xmm10\n\t" - "pxor %%xmm7, %%xmm5\n\t" - "pxor %%xmm5, %%xmm10\n\t" - "movdqu %%xmm5, %[outbuf6]\n\t" + "movdqa %%xmm11, %%xmm0\n\t" + "pxor %%xmm5, %%xmm0\n\t" + "pxor %%xmm0, %%xmm10\n\t" + "movdqu %%xmm0, %[outbuf6]\n\t" : [outbuf6] "=m" (*(outbuf + 6 * BLOCKSIZE)) : [inbuf6] "m" (*(inbuf + 6 * BLOCKSIZE)) : "memory" ); asm volatile ("movdqu %[l7], %%xmm0\n\t" - "movdqu %[inbuf7], %%xmm11\n\t" + "pxor %%xmm11, %%xmm5\n\t" "pxor %%xmm0, %%xmm5\n\t" + "movdqu %[inbuf7], %%xmm11\n\t" "pxor %%xmm5, %%xmm11\n\t" : : [l7] "m" (*l), @@ -2655,14 +2825,6 @@ aesni_ocb_dec (gcry_cipher_hd_t c, void *outbuf_arg, "movdqu %%xmm9, %[outbuf5]\n\t" "movdqu %%xmm10, %[outbuf6]\n\t" "movdqu %%xmm11, %[outbuf7]\n\t" - "pxor %%xmm2, %%xmm1\n\t" - "pxor %%xmm4, %%xmm1\n\t" - "pxor %%xmm9, %%xmm1\n\t" - "pxor %%xmm11, %%xmm1\n\t" - "pxor %%xmm3, %%xmm6\n\t" - "pxor %%xmm8, %%xmm6\n\t" - "pxor %%xmm10, %%xmm6\n\t" - "pxor %%xmm1, %%xmm6\n\t" : [outbuf0] "=m" (*(outbuf + 0 * BLOCKSIZE)), [outbuf1] "=m" (*(outbuf + 1 * BLOCKSIZE)), [outbuf2] "=m" (*(outbuf + 2 * BLOCKSIZE)), @@ -2678,7 +2840,7 @@ aesni_ocb_dec (gcry_cipher_hd_t c, void *outbuf_arg, inbuf += 8*BLOCKSIZE; } - aesni_cleanup_7_15(); + aesni_cleanup_8_15(); } #endif @@ -2688,40 +2850,46 @@ aesni_ocb_dec (gcry_cipher_hd_t c, void *outbuf_arg, l = aes_ocb_get_l(c, n); /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ - /* P_i = Offset_i xor DECIPHER(K, C_i xor Offset_i) */ - /* Checksum_i = Checksum_{i-1} xor P_i */ - asm volatile ("movdqu %[l0], %%xmm4\n\t" + /* C_i = Offset_i xor DECIPHER(K, P_i xor Offset_i) */ + asm volatile ("movdqu %[l0], %%xmm0\n\t" "movdqu %[inbuf0], %%xmm1\n\t" - "pxor %%xmm4, %%xmm5\n\t" - "pxor %%xmm5, %%xmm1\n\t" - "movdqu %%xmm5, %[outbuf0]\n\t" - : [outbuf0] "=m" (*(outbuf + 0 * BLOCKSIZE)) + "movdqu %[l0l1], %%xmm3\n\t" + : : [l0] "m" (*c->u_mode.ocb.L[0]), + [l0l1] "m" (*c->u_mode.ocb.L0L1), [inbuf0] "m" (*(inbuf + 0 * BLOCKSIZE)) : "memory" ); - asm volatile ("movdqu %[l1], %%xmm0\n\t" - "movdqu %[inbuf1], %%xmm2\n\t" - "pxor %%xmm0, %%xmm5\n\t" - "pxor %%xmm5, %%xmm2\n\t" - "movdqu %%xmm5, %[outbuf1]\n\t" - : [outbuf1] "=m" (*(outbuf + 1 * BLOCKSIZE)) - : [l1] "m" (*c->u_mode.ocb.L[1]), - [inbuf1] "m" (*(inbuf + 1 * BLOCKSIZE)) + asm volatile ("movdqu %[l0l1l0], %%xmm4\n\t" + "movdqu %[l3], %%xmm6\n\t" + "pxor %%xmm5, %%xmm0\n\t" + "pxor %%xmm0, %%xmm1\n\t" + "movdqu %%xmm0, %[outbuf0]\n\t" + : [outbuf0] "=m" (*(outbuf + 0 * BLOCKSIZE)) + : [l0l1l0] "m" (*c->u_mode.ocb.L0L1L0), + [l3] "m" (*l) : "memory" ); - asm volatile ("movdqu %[inbuf2], %%xmm3\n\t" - "pxor %%xmm4, %%xmm5\n\t" + asm volatile ("movdqu %[inbuf1], %%xmm2\n\t" "pxor %%xmm5, %%xmm3\n\t" - "movdqu %%xmm5, %[outbuf2]\n\t" + "pxor %%xmm3, %%xmm2\n\t" + "movdqu %%xmm3, %[outbuf1]\n\t" + : [outbuf1] "=m" (*(outbuf + 1 * BLOCKSIZE)) + : [inbuf1] "m" (*(inbuf + 1 * BLOCKSIZE)) + : "memory" ); + asm volatile ("movdqa %%xmm4, %%xmm0\n\t" + "movdqu %[inbuf2], %%xmm3\n\t" + "pxor %%xmm5, %%xmm0\n\t" + "pxor %%xmm0, %%xmm3\n\t" + "movdqu %%xmm0, %[outbuf2]\n\t" : [outbuf2] "=m" (*(outbuf + 2 * BLOCKSIZE)) - : [inbuf2] "m" (*(inbuf + 2 * BLOCKSIZE)) + : + [inbuf2] "m" (*(inbuf + 2 * BLOCKSIZE)) : "memory" ); - asm volatile ("movdqu %[l3], %%xmm0\n\t" + asm volatile ("pxor %%xmm6, %%xmm5\n\t" + "pxor %%xmm4, %%xmm5\n\t" "movdqu %[inbuf3], %%xmm4\n\t" - "pxor %%xmm0, %%xmm5\n\t" "pxor %%xmm5, %%xmm4\n\t" : - : [l3] "m" (*l), - [inbuf3] "m" (*(inbuf + 3 * BLOCKSIZE)) + : [inbuf3] "m" (*(inbuf + 3 * BLOCKSIZE)) : "memory" ); do_aesni_dec_vec4 (ctx); @@ -2737,10 +2905,6 @@ aesni_ocb_dec (gcry_cipher_hd_t c, void *outbuf_arg, "movdqu %%xmm3, %[outbuf2]\n\t" "pxor %%xmm5, %%xmm4\n\t" "movdqu %%xmm4, %[outbuf3]\n\t" - "pxor %%xmm1, %%xmm6\n\t" - "pxor %%xmm2, %%xmm6\n\t" - "pxor %%xmm3, %%xmm6\n\t" - "pxor %%xmm4, %%xmm6\n\t" : [outbuf0] "+m" (*(outbuf + 0 * BLOCKSIZE)), [outbuf1] "+m" (*(outbuf + 1 * BLOCKSIZE)), [outbuf2] "+m" (*(outbuf + 2 * BLOCKSIZE)), @@ -2771,7 +2935,6 @@ aesni_ocb_dec (gcry_cipher_hd_t c, void *outbuf_arg, do_aesni_dec (ctx); asm volatile ("pxor %%xmm5, %%xmm0\n\t" - "pxor %%xmm0, %%xmm6\n\t" "movdqu %%xmm0, %[outbuf]\n\t" : [outbuf] "=m" (*outbuf) : @@ -2783,14 +2946,16 @@ aesni_ocb_dec (gcry_cipher_hd_t c, void *outbuf_arg, c->u_mode.ocb.data_nblocks = n; asm volatile ("movdqu %%xmm5, %[iv]\n\t" - "movdqu %%xmm6, %[ctr]\n\t" - : [iv] "=m" (*c->u_iv.iv), - [ctr] "=m" (*c->u_ctr.ctr) + : [iv] "=m" (*c->u_iv.iv) : : "memory" ); + aesni_ocb_checksum (c, outbuf_arg, nblocks_arg); + aesni_cleanup (); - aesni_cleanup_2_6 (); + aesni_cleanup_2_7 (); + + return 0; } @@ -2799,11 +2964,9 @@ _gcry_aes_aesni_ocb_crypt(gcry_cipher_hd_t c, void *outbuf_arg, const void *inbuf_arg, size_t nblocks, int encrypt) { if (encrypt) - aesni_ocb_enc(c, outbuf_arg, inbuf_arg, nblocks); + return aesni_ocb_enc(c, outbuf_arg, inbuf_arg, nblocks); else - aesni_ocb_dec(c, outbuf_arg, inbuf_arg, nblocks); - - return 0; + return aesni_ocb_dec(c, outbuf_arg, inbuf_arg, nblocks); } @@ -2815,10 +2978,10 @@ _gcry_aes_aesni_ocb_auth (gcry_cipher_hd_t c, const void *abuf_arg, const unsigned char *abuf = abuf_arg; u64 n = c->u_mode.ocb.aad_nblocks; const unsigned char *l; - aesni_prepare_2_6_variable; + aesni_prepare_2_7_variable; aesni_prepare (); - aesni_prepare_2_6 (); + aesni_prepare_2_7 (); /* Preload Offset and Sum */ asm volatile ("movdqu %[iv], %%xmm5\n\t" @@ -2856,15 +3019,17 @@ _gcry_aes_aesni_ocb_auth (gcry_cipher_hd_t c, const void *abuf_arg, #ifdef __x86_64__ if (nblocks >= 8) { - aesni_prepare_7_15_variable; + aesni_prepare_8_15_variable; - aesni_prepare_7_15(); + aesni_prepare_8_15(); - asm volatile ("movdqu %[l0], %%xmm7\n\t" - "movdqu %[l1], %%xmm12\n\t" + asm volatile ("movdqu %[l0], %%xmm7\n\t" + "movdqu %[l0l1], %%xmm12\n\t" + "movdqu %[l0l1l0], %%xmm13\n\t" : : [l0] "m" (*c->u_mode.ocb.L[0]), - [l1] "m" (*c->u_mode.ocb.L[1]) + [l0l1] "m" (*c->u_mode.ocb.L0L1), + [l0l1l0] "m" (*c->u_mode.ocb.L0L1L0) : "memory" ); for ( ;nblocks >= 8 ; nblocks -= 8 ) @@ -2872,63 +3037,66 @@ _gcry_aes_aesni_ocb_auth (gcry_cipher_hd_t c, const void *abuf_arg, n += 4; l = aes_ocb_get_l(c, n); + asm volatile ("movdqu %[l3], %%xmm0\n\t" + "pxor %%xmm13, %%xmm0\n\t" + : + : [l3] "m" (*l) + : "memory" ); + + n += 4; + l = aes_ocb_get_l(c, n); + + asm volatile ("movdqu %[l7], %%xmm14\n\t" + "pxor %%xmm13, %%xmm14\n\t" + : + : [l7] "m" (*l) + : "memory" ); + /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ /* Sum_i = Sum_{i-1} xor ENCIPHER(K, A_i xor Offset_i) */ asm volatile ("movdqu %[abuf0], %%xmm1\n\t" - "pxor %%xmm7, %%xmm5\n\t" - "pxor %%xmm5, %%xmm1\n\t" + "movdqu %[abuf1], %%xmm2\n\t" + "movdqu %[abuf2], %%xmm3\n\t" + "movdqu %[abuf3], %%xmm4\n\t" + "movdqu %[abuf4], %%xmm8\n\t" + "movdqu %[abuf5], %%xmm9\n\t" + "movdqu %[abuf6], %%xmm10\n\t" + "movdqu %[abuf7], %%xmm11\n\t" : - : [abuf0] "m" (*(abuf + 0 * BLOCKSIZE)) + : [abuf0] "m" (*(abuf + 0 * BLOCKSIZE)), + [abuf1] "m" (*(abuf + 1 * BLOCKSIZE)), + [abuf2] "m" (*(abuf + 2 * BLOCKSIZE)), + [abuf3] "m" (*(abuf + 3 * BLOCKSIZE)), + [abuf4] "m" (*(abuf + 4 * BLOCKSIZE)), + [abuf5] "m" (*(abuf + 5 * BLOCKSIZE)), + [abuf6] "m" (*(abuf + 6 * BLOCKSIZE)), + [abuf7] "m" (*(abuf + 7 * BLOCKSIZE)) : "memory" ); - asm volatile ("movdqu %[abuf1], %%xmm2\n\t" - "pxor %%xmm12, %%xmm5\n\t" + asm volatile ("pxor %%xmm7, %%xmm1\n\t" + "pxor %%xmm5, %%xmm1\n\t" + + "pxor %%xmm12, %%xmm2\n\t" "pxor %%xmm5, %%xmm2\n\t" - : - : [abuf1] "m" (*(abuf + 1 * BLOCKSIZE)) - : "memory" ); - asm volatile ("movdqu %[abuf2], %%xmm3\n\t" - "pxor %%xmm7, %%xmm5\n\t" + + "pxor %%xmm13, %%xmm3\n\t" "pxor %%xmm5, %%xmm3\n\t" - : - : [abuf2] "m" (*(abuf + 2 * BLOCKSIZE)) - : "memory" ); - asm volatile ("movdqu %[l3], %%xmm0\n\t" - "movdqu %[abuf3], %%xmm4\n\t" + "pxor %%xmm0, %%xmm5\n\t" "pxor %%xmm5, %%xmm4\n\t" - : - : [l3] "m" (*l), - [abuf3] "m" (*(abuf + 3 * BLOCKSIZE)) - : "memory" ); - n += 4; - l = aes_ocb_get_l(c, n); - - asm volatile ("movdqu %[abuf4], %%xmm8\n\t" - "pxor %%xmm7, %%xmm5\n\t" + "pxor %%xmm7, %%xmm8\n\t" "pxor %%xmm5, %%xmm8\n\t" - : - : [abuf4] "m" (*(abuf + 4 * BLOCKSIZE)) - : "memory" ); - asm volatile ("movdqu %[abuf5], %%xmm9\n\t" - "pxor %%xmm12, %%xmm5\n\t" + + "pxor %%xmm12, %%xmm9\n\t" "pxor %%xmm5, %%xmm9\n\t" - : - : [abuf5] "m" (*(abuf + 5 * BLOCKSIZE)) - : "memory" ); - asm volatile ("movdqu %[abuf6], %%xmm10\n\t" - "pxor %%xmm7, %%xmm5\n\t" + + "pxor %%xmm13, %%xmm10\n\t" "pxor %%xmm5, %%xmm10\n\t" - : - : [abuf6] "m" (*(abuf + 6 * BLOCKSIZE)) - : "memory" ); - asm volatile ("movdqu %[l7], %%xmm0\n\t" - "movdqu %[abuf7], %%xmm11\n\t" - "pxor %%xmm0, %%xmm5\n\t" + + "pxor %%xmm14, %%xmm5\n\t" "pxor %%xmm5, %%xmm11\n\t" : - : [l7] "m" (*l), - [abuf7] "m" (*(abuf + 7 * BLOCKSIZE)) + : : "memory" ); do_aesni_enc_vec8 (ctx); @@ -2948,7 +3116,7 @@ _gcry_aes_aesni_ocb_auth (gcry_cipher_hd_t c, const void *abuf_arg, abuf += 8*BLOCKSIZE; } - aesni_cleanup_7_15(); + aesni_cleanup_8_15(); } #endif @@ -2959,36 +3127,41 @@ _gcry_aes_aesni_ocb_auth (gcry_cipher_hd_t c, const void *abuf_arg, /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */ /* Sum_i = Sum_{i-1} xor ENCIPHER(K, A_i xor Offset_i) */ - asm volatile ("movdqu %[l0], %%xmm4\n\t" + asm volatile ("movdqu %[l0], %%xmm0\n\t" "movdqu %[abuf0], %%xmm1\n\t" - "pxor %%xmm4, %%xmm5\n\t" - "pxor %%xmm5, %%xmm1\n\t" + "movdqu %[l0l1], %%xmm3\n\t" : : [l0] "m" (*c->u_mode.ocb.L[0]), + [l0l1] "m" (*c->u_mode.ocb.L0L1), [abuf0] "m" (*(abuf + 0 * BLOCKSIZE)) : "memory" ); - asm volatile ("movdqu %[l1], %%xmm0\n\t" - "movdqu %[abuf1], %%xmm2\n\t" - "pxor %%xmm0, %%xmm5\n\t" - "pxor %%xmm5, %%xmm2\n\t" + asm volatile ("movdqu %[l0l1l0], %%xmm4\n\t" + "movdqu %[l3], %%xmm7\n\t" + "pxor %%xmm5, %%xmm0\n\t" + "pxor %%xmm0, %%xmm1\n\t" : - : [l1] "m" (*c->u_mode.ocb.L[1]), - [abuf1] "m" (*(abuf + 1 * BLOCKSIZE)) + : [l0l1l0] "m" (*c->u_mode.ocb.L0L1L0), + [l3] "m" (*l) : "memory" ); - asm volatile ("movdqu %[abuf2], %%xmm3\n\t" - "pxor %%xmm4, %%xmm5\n\t" + asm volatile ("movdqu %[abuf1], %%xmm2\n\t" "pxor %%xmm5, %%xmm3\n\t" + "pxor %%xmm3, %%xmm2\n\t" : - : [l2] "m" (*c->u_mode.ocb.L[0]), - [abuf2] "m" (*(abuf + 2 * BLOCKSIZE)) + : [abuf1] "m" (*(abuf + 1 * BLOCKSIZE)) : "memory" ); - asm volatile ("movdqu %[l3], %%xmm0\n\t" + asm volatile ("movdqa %%xmm4, %%xmm0\n\t" + "movdqu %[abuf2], %%xmm3\n\t" + "pxor %%xmm5, %%xmm0\n\t" + "pxor %%xmm0, %%xmm3\n\t" + : + : [abuf2] "m" (*(abuf + 2 * BLOCKSIZE)) + : "memory" ); + asm volatile ("pxor %%xmm7, %%xmm5\n\t" + "pxor %%xmm4, %%xmm5\n\t" "movdqu %[abuf3], %%xmm4\n\t" - "pxor %%xmm0, %%xmm5\n\t" "pxor %%xmm5, %%xmm4\n\t" : - : [l3] "m" (*l), - [abuf3] "m" (*(abuf + 3 * BLOCKSIZE)) + : [abuf3] "m" (*(abuf + 3 * BLOCKSIZE)) : "memory" ); do_aesni_enc_vec4 (ctx); @@ -3038,7 +3211,7 @@ _gcry_aes_aesni_ocb_auth (gcry_cipher_hd_t c, const void *abuf_arg, : "memory" ); aesni_cleanup (); - aesni_cleanup_2_6 (); + aesni_cleanup_2_7 (); return 0; } @@ -3053,10 +3226,10 @@ _gcry_aes_aesni_xts_enc (RIJNDAEL_context *ctx, unsigned char *tweak, unsigned char *outbuf, const unsigned char *inbuf, size_t nblocks) { - aesni_prepare_2_6_variable; + aesni_prepare_2_7_variable; aesni_prepare (); - aesni_prepare_2_6 (); + aesni_prepare_2_7 (); /* Preload Tweak */ asm volatile ("movdqu %[tweak], %%xmm5\n\t" @@ -3182,7 +3355,7 @@ _gcry_aes_aesni_xts_enc (RIJNDAEL_context *ctx, unsigned char *tweak, : "memory" ); aesni_cleanup (); - aesni_cleanup_2_6 (); + aesni_cleanup_2_7 (); } @@ -3191,10 +3364,10 @@ _gcry_aes_aesni_xts_dec (RIJNDAEL_context *ctx, unsigned char *tweak, unsigned char *outbuf, const unsigned char *inbuf, size_t nblocks) { - aesni_prepare_2_6_variable; + aesni_prepare_2_7_variable; aesni_prepare (); - aesni_prepare_2_6 (); + aesni_prepare_2_7 (); if ( !ctx->decryption_prepared ) { @@ -3326,7 +3499,7 @@ _gcry_aes_aesni_xts_dec (RIJNDAEL_context *ctx, unsigned char *tweak, : "memory" ); aesni_cleanup (); - aesni_cleanup_2_6 (); + aesni_cleanup_2_7 (); } diff --git a/cipher/rijndael-internal.h b/cipher/rijndael-internal.h index 160fb8c..876d55f 100644 --- a/cipher/rijndael-internal.h +++ b/cipher/rijndael-internal.h @@ -143,6 +143,8 @@ typedef struct RIJNDAEL_context_s #endif /*USE_PADLOCK*/ #ifdef USE_AESNI unsigned int use_aesni:1; /* AES-NI shall be used. */ + unsigned int use_avx:1; /* AVX shall be used. */ + unsigned int use_avx2:1; /* AVX2 shall be used. */ #endif /*USE_AESNI*/ #ifdef USE_SSSE3 unsigned int use_ssse3:1; /* SSSE3 shall be used. */ diff --git a/cipher/rijndael.c b/cipher/rijndael.c index 1bc8b0f..8094537 100644 --- a/cipher/rijndael.c +++ b/cipher/rijndael.c @@ -334,6 +334,8 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen, ctx->prefetch_enc_fn = NULL; ctx->prefetch_dec_fn = NULL; ctx->use_aesni = 1; + ctx->use_avx = !!(hwfeatures & HWF_INTEL_AVX); + ctx->use_avx2 = !!(hwfeatures & HWF_INTEL_AVX2); if (hd) { hd->bulk.cfb_enc = _gcry_aes_aesni_cfb_enc; diff --git a/tests/basic.c b/tests/basic.c index f3d8951..0afae30 100644 --- a/tests/basic.c +++ b/tests/basic.c @@ -4411,11 +4411,114 @@ do_check_ocb_cipher (int inplace) "1792A4E31E0755FB03E31B22116E6C2DDF9EFD6E33D536F1" "A0124B0A55BAE884ED93481529C76B6AD0C515F4D1CDD4FD" "AC4F02AA" + }, + { GCRY_CIPHER_AES, 12, "0F0E0D0C0B0A09080706050403020100", + "BBAA9988776655443322110D", + "000102030405060708090A0B0C0D0E0F1011121314151617" + "18191A1B1C1D1E1F2021222324252627", + /* test vector for checksumming */ + "01000000000000000000000000000000" + "02000000000000000000000000000000" + "04000000000000000000000000000000" + "08000000000000000000000000000000" + "10000000000000000000000000000000" + "20000000000000000000000000000000" + "40000000000000000000000000000000" + "80000000000000000000000000000000" + "00010000000000000000000000000000" + "00020000000000000000000000000000" + "00040000000000000000000000000000" + "00080000000000000000000000000000" + "00100000000000000000000000000000" + "00200000000000000000000000000000" + "00400000000000000000000000000000" + "00800000000000000000000000000000" + "00000100000000000000000000000000" + "00000200000000000000000000000000" + "00000400000000000000000000000000" + "00000800000000000000000000000000" + "00001000000000000000000000000000" + "00002000000000000000000000000000" + "00004000000000000000000000000000" + "00008000000000000000000000000000" + "00000001000000000000000000000000" + "00000002000000000000000000000000" + "00000004000000000000000000000000" + "00000008000000000000000000000000" + "00000010000000000000000000000000" + "00000020000000000000000000000000" + "00000040000000000000000000000000" + "00000080000000000000000000000000" + "00000000010000000000000000000000" + "00000000020000000000000000000000" + "00000000040000000000000000000000" + "00000000080000000000000000000000" + "00000000100000000000000000000000" + "00000000200000000000000000000000" + "00000000400000000000000000000000" + "00000000800000000000000000000000" + "00000000000100000000000000000000" + "00000000000200000000000000000000" + "00000000000400000000000000000000" + "00000000000800000000000000000000" + "00000000001000000000000000000000" + "00000000002000000000000000000000" + "00000000004000000000000000000000" + "00000000008000000000000000000000", + "01105c6e36f6ac480f022c51e31ed702" + "90fda4b7b783194d4b4be8e4e1e2dff4" + "6a0804d1c5f9f808ea7933e31c063233" + "2bf65a22b20bb13cde3b80b3682ba965" + "b1207c58916f7856fa9968b410e50dee" + "98b35c071163d1b352b9bbccd09fde29" + "b850f40e71a8ae7d2e2d577f5ee39c46" + "7fa28130b50a123c29958e4665dda9a5" + "e0793997f8f19633a96392141d6e0e88" + "77850ed4364065d1d2f8746e2f1d5fd1" + "996cdde03215306503a30e41f58ef3c4" + "400365cfea4fa6381157c12a46598edf" + "18604854462ec66e3d3cf26d4723cb6a" + "9d801095048086a606fdb9192760889b" + "a8ce2e70e1b55a469137a9e2e6734565" + "283cb1e2c74f37e0854d03e33f8ba499" + "ef5d9af4edfce077c6280338f0a64286" + "2e6bc27ebd5a4c91b3778e22631251c8" + "c5bb75a10945597a9d6c274fc82d3338" + "b403a0a549d1375f26e71ef22bce0941" + "93ea87e2ed72fce0546148c351eec3be" + "867bb1b96070c377fff3c98e21562beb" + "475cfe28abcaaedf49981f6599b15140" + "ea6130d24407079f18ba9d4a8960b082" + "b39c57320e2e064f02fde88c23112146" + "1cac3655868aef584714826ee4f361fb" + "e6d692e1589cbb9dd3c74fa628df2a1f" + "3b0029b1d62b7e9978013ed3c793c1dd" + "1f184c8f7022a853cac40b74ac749aa3" + "f33f0d14732dfda0f2c3c20591bf1f5a" + "710ec0d0bca342baa5146068a78ff58c" + "66316312b7a98af35a0f4e92799b4047" + "f047ae61f25c28d232ce5c168cc745d6" + "6da13cb0f9e38a696635dba7a21571cf" + "cd64ec8cc33db7879f59a90d9edd00f6" + "a899e39ab36b9269a3ac04ebad9326bf" + "53cd9b400168a61714cd628a4056d236" + "bd8622c76daa54cb65f5db2fe03bafbe" + "0b23549ae31136f607293e8093a21934" + "74fd5e9c2451b4c8e0499e6ad34fafc8" + "ab77722a282f7f84b14ddebf7e696300" + "c1ef92d4a0263c6cca104530f996e272" + "f58992ff68d642b071a5848dc4acf2ae" + "28fb1f27ae0f297d5136a7a0a4a03e89" + "b588755b8217a1c62773790e69261269" + "19f45daf7b3ccf18e3fc590a9a0e172f" + "033ac4d13c3decc4c62d7de718ace802" + "140452dc850989f6762e3578bbb04be3" + "1a237c599c4649f4e586b2de" } }; gpg_error_t err = 0; gcry_cipher_hd_t hde, hdd; - unsigned char out[MAX_DATA_LEN]; + unsigned char out[1024]; unsigned char tag[16]; int tidx; @@ -4548,7 +4651,7 @@ do_check_ocb_cipher (int inplace) } else { - err = gcry_cipher_encrypt (hde, out, MAX_DATA_LEN, + err = gcry_cipher_encrypt (hde, out, sizeof(out), plain, plainlen); } } @@ -4605,7 +4708,7 @@ do_check_ocb_cipher (int inplace) } else { - unsigned char tmp[MAX_DATA_LEN]; + unsigned char tmp[sizeof(out)]; memcpy(tmp, out, plainlen); err = gcry_cipher_decrypt (hdd, out, plainlen, tmp, plainlen); @@ -4696,7 +4799,7 @@ check_ocb_cipher_largebuf_split (int algo, int keylen, const char *tagexpect, } for (i = 0; i < buflen; i++) - inbuf[i] = 'a'; + inbuf[i] = (i + 181081) * 5039; err = gcry_cipher_open (&hde, algo, GCRY_CIPHER_MODE_OCB, 0); if (!err) @@ -4855,6 +4958,131 @@ out_free: static void +check_ocb_cipher_checksum (int algo, int keylen) +{ + static const unsigned char key[32] = + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"; + static const unsigned char nonce[12] = + "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x00\x01\x02\x03"; + const size_t buflen = 128 * 16; + unsigned char *inbuf, *outbuf; + gpg_error_t err = 0; + gcry_cipher_hd_t hde, hde2; + unsigned char tag[16]; + unsigned char tag2[16]; + int i; + + inbuf = xmalloc(buflen); + if (!inbuf) + { + fail ("out-of-memory\n"); + return; + } + outbuf = xmalloc(buflen); + if (!inbuf) + { + fail ("out-of-memory\n"); + xfree(inbuf); + return; + } + + memset(inbuf, 0, buflen); + for (i = 0; i < 128; i += 16) + { + unsigned char *blk = inbuf + i; + int bit2set = i / 16; + int byteidx = bit2set / 8; + int bitpos = bit2set % 8; + + blk[byteidx] |= 1 << bitpos; + } + + err = gcry_cipher_open (&hde, algo, GCRY_CIPHER_MODE_OCB, 0); + if (!err) + err = gcry_cipher_open (&hde2, algo, GCRY_CIPHER_MODE_OCB, 0); + if (err) + { + fail ("cipher-ocb, gcry_cipher_open failed (checksum, algo %d): %s\n", + algo, gpg_strerror (err)); + goto out_free; + } + + err = gcry_cipher_setkey (hde, key, keylen); + if (!err) + err = gcry_cipher_setkey (hde2, key, keylen); + if (err) + { + fail ("cipher-ocb, gcry_cipher_setkey failed (checksum, algo %d): %s\n", + algo, gpg_strerror (err)); + gcry_cipher_close (hde); + gcry_cipher_close (hde2); + goto out_free; + } + + err = gcry_cipher_setiv (hde, nonce, 12); + if (!err) + err = gcry_cipher_setiv (hde2, nonce, 12); + if (err) + { + fail ("cipher-ocb, gcry_cipher_setiv failed (checksum, algo %d): %s\n", + algo, gpg_strerror (err)); + gcry_cipher_close (hde); + gcry_cipher_close (hde2); + goto out_free; + } + + err = gcry_cipher_final (hde); + if (!err) + { + err = gcry_cipher_encrypt (hde, outbuf, buflen, inbuf, buflen); + } + for (i = 0; i < buflen && !err; i += 16) + { + if (i + 16 == buflen) + err = gcry_cipher_final (hde2); + if (!err) + err = gcry_cipher_encrypt (hde2, outbuf + i, 16, inbuf + i, 16); + } + + if (err) + { + fail ("cipher-ocb, gcry_cipher_encrypt failed (checksum, algo %d): %s\n", + algo, gpg_strerror (err)); + gcry_cipher_close (hde); + gcry_cipher_close (hde2); + goto out_free; + } + + /* Check that the tag matches. */ + err = gcry_cipher_gettag (hde, tag, 16); + if (err) + { + fail ("cipher_ocb, gcry_cipher_gettag failed (checksum, algo %d): %s\n", + algo, gpg_strerror (err)); + } + err = gcry_cipher_gettag (hde2, tag2, 16); + if (err) + { + fail ("cipher_ocb, gcry_cipher_gettag failed (checksum2, algo %d): %s\n", + algo, gpg_strerror (err)); + } + if (memcmp (tag, tag2, 16)) + { + mismatch (tag, 16, tag2, 16); + fail ("cipher-ocb, encrypt tag mismatch (checksum, algo %d)\n", algo); + } + + gcry_cipher_close (hde); + gcry_cipher_close (hde2); + +out_free: + xfree(inbuf); + xfree(outbuf); +} + + +static void check_ocb_cipher_largebuf (int algo, int keylen, const char *tagexpect) { unsigned int split; @@ -4863,6 +5091,8 @@ check_ocb_cipher_largebuf (int algo, int keylen, const char *tagexpect) { check_ocb_cipher_largebuf_split(algo, keylen, tagexpect, split); } + + check_ocb_cipher_checksum(algo, keylen); } @@ -5108,35 +5338,25 @@ check_ocb_cipher (void) /* Check large buffer encryption/decryption. */ check_ocb_cipher_largebuf(GCRY_CIPHER_AES, 16, - "\xf5\xf3\x12\x7d\x58\x2d\x96\xe8" - "\x33\xfd\x7a\x4f\x42\x60\x5d\x20"); + "\xc1\x5b\xf1\x80\xa4\xd5\xea\xfd\xae\x17\xa6\xcd\x6b\x10\xa8\xea"); check_ocb_cipher_largebuf(GCRY_CIPHER_AES256, 32, - "\xfa\x26\xa5\xbf\xf6\x7d\x3a\x8d" - "\xfe\x96\x67\xc9\xc8\x41\x03\x51"); + "\x2b\xb7\x25\x6b\x77\xc7\xfb\x21\x5c\xc9\x6c\x36\x17\x1a\x1a\xd5"); check_ocb_cipher_largebuf(GCRY_CIPHER_CAMELLIA128, 16, - "\x28\x23\x38\x45\x2b\xfd\x42\x45" - "\x43\x64\x7e\x67\x7f\xf4\x8b\xcd"); + "\xe0\xae\x3f\x29\x3a\xee\xd8\xe3\xf2\x20\xc1\xa2\xd8\x72\x12\xd9"); check_ocb_cipher_largebuf(GCRY_CIPHER_CAMELLIA192, 24, - "\xee\xca\xe5\x39\x27\x2d\x33\xe7" - "\x79\x74\xb0\x1d\x37\x12\xd5\x6c"); + "\xd7\x98\x71\xcf\x19\x5c\xa3\x3d\x6c\xfc\xc9\xbe\x9f\x13\x6b\xbd"); check_ocb_cipher_largebuf(GCRY_CIPHER_CAMELLIA256, 32, - "\x39\x39\xd0\x2d\x05\x68\x74\xee" - "\x18\x6b\xea\x3d\x0b\xd3\x58\xae"); + "\x03\xf6\xec\x1a\x0e\xae\x66\x24\x2b\xba\x26\x0f\xb3\xb3\x1f\xb9"); check_ocb_cipher_largebuf(GCRY_CIPHER_TWOFISH, 16, - "\x63\xe3\x0e\xb9\x11\x6f\x14\xba" - "\x79\xe4\xa7\x9e\xad\x3c\x02\x0c"); + "\x1c\xf9\xc7\xfc\x3a\x32\xac\xc7\x5e\x0a\xc2\x5c\x90\xd6\xf6\xf9"); check_ocb_cipher_largebuf(GCRY_CIPHER_TWOFISH, 32, - "\xf6\xd4\xfe\x4e\x50\x85\x13\x59" - "\x69\x0e\x4c\x67\x3e\xdd\x47\x90"); + "\x53\x02\xc8\x0d\x4e\x9a\x44\x9e\x43\xd4\xaa\x06\x30\x93\xcc\x16"); check_ocb_cipher_largebuf(GCRY_CIPHER_SERPENT128, 16, - "\x3c\xfb\x66\x14\x3c\xc8\x6c\x67" - "\x26\xb8\x23\xeb\xaf\x43\x98\x69"); + "\xd3\x64\xac\x40\x48\x88\x77\xe2\x41\x26\x4c\xde\x21\x29\x21\x8d"); check_ocb_cipher_largebuf(GCRY_CIPHER_SERPENT192, 24, - "\x5e\x62\x27\xc5\x32\xc3\x1d\xe6" - "\x2e\x65\xe7\xd6\xfb\x05\xd7\xb2"); + "\x99\xeb\x35\xb0\x62\x4e\x7b\xf1\x5e\x9f\xed\x32\x78\x90\x0b\xd0"); check_ocb_cipher_largebuf(GCRY_CIPHER_SERPENT256, 32, - "\xe7\x8b\xe6\xd4\x2f\x7a\x36\x4c" - "\xba\xee\x20\xe2\x68\xf4\xcb\xcc"); + "\x71\x66\x2f\x68\xbf\xdd\xcc\xb1\xbf\x81\x56\x5f\x01\x73\xeb\x44"); /* Check that the AAD data is correctly buffered. */ check_ocb_cipher_splitaad (); ----------------------------------------------------------------------- Summary of changes: cipher/cipher-gcm-intel-pclmul.c | 7 + cipher/cipher-internal.h | 4 +- cipher/cipher-ocb.c | 11 + cipher/crc-intel-pclmul.c | 7 + cipher/rijndael-aesni.c | 878 +++++++++++++++++++++++---------------- cipher/rijndael-internal.h | 2 + cipher/rijndael-ssse3-amd64.c | 7 + cipher/rijndael.c | 2 + cipher/sha1-intel-shaext.c | 7 + cipher/sha256-intel-shaext.c | 7 + tests/basic.c | 268 ++++++++++-- 11 files changed, 826 insertions(+), 374 deletions(-) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 21 09:21:29 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 21 Nov 2018 09:21:29 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-281-ge5c3a69 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via e5c3a6999a374813134a9e68744444c25c3017f6 (commit) from 1e700961ddf4c54ec5a03a697fe00d7eb606fdff (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e5c3a6999a374813134a9e68744444c25c3017f6 Author: Werner Koch Date: Wed Nov 21 09:20:56 2018 +0100 doc: Clarify use of clear and nodefault in the AKL. -- diff --git a/doc/gpg.texi b/doc/gpg.texi index dedb8cc..58672c9 100644 --- a/doc/gpg.texi +++ b/doc/gpg.texi @@ -1783,7 +1783,9 @@ list. The default is "local,wkd". @item clear Clear all defined mechanisms. This is useful to override - mechanisms given in a config file. + mechanisms given in a config file. Note that a @code{nodefault} in + @var{mechanisms} will also be cleared unless it is given after the + @code{clear}. @end table diff --git a/g10/gpg.c b/g10/gpg.c index 1102892..9f96ef4 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -3554,7 +3554,7 @@ main (int argc, char **argv) case oAutoKeyLocate: if (default_akl) { - /* This is the first time --aito-key-locate is seen. + /* This is the first time --auto-key-locate is seen. * We need to reset the default akl. */ default_akl = 0; release_akl(); ----------------------------------------------------------------------- Summary of changes: doc/gpg.texi | 4 +++- g10/gpg.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 21 09:22:15 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 21 Nov 2018 09:22:15 +0100 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.11-4-g6acca0e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 6acca0e4d9f9e432a795ac261dd8fa02bcc583cd (commit) from 2768293b1ee6f174f216f9006b5bc3e0c10265a2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6acca0e4d9f9e432a795ac261dd8fa02bcc583cd Author: Werner Koch Date: Wed Nov 21 09:20:56 2018 +0100 doc: Clarify use of clear and nodefault in the AKL. -- (cherry picked from commit e5c3a6999a374813134a9e68744444c25c3017f6) diff --git a/doc/gpg.texi b/doc/gpg.texi index ffcdaf2..8f1b8ce 100644 --- a/doc/gpg.texi +++ b/doc/gpg.texi @@ -1783,7 +1783,9 @@ list. The default is "local,wkd". @item clear Clear all defined mechanisms. This is useful to override - mechanisms given in a config file. + mechanisms given in a config file. Note that a @code{nodefault} in + @var{mechanisms} will also be cleared unless it is given after the + @code{clear}. @end table diff --git a/g10/gpg.c b/g10/gpg.c index e18eefe..b316e85 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -3487,7 +3487,7 @@ main (int argc, char **argv) case oAutoKeyLocate: if (default_akl) { - /* This is the first time --aito-key-locate is seen. + /* This is the first time --auto-key-locate is seen. * We need to reset the default akl. */ default_akl = 0; release_akl(); ----------------------------------------------------------------------- Summary of changes: doc/gpg.texi | 4 +++- g10/gpg.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 22 08:03:55 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Thu, 22 Nov 2018 08:03:55 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-79-gde6bb23 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via de6bb23279796b9ae4dc369d58591cb75f818684 (commit) from b182838f71d8349d6cd7be9ecfb859b893d09127 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit de6bb23279796b9ae4dc369d58591cb75f818684 Author: Ben McGinnes Date: Thu Nov 22 18:00:22 2018 +1100 python: version as integers * lang/python/version.py.in: added gpg.version.versionintlist * If gpg.version.versionintlist[2] ever returns -1 then there's a serious problem with the build and it should be lodged as a bug if it's repeatable. Seeing this should never happen, but checking for it is better than not doing so. diff --git a/lang/python/version.py.in b/lang/python/version.py.in index ad76eda..0388cda 100644 --- a/lang/python/version.py.in +++ b/lang/python/version.py.in @@ -28,12 +28,32 @@ productname = 'gpg' versionstr = "@VERSION@" gpgme_versionstr = gpgme.GPGME_VERSION in_tree_build = bool(gpgme.cvar.gpg_in_tree_build) +is_beta = False versionlist = versionstr.split(".") major = versionlist[0] minor = versionlist[1] patch = versionlist[2] +versionintlist = [] +versionintlist.append(int(major)) +versionintlist.append(int(minor)) + +try: + int(patch) +except ValueError as e: + is_beta = True + +if is_beta is False: + versionintlist.append(int(patch)) +else: + try: + beta_patch = patch.split("-") + versionintlist.append(int(beta_patch[0])) + except Exception as e: + # This should never happen, if it does then lodge a bug report. + versionintlist.append(-1) + copyright = """\ Copyright (C) 2016-2018 g10 Code GmbH Copyright (C) 2015 Benjamin D. McGinnes ----------------------------------------------------------------------- Summary of changes: lang/python/version.py.in | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 22 10:03:07 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Thu, 22 Nov 2018 10:03:07 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-80-gc87155e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via c87155e6eba2e97e4e6c6ee7e2591088a5489556 (commit) from de6bb23279796b9ae4dc369d58591cb75f818684 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c87155e6eba2e97e4e6c6ee7e2591088a5489556 Author: Ben McGinnes Date: Thu Nov 22 20:00:12 2018 +1100 python: docs update * Added documentation for the new methods added to gpgme.version. * Removed the Flask based advanced use case from the what-is-new section as that type of code will not be added here. diff --git a/lang/python/doc/rst/gpgme-python-howto.rst b/lang/python/doc/rst/gpgme-python-howto.rst index 4cbb929..6a22ce2 100644 --- a/lang/python/doc/rst/gpgme-python-howto.rst +++ b/lang/python/doc/rst/gpgme-python-howto.rst @@ -6,7 +6,7 @@ Introduction +-----------------------------------+-----------------------------------+ | Version: | 0.1.4 | +-----------------------------------+-----------------------------------+ -| GPGME Version: | 1.12.0 | +| GPGME Version: | 1.12.1 | +-----------------------------------+-----------------------------------+ | Author: | `Ben | | | McGinnes = 3: + gpgme_version = gpgme_version_str[0].decode().strip() + else: + gpgme_version = None + + if gpgme_version is not None: + if gpgme_version == gpg.version.versionstr: + print("The GPGME Python bindings match libgpgme.") + else: + print("The GPGME Python bindings do NOT match libgpgme.") + else: + print("Upgrade Python and reinstall the GPGME Python bindings.") + +For many developers, however, the preferred checking means checking for +a minimum version or point release. This is now readily available via +the ``gpg.version.versionintlist`` method (added in version +``1.12.1-beta79``). It is also now possible to easily check whether the +installed GPGME Python bindings were built from a development or beta +branch of the GPGME source code. + +The following code demonstrates how both of those methods may be used: + +.. code:: python + + import gpg + + try: + if gpg.version.is_beta is True: + print("The installed GPGME Python bindings were built from beta code.") + else: + print("The installed GPGME Python bindings are a released version.") + except Exception as e: + print(e) + + try: + if gpg.version.versionintlist[0] == 1: + if gpg.version.versionintlist[1] == 12: + if gpg.version.versionintlist[2] == 1: + print("This is the minimum version for using versionintlist.") + elif gpg.version.versionintlist[2] > 1: + print("The versionintlist method is available.") + else: + pass + elif gpg.version.versionintlist[1] > 12: + print("The versionintlist method is available.") + else: + pass + elif gpg.version.versionintlist[0] > 1: + print("The versionintlist method is available.") + else: + pass + except Exception as e: + print(e) + +The points where ``pass`` is used in the above example will most likely +also produce an ``Exception`` error since those results should only +occur in versions which do not have the ``gpgme.version.is_beta`` and +``gpgme.version.versionintlist`` methods available. + .. _copyright-and-license: Copyright and Licensing @@ -2859,10 +2948,6 @@ the author at any of the following URLs: SSL) `__ - `GPGME Python Bindings HOWTO draft (reST file AWS S3 no SSL) `__ -- `GPGME Python Bindings HOWTO draft (Docbook 4.2 AWS S3 - SSL) `__ -- `GPGME Python Bindings HOWTO draft (Docbook 4.2 AWS S3 no - SSL) `__ All of these draft versions except for one have been generated from this document via Emacs `Org mode `__ and `GNU @@ -2878,8 +2963,8 @@ either of the following two commands: .. code:: shell - pandoc -f org -t rst -o gpgme-python-howto.rst gpgme-python-howto.org - pandoc -f org -t rst -o gpgme-python-howto.rst gpgme-python-howto + pandoc -f org -t rst+smart -o gpgme-python-howto.rst gpgme-python-howto.org + pandoc -f org -t rst+smart -o gpgme-python-howto.rst gpgme-python-howto In addition to these there is a significantly less frequently updated version as a HTML `WebHelp diff --git a/lang/python/doc/rst/what-is-new.rst b/lang/python/doc/rst/what-is-new.rst index 9332fb6..0fca98f 100644 --- a/lang/python/doc/rst/what-is-new.rst +++ b/lang/python/doc/rst/what-is-new.rst @@ -33,10 +33,11 @@ New in GPGME 1?13?0 Additions since GPGME 1.12.0 include: -- An advanced HOWTO on using the bindings with web interfaces, - specifically Flask. - Moving the *What\'s New* section out of the basic `HOWTO `__ document and into its own file so as to more readily include other documents beyond that HOWTO. - Moving the preceding, archival, segments into `another file `__. +- Added ``gpg.version.versionintlist`` to make it easier for Python + developers to check for a specific version number, even with beta + versions (it will drop the \"-betaN\" part). diff --git a/lang/python/doc/src/gpgme-python-howto b/lang/python/doc/src/gpgme-python-howto index 7cc9770..11fb1e2 100644 --- a/lang/python/doc/src/gpgme-python-howto +++ b/lang/python/doc/src/gpgme-python-howto @@ -2893,6 +2893,96 @@ available in the =lang/python/examples/howto= directory as normal; the executable version is the =import-keys-hkp.py= file. +** GPGME version checking + :PROPERTIES: + :CUSTOM_ID: gpgme-version-check + :END: + +For various reasons it may be necessary to check which version of +GPGME the bindings have been built against; including whether a +minimum required version of GPGME is in use. + +For the most part the =gpg.version.versionstr= and +=gpg.version.versionlist= methods have been quite sufficient. The +former returns the same string as =gpgme-config --version=, while the +latter returns the major, minor and patch values in a list. + +To check if the installed bindings have actually been built against +the current installed libgpgme version, this check can be performed: + +#+BEGIN_SRC python -i +import gpg +import subprocess +import sys + +gpgme_version_call = subprocess.Popen(["gpgme-config", "--version"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) +gpgme_version_str = gpgme_version_call.communicate() + +if sys.version_info[0] == 2: + gpgme_version = gpgme_version_str[0].strip() +elif sys.version_info[0] >= 3: + gpgme_version = gpgme_version_str[0].decode().strip() +else: + gpgme_version = None + +if gpgme_version is not None: + if gpgme_version == gpg.version.versionstr: + print("The GPGME Python bindings match libgpgme.") + else: + print("The GPGME Python bindings do NOT match libgpgme.") +else: + print("Upgrade Python and reinstall the GPGME Python bindings.") +#+END_SRC + +For many developers, however, the preferred checking means checking +for a minimum version or point release. This is now readily available +via the =gpg.version.versionintlist= method (added in version +=1.12.1-beta79=). It is also now possible to easily check whether the +installed GPGME Python bindings were built from a development or beta +branch of the GPGME source code. + +The following code demonstrates how both of those methods may be used: + +#+BEGIN_SRC python -i +import gpg + +try: + if gpg.version.is_beta is True: + print("The installed GPGME Python bindings were built from beta code.") + else: + print("The installed GPGME Python bindings are a released version.") +except Exception as e: + print(e) + +try: + if gpg.version.versionintlist[0] == 1: + if gpg.version.versionintlist[1] == 12: + if gpg.version.versionintlist[2] == 1: + print("This is the minimum version for using versionintlist.") + elif gpg.version.versionintlist[2] > 1: + print("The versionintlist method is available.") + else: + pass + elif gpg.version.versionintlist[1] > 12: + print("The versionintlist method is available.") + else: + pass + elif gpg.version.versionintlist[0] > 1: + print("The versionintlist method is available.") + else: + pass +except Exception as e: + print(e) +#+END_SRC + +The points where =pass= is used in the above example will most likely +also produce an =Exception= error since those results should only +occur in versions which do not have the =gpgme.version.is_beta= and +=gpgme.version.versionintlist= methods available. + + * Copyright and Licensing :PROPERTIES: :CUSTOM_ID: copyright-and-license diff --git a/lang/python/doc/src/what-is-new b/lang/python/doc/src/what-is-new index 4ca8ea8..5bcb5ae 100644 --- a/lang/python/doc/src/what-is-new +++ b/lang/python/doc/src/what-is-new @@ -35,9 +35,10 @@ considerably. Additions since GPGME 1.12.0 include: -- An advanced HOWTO on using the bindings with web interfaces, - specifically Flask. - Moving the /What's New/ section out of the basic [[file:gpgme-python-howto.org][HOWTO]] document and into its own file so as to more readily include other documents beyond that HOWTO. - Moving the preceding, archival, segments into [[file:what-was-new.org][another file]]. +- Added =gpg.version.versionintlist= to make it easier for Python + developers to check for a specific version number, even with beta + versions (it will drop the "-betaN" part). diff --git a/lang/python/doc/texinfo/gpgme-python-howto.texi b/lang/python/doc/texinfo/gpgme-python-howto.texi index 4f10bc5..3ac26d6 100644 --- a/lang/python/doc/texinfo/gpgme-python-howto.texi +++ b/lang/python/doc/texinfo/gpgme-python-howto.texi @@ -149,6 +149,7 @@ Miscellaneous extras and work-arounds * Group lines:: * Keyserver access for Python:: +* GPGME version checking:: Keyserver access for Python @@ -170,14 +171,14 @@ Copyright and Licensing @item Version: @tab 0.1.4 @item GPGME Version: - at tab 1.12.0 + at tab 1.12.1 @item Author: @tab @uref{https://gnupg.org/people/index.html#sec-1-5, Ben McGinnes} @item Author GPG Key: @tab DB4724E6FA4286C92B4E55C4321E4E2373590E5D @item Language: @tab Australian English, British English - at item xml:lang: + at item Language codes: @tab en-AU, en-GB, en @end multitable @@ -2887,6 +2888,7 @@ especially true of the first of these, dealing with @ref{Group lines, , group li @menu * Group lines:: * Keyserver access for Python:: +* GPGME version checking:: @end menu @node Group lines @@ -3005,6 +3007,93 @@ HOWTO and the corresponding executable version of that example is available in the @samp{lang/python/examples/howto} directory as normal; the executable version is the @samp{import-keys-hkp.py} file. + at node GPGME version checking + at section GPGME version checking + +For various reasons it may be necessary to check which version of +GPGME the bindings have been built against; including whether a +minimum required version of GPGME is in use. + +For the most part the @samp{gpg.version.versionstr} and + at samp{gpg.version.versionlist} methods have been quite sufficient. The +former returns the same string as @samp{gpgme-config --version}, while the +latter returns the major, minor and patch values in a list. + +To check if the installed bindings have actually been built against +the current installed libgpgme version, this check can be performed: + + at example +import gpg +import subprocess +import sys + +gpgme_version_call = subprocess.Popen(["gpgme-config", "--version"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) +gpgme_version_str = gpgme_version_call.communicate() + +if sys.version_info[0] == 2: + gpgme_version = gpgme_version_str[0].strip() +elif sys.version_info[0] >= 3: + gpgme_version = gpgme_version_str[0].decode().strip() +else: + gpgme_version = None + +if gpgme_version is not None: + if gpgme_version == gpg.version.versionstr: + print("The GPGME Python bindings match libgpgme.") + else: + print("The GPGME Python bindings do NOT match libgpgme.") +else: + print("Upgrade Python and reinstall the GPGME Python bindings.") + at end example + +For many developers, however, the preferred checking means checking +for a minimum version or point release. This is now readily available +via the @samp{gpg.version.versionintlist} method (added in version + at samp{1.12.1-beta79}). It is also now possible to easily check whether the +installed GPGME Python bindings were built from a development or beta +branch of the GPGME source code. + +The following code demonstrates how both of those methods may be used: + + at example +import gpg + +try: + if gpg.version.is_beta is True: + print("The installed GPGME Python bindings were built from beta code.") + else: + print("The installed GPGME Python bindings are a released version.") +except Exception as e: + print(e) + +try: + if gpg.version.versionintlist[0] == 1: + if gpg.version.versionintlist[1] == 12: + if gpg.version.versionintlist[2] == 1: + print("This is the minimum version for using versionintlist.") + elif gpg.version.versionintlist[2] > 1: + print("The versionintlist method is available.") + else: + pass + elif gpg.version.versionintlist[1] > 12: + print("The versionintlist method is available.") + else: + pass + elif gpg.version.versionintlist[0] > 1: + print("The versionintlist method is available.") + else: + pass +except Exception as e: + print(e) + at end example + +The points where @samp{pass} is used in the above example will most likely +also produce an @samp{Exception} error since those results should only +occur in versions which do not have the @samp{gpgme.version.is_beta} and + at samp{gpgme.version.versionintlist} methods available. + @node Copyright and Licensing @chapter Copyright and Licensing @@ -3044,10 +3133,6 @@ from the author at any of the following URLs: @uref{https://files.au.adversary.org/crypto/gpgme-python-howto.rst, GPGME Python Bindings HOWTO draft (reST file AWS S3 SSL)} @item @uref{http://files.au.adversary.org/crypto/gpgme-python-howto.rst, GPGME Python Bindings HOWTO draft (reST file AWS S3 no SSL)} - at item - at uref{https://files.au.adversary.org/crypto/gpgme-python-howto.xml, GPGME Python Bindings HOWTO draft (Docbook 4.2 AWS S3 SSL)} - at item - at uref{http://files.au.adversary.org/crypto/gpgme-python-howto.xml, GPGME Python Bindings HOWTO draft (Docbook 4.2 AWS S3 no SSL)} @end itemize All of these draft versions except for one have been generated from @@ -3060,8 +3145,8 @@ using the latest version of Pandoc from the Org mode source file using either of the following two commands: @example -pandoc -f org -t rst -o gpgme-python-howto.rst gpgme-python-howto.org -pandoc -f org -t rst -o gpgme-python-howto.rst gpgme-python-howto +pandoc -f org -t rst+smart -o gpgme-python-howto.rst gpgme-python-howto.org +pandoc -f org -t rst+smart -o gpgme-python-howto.rst gpgme-python-howto @end example In addition to these there is a significantly less frequently updated @@ -3089,4 +3174,4 @@ WITHOUT ANY WARRANTY, to the extent permitted by law; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - at bye + at bye \ No newline at end of file diff --git a/lang/python/doc/texinfo/what-is-new.texi b/lang/python/doc/texinfo/what-is-new.texi index 6233cac..0b70d21 100644 --- a/lang/python/doc/texinfo/what-is-new.texi +++ b/lang/python/doc/texinfo/what-is-new.texi @@ -66,14 +66,15 @@ Additions since GPGME 1.12.0 include: @itemize @item -An advanced HOWTO on using the bindings with web interfaces, -specifically Flask. - at item Moving the @emph{What's New} section out of the basic @uref{gpgme-python-howto.org, HOWTO} document and into its own file so as to more readily include other documents beyond that HOWTO. @item Moving the preceding, archival, segments into @uref{what-was-new.org, another file}. + at item +Added @samp{gpg.version.versionintlist} to make it easier for Python +developers to check for a specific version number, even with beta +versions (it will drop the "-betaN" part). @end itemize @bye \ No newline at end of file ----------------------------------------------------------------------- Summary of changes: lang/python/doc/rst/gpgme-python-howto.rst | 101 +++++++++++++++++++++-- lang/python/doc/rst/what-is-new.rst | 5 +- lang/python/doc/src/gpgme-python-howto | 90 +++++++++++++++++++++ lang/python/doc/src/what-is-new | 5 +- lang/python/doc/texinfo/gpgme-python-howto.texi | 103 +++++++++++++++++++++--- lang/python/doc/texinfo/what-is-new.texi | 7 +- 6 files changed, 287 insertions(+), 24 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 22 22:37:32 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 22 Nov 2018 22:37:32 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-282-gfa1b1ea Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via fa1b1eaa4241ff3f0634c8bdf8591cbc7c464144 (commit) from e5c3a6999a374813134a9e68744444c25c3017f6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit fa1b1eaa4241ff3f0634c8bdf8591cbc7c464144 Author: Werner Koch Date: Thu Nov 22 22:27:56 2018 +0100 dirmngr: Avoid possible CSRF attacks via http redirects. * dirmngr/http.h (parsed_uri_s): Add fields off_host and off_path. (http_redir_info_t): New. * dirmngr/http.c (do_parse_uri): Set new fields. (same_host_p): New. (http_prepare_redirect): New. * dirmngr/t-http-basic.c: New test. * dirmngr/ks-engine-hkp.c (send_request): Use http_prepare_redirect instead of the open code. * dirmngr/ks-engine-http.c (ks_http_fetch): Ditto. -- With this change a http query will not follow a redirect unless the Location header gives the same host. If the host is different only the host and port is taken from the Location header and the original path and query parts are kept. Signed-off-by: Werner Koch diff --git a/dirmngr/Makefile.am b/dirmngr/Makefile.am index 22b8c1a..098e711 100644 --- a/dirmngr/Makefile.am +++ b/dirmngr/Makefile.am @@ -120,7 +120,7 @@ t_common_ldadd = $(libcommon) $(LIBASSUAN_LIBS) $(LIBGCRYPT_LIBS) \ $(NTBTLS_LIBS) $(LIBGNUTLS_LIBS) \ $(DNSLIBS) $(LIBINTL) $(LIBICONV) -module_tests = +module_tests = t-http-basic if USE_LDAP module_tests += t-ldap-parse-uri @@ -151,6 +151,15 @@ t_http_CFLAGS = -DWITHOUT_NPTH=1 $(USE_C99_CFLAGS) \ t_http_LDADD = $(t_common_ldadd) \ $(NTBTLS_LIBS) $(KSBA_LIBS) $(LIBGNUTLS_LIBS) $(DNSLIBS) +t_http_basic_SOURCES = $(t_common_src) t-http-basic.c http.c \ + dns-stuff.c http-common.c +t_http_basic_CFLAGS = -DWITHOUT_NPTH=1 $(USE_C99_CFLAGS) \ + $(LIBGCRYPT_CFLAGS) $(NTBTLS_CFLAGS) $(LIBGNUTLS_CFLAGS) \ + $(LIBASSUAN_CFLAGS) $(GPG_ERROR_CFLAGS) $(KSBA_CFLAGS) +t_http_basic_LDADD = $(t_common_ldadd) \ + $(NTBTLS_LIBS) $(KSBA_LIBS) $(LIBGNUTLS_LIBS) $(DNSLIBS) + + t_ldap_parse_uri_SOURCES = \ t-ldap-parse-uri.c ldap-parse-uri.c ldap-parse-uri.h \ http.c http-common.c dns-stuff.c \ diff --git a/dirmngr/http.c b/dirmngr/http.c index 5fb7eed..6c183b2 100644 --- a/dirmngr/http.c +++ b/dirmngr/http.c @@ -1350,6 +1350,8 @@ do_parse_uri (parsed_uri_t uri, int only_local_part, uri->v6lit = 0; uri->onion = 0; uri->explicit_port = 0; + uri->off_host = 0; + uri->off_path = 0; /* A quick validity check. */ if (strspn (p, VALID_URI_CHARS) != n) @@ -1393,7 +1395,19 @@ do_parse_uri (parsed_uri_t uri, int only_local_part, { p += 2; if ((p2 = strchr (p, '/'))) - *p2++ = 0; + { + if (p2 - uri->buffer > 10000) + return GPG_ERR_BAD_URI; + uri->off_path = p2 - uri->buffer; + *p2++ = 0; + } + else + { + n = (p - uri->buffer) + strlen (p); + if (n > 10000) + return GPG_ERR_BAD_URI; + uri->off_path = n; + } /* Check for username/password encoding */ if ((p3 = strchr (p, '@'))) @@ -1412,11 +1426,19 @@ do_parse_uri (parsed_uri_t uri, int only_local_part, *p3++ = '\0'; /* worst case, uri->host should have length 0, points to \0 */ uri->host = p + 1; + if (p - uri->buffer > 10000) + return GPG_ERR_BAD_URI; + uri->off_host = (p + 1) - uri->buffer; uri->v6lit = 1; p = p3; } else - uri->host = p; + { + uri->host = p; + if (p - uri->buffer > 10000) + return GPG_ERR_BAD_URI; + uri->off_host = p - uri->buffer; + } if ((p3 = strchr (p, ':'))) { @@ -3496,3 +3518,148 @@ uri_query_lookup (parsed_uri_t uri, const char *key) return NULL; } + + +/* Return true if both URI point to the same host. */ +static int +same_host_p (parsed_uri_t a, parsed_uri_t b) +{ + return a->host && b->host && !ascii_strcasecmp (a->host, b->host); +} + + +/* Prepare a new URL for a HTTP redirect. INFO has flags controlling + * the operaion, STATUS_CODE is used for diagnostics, LOCATION is the + * value of the "Location" header, and R_URL reveives the new URL on + * success or NULL or error. Note that INFO->ORIG_URL is + * required. */ +gpg_error_t +http_prepare_redirect (http_redir_info_t *info, unsigned int status_code, + const char *location, char **r_url) +{ + gpg_error_t err; + parsed_uri_t locuri; + parsed_uri_t origuri; + char *newurl; + char *p; + + *r_url = NULL; + + if (!info || !info->orig_url) + return gpg_error (GPG_ERR_INV_ARG); + + if (!info->silent) + log_info (_("URL '%s' redirected to '%s' (%u)\n"), + info->orig_url, location? location:"[none]", status_code); + + if (!info->redirects_left) + { + if (!info->silent) + log_error (_("too many redirections\n")); + return gpg_error (GPG_ERR_NO_DATA); + } + info->redirects_left--; + + if (!location || !*location) + return gpg_error (GPG_ERR_NO_DATA); + + err = http_parse_uri (&locuri, location, 0); + if (err) + return err; + + /* Make sure that an onion address only redirects to another + * onion address, or that a https address only redirects to a + * https address. */ + if (info->orig_onion && !locuri->onion) + { + http_release_parsed_uri (locuri); + return gpg_error (GPG_ERR_FORBIDDEN); + } + if (!info->allow_downgrade && info->orig_https && !locuri->use_tls) + { + http_release_parsed_uri (locuri); + return gpg_error (GPG_ERR_FORBIDDEN); + } + + if (info->trust_location) + { + /* We trust the Location - return it verbatim. */ + http_release_parsed_uri (locuri); + newurl = xtrystrdup (location); + if (!newurl) + { + err = gpg_error_from_syserror (); + http_release_parsed_uri (locuri); + return err; + } + } + else if ((err = http_parse_uri (&origuri, info->orig_url, 0))) + { + http_release_parsed_uri (locuri); + return err; + } + else if (same_host_p (origuri, locuri)) + { + /* The host is the same and thus we can take the location + * verbatim. */ + http_release_parsed_uri (origuri); + http_release_parsed_uri (locuri); + newurl = xtrystrdup (location); + if (!newurl) + { + err = gpg_error_from_syserror (); + http_release_parsed_uri (locuri); + return err; + } + } + else + { + /* We take only the host and port from the URL given in the + * Location. This limits the effects of redirection attacks by + * rogue hosts returning an URL to servers in the client's own + * network. We don't even include the userinfo because they + * should be considered similar to the path and query parts. + */ + if (!(locuri->off_path - locuri->off_host)) + { + http_release_parsed_uri (origuri); + http_release_parsed_uri (locuri); + return gpg_error (GPG_ERR_BAD_URI); + } + if (!(origuri->off_path - origuri->off_host)) + { + http_release_parsed_uri (origuri); + http_release_parsed_uri (locuri); + return gpg_error (GPG_ERR_BAD_URI); + } + + newurl = xtrymalloc (strlen (origuri->original) + + (locuri->off_path - locuri->off_host) + 1); + if (!newurl) + { + err = gpg_error_from_syserror (); + http_release_parsed_uri (origuri); + http_release_parsed_uri (locuri); + return err; + } + /* Build new URL from + * uriguri: scheme userinfo ---- ---- path rest + * locuri: ------ -------- host port ---- ---- + */ + p = newurl; + memcpy (p, origuri->original, origuri->off_host); + p += origuri->off_host; + memcpy (p, locuri->original + locuri->off_host, + (locuri->off_path - locuri->off_host)); + p += locuri->off_path - locuri->off_host; + strcpy (p, origuri->original + origuri->off_path); + + http_release_parsed_uri (origuri); + http_release_parsed_uri (locuri); + if (!info->silent) + log_info (_("redirection changed to '%s'\n"), newurl); + } + + *r_url = newurl; + return 0; +} diff --git a/dirmngr/http.h b/dirmngr/http.h index a86abbe..4755b92 100644 --- a/dirmngr/http.h +++ b/dirmngr/http.h @@ -58,6 +58,8 @@ struct parsed_uri_s char *auth; /* username/password for basic auth. */ char *host; /* Host (converted to lowercase). */ unsigned short port; /* Port (always set if the host is set). */ + unsigned short off_host; /* Offset to the HOST respective PATH parts */ + unsigned short off_path; /* in the original URI buffer. */ char *path; /* Path. */ uri_tuple_t params; /* ";xxxxx" */ uri_tuple_t query; /* "?xxx=yyy" */ @@ -100,6 +102,21 @@ typedef struct http_session_s *http_session_t; struct http_context_s; typedef struct http_context_s *http_t; +/* An object used to track redirection infos. */ +struct http_redir_info_s +{ + unsigned int redirects_left; /* Number of still possible redirects. */ + const char *orig_url; /* The original requested URL. */ + unsigned int orig_onion:1; /* Original request was an onion address. */ + unsigned int orig_https:1; /* Original request was a http address. */ + unsigned int silent:1; /* No diagnostics. */ + unsigned int allow_downgrade:1;/* Allow a downgrade from https to http. */ + unsigned int trust_location:1; /* Trust the received Location header. */ +}; +typedef struct http_redir_info_s http_redir_info_t; + + + /* A TLS verify callback function. */ typedef gpg_error_t (*http_verify_cb_t) (void *opaque, http_t http, @@ -176,5 +193,9 @@ gpg_error_t http_verify_server_credentials (http_session_t sess); char *http_escape_string (const char *string, const char *specials); char *http_escape_data (const void *data, size_t datalen, const char *specials); +gpg_error_t http_prepare_redirect (http_redir_info_t *info, + unsigned int status_code, + const char *location, char **r_url); + #endif /*GNUPG_COMMON_HTTP_H*/ diff --git a/dirmngr/ks-engine-hkp.c b/dirmngr/ks-engine-hkp.c index 790a8b1..1b14a2e 100644 --- a/dirmngr/ks-engine-hkp.c +++ b/dirmngr/ks-engine-hkp.c @@ -1201,18 +1201,21 @@ send_request (ctrl_t ctrl, const char *request, const char *hostportstr, gpg_error_t err; http_session_t session = NULL; http_t http = NULL; - int redirects_left = MAX_REDIRECTS; + http_redir_info_t redirinfo = { MAX_REDIRECTS }; estream_t fp = NULL; char *request_buffer = NULL; parsed_uri_t uri = NULL; - int is_onion; *r_fp = NULL; err = http_parse_uri (&uri, request, 0); if (err) goto leave; - is_onion = uri->onion; + redirinfo.orig_url = request; + redirinfo.orig_onion = uri->onion; + redirinfo.allow_downgrade = 1; + /* FIXME: I am not sure whey we allow a downgrade for hkp requests. + * Needs at least an explanation here.. */ err = http_session_new (&session, httphost, ((ctrl->http_no_crl? HTTP_FLAG_NO_CRL : 0) @@ -1293,45 +1296,18 @@ send_request (ctrl_t ctrl, const char *request, const char *hostportstr, case 302: case 307: { - const char *s = http_get_header (http, "Location"); - - log_info (_("URL '%s' redirected to '%s' (%u)\n"), - request, s?s:"[none]", http_get_status_code (http)); - if (s && *s && redirects_left-- ) - { - if (is_onion) - { - /* Make sure that an onion address only redirects to - * another onion address. */ - http_release_parsed_uri (uri); - uri = NULL; - err = http_parse_uri (&uri, s, 0); - if (err) - goto leave; - - if (! uri->onion) - { - err = gpg_error (GPG_ERR_FORBIDDEN); - goto leave; - } - } + xfree (request_buffer); + err = http_prepare_redirect (&redirinfo, http_get_status_code (http), + http_get_header (http, "Location"), + &request_buffer); + if (err) + goto leave; - xfree (request_buffer); - request_buffer = xtrystrdup (s); - if (request_buffer) - { - request = request_buffer; - http_close (http, 0); - http = NULL; - goto once_more; - } - err = gpg_error_from_syserror (); - } - else - err = gpg_error (GPG_ERR_NO_DATA); - log_error (_("too many redirections\n")); + request = request_buffer; + http_close (http, 0); + http = NULL; } - goto leave; + goto once_more; case 501: err = gpg_error (GPG_ERR_NOT_IMPLEMENTED); diff --git a/dirmngr/ks-engine-http.c b/dirmngr/ks-engine-http.c index 9e6b9e1..0f3e2db 100644 --- a/dirmngr/ks-engine-http.c +++ b/dirmngr/ks-engine-http.c @@ -74,17 +74,18 @@ ks_http_fetch (ctrl_t ctrl, const char *url, unsigned int flags, http_session_t session = NULL; unsigned int session_flags; http_t http = NULL; - int redirects_left = MAX_REDIRECTS; + http_redir_info_t redirinfo = { MAX_REDIRECTS }; estream_t fp = NULL; char *request_buffer = NULL; parsed_uri_t uri = NULL; - int is_onion, is_https; err = http_parse_uri (&uri, url, 0); if (err) goto leave; - is_onion = uri->onion; - is_https = uri->use_tls; + redirinfo.orig_url = url; + redirinfo.orig_onion = uri->onion; + redirinfo.orig_https = uri->use_tls; + redirinfo.allow_downgrade = !!(flags & KS_HTTP_FETCH_ALLOW_DOWNGRADE); /* By default we only use the system provided certificates with this * fetch command. */ @@ -158,53 +159,20 @@ ks_http_fetch (ctrl_t ctrl, const char *url, unsigned int flags, case 302: case 307: { - const char *s = http_get_header (http, "Location"); - - log_info (_("URL '%s' redirected to '%s' (%u)\n"), - url, s?s:"[none]", http_get_status_code (http)); - if (s && *s && redirects_left-- ) - { - if (is_onion || is_https) - { - /* Make sure that an onion address only redirects to - * another onion address, or that a https address - * only redirects to a https address. */ - http_release_parsed_uri (uri); - uri = NULL; - err = http_parse_uri (&uri, s, 0); - if (err) - goto leave; - - if (is_onion && !uri->onion) - { - err = gpg_error (GPG_ERR_FORBIDDEN); - goto leave; - } - if (!(flags & KS_HTTP_FETCH_ALLOW_DOWNGRADE) - && is_https && !uri->use_tls) - { - err = gpg_error (GPG_ERR_FORBIDDEN); - goto leave; - } - } - - xfree (request_buffer); - request_buffer = xtrystrdup (s); - if (request_buffer) - { - url = request_buffer; - http_close (http, 0); - http = NULL; - http_session_release (session); - goto once_more; - } - err = gpg_error_from_syserror (); - } - else - err = gpg_error (GPG_ERR_NO_DATA); - log_error (_("too many redirections\n")); + xfree (request_buffer); + err = http_prepare_redirect (&redirinfo, http_get_status_code (http), + http_get_header (http, "Location"), + &request_buffer); + if (err) + goto leave; + + url = request_buffer; + http_close (http, 0); + http = NULL; + http_session_release (session); + session = NULL; } - goto leave; + goto once_more; default: log_error (_("error accessing '%s': http status %u\n"), diff --git a/dirmngr/t-http-basic.c b/dirmngr/t-http-basic.c new file mode 100644 index 0000000..edf82ef --- /dev/null +++ b/dirmngr/t-http-basic.c @@ -0,0 +1,199 @@ +/* t-http-basic.c - Basic regression tests for http.c + * Copyright (C) 2018 g10 Code GmbH + * + * This file is part of GnuPG. + * + * GnuPG 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 3 of the License, or + * (at your option) any later version. + * + * GnuPG 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 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 . + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include +#include + +#include "../common/util.h" +#include "t-support.h" +#include "http.h" + +#define PGM "t-http-basic" + + +static void +test_http_prepare_redirect (void) +{ + static struct { + const char *url; + const char *location; + const char *expect_url; + gpg_error_t expect_err; + } tests[] = { + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + NULL, + "", + GPG_ERR_NO_DATA + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "", + "", + GPG_ERR_NO_DATA + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "foo//bla", + "", + GPG_ERR_BAD_URI + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + 0 + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + 0 + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://foo.gnupg.org:8080/.not-so-well-known/openpgpkey/hu/12345678", + "http://foo.gnupg.org:8080/.well-known/openpgpkey/hu/12345678", + 0 + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http:///.no-so-well-known/openpgpkey/hu/12345678", + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + GPG_ERR_BAD_URI + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.org:8080/.not-so-well-known/openpgpkey/hu/12345678", + "http://gnupg.org:8080/.not-so-well-known/openpgpkey/hu/12345678", + 0 + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.org:8/.not-so-well-known/openpgpkey/hu/12345678", + "http://gnupg.org:8/.not-so-well-known/openpgpkey/hu/12345678", + 0 + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.org:/.no-so-well-known/openpgpkey/hu/12345678", + "http://gnupg.org:/.no-so-well-known/openpgpkey/hu/12345678", + 0 + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.org/", + "http://gnupg.org/", + 0 + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.net", + "http://gnupg.net/.well-known/openpgpkey/hu/12345678", + 0 + }, + { + "http://gnupg.org", + "http://gnupg.org", + "http://gnupg.org", + 0 + }, + { + "http://gnupg.org", + "http://foo.gnupg.org", + "http://foo.gnupg.org", + 0 + }, + { + "http://gnupg.org/", + "http://foo.gnupg.org", + "http://foo.gnupg.org/", + 0 + }, + { + "http://gnupg.org", + "http://foo.gnupg.org/", + "http://foo.gnupg.org", + 0 + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.org/something-else", + "http://gnupg.org/something-else", + 0 + }, + }; + int tidx; + http_redir_info_t ri; + gpg_error_t err; + char *newurl; + + err = http_prepare_redirect (NULL, 301, tests[0].location, &newurl); + if (gpg_err_code (err) != GPG_ERR_INV_ARG) + fail (0); + memset (&ri, 0, sizeof ri); + err = http_prepare_redirect (&ri, 301, tests[0].location, &newurl); + if (gpg_err_code (err) != GPG_ERR_INV_ARG) + fail (0); + memset (&ri, 0, sizeof ri); + ri.silent = 1; + ri.orig_url = "http://example.org"; + err = http_prepare_redirect (&ri, 301, tests[0].location, &newurl); + if (gpg_err_code (err) != GPG_ERR_NO_DATA) + fail (0); + + for (tidx = 0; tidx < DIM (tests); tidx++) + { + memset (&ri, 0, sizeof ri); + ri.silent = 1; + ri.redirects_left = 1; + ri.orig_url = tests[tidx].url; + + err = http_prepare_redirect (&ri, 301, tests[tidx].location, &newurl); + if (err && newurl) + fail (tidx); + if (err && gpg_err_code (err) != tests[tidx].expect_err) + fail (tidx); + if (err) + continue; + if (!newurl) + fail (tidx); + if (strcmp (tests[tidx].expect_url, newurl)) + { + fprintf (stderr, "want: '%s'\n", tests[tidx].expect_url); + fprintf (stderr, "got : '%s'\n", newurl); + fail (tidx); + } + + xfree (newurl); + } +} + + +int +main (int argc, char **argv) +{ + (void)argc; + (void)argv; + + test_http_prepare_redirect (); + + return 0; +} diff --git a/dirmngr/t-http.c b/dirmngr/t-http.c index 8b32613..70d7f3f 100644 --- a/dirmngr/t-http.c +++ b/dirmngr/t-http.c @@ -394,9 +394,9 @@ main (int argc, char **argv) else { printf ("Auth : %s\n", uri->auth? uri->auth:"[none]"); - printf ("Host : %s\n", uri->host); + printf ("Host : %s (off=%hu)\n", uri->host, uri->off_host); printf ("Port : %u\n", uri->port); - printf ("Path : %s\n", uri->path); + printf ("Path : %s (off=%hu)\n", uri->path, uri->off_path); for (r = uri->params; r; r = r->next) { printf ("Params: %s", r->name); ----------------------------------------------------------------------- Summary of changes: dirmngr/Makefile.am | 11 ++- dirmngr/http.c | 171 +++++++++++++++++++++++++++++++++++++++- dirmngr/http.h | 21 +++++ dirmngr/ks-engine-hkp.c | 56 ++++--------- dirmngr/ks-engine-http.c | 68 +++++----------- dirmngr/t-http-basic.c | 199 +++++++++++++++++++++++++++++++++++++++++++++++ dirmngr/t-http.c | 4 +- 7 files changed, 435 insertions(+), 95 deletions(-) create mode 100644 dirmngr/t-http-basic.c hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 23 09:28:16 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 23 Nov 2018 09:28:16 +0100 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.11-5-g4a4bb87 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 4a4bb874f63741026bd26264c43bb32b1099f060 (commit) from 6acca0e4d9f9e432a795ac261dd8fa02bcc583cd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4a4bb874f63741026bd26264c43bb32b1099f060 Author: Werner Koch Date: Thu Nov 22 22:27:56 2018 +0100 dirmngr: Avoid possible CSRF attacks via http redirects. * dirmngr/http.h (parsed_uri_s): Add fields off_host and off_path. (http_redir_info_t): New. * dirmngr/http.c (do_parse_uri): Set new fields. (same_host_p): New. (http_prepare_redirect): New. * dirmngr/t-http-basic.c: New test. * dirmngr/ks-engine-hkp.c (send_request): Use http_prepare_redirect instead of the open code. * dirmngr/ks-engine-http.c (ks_http_fetch): Ditto. -- With this change a http query will not follow a redirect unless the Location header gives the same host. If the host is different only the host and port is taken from the Location header and the original path and query parts are kept. Signed-off-by: Werner Koch (cherry picked from commit fa1b1eaa4241ff3f0634c8bdf8591cbc7c464144) diff --git a/dirmngr/Makefile.am b/dirmngr/Makefile.am index 43f59bd..081f723 100644 --- a/dirmngr/Makefile.am +++ b/dirmngr/Makefile.am @@ -120,7 +120,7 @@ t_common_ldadd = $(libcommon) $(LIBASSUAN_LIBS) $(LIBGCRYPT_LIBS) \ $(NTBTLS_LIBS) $(LIBGNUTLS_LIBS) \ $(DNSLIBS) $(LIBINTL) $(LIBICONV) -module_tests = +module_tests = t-http-basic if USE_LDAP module_tests += t-ldap-parse-uri @@ -151,6 +151,15 @@ t_http_CFLAGS = -DWITHOUT_NPTH=1 $(USE_C99_CFLAGS) \ t_http_LDADD = $(t_common_ldadd) \ $(NTBTLS_LIBS) $(KSBA_LIBS) $(LIBGNUTLS_LIBS) $(DNSLIBS) +t_http_basic_SOURCES = $(t_common_src) t-http-basic.c http.c \ + dns-stuff.c http-common.c +t_http_basic_CFLAGS = -DWITHOUT_NPTH=1 $(USE_C99_CFLAGS) \ + $(LIBGCRYPT_CFLAGS) $(NTBTLS_CFLAGS) $(LIBGNUTLS_CFLAGS) \ + $(LIBASSUAN_CFLAGS) $(GPG_ERROR_CFLAGS) $(KSBA_CFLAGS) +t_http_basic_LDADD = $(t_common_ldadd) \ + $(NTBTLS_LIBS) $(KSBA_LIBS) $(LIBGNUTLS_LIBS) $(DNSLIBS) + + t_ldap_parse_uri_SOURCES = \ t-ldap-parse-uri.c ldap-parse-uri.c ldap-parse-uri.h \ http.c http-common.c dns-stuff.c \ diff --git a/dirmngr/http.c b/dirmngr/http.c index 6846107..d37faa8 100644 --- a/dirmngr/http.c +++ b/dirmngr/http.c @@ -1347,6 +1347,8 @@ do_parse_uri (parsed_uri_t uri, int only_local_part, uri->v6lit = 0; uri->onion = 0; uri->explicit_port = 0; + uri->off_host = 0; + uri->off_path = 0; /* A quick validity check. */ if (strspn (p, VALID_URI_CHARS) != n) @@ -1390,7 +1392,19 @@ do_parse_uri (parsed_uri_t uri, int only_local_part, { p += 2; if ((p2 = strchr (p, '/'))) - *p2++ = 0; + { + if (p2 - uri->buffer > 10000) + return GPG_ERR_BAD_URI; + uri->off_path = p2 - uri->buffer; + *p2++ = 0; + } + else + { + n = (p - uri->buffer) + strlen (p); + if (n > 10000) + return GPG_ERR_BAD_URI; + uri->off_path = n; + } /* Check for username/password encoding */ if ((p3 = strchr (p, '@'))) @@ -1409,11 +1423,19 @@ do_parse_uri (parsed_uri_t uri, int only_local_part, *p3++ = '\0'; /* worst case, uri->host should have length 0, points to \0 */ uri->host = p + 1; + if (p - uri->buffer > 10000) + return GPG_ERR_BAD_URI; + uri->off_host = (p + 1) - uri->buffer; uri->v6lit = 1; p = p3; } else - uri->host = p; + { + uri->host = p; + if (p - uri->buffer > 10000) + return GPG_ERR_BAD_URI; + uri->off_host = p - uri->buffer; + } if ((p3 = strchr (p, ':'))) { @@ -3490,3 +3512,148 @@ uri_query_lookup (parsed_uri_t uri, const char *key) return NULL; } + + +/* Return true if both URI point to the same host. */ +static int +same_host_p (parsed_uri_t a, parsed_uri_t b) +{ + return a->host && b->host && !ascii_strcasecmp (a->host, b->host); +} + + +/* Prepare a new URL for a HTTP redirect. INFO has flags controlling + * the operaion, STATUS_CODE is used for diagnostics, LOCATION is the + * value of the "Location" header, and R_URL reveives the new URL on + * success or NULL or error. Note that INFO->ORIG_URL is + * required. */ +gpg_error_t +http_prepare_redirect (http_redir_info_t *info, unsigned int status_code, + const char *location, char **r_url) +{ + gpg_error_t err; + parsed_uri_t locuri; + parsed_uri_t origuri; + char *newurl; + char *p; + + *r_url = NULL; + + if (!info || !info->orig_url) + return gpg_error (GPG_ERR_INV_ARG); + + if (!info->silent) + log_info (_("URL '%s' redirected to '%s' (%u)\n"), + info->orig_url, location? location:"[none]", status_code); + + if (!info->redirects_left) + { + if (!info->silent) + log_error (_("too many redirections\n")); + return gpg_error (GPG_ERR_NO_DATA); + } + info->redirects_left--; + + if (!location || !*location) + return gpg_error (GPG_ERR_NO_DATA); + + err = http_parse_uri (&locuri, location, 0); + if (err) + return err; + + /* Make sure that an onion address only redirects to another + * onion address, or that a https address only redirects to a + * https address. */ + if (info->orig_onion && !locuri->onion) + { + http_release_parsed_uri (locuri); + return gpg_error (GPG_ERR_FORBIDDEN); + } + if (!info->allow_downgrade && info->orig_https && !locuri->use_tls) + { + http_release_parsed_uri (locuri); + return gpg_error (GPG_ERR_FORBIDDEN); + } + + if (info->trust_location) + { + /* We trust the Location - return it verbatim. */ + http_release_parsed_uri (locuri); + newurl = xtrystrdup (location); + if (!newurl) + { + err = gpg_error_from_syserror (); + http_release_parsed_uri (locuri); + return err; + } + } + else if ((err = http_parse_uri (&origuri, info->orig_url, 0))) + { + http_release_parsed_uri (locuri); + return err; + } + else if (same_host_p (origuri, locuri)) + { + /* The host is the same and thus we can take the location + * verbatim. */ + http_release_parsed_uri (origuri); + http_release_parsed_uri (locuri); + newurl = xtrystrdup (location); + if (!newurl) + { + err = gpg_error_from_syserror (); + http_release_parsed_uri (locuri); + return err; + } + } + else + { + /* We take only the host and port from the URL given in the + * Location. This limits the effects of redirection attacks by + * rogue hosts returning an URL to servers in the client's own + * network. We don't even include the userinfo because they + * should be considered similar to the path and query parts. + */ + if (!(locuri->off_path - locuri->off_host)) + { + http_release_parsed_uri (origuri); + http_release_parsed_uri (locuri); + return gpg_error (GPG_ERR_BAD_URI); + } + if (!(origuri->off_path - origuri->off_host)) + { + http_release_parsed_uri (origuri); + http_release_parsed_uri (locuri); + return gpg_error (GPG_ERR_BAD_URI); + } + + newurl = xtrymalloc (strlen (origuri->original) + + (locuri->off_path - locuri->off_host) + 1); + if (!newurl) + { + err = gpg_error_from_syserror (); + http_release_parsed_uri (origuri); + http_release_parsed_uri (locuri); + return err; + } + /* Build new URL from + * uriguri: scheme userinfo ---- ---- path rest + * locuri: ------ -------- host port ---- ---- + */ + p = newurl; + memcpy (p, origuri->original, origuri->off_host); + p += origuri->off_host; + memcpy (p, locuri->original + locuri->off_host, + (locuri->off_path - locuri->off_host)); + p += locuri->off_path - locuri->off_host; + strcpy (p, origuri->original + origuri->off_path); + + http_release_parsed_uri (origuri); + http_release_parsed_uri (locuri); + if (!info->silent) + log_info (_("redirection changed to '%s'\n"), newurl); + } + + *r_url = newurl; + return 0; +} diff --git a/dirmngr/http.h b/dirmngr/http.h index 4cfb4c8..a0458f8 100644 --- a/dirmngr/http.h +++ b/dirmngr/http.h @@ -58,6 +58,8 @@ struct parsed_uri_s char *auth; /* username/password for basic auth. */ char *host; /* Host (converted to lowercase). */ unsigned short port; /* Port (always set if the host is set). */ + unsigned short off_host; /* Offset to the HOST respective PATH parts */ + unsigned short off_path; /* in the original URI buffer. */ char *path; /* Path. */ uri_tuple_t params; /* ";xxxxx" */ uri_tuple_t query; /* "?xxx=yyy" */ @@ -100,6 +102,21 @@ typedef struct http_session_s *http_session_t; struct http_context_s; typedef struct http_context_s *http_t; +/* An object used to track redirection infos. */ +struct http_redir_info_s +{ + unsigned int redirects_left; /* Number of still possible redirects. */ + const char *orig_url; /* The original requested URL. */ + unsigned int orig_onion:1; /* Original request was an onion address. */ + unsigned int orig_https:1; /* Original request was a http address. */ + unsigned int silent:1; /* No diagnostics. */ + unsigned int allow_downgrade:1;/* Allow a downgrade from https to http. */ + unsigned int trust_location:1; /* Trust the received Location header. */ +}; +typedef struct http_redir_info_s http_redir_info_t; + + + /* A TLS verify callback function. */ typedef gpg_error_t (*http_verify_cb_t) (void *opaque, http_t http, @@ -176,5 +193,9 @@ gpg_error_t http_verify_server_credentials (http_session_t sess); char *http_escape_string (const char *string, const char *specials); char *http_escape_data (const void *data, size_t datalen, const char *specials); +gpg_error_t http_prepare_redirect (http_redir_info_t *info, + unsigned int status_code, + const char *location, char **r_url); + #endif /*GNUPG_COMMON_HTTP_H*/ diff --git a/dirmngr/ks-engine-hkp.c b/dirmngr/ks-engine-hkp.c index 7c2836c..3645789 100644 --- a/dirmngr/ks-engine-hkp.c +++ b/dirmngr/ks-engine-hkp.c @@ -1159,18 +1159,21 @@ send_request (ctrl_t ctrl, const char *request, const char *hostportstr, gpg_error_t err; http_session_t session = NULL; http_t http = NULL; - int redirects_left = MAX_REDIRECTS; + http_redir_info_t redirinfo = { MAX_REDIRECTS }; estream_t fp = NULL; char *request_buffer = NULL; parsed_uri_t uri = NULL; - int is_onion; *r_fp = NULL; err = http_parse_uri (&uri, request, 0); if (err) goto leave; - is_onion = uri->onion; + redirinfo.orig_url = request; + redirinfo.orig_onion = uri->onion; + redirinfo.allow_downgrade = 1; + /* FIXME: I am not sure whey we allow a downgrade for hkp requests. + * Needs at least an explanation here.. */ err = http_session_new (&session, httphost, ((ctrl->http_no_crl? HTTP_FLAG_NO_CRL : 0) @@ -1251,45 +1254,18 @@ send_request (ctrl_t ctrl, const char *request, const char *hostportstr, case 302: case 307: { - const char *s = http_get_header (http, "Location"); - - log_info (_("URL '%s' redirected to '%s' (%u)\n"), - request, s?s:"[none]", http_get_status_code (http)); - if (s && *s && redirects_left-- ) - { - if (is_onion) - { - /* Make sure that an onion address only redirects to - * another onion address. */ - http_release_parsed_uri (uri); - uri = NULL; - err = http_parse_uri (&uri, s, 0); - if (err) - goto leave; - - if (! uri->onion) - { - err = gpg_error (GPG_ERR_FORBIDDEN); - goto leave; - } - } + xfree (request_buffer); + err = http_prepare_redirect (&redirinfo, http_get_status_code (http), + http_get_header (http, "Location"), + &request_buffer); + if (err) + goto leave; - xfree (request_buffer); - request_buffer = xtrystrdup (s); - if (request_buffer) - { - request = request_buffer; - http_close (http, 0); - http = NULL; - goto once_more; - } - err = gpg_error_from_syserror (); - } - else - err = gpg_error (GPG_ERR_NO_DATA); - log_error (_("too many redirections\n")); + request = request_buffer; + http_close (http, 0); + http = NULL; } - goto leave; + goto once_more; case 501: err = gpg_error (GPG_ERR_NOT_IMPLEMENTED); diff --git a/dirmngr/ks-engine-http.c b/dirmngr/ks-engine-http.c index 946c927..1abb350 100644 --- a/dirmngr/ks-engine-http.c +++ b/dirmngr/ks-engine-http.c @@ -74,17 +74,18 @@ ks_http_fetch (ctrl_t ctrl, const char *url, unsigned int flags, http_session_t session = NULL; unsigned int session_flags; http_t http = NULL; - int redirects_left = MAX_REDIRECTS; + http_redir_info_t redirinfo = { MAX_REDIRECTS }; estream_t fp = NULL; char *request_buffer = NULL; parsed_uri_t uri = NULL; - int is_onion, is_https; err = http_parse_uri (&uri, url, 0); if (err) goto leave; - is_onion = uri->onion; - is_https = uri->use_tls; + redirinfo.orig_url = url; + redirinfo.orig_onion = uri->onion; + redirinfo.orig_https = uri->use_tls; + redirinfo.allow_downgrade = !!(flags & KS_HTTP_FETCH_ALLOW_DOWNGRADE); /* By default we only use the system provided certificates with this * fetch command. */ @@ -158,53 +159,20 @@ ks_http_fetch (ctrl_t ctrl, const char *url, unsigned int flags, case 302: case 307: { - const char *s = http_get_header (http, "Location"); - - log_info (_("URL '%s' redirected to '%s' (%u)\n"), - url, s?s:"[none]", http_get_status_code (http)); - if (s && *s && redirects_left-- ) - { - if (is_onion || is_https) - { - /* Make sure that an onion address only redirects to - * another onion address, or that a https address - * only redirects to a https address. */ - http_release_parsed_uri (uri); - uri = NULL; - err = http_parse_uri (&uri, s, 0); - if (err) - goto leave; - - if (is_onion && !uri->onion) - { - err = gpg_error (GPG_ERR_FORBIDDEN); - goto leave; - } - if (!(flags & KS_HTTP_FETCH_ALLOW_DOWNGRADE) - && is_https && !uri->use_tls) - { - err = gpg_error (GPG_ERR_FORBIDDEN); - goto leave; - } - } - - xfree (request_buffer); - request_buffer = xtrystrdup (s); - if (request_buffer) - { - url = request_buffer; - http_close (http, 0); - http = NULL; - http_session_release (session); - goto once_more; - } - err = gpg_error_from_syserror (); - } - else - err = gpg_error (GPG_ERR_NO_DATA); - log_error (_("too many redirections\n")); + xfree (request_buffer); + err = http_prepare_redirect (&redirinfo, http_get_status_code (http), + http_get_header (http, "Location"), + &request_buffer); + if (err) + goto leave; + + url = request_buffer; + http_close (http, 0); + http = NULL; + http_session_release (session); + session = NULL; } - goto leave; + goto once_more; default: log_error (_("error accessing '%s': http status %u\n"), diff --git a/dirmngr/t-http-basic.c b/dirmngr/t-http-basic.c new file mode 100644 index 0000000..edf82ef --- /dev/null +++ b/dirmngr/t-http-basic.c @@ -0,0 +1,199 @@ +/* t-http-basic.c - Basic regression tests for http.c + * Copyright (C) 2018 g10 Code GmbH + * + * This file is part of GnuPG. + * + * GnuPG 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 3 of the License, or + * (at your option) any later version. + * + * GnuPG 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 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 . + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include +#include + +#include "../common/util.h" +#include "t-support.h" +#include "http.h" + +#define PGM "t-http-basic" + + +static void +test_http_prepare_redirect (void) +{ + static struct { + const char *url; + const char *location; + const char *expect_url; + gpg_error_t expect_err; + } tests[] = { + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + NULL, + "", + GPG_ERR_NO_DATA + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "", + "", + GPG_ERR_NO_DATA + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "foo//bla", + "", + GPG_ERR_BAD_URI + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + 0 + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + 0 + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://foo.gnupg.org:8080/.not-so-well-known/openpgpkey/hu/12345678", + "http://foo.gnupg.org:8080/.well-known/openpgpkey/hu/12345678", + 0 + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http:///.no-so-well-known/openpgpkey/hu/12345678", + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + GPG_ERR_BAD_URI + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.org:8080/.not-so-well-known/openpgpkey/hu/12345678", + "http://gnupg.org:8080/.not-so-well-known/openpgpkey/hu/12345678", + 0 + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.org:8/.not-so-well-known/openpgpkey/hu/12345678", + "http://gnupg.org:8/.not-so-well-known/openpgpkey/hu/12345678", + 0 + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.org:/.no-so-well-known/openpgpkey/hu/12345678", + "http://gnupg.org:/.no-so-well-known/openpgpkey/hu/12345678", + 0 + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.org/", + "http://gnupg.org/", + 0 + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.net", + "http://gnupg.net/.well-known/openpgpkey/hu/12345678", + 0 + }, + { + "http://gnupg.org", + "http://gnupg.org", + "http://gnupg.org", + 0 + }, + { + "http://gnupg.org", + "http://foo.gnupg.org", + "http://foo.gnupg.org", + 0 + }, + { + "http://gnupg.org/", + "http://foo.gnupg.org", + "http://foo.gnupg.org/", + 0 + }, + { + "http://gnupg.org", + "http://foo.gnupg.org/", + "http://foo.gnupg.org", + 0 + }, + { + "http://gnupg.org/.well-known/openpgpkey/hu/12345678", + "http://gnupg.org/something-else", + "http://gnupg.org/something-else", + 0 + }, + }; + int tidx; + http_redir_info_t ri; + gpg_error_t err; + char *newurl; + + err = http_prepare_redirect (NULL, 301, tests[0].location, &newurl); + if (gpg_err_code (err) != GPG_ERR_INV_ARG) + fail (0); + memset (&ri, 0, sizeof ri); + err = http_prepare_redirect (&ri, 301, tests[0].location, &newurl); + if (gpg_err_code (err) != GPG_ERR_INV_ARG) + fail (0); + memset (&ri, 0, sizeof ri); + ri.silent = 1; + ri.orig_url = "http://example.org"; + err = http_prepare_redirect (&ri, 301, tests[0].location, &newurl); + if (gpg_err_code (err) != GPG_ERR_NO_DATA) + fail (0); + + for (tidx = 0; tidx < DIM (tests); tidx++) + { + memset (&ri, 0, sizeof ri); + ri.silent = 1; + ri.redirects_left = 1; + ri.orig_url = tests[tidx].url; + + err = http_prepare_redirect (&ri, 301, tests[tidx].location, &newurl); + if (err && newurl) + fail (tidx); + if (err && gpg_err_code (err) != tests[tidx].expect_err) + fail (tidx); + if (err) + continue; + if (!newurl) + fail (tidx); + if (strcmp (tests[tidx].expect_url, newurl)) + { + fprintf (stderr, "want: '%s'\n", tests[tidx].expect_url); + fprintf (stderr, "got : '%s'\n", newurl); + fail (tidx); + } + + xfree (newurl); + } +} + + +int +main (int argc, char **argv) +{ + (void)argc; + (void)argv; + + test_http_prepare_redirect (); + + return 0; +} diff --git a/dirmngr/t-http.c b/dirmngr/t-http.c index 440633d..3cf08ad 100644 --- a/dirmngr/t-http.c +++ b/dirmngr/t-http.c @@ -394,9 +394,9 @@ main (int argc, char **argv) else { printf ("Auth : %s\n", uri->auth? uri->auth:"[none]"); - printf ("Host : %s\n", uri->host); + printf ("Host : %s (off=%hu)\n", uri->host, uri->off_host); printf ("Port : %u\n", uri->port); - printf ("Path : %s\n", uri->path); + printf ("Path : %s (off=%hu)\n", uri->path, uri->off_path); for (r = uri->params; r; r = r->next) { printf ("Params: %s", r->name); ----------------------------------------------------------------------- Summary of changes: dirmngr/Makefile.am | 11 ++- dirmngr/http.c | 171 +++++++++++++++++++++++++++++++++++++++- dirmngr/http.h | 21 +++++ dirmngr/ks-engine-hkp.c | 56 ++++--------- dirmngr/ks-engine-http.c | 68 +++++----------- dirmngr/t-http-basic.c | 199 +++++++++++++++++++++++++++++++++++++++++++++++ dirmngr/t-http.c | 4 +- 7 files changed, 435 insertions(+), 95 deletions(-) create mode 100644 dirmngr/t-http-basic.c hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 26 03:21:58 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Mon, 26 Nov 2018 03:21:58 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-81-g1c92f3f Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 1c92f3ff55ad0cdda06d05ad0a83193e3a147b7e (commit) from c87155e6eba2e97e4e6c6ee7e2591088a5489556 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1c92f3ff55ad0cdda06d05ad0a83193e3a147b7e Author: Ben McGinnes Date: Mon Nov 26 13:19:34 2018 +1100 python docs: checking key signatures * Added instructions for checking key certifications or key signatures (depending on preferred terminology). * Added pendulum module to recommended installations, but not to requirements. Tested-by: Ben McGinnes Signed-off-by: Ben McGinnes diff --git a/lang/python/doc/rst/gpgme-python-howto.rst b/lang/python/doc/rst/gpgme-python-howto.rst index 6a22ce2..dae4c64 100644 --- a/lang/python/doc/rst/gpgme-python-howto.rst +++ b/lang/python/doc/rst/gpgme-python-howto.rst @@ -262,16 +262,18 @@ significant advantage in some way. #. If possible add the following Python modules which are not part of the standard library: `Requests `__, - `Cython `__ and - `hkp4py `__. Chances are quite - high that at least the first one and maybe two of those will already - be installed. + `Cython `__, + `Pendulum `__ and + `hkp4py `__. -Note that, as with Cython, some of the planned additions to the -`Advanced <#advanced-use>`__ section, will bring with them additional -requirements. Most of these will be fairly well known and commonly -installed ones, however, which are in many cases likely to have already -been installed on many systems or be familiar to Python programmers. +Chances are quite high that at least the first one and maybe two of +those will already be installed. + +Note that, as with Cython, some of advanced use case scenarios will +bring with them additional requirements. Most of these will be fairly +well known and commonly installed ones, however, which are in many cases +likely to have already been installed on many systems or be familiar to +Python programmers. Installation ------------ @@ -2569,6 +2571,81 @@ signature which will last a little over a month, do this: key = c.get_key(dmfpr, secret=True) c.key_sign(key, uids=uid, expires_in=2764800) +.. _key-sign-verify: + +Verifying key certifications +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code:: python + + import gpg + import time + + c = gpg.Context() + dmfpr = "177B7C25DB99745EE2EE13ED026D2F19E99E63AA" + keys = list(c.keylist(pattern=dmuid, mode=gpg.constants.keylist.mode.SIGS)) + key = keys[0] + + for user in key.uids: + for sig in user.signatures: + print("0x{0}".format(sig.keyid), "", time.ctime(sig.timestamp), "", + sig.uid) + +Which for Danger Mouse displays the following: + +:: + + 0x92E3F6115435C65A Thu Mar 15 13:17:44 2018 Danger Mouse + 0x321E4E2373590E5D Mon Nov 26 12:46:05 2018 Ben McGinnes + +The two key signatures listed are for the self-certification of Danger +Mouse\'s key made when the key was created in March, 2018; and the +second is a signature made by the author and set to expire at the end of +the year. Note that the second signature was made with the following +code (including the preceding code to display the output of the +certifications or key signatures): + +.. code:: python + + import gpg + import math + import pendulum + import time + + hd = "/home/dm/.gnupg" + c = gpg.Context() + d = gpg.Context(home_dir=hd) + dmfpr = "177B7C25DB99745EE2EE13ED026D2F19E99E63AA" + dmuid = "Danger Mouse " + dkeys = list(c.keylist(pattern=dmuid)) + dmkey = dkeys[0] + + c.key_import(d.key_export(pattern=None)) + + tp = pendulum.period(pendulum.now(tz="local"), pendulum.datetime(2019, 1, 1)) + ts = tp.total_seconds() + total_secs = math.ceil(ts) + c.key_sign(dmkey, uids=dmuid, expires_in=total_secs) + + d.key_import(c.key_export(pattern=dmuid)) + keys = list(c.keylist(pattern=dmuid, mode=gpg.constants.keylist.mode.SIGS)) + key = keys[0] + + for user in key.uids: + for sig in user.signatures: + print("0x{0}".format(sig.keyid), "", time.ctime(sig.timestamp), "", + sig.uid) + +Note that this final code block includes the use of a module which is +*not* part of Python\'s standard library, the `pendulum +module `__. Unlike the standard datetime +module, pendulum makes working with dates and times significantly easier +in Python; just as the requests module makes working with HTTP and HTTPS +easier than the builtin modules do. + +Though neither requests nor pendulum are required modules for using the +GPGME Python bindings, they are both highly recommended more generally. + .. _advanced-use: Advanced or Experimental Use Cases diff --git a/lang/python/doc/src/gpgme-python-howto b/lang/python/doc/src/gpgme-python-howto index 11fb1e2..4b02a93 100644 --- a/lang/python/doc/src/gpgme-python-howto +++ b/lang/python/doc/src/gpgme-python-howto @@ -279,15 +279,16 @@ a significant advantage in some way. reach EOL soon. In production systems and services, Python 3.6 should be robust enough to be relied on. 3. If possible add the following Python modules which are not part of - the standard library: [[http://docs.python-requests.org/en/latest/index.html][Requests]], [[https://cython.org/][Cython]] and [[https://github.com/Selfnet/hkp4py][hkp4py]]. Chances are - quite high that at least the first one and maybe two of those will - already be installed. + the standard library: [[http://docs.python-requests.org/en/latest/index.html][Requests]], [[https://cython.org/][Cython]], [[https://pendulum.eustace.io/][Pendulum]] and [[https://github.com/Selfnet/hkp4py][hkp4py]]. -Note that, as with Cython, some of the planned additions to the -[[#advanced-use][Advanced]] section, will bring with them additional requirements. Most -of these will be fairly well known and commonly installed ones, -however, which are in many cases likely to have already been installed -on many systems or be familiar to Python programmers. +Chances are quite high that at least the first one and maybe two of +those will already be installed. + +Note that, as with Cython, some of advanced use case scenarios will +bring with them additional requirements. Most of these will be fairly +well known and commonly installed ones, however, which are in many +cases likely to have already been installed on many systems or be +familiar to Python programmers. ** Installation @@ -2640,6 +2641,81 @@ c.key_sign(key, uids=uid, expires_in=2764800) #+END_SRC +*** Verifying key certifications + :PROPERTIES: + :CUSTOM_ID: key-sign-verify + :END: + +#+BEGIN_SRC python -i +import gpg +import time + +c = gpg.Context() +dmfpr = "177B7C25DB99745EE2EE13ED026D2F19E99E63AA" +keys = list(c.keylist(pattern=dmuid, mode=gpg.constants.keylist.mode.SIGS)) +key = keys[0] + +for user in key.uids: + for sig in user.signatures: + print("0x{0}".format(sig.keyid), "", time.ctime(sig.timestamp), "", + sig.uid) +#+END_SRC + +Which for Danger Mouse displays the following: + +#+BEGIN_EXAMPLE + 0x92E3F6115435C65A Thu Mar 15 13:17:44 2018 Danger Mouse + 0x321E4E2373590E5D Mon Nov 26 12:46:05 2018 Ben McGinnes +#+END_EXAMPLE + +The two key signatures listed are for the self-certification of Danger +Mouse's key made when the key was created in March, 2018; and the +second is a signature made by the author and set to expire at the end +of the year. Note that the second signature was made with the +following code (including the preceding code to display the output of +the certifications or key signatures): + +#+BEGIN_SRC python -i +import gpg +import math +import pendulum +import time + +hd = "/home/dm/.gnupg" +c = gpg.Context() +d = gpg.Context(home_dir=hd) +dmfpr = "177B7C25DB99745EE2EE13ED026D2F19E99E63AA" +dmuid = "Danger Mouse " +dkeys = list(c.keylist(pattern=dmuid)) +dmkey = dkeys[0] + +c.key_import(d.key_export(pattern=None)) + +tp = pendulum.period(pendulum.now(tz="local"), pendulum.datetime(2019, 1, 1)) +ts = tp.total_seconds() +total_secs = math.ceil(ts) +c.key_sign(dmkey, uids=dmuid, expires_in=total_secs) + +d.key_import(c.key_export(pattern=dmuid)) +keys = list(c.keylist(pattern=dmuid, mode=gpg.constants.keylist.mode.SIGS)) +key = keys[0] + +for user in key.uids: + for sig in user.signatures: + print("0x{0}".format(sig.keyid), "", time.ctime(sig.timestamp), "", + sig.uid) +#+END_SRC + +Note that this final code block includes the use of a module which is +/not/ part of Python's standard library, the [[https://pendulum.eustace.io/][pendulum module]]. Unlike +the standard datetime module, pendulum makes working with dates and +times significantly easier in Python; just as the requests module +makes working with HTTP and HTTPS easier than the builtin modules do. + +Though neither requests nor pendulum are required modules for using +the GPGME Python bindings, they are both highly recommended more +generally. + * Advanced or Experimental Use Cases :PROPERTIES: :CUSTOM_ID: advanced-use diff --git a/lang/python/doc/texinfo/gpgme-python-howto.texi b/lang/python/doc/texinfo/gpgme-python-howto.texi index 3ac26d6..558bc87 100644 --- a/lang/python/doc/texinfo/gpgme-python-howto.texi +++ b/lang/python/doc/texinfo/gpgme-python-howto.texi @@ -141,6 +141,10 @@ User IDs * Adding User IDs:: * Revoking User IDs:: +Key certification + +* Verifying key certifications:: + Advanced or Experimental Use Cases * C plus Python plus SWIG plus Cython:: @@ -432,16 +436,17 @@ reach EOL soon. In production systems and services, Python 3.6 should be robust enough to be relied on. @item If possible add the following Python modules which are not part of -the standard library: @uref{http://docs.python-requests.org/en/latest/index.html, Requests}, @uref{https://cython.org/, Cython} and @uref{https://github.com/Selfnet/hkp4py, hkp4py}. Chances are -quite high that at least the first one and maybe two of those will -already be installed. +the standard library: @uref{http://docs.python-requests.org/en/latest/index.html, Requests}, @uref{https://cython.org/, Cython}, @uref{https://pendulum.eustace.io/, Pendulum} and @uref{https://github.com/Selfnet/hkp4py, hkp4py}. @end enumerate -Note that, as with Cython, some of the planned additions to the - at ref{Advanced or Experimental Use Cases, , Advanced} section, will bring with them additional requirements. Most -of these will be fairly well known and commonly installed ones, -however, which are in many cases likely to have already been installed -on many systems or be familiar to Python programmers. +Chances are quite high that at least the first one and maybe two of +those will already be installed. + +Note that, as with Cython, some of advanced use case scenarios will +bring with them additional requirements. Most of these will be fairly +well known and commonly installed ones, however, which are in many +cases likely to have already been installed on many systems or be +familiar to Python programmers. @node Installation @section Installation @@ -2754,6 +2759,83 @@ key = c.get_key(dmfpr, secret=True) c.key_sign(key, uids=uid, expires_in=2764800) @end example + at menu +* Verifying key certifications:: + at end menu + + at node Verifying key certifications + at subsection Verifying key certifications + + at example +import gpg +import time + +c = gpg.Context() +dmfpr = "177B7C25DB99745EE2EE13ED026D2F19E99E63AA" +keys = list(c.keylist(pattern=dmuid, mode=gpg.constants.keylist.mode.SIGS)) +key = keys[0] + +for user in key.uids: + for sig in user.signatures: + print("0x@{0@}".format(sig.keyid), "", time.ctime(sig.timestamp), "", + sig.uid) + at end example + +Which for Danger Mouse displays the following: + + at example +0x92E3F6115435C65A Thu Mar 15 13:17:44 2018 Danger Mouse +0x321E4E2373590E5D Mon Nov 26 12:46:05 2018 Ben McGinnes + at end example + +The two key signatures listed are for the self-certification of Danger +Mouse's key made when the key was created in March, 2018; and the +second is a signature made by the author and set to expire at the end +of the year. Note that the second signature was made with the +following code (including the preceding code to display the output of +the certifications or key signatures): + + at example +import gpg +import math +import pendulum +import time + +hd = "/home/dm/.gnupg" +c = gpg.Context() +d = gpg.Context(home_dir=hd) +dmfpr = "177B7C25DB99745EE2EE13ED026D2F19E99E63AA" +dmuid = "Danger Mouse " +dkeys = list(c.keylist(pattern=dmuid)) +dmkey = dkeys[0] + +c.key_import(d.key_export(pattern=None)) + +tp = pendulum.period(pendulum.now(tz="local"), pendulum.datetime(2019, 1, 1)) +ts = tp.total_seconds() +total_secs = math.ceil(ts) +c.key_sign(dmkey, uids=dmuid, expires_in=total_secs) + +d.key_import(c.key_export(pattern=dmuid)) +keys = list(c.keylist(pattern=dmuid, mode=gpg.constants.keylist.mode.SIGS)) +key = keys[0] + +for user in key.uids: + for sig in user.signatures: + print("0x@{0@}".format(sig.keyid), "", time.ctime(sig.timestamp), "", + sig.uid) + at end example + +Note that this final code block includes the use of a module which is + at emph{not} part of Python's standard library, the @uref{https://pendulum.eustace.io/, pendulum module}. Unlike +the standard datetime module, pendulum makes working with dates and +times significantly easier in Python; just as the requests module +makes working with HTTP and HTTPS easier than the builtin modules do. + +Though neither requests nor pendulum are required modules for using +the GPGME Python bindings, they are both highly recommended more +generally. + @node Advanced or Experimental Use Cases @chapter Advanced or Experimental Use Cases ----------------------------------------------------------------------- Summary of changes: lang/python/doc/rst/gpgme-python-howto.rst | 95 +++++++++++++++++++++--- lang/python/doc/src/gpgme-python-howto | 92 +++++++++++++++++++++-- lang/python/doc/texinfo/gpgme-python-howto.texi | 98 +++++++++++++++++++++++-- 3 files changed, 260 insertions(+), 25 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 26 04:10:46 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Mon, 26 Nov 2018 04:10:46 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-285-g40c7923 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 40c7923ea881881a48de8f303b0870ec5910e13d (commit) via 9fb3f0f3f79e74166cce8e0781e97043f25890cc (commit) via f45d6124696cc92ccdec09841b8182679c377997 (commit) from fa1b1eaa4241ff3f0634c8bdf8591cbc7c464144 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 40c7923ea881881a48de8f303b0870ec5910e13d Author: NIIBE Yutaka Date: Mon Nov 26 12:07:36 2018 +0900 agent: Have a thread to wait for the child process of scdaemon. * agent/call-scd.c (wait_child_thread): New. (start_scd): Create a thread for wait_child_thread. (agent_scd_check_aliveness): Remove. Signed-off-by: NIIBE Yutaka diff --git a/agent/agent.h b/agent/agent.h index 9baf596..8a3e5c6 100644 --- a/agent/agent.h +++ b/agent/agent.h @@ -546,7 +546,6 @@ int divert_writekey (ctrl_t ctrl, int force, const char *serialno, void initialize_module_call_scd (void); void agent_scd_dump_state (void); int agent_scd_check_running (void); -void agent_scd_check_aliveness (void); int agent_reset_scd (ctrl_t ctrl); int agent_card_learn (ctrl_t ctrl, void (*kpinfo_cb)(void*, const char *), diff --git a/agent/call-scd.c b/agent/call-scd.c index 592ddb9..c6d062a 100644 --- a/agent/call-scd.c +++ b/agent/call-scd.c @@ -207,6 +207,85 @@ atfork_cb (void *opaque, int where) } +static void * +wait_child_thread (void *arg) +{ + int err; + struct scd_local_s *sl; + +#ifdef HAVE_W32_SYSTEM + HANDLE pid = (HANDLE)arg; + + npth_unprotect (); + WaitForSingleObject ((HANDLE)pid, INFINITE); + npth_protect (); +#else + int wstatus; + pid_t pid = (pid_t)(uintptr_t)arg; + + again: + npth_unprotect (); + err = waitpid (pid, &wstatus, 0); + npth_protect (); + + if (err < 0) + { + if (errno == EINTR) + goto again; + log_error ("waitpid failed: %s\n", strerror (errno)); + return NULL; + } + else + { + if (WIFEXITED (wstatus)) + log_info ("scdaemon finished (status %d)\n", WEXITSTATUS (wstatus)); + else if (WIFSIGNALED (wstatus)) + log_info ("scdaemon killed by signal %d\n", WTERMSIG (wstatus)); + else + { + if (WIFSTOPPED (wstatus)) + log_info ("scdaemon stopped by signal %d\n", WSTOPSIG (wstatus)); + goto again; + } + } +#endif + + err = npth_mutex_lock (&start_scd_lock); + if (err) + { + log_error ("failed to acquire the start_scd lock: %s\n", + strerror (err)); + } + else + { + assuan_set_flag (primary_scd_ctx, ASSUAN_NO_WAITPID, 1); + + for (sl = scd_local_list; sl; sl = sl->next_local) + { + sl->invalid = 1; + if (!sl->in_use && sl->ctx) + { + assuan_release (sl->ctx); + sl->ctx = NULL; + } + } + + primary_scd_ctx = NULL; + primary_scd_ctx_reusable = 0; + + xfree (socket_name); + socket_name = NULL; + + err = npth_mutex_unlock (&start_scd_lock); + if (err) + log_error ("failed to release the start_scd lock while" + " doing the aliveness check: %s\n", strerror (err)); + } + + return NULL; +} + + /* Fork off the SCdaemon if this has not already been done. Lock the daemon and make sure that a proper context has been setup in CTRL. This function might also lock the daemon, which means that the @@ -427,6 +506,24 @@ start_scd (ctrl_t ctrl) primary_scd_ctx = ctx; primary_scd_ctx_reusable = 0; + { + npth_t thread; + npth_attr_t tattr; + pid_t pid; + + pid = assuan_get_pid (primary_scd_ctx); + err = npth_attr_init (&tattr); + if (!err) + { + npth_attr_setdetachstate (&tattr, NPTH_CREATE_DETACHED); + err = npth_create (&thread, &tattr, wait_child_thread, + (void *)(uintptr_t)pid); + if (err) + log_error ("error spawning wait_child_thread: %s\n", strerror (err)); + npth_attr_destroy (&tattr); + } + } + leave: xfree (abs_homedir); if (err) @@ -456,91 +553,6 @@ agent_scd_check_running (void) } -/* Check whether the Scdaemon is still alive and clean it up if not. */ -void -agent_scd_check_aliveness (void) -{ - pid_t pid; -#ifdef HAVE_W32_SYSTEM - DWORD rc; -#else - int rc; -#endif - struct timespec abstime; - int err; - - if (!primary_scd_ctx) - return; /* No scdaemon running. */ - - /* This is not a critical function so we use a short timeout while - acquiring the lock. */ - npth_clock_gettime (&abstime); - abstime.tv_sec += 1; - err = npth_mutex_timedlock (&start_scd_lock, &abstime); - if (err) - { - if (err == ETIMEDOUT) - { - if (opt.verbose > 1) - log_info ("failed to acquire the start_scd lock while" - " doing an aliveness check: %s\n", strerror (err)); - } - else - log_error ("failed to acquire the start_scd lock while" - " doing an aliveness check: %s\n", strerror (err)); - return; - } - - if (primary_scd_ctx) - { - pid = assuan_get_pid (primary_scd_ctx); -#ifdef HAVE_W32_SYSTEM - /* If we have a PID we disconnect if either GetExitProcessCode - fails or if ir returns the exit code of the scdaemon. 259 is - the error code for STILL_ALIVE. */ - if (pid != (pid_t)(void*)(-1) && pid - && (!GetExitCodeProcess ((HANDLE)pid, &rc) || rc != 259)) -#else - if (pid != (pid_t)(-1) && pid - && ((rc=waitpid (pid, NULL, WNOHANG))==-1 || (rc == pid)) ) -#endif - { - /* Okay, scdaemon died. Disconnect the primary connection - now but take care that it won't do another wait. Also - cleanup all other connections and release their - resources. The next use will start a new daemon then. - Due to the use of the START_SCD_LOCK we are sure that - none of these context are actually in use. */ - struct scd_local_s *sl; - - assuan_set_flag (primary_scd_ctx, ASSUAN_NO_WAITPID, 1); - - for (sl=scd_local_list; sl; sl = sl->next_local) - { - sl->invalid = 1; - if (!sl->in_use && sl->ctx) - { - assuan_release (sl->ctx); - sl->ctx = NULL; - } - } - - primary_scd_ctx = NULL; - primary_scd_ctx_reusable = 0; - - xfree (socket_name); - socket_name = NULL; - } - } - - err = npth_mutex_unlock (&start_scd_lock); - if (err) - log_error ("failed to release the start_scd lock while" - " doing the aliveness check: %s\n", strerror (err)); -} - - - /* Reset the SCD if it has been used. Actually it is not a reset but a cleanup of resources used by the current connection. */ int diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index 911064c..de6947d 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -2370,9 +2370,6 @@ handle_tick (void) if (!last_minute) last_minute = time (NULL); - /* Check whether the scdaemon has died and cleanup in this case. */ - agent_scd_check_aliveness (); - /* If we are running as a child of another process, check whether the parent is still alive and shutdown if not. */ #ifndef HAVE_W32_SYSTEM commit 9fb3f0f3f79e74166cce8e0781e97043f25890cc Author: NIIBE Yutaka Date: Mon Nov 26 11:05:28 2018 +0900 agent: Defer calling assuan_release when it's still in use. * agent/call-scd.c (struct scd_local_s): Remove LOCK, introduce IN_USE and INVALID flags. (unlock_scd): Call assuan_release when CTX is invalid. (start_scd): Set IN_USE. (agent_scd_check_aliveness): Don't call assuan_release when it's in use. Signed-off-by: NIIBE Yutaka diff --git a/agent/call-scd.c b/agent/call-scd.c index 954be02..592ddb9 100644 --- a/agent/call-scd.c +++ b/agent/call-scd.c @@ -54,11 +54,10 @@ struct scd_local_s SCD_LOCAL_LIST (see below). */ struct scd_local_s *next_local; - assuan_context_t ctx; /* NULL or session context for the SCdaemon - used with this connection. */ - int locked; /* This flag is used to assert proper use of - start_scd and unlock_scd. */ - + assuan_context_t ctx; /* NULL or session context for the SCdaemon + used with this connection. */ + unsigned int in_use: 1; /* CTX is in use. */ + unsigned int invalid:1; /* CTX is invalid, should be released. */ }; @@ -132,7 +131,7 @@ initialize_module_call_scd (void) { err = npth_mutex_init (&start_scd_lock, NULL); if (err) - log_fatal ("error initializing mutex: %s\n", strerror (err)); + log_fatal ("error initializing mutex: %s\n", strerror (err)); initialized = 1; } } @@ -162,14 +161,37 @@ agent_scd_dump_state (void) static int unlock_scd (ctrl_t ctrl, int rc) { - if (ctrl->scd_local->locked != 1) + int err; + + if (ctrl->scd_local->in_use == 0) { - log_error ("unlock_scd: invalid lock count (%d)\n", - ctrl->scd_local->locked); + log_error ("unlock_scd: CTX is not in use\n"); if (!rc) rc = gpg_error (GPG_ERR_INTERNAL); } - ctrl->scd_local->locked = 0; + ctrl->scd_local->in_use = 0; + if (ctrl->scd_local->invalid) + { + err = npth_mutex_lock (&start_scd_lock); + if (err) + { + log_error ("failed to acquire the start_scd lock: %s\n", + strerror (err)); + return gpg_error (GPG_ERR_INTERNAL); + } + + assuan_release (ctrl->scd_local->ctx); + ctrl->scd_local->ctx = NULL; + + err = npth_mutex_unlock (&start_scd_lock); + if (err) + { + log_error ("failed to release the start_scd lock: %s\n", + strerror (err)); + return gpg_error (GPG_ERR_INTERNAL); + } + } + ctrl->scd_local->invalid = 0; return rc; } @@ -216,15 +238,12 @@ start_scd (ctrl_t ctrl) scd_local_list = ctrl->scd_local; } - - /* Assert that the lock count is as expected. */ - if (ctrl->scd_local->locked) + if (ctrl->scd_local->in_use) { - log_error ("start_scd: invalid lock count (%d)\n", - ctrl->scd_local->locked); + log_error ("start_scd: CTX is in use\n"); return gpg_error (GPG_ERR_INTERNAL); } - ctrl->scd_local->locked++; + ctrl->scd_local->in_use = 1; if (ctrl->scd_local->ctx) return 0; /* Okay, the context is fine. We used to test for an @@ -344,7 +363,7 @@ start_scd (ctrl_t ctrl) detached flag so that under Windows SCDAEMON does not show up a new window. */ rc = assuan_pipe_connect (ctx, opt.scdaemon_program, argv, - no_close_list, atfork_cb, NULL, + no_close_list, atfork_cb, NULL, ASSUAN_PIPE_CONNECT_DETACHED); if (rc) { @@ -414,7 +433,7 @@ start_scd (ctrl_t ctrl) { unlock_scd (ctrl, err); if (ctx) - assuan_release (ctx); + assuan_release (ctx); } else { @@ -495,14 +514,13 @@ agent_scd_check_aliveness (void) struct scd_local_s *sl; assuan_set_flag (primary_scd_ctx, ASSUAN_NO_WAITPID, 1); - assuan_release (primary_scd_ctx); for (sl=scd_local_list; sl; sl = sl->next_local) { - if (sl->ctx) + sl->invalid = 1; + if (!sl->in_use && sl->ctx) { - if (sl->ctx != primary_scd_ctx) - assuan_release (sl->ctx); + assuan_release (sl->ctx); sl->ctx = NULL; } } commit f45d6124696cc92ccdec09841b8182679c377997 Author: NIIBE Yutaka Date: Mon Nov 26 10:37:02 2018 +0900 agent: Clean up SCDaemon management. * agent/call-scd.c (struct scd_local_s): Remove ctrl_backlink. (start_scd): Don't assign to the field. (agent_scd_check_aliveness): Fix typo in comment. Signed-off-by: NIIBE Yutaka diff --git a/agent/call-scd.c b/agent/call-scd.c index 51d9abd..954be02 100644 --- a/agent/call-scd.c +++ b/agent/call-scd.c @@ -54,12 +54,6 @@ struct scd_local_s SCD_LOCAL_LIST (see below). */ struct scd_local_s *next_local; - /* We need to get back to the ctrl object actually referencing this - structure. This is really an awkward way of enumerating the local - contexts. A much cleaner way would be to keep a global list of - ctrl objects to enumerate them. */ - ctrl_t ctrl_backlink; - assuan_context_t ctx; /* NULL or session context for the SCdaemon used with this connection. */ int locked; /* This flag is used to assert proper use of @@ -218,7 +212,6 @@ start_scd (ctrl_t ctrl) ctrl->scd_local = xtrycalloc (1, sizeof *ctrl->scd_local); if (!ctrl->scd_local) return gpg_error_from_syserror (); - ctrl->scd_local->ctrl_backlink = ctrl; ctrl->scd_local->next_local = scd_local_list; scd_local_list = ctrl->scd_local; } @@ -497,7 +490,7 @@ agent_scd_check_aliveness (void) now but take care that it won't do another wait. Also cleanup all other connections and release their resources. The next use will start a new daemon then. - Due to the use of the START_SCD_LOCAL we are sure that + Due to the use of the START_SCD_LOCK we are sure that none of these context are actually in use. */ struct scd_local_s *sl; ----------------------------------------------------------------------- Summary of changes: agent/agent.h | 1 - agent/call-scd.c | 245 +++++++++++++++++++++++++++++------------------------- agent/gpg-agent.c | 3 - 3 files changed, 134 insertions(+), 115 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 26 13:07:30 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Mon, 26 Nov 2018 13:07:30 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-286-gf12fcd9 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via f12fcd907903742bde3ebb7ffef244c92d6d1611 (commit) from 40c7923ea881881a48de8f303b0870ec5910e13d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f12fcd907903742bde3ebb7ffef244c92d6d1611 Author: Andre Heinecke Date: Mon Nov 26 13:05:26 2018 +0100 w32: Fix linkage of gpg-pair-tool * tools/Makefile.am (gpg_pair_tool_LDADD): Add W32SOCKLIBS. -- This is required because parts of libcommon depend on ws2_32. diff --git a/tools/Makefile.am b/tools/Makefile.am index 196bf52..e4fd81c 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -174,7 +174,7 @@ gpg_pair_tool_SOURCES = \ gpg_pair_tool_CFLAGS = $(GPG_ERROR_CFLAGS) $(INCICONV) gpg_pair_tool_LDADD = $(libcommon) \ $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) \ - $(LIBINTL) $(LIBICONV) + $(LIBINTL) $(LIBICONV) $(W32SOCKLIBS) # Make sure that all libs are build before we use them. This is ----------------------------------------------------------------------- Summary of changes: tools/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 26 14:42:04 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Mon, 26 Nov 2018 14:42:04 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-2.3.2-6-g0193956 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 019395666f179b975341dfce76ae3b7a3867b2fe (commit) via 572420273d97b79157cc4b9be8f45e431f8df284 (commit) from e8c7a5285420acd86ac97143747b78b6934151b3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 019395666f179b975341dfce76ae3b7a3867b2fe Author: Andre Heinecke Date: Mon Nov 26 14:41:24 2018 +0100 Fix two memdbg refcount errors * src/mapihelp.cpp (is_really_cms_encrypted): Fix references. -- This code is almost never run so that did not happen before. diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp index 3949ea3..acd28c8 100644 --- a/src/mapihelp.cpp +++ b/src/mapihelp.cpp @@ -856,7 +856,8 @@ is_really_cms_encrypted (LPMESSAGE message) SRCNAME, __func__, hr); TRETURN -1; } - + memdbg_addRef (mapitable); + hr = HrQueryAllRows (mapitable, (LPSPropTagArray)&propAttNum, NULL, NULL, 0, &mapirows); if (FAILED (hr)) @@ -916,6 +917,7 @@ is_really_cms_encrypted (LPMESSAGE message) goto leave; } + memdbg_addRef (stream); hr = stream->Read (buffer, sizeof buffer, &nread); if ( hr != S_OK ) { commit 572420273d97b79157cc4b9be8f45e431f8df284 Author: Andre Heinecke Date: Mon Nov 26 14:15:45 2018 +0100 Avoid use of error msg class "IPM.Note.GpgOL" * src/mapihelp.cpp (change_message_class_ipm_note_secure_cex), (change_message_class_ipm_note_smime): Use OpaqueEncrypted rather then IPM.Note.GpgOL. (mapi_change_message_class): Change old IPM.Note.GpgOL mails. -- This should help debugging GnuPG-Bug-Id: T4267 And in any case IPM.Note.GpgOL should never be used as we do not handle it in decryption. diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp index 4a1d532..3949ea3 100644 --- a/src/mapihelp.cpp +++ b/src/mapihelp.cpp @@ -1248,7 +1248,7 @@ change_message_class_ipm_note_smime (LPMESSAGE message) /* If we did not found anything but let's change the class anyway. */ if (!newvalue && opt.enable_smime) - newvalue = xstrdup ("IPM.Note.GpgOL"); + newvalue = xstrdup ("IPM.Note.GpgOL.OpaqueEncrypted"); TRETURN newvalue; } @@ -1412,7 +1412,7 @@ change_message_class_ipm_note_secure_cex (LPMESSAGE message, int is_cexenc) } if (!newvalue) - newvalue = xstrdup ("IPM.Note.GpgOL"); + newvalue = xstrdup ("IPM.Note.GpgOL.OpaqueEncrypted"); TRETURN newvalue; } @@ -1528,7 +1528,8 @@ mapi_change_message_class (LPMESSAGE message, int sync_override, { newvalue = change_message_class_ipm_note (message); } - else if (opt.enable_smime && !strcmp (s, "IPM.Note.SMIME")) + else if (opt.enable_smime && (!strcmp (s, "IPM.Note.SMIME") || + !strcmp (s, "IPM.Note.GpgOL"))) { newvalue = change_message_class_ipm_note_smime (message); } ----------------------------------------------------------------------- Summary of changes: src/mapihelp.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 26 20:22:53 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 26 Nov 2018 20:22:53 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.32-57-gbd8668c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via bd8668c120ac0f725edb092b2c4ca49ffdb78ed2 (commit) via ffb49b72f132d954a3d9fa11e45803c36a62fd25 (commit) from a5d4a4b32b11814d673241d62624ecec1d577571 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bd8668c120ac0f725edb092b2c4ca49ffdb78ed2 Author: Werner Koch Date: Mon Nov 26 20:22:24 2018 +0100 core: New functions gpgrt_fprintf_sf anf gpgrt_fprintf_sf_unlocked. * src/gpg-error.h.in (gpgrt_string_filter_t): New type. (gpgrt_fprintf_sf, gpgrt_fprintf_sf_unlocked): New. * src/gpg-error.vers, src/gpg-error.def.in: Add them. * src/visibility.c (gpgrt_fprintf_sf): New. (gpgrt_fprintf_sf_unlocked): New. * src/estream-printf.c (pr_string): Add and use args sf, sfvalue and string_no. (do_format): Add args sf and sfvalue. Keep a string format counter. (_gpgrt_estream_format): Add args sf and sfvalue. Change all callers to provide NULL for them. * src/estream.c (_gpgrt_vfprintf_unlocked, _gpgrt_vfprintf): Add sf and sfvalue and adjust all callers. (do_print_stream): Ditto. * tests/t-printf.c (stream_to_string): New. (struct sfstate_s): New. (string_filter): New. (check_fprintf_sf): New. (main): Call new test. -- The actual reason to implement these functions is to enhance the internal logging function with a filter to sanitized strings so that control values or other things can be quoted. Signed-off-by: Werner Koch diff --git a/NEWS b/NEWS index f1facf4..5804819 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,10 @@ Noteworthy changes in version 1.33 (unreleased) [C24/A24/R_] * Interface changes relative to the 1.28 release: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gpgrt_cmp_version New. + gpgrt_ftruncate New but limited functionality. + gpgrt_string_filter_t New. + gpgrt_fprintf_sf New. + gpgrt_fprintf_sf_unlocked New. Noteworthy changes in version 1.32 (2018-07-12) [C24/A24/R3] diff --git a/src/estream-printf.c b/src/estream-printf.c index eb6fa3a..b9775a6 100644 --- a/src/estream-printf.c +++ b/src/estream-printf.c @@ -1196,7 +1196,8 @@ pr_char (estream_printf_out_t outfnc, void *outfncarg, /* "s" formatting. */ static int pr_string (estream_printf_out_t outfnc, void *outfncarg, - argspec_t arg, value_t value, size_t *nbytes) + argspec_t arg, value_t value, size_t *nbytes, + gpgrt_string_filter_t sf, void *sfvalue, int string_no) { int rc; size_t n; @@ -1205,6 +1206,11 @@ pr_string (estream_printf_out_t outfnc, void *outfncarg, if (arg->vt != VALTYPE_STRING) return -1; string = value.a_string; + if (sf) + string = sf (value.a_string, string_no, sfvalue); + else + string = value.a_string; + if (!string) string = "(null)"; if (arg->precision >= 0) @@ -1222,12 +1228,12 @@ pr_string (estream_printf_out_t outfnc, void *outfncarg, { rc = pad_out (outfnc, outfncarg, ' ', arg->width - n, nbytes); if (rc) - return rc; + goto leave; } rc = outfnc (outfncarg, string, n); if (rc) - return rc; + goto leave; *nbytes += n; if ((arg->flags & FLAG_LEFT_JUST) @@ -1235,10 +1241,16 @@ pr_string (estream_printf_out_t outfnc, void *outfncarg, { rc = pad_out (outfnc, outfncarg, ' ', arg->width - n, nbytes); if (rc) - return rc; + goto leave; } - return 0; + rc = 0; + + leave: + if (sf) /* Tell the filter to release resources. */ + sf (value.a_string, -1, sfvalue); + + return rc; } @@ -1337,14 +1349,18 @@ pr_bytes_so_far (estream_printf_out_t outfnc, void *outfncarg, /* Run the actual formatting. OUTFNC and OUTFNCARG are the output - functions. FORMAT is format string ARGSPECS is the parsed format - string, ARGSPECS_LEN the number of items in ARGSPECS. VALUETABLE - holds the values and may be directly addressed using the position - arguments given by ARGSPECS. MYERRNO is used for the "%m" - conversion. NBYTES well be updated to reflect the number of bytes - send to the output function. */ + * functions. FORMAT is format string ARGSPECS is the parsed format + * string, ARGSPECS_LEN the number of items in ARGSPECS. + * STRING_FILTER is an optional function to filter string (%s) args; + * it is called with the original string and the count of already + * processed %s arguments. Its return value will be used instead of + * the original string. VALUETABLE holds the values and may be + * directly addressed using the position arguments given by ARGSPECS. + * MYERRNO is used for the "%m" conversion. NBYTES well be updated to + * reflect the number of bytes send to the output function. */ static int do_format (estream_printf_out_t outfnc, void *outfncarg, + gpgrt_string_filter_t sf, void *sfvalue, const char *format, argspec_t argspecs, size_t argspecs_len, valueitem_t valuetable, int myerrno, size_t *nbytes) { @@ -1354,6 +1370,7 @@ do_format (estream_printf_out_t outfnc, void *outfncarg, int argidx = 0; /* Only used for assertion. */ size_t n; value_t value; + int string_no = 0; /* Number of processed "%s" args. */ s = format; while ( *s ) @@ -1443,8 +1460,12 @@ do_format (estream_printf_out_t outfnc, void *outfncarg, rc = pr_char (outfnc, outfncarg, arg, value, nbytes); break; case CONSPEC_STRING: + rc = pr_string (outfnc, outfncarg, arg, value, nbytes, + sf, sfvalue, string_no++); + break; case CONSPEC_STRERROR: - rc = pr_string (outfnc, outfncarg, arg, value, nbytes); + rc = pr_string (outfnc, outfncarg, arg, value, nbytes, + NULL, NULL, 0); break; case CONSPEC_POINTER: rc = pr_pointer (outfnc, outfncarg, arg, value, nbytes); @@ -1478,6 +1499,7 @@ do_format (estream_printf_out_t outfnc, void *outfncarg, int _gpgrt_estream_format (estream_printf_out_t outfnc, void *outfncarg, + gpgrt_string_filter_t sf, void *sfvalue, const char *format, va_list vaargs) { /* Buffer to hold the argspecs and a pointer to it.*/ @@ -1489,10 +1511,10 @@ _gpgrt_estream_format (estream_printf_out_t outfnc, struct valueitem_s valuetable_buffer[DEFAULT_MAX_VALUES]; valueitem_t valuetable = valuetable_buffer; - int rc; /* Return code. */ + int rc; /* Return code. */ size_t argidx; /* Used to index the argspecs array. */ size_t validx; /* Used to index the valuetable. */ - int max_pos;/* Highest argument position. */ + int max_pos; /* Highest argument position. */ size_t nbytes = 0; /* Keep track of the number of bytes passed to the output function. */ @@ -1606,7 +1628,7 @@ _gpgrt_estream_format (estream_printf_out_t outfnc, /* fprintf (stderr, "%2d: vt=%d\n", validx, valuetable[validx].vt); */ /* Everything has been collected, go ahead with the formatting. */ - rc = do_format (outfnc, outfncarg, format, + rc = do_format (outfnc, outfncarg, sf, sfvalue, format, argspecs, argspecs_len, valuetable, myerrno, &nbytes); goto leave; @@ -1646,7 +1668,8 @@ _gpgrt_estream_printf (const char *format, ...) va_list arg_ptr; va_start (arg_ptr, format); - rc = _gpgrt_estream_format (plain_stdio_out, stderr, format, arg_ptr); + rc = _gpgrt_estream_format (plain_stdio_out, stderr, NULL, NULL, + format, arg_ptr); va_end (arg_ptr); return rc; @@ -1660,7 +1683,8 @@ _gpgrt_estream_fprintf (FILE *fp, const char *format, ...) va_list arg_ptr; va_start (arg_ptr, format); - rc = _gpgrt_estream_format (plain_stdio_out, fp, format, arg_ptr); + rc = _gpgrt_estream_format (plain_stdio_out, fp, NULL, NULL, + format, arg_ptr); va_end (arg_ptr); return rc; @@ -1670,7 +1694,8 @@ _gpgrt_estream_fprintf (FILE *fp, const char *format, ...) int _gpgrt_estream_vfprintf (FILE *fp, const char *format, va_list arg_ptr) { - return _gpgrt_estream_format (plain_stdio_out, fp, format, arg_ptr); + return _gpgrt_estream_format (plain_stdio_out, fp, NULL, NULL, + format, arg_ptr); } @@ -1725,7 +1750,8 @@ _gpgrt_estream_vsnprintf (char *buf, size_t bufsize, parm.count = 0; parm.used = 0; parm.buffer = bufsize?buf:NULL; - rc = _gpgrt_estream_format (fixed_buffer_out, &parm, format, arg_ptr); + rc = _gpgrt_estream_format (fixed_buffer_out, &parm, NULL, NULL, + format, arg_ptr); if (!rc) rc = fixed_buffer_out (&parm, "", 1); /* Print terminating Nul. */ if (rc == -1) @@ -1820,7 +1846,8 @@ _gpgrt_estream_vasprintf (char **bufp, const char *format, va_list arg_ptr) return -1; } - rc = _gpgrt_estream_format (dynamic_buffer_out, &parm, format, arg_ptr); + rc = _gpgrt_estream_format (dynamic_buffer_out, &parm, NULL, NULL, + format, arg_ptr); if (!rc) rc = dynamic_buffer_out (&parm, "", 1); /* Print terminating Nul. */ /* Fixme: Should we shrink the resulting buffer? */ diff --git a/src/estream-printf.h b/src/estream-printf.h index ae303a7..69c7052 100644 --- a/src/estream-printf.h +++ b/src/estream-printf.h @@ -124,8 +124,10 @@ typedef int (*estream_printf_out_t) (void *outfncarg, const char *buf, size_t buflen); int _gpgrt_estream_format (estream_printf_out_t outfnc, void *outfncarg, + char *(*string_filter)(const char *s,int n,void*st), + void *string_filter_state, const char *format, va_list vaargs) - _ESTREAM_GCC_A_PRINTF(3,0); + _ESTREAM_GCC_A_PRINTF(5,0); int _gpgrt_estream_printf (const char *format, ...) _ESTREAM_GCC_A_PRINTF(1,2); int _gpgrt_estream_fprintf (FILE *fp, const char *format, ... ) diff --git a/src/estream.c b/src/estream.c index 72e93e0..3645dfe 100644 --- a/src/estream.c +++ b/src/estream.c @@ -2982,12 +2982,13 @@ print_writer (void *outfncarg, const char *buf, size_t buflen) /* The core of our printf function. This is called in locked state. */ static int do_print_stream (estream_t _GPGRT__RESTRICT stream, + gpgrt_string_filter_t sf, void *sfvalue, const char *_GPGRT__RESTRICT format, va_list ap) { int rc; stream->intern->print_ntotal = 0; - rc = _gpgrt_estream_format (print_writer, stream, format, ap); + rc = _gpgrt_estream_format (print_writer, stream, sf, sfvalue, format, ap); if (rc) return -1; return (int)stream->intern->print_ntotal; @@ -4444,22 +4445,24 @@ _gpgrt_read_line (estream_t stream, int _gpgrt_vfprintf_unlocked (estream_t _GPGRT__RESTRICT stream, + gpgrt_string_filter_t sf, void *sfvalue, const char *_GPGRT__RESTRICT format, va_list ap) { - return do_print_stream (stream, format, ap); + return do_print_stream (stream, sf, sfvalue, format, ap); } int _gpgrt_vfprintf (estream_t _GPGRT__RESTRICT stream, + gpgrt_string_filter_t sf, void *sfvalue, const char *_GPGRT__RESTRICT format, va_list ap) { int ret; lock_stream (stream); - ret = do_print_stream (stream, format, ap); + ret = do_print_stream (stream, sf, sfvalue, format, ap); unlock_stream (stream); return ret; @@ -4474,7 +4477,7 @@ _gpgrt_fprintf_unlocked (estream_t _GPGRT__RESTRICT stream, va_list ap; va_start (ap, format); - ret = do_print_stream (stream, format, ap); + ret = do_print_stream (stream, NULL, NULL, format, ap); va_end (ap); return ret; @@ -4490,7 +4493,7 @@ _gpgrt_fprintf (estream_t _GPGRT__RESTRICT stream, va_list ap; va_start (ap, format); lock_stream (stream); - ret = do_print_stream (stream, format, ap); + ret = do_print_stream (stream, NULL, NULL, format, ap); unlock_stream (stream); va_end (ap); diff --git a/src/gpg-error.def.in b/src/gpg-error.def.in index 9b522ea..f03a7e3 100644 --- a/src/gpg-error.def.in +++ b/src/gpg-error.def.in @@ -221,5 +221,8 @@ EXPORTS gpgrt_cmp_version @169 gpgrt_ftruncate @170 + gpgrt_fprintf_sf @171 + gpgrt_fprintf_sf_unlocked @172 + ;; end of file with public symbols for Windows. diff --git a/src/gpg-error.h.in b/src/gpg-error.h.in index c0ac0eb..cb32c48 100644 --- a/src/gpg-error.h.in +++ b/src/gpg-error.h.in @@ -644,6 +644,11 @@ typedef struct _gpgrt_poll_s gpgrt_poll_t; typedef struct _gpgrt_poll_s es_poll_t; #endif +/* The type of the string filter function as used by fprintf_sf et al. */ +typedef char *(*gpgrt_string_filter_t) (const char *s, int n, void *opaque); + + + gpgrt_stream_t gpgrt_fopen (const char *_GPGRT__RESTRICT path, const char *_GPGRT__RESTRICT mode); gpgrt_stream_t gpgrt_mopen (void *_GPGRT__RESTRICT data, @@ -783,6 +788,15 @@ int gpgrt_fprintf_unlocked (gpgrt_stream_t _GPGRT__RESTRICT stream, const char *_GPGRT__RESTRICT format, ...) GPGRT_ATTR_PRINTF(2,3); +int gpgrt_fprintf_sf (gpgrt_stream_t _GPGRT__RESTRICT stream, + gpgrt_string_filter_t sf, void *sfvalue, + const char *_GPGRT__RESTRICT format, + ...) GPGRT_ATTR_PRINTF(4,5); +int gpgrt_fprintf_sf_unlocked (gpgrt_stream_t _GPGRT__RESTRICT stream, + gpgrt_string_filter_t sf, void *sfvalue, + const char *_GPGRT__RESTRICT format, + ...) GPGRT_ATTR_PRINTF(4,5); + int gpgrt_printf (const char *_GPGRT__RESTRICT format, ...) GPGRT_ATTR_PRINTF(1,2); int gpgrt_printf_unlocked (const char *_GPGRT__RESTRICT format, ...) diff --git a/src/gpg-error.vers b/src/gpg-error.vers index f9524d7..105e3bb 100644 --- a/src/gpg-error.vers +++ b/src/gpg-error.vers @@ -193,6 +193,9 @@ GPG_ERROR_1.0 { gpgrt_cmp_version; gpgrt_ftruncate; + gpgrt_fprintf_sf; + gpgrt_fprintf_sf_unlocked; + local: *; }; diff --git a/src/gpgrt-int.h b/src/gpgrt-int.h index 09aad11..e326400 100644 --- a/src/gpgrt-int.h +++ b/src/gpgrt-int.h @@ -435,11 +435,13 @@ int _gpgrt_fprintf_unlocked (gpgrt_stream_t _GPGRT__RESTRICT stream, GPGRT_ATTR_PRINTF(2,3); int _gpgrt_vfprintf (gpgrt_stream_t _GPGRT__RESTRICT stream, + gpgrt_string_filter_t sf, void *sfvalue, const char *_GPGRT__RESTRICT format, va_list ap) - GPGRT_ATTR_PRINTF(2,0); + GPGRT_ATTR_PRINTF(4,0); int _gpgrt_vfprintf_unlocked (gpgrt_stream_t _GPGRT__RESTRICT stream, + gpgrt_string_filter_t sf, void *sfvalue, const char *_GPGRT__RESTRICT format, va_list ap) - GPGRT_ATTR_PRINTF(2,0); + GPGRT_ATTR_PRINTF(4,0); int _gpgrt_setvbuf (gpgrt_stream_t _GPGRT__RESTRICT stream, char *_GPGRT__RESTRICT buf, int mode, size_t size); diff --git a/src/logging.c b/src/logging.c index d01f974..51e1362 100644 --- a/src/logging.c +++ b/src/logging.c @@ -839,7 +839,7 @@ _gpgrt_logv_internal (int level, int ignore_arg_ptr, const char *extrastring, } else { - rc = _gpgrt_vfprintf_unlocked (logstream, fmt, arg_ptr); + rc = _gpgrt_vfprintf_unlocked (logstream, NULL, NULL, fmt, arg_ptr); if (rc > 0) length += rc; } diff --git a/src/visibility.c b/src/visibility.c index 1947111..573a5a4 100644 --- a/src/visibility.c +++ b/src/visibility.c @@ -515,7 +515,7 @@ gpgrt_vfprintf (estream_t _GPGRT__RESTRICT stream, const char *_GPGRT__RESTRICT format, va_list ap) { - return _gpgrt_vfprintf (stream, format, ap); + return _gpgrt_vfprintf (stream, NULL, NULL, format, ap); } int @@ -523,7 +523,7 @@ gpgrt_vfprintf_unlocked (estream_t _GPGRT__RESTRICT stream, const char *_GPGRT__RESTRICT format, va_list ap) { - return _gpgrt_vfprintf_unlocked (stream, format, ap); + return _gpgrt_vfprintf_unlocked (stream, NULL, NULL, format, ap); } int @@ -533,7 +533,7 @@ gpgrt_printf (const char *_GPGRT__RESTRICT format, ...) int rc; va_start (ap, format); - rc = _gpgrt_vfprintf (es_stdout, format, ap); + rc = _gpgrt_vfprintf (es_stdout, NULL, NULL, format, ap); va_end (ap); return rc; @@ -546,7 +546,7 @@ gpgrt_printf_unlocked (const char *_GPGRT__RESTRICT format, ...) int rc; va_start (ap, format); - rc = _gpgrt_vfprintf_unlocked (es_stdout, format, ap); + rc = _gpgrt_vfprintf_unlocked (es_stdout, NULL, NULL, format, ap); va_end (ap); return rc; @@ -560,7 +560,7 @@ gpgrt_fprintf (estream_t _GPGRT__RESTRICT stream, int rc; va_start (ap, format); - rc = _gpgrt_vfprintf (stream, format, ap); + rc = _gpgrt_vfprintf (stream, NULL, NULL, format, ap); va_end (ap); return rc; @@ -574,7 +574,37 @@ gpgrt_fprintf_unlocked (estream_t _GPGRT__RESTRICT stream, int rc; va_start (ap, format); - rc = _gpgrt_vfprintf_unlocked (stream, format, ap); + rc = _gpgrt_vfprintf_unlocked (stream, NULL, NULL, format, ap); + va_end (ap); + + return rc; +} + +int +gpgrt_fprintf_sf (estream_t _GPGRT__RESTRICT stream, + gpgrt_string_filter_t sf, void *sfvalue, + const char *_GPGRT__RESTRICT format, ...) +{ + va_list ap; + int rc; + + va_start (ap, format); + rc = _gpgrt_vfprintf (stream, sf, sfvalue, format, ap); + va_end (ap); + + return rc; +} + +int +gpgrt_fprintf_sf_unlocked (estream_t _GPGRT__RESTRICT stream, + gpgrt_string_filter_t sf, void *sfvalue, + const char *_GPGRT__RESTRICT format, ...) +{ + va_list ap; + int rc; + + va_start (ap, format); + rc = _gpgrt_vfprintf_unlocked (stream, sf, sfvalue, format, ap); va_end (ap); return rc; diff --git a/src/visibility.h b/src/visibility.h index 46383c7..2dde522 100644 --- a/src/visibility.h +++ b/src/visibility.h @@ -121,6 +121,8 @@ MARK_VISIBLE (gpgrt_getline) MARK_VISIBLE (gpgrt_read_line) MARK_VISIBLE (gpgrt_fprintf) MARK_VISIBLE (gpgrt_fprintf_unlocked) +MARK_VISIBLE (gpgrt_fprintf_sf) +MARK_VISIBLE (gpgrt_fprintf_sf_unlocked) MARK_VISIBLE (gpgrt_printf) MARK_VISIBLE (gpgrt_printf_unlocked) MARK_VISIBLE (gpgrt_vfprintf) @@ -296,6 +298,8 @@ MARK_VISIBLE (gpgrt_cmp_version); #define gpgrt_read_line _gpgrt_USE_UNDERSCORED_FUNCTION #define gpgrt_fprintf _gpgrt_USE_UNDERSCORED_FUNCTION #define gpgrt_fprintf_unlocked _gpgrt_USE_UNDERSCORED_FUNCTION +#define gpgrt_fprintf_sf _gpgrt_USE_UNDERSCORED_FUNCTION +#define gpgrt_fprintf_sf_unlocked _gpgrt_USE_UNDERSCORED_FUNCTION #define gpgrt_printf _gpgrt_USE_UNDERSCORED_FUNCTION #define gpgrt_printf_unlocked _gpgrt_USE_UNDERSCORED_FUNCTION #define gpgrt_vfprintf _gpgrt_USE_UNDERSCORED_FUNCTION diff --git a/tests/t-printf.c b/tests/t-printf.c index 7fba012..1e4d393 100644 --- a/tests/t-printf.c +++ b/tests/t-printf.c @@ -40,6 +40,49 @@ static char *one_test_buf1; static int one_test_rc1; + + + +/* Read all data from STREAM into a new malloced buffer and return + * that buffer. The buffer is always 0 terminated. Either returns a + * string or dies. The stream will be trunctaed to zero. */ +static char * +stream_to_string (gpgrt_stream_t stream) +{ +#define NCHUNK 1024 + char *buffer; + size_t bufsize, buflen; + size_t nread; + + gpgrt_rewind (stream); + + buffer = NULL; + buflen = bufsize = 0; + do + { + bufsize += NCHUNK; + buffer = realloc (buffer, bufsize+1); + if (!buffer) + die ("malloc failed at line %d\n", __LINE__); + + nread = gpgrt_fread (buffer + buflen, 1, NCHUNK, stream); + if (nread < NCHUNK && gpgrt_ferror (stream)) + die ("fread failed at line %d: %s\n", __LINE__, strerror (errno)); + buflen += nread; + } + while (nread == NCHUNK); + buffer[nread] = 0; + + if (strlen (buffer) != buflen) + fail ("stream_to_string detected an embedded nul"); + + gpgrt_ftruncate (stream, 0); + return buffer; +#undef NCHUNK +} + + + static void one_test_x0 (const char *format, ...) { @@ -375,6 +418,74 @@ check_snprintf (void) } +struct sfstate_s +{ + char *last_result; +}; + +static char * +string_filter (const char *string, int no, void *opaque) +{ + struct sfstate_s *state = opaque; + + free (state->last_result); + if (no == -1) + { + state->last_result = NULL; + return NULL; + } + if (no == 3) + state->last_result = NULL; + else + state->last_result = strdup (string? string : "[==>Niente<==]"); + + return state->last_result; +} + + +static void +check_fprintf_sf (void) +{ + volatile char *nullptr = NULL; /* Avoid compiler warning. */ + struct sfstate_s sfstate = {NULL}; + gpgrt_stream_t stream; + const char *expect; + char *result; + + stream = gpgrt_fopenmem (0, "w+b"); + if (!stream) + die ("fopenmem failed at line %d\n", __LINE__); + + gpgrt_fprintf_sf (stream, string_filter, &sfstate, + "%s a=%d b=%s c=%d d=%.8s null=%s\n", + nullptr, 1, "foo\x01 bar", 2, + "a longer string", nullptr); + expect = "[==>Niente<==] a=1 b=foo\x01 bar c=2 d=a longer null=(null)\n"; + result = stream_to_string (stream); + if (strcmp (result, expect)) + { + show ("expect: '%s'\n", expect); + show ("result: '%s'\n", result); + fail ("fprintf_sf failed at %d\n", __LINE__); + } + free (result); + + gpgrt_fprintf_sf (stream, string_filter, &sfstate, + "a=%d b=%s c=%d d=%.8s e=%s\n", + 1, "foo\n bar", 2, nullptr, ""); + expect = "a=1 b=foo\n bar c=2 d=[==>Nien e=\n"; + result = stream_to_string (stream); + if (strcmp (result, expect)) + { + show ("expect: '%s'\n", expect); + show ("result: '%s'\n", result); + fail ("fprintf_sf failed at %d\n", __LINE__); + } + free (result); + + gpgrt_fclose (stream); +} + int main (int argc, char **argv) @@ -420,6 +531,7 @@ main (int argc, char **argv) run_tests (); check_snprintf (); + check_fprintf_sf (); #ifdef __GLIBC__ return !!errorcount; commit ffb49b72f132d954a3d9fa11e45803c36a62fd25 Author: Werner Koch Date: Mon Nov 26 20:06:36 2018 +0100 core: Add a limited version of gpgrt_ftruncate. * src/gpg-error.h.in (gpgrt_ftruncate, es_ftruncate): New. * src/gpg-error.def.in, src/gpg-error.vers: Add gpgrt_ftruncate. * src/visibility.c (gpgrt_ftruncate): new. * src/gpgrt-int.h (COOKIE_IOCTL_TRUNCATE): New. * src/estream.c (func_mem_ioctl): Support new internal IOCTL. (_gpgrt_ftruncate): New. -- Right now the ftruncate works only on memory streams. Can easily be added to other stream times. Signed-off-by: Werner Koch diff --git a/src/estream.c b/src/estream.c index 8ad664e..72e93e0 100644 --- a/src/estream.c +++ b/src/estream.c @@ -820,6 +820,14 @@ func_mem_ioctl (void *cookie, int cmd, void *ptr, size_t *len) mem_cookie->offset = 0; ret = 0; } + else if (cmd == COOKIE_IOCTL_TRUNCATE) + { + gpgrt_off_t length = *(gpgrt_off_t *)ptr; + + ret = func_mem_seek (cookie, &length, SEEK_SET); + if (ret != -1) + mem_cookie->data_len = mem_cookie->offset; + } else { _set_errno (EINVAL); @@ -4027,6 +4035,29 @@ _gpgrt_rewind (estream_t stream) int +_gpgrt_ftruncate (estream_t stream, gpgrt_off_t length) +{ + cookie_ioctl_function_t func_ioctl; + int ret; + + lock_stream (stream); + func_ioctl = stream->intern->func_ioctl; + if (!func_ioctl) + { + _set_errno (EOPNOTSUPP); + ret = -1; + } + else + { + ret = func_ioctl (stream->intern->cookie, COOKIE_IOCTL_TRUNCATE, + &length, NULL); + } + unlock_stream (stream); + return ret; +} + + +int _gpgrt__getc_underflow (estream_t stream) { int err; diff --git a/src/gpg-error.def.in b/src/gpg-error.def.in index c2fabb0..9b522ea 100644 --- a/src/gpg-error.def.in +++ b/src/gpg-error.def.in @@ -220,5 +220,6 @@ EXPORTS gpgrt_cmp_version @169 + gpgrt_ftruncate @170 ;; end of file with public symbols for Windows. diff --git a/src/gpg-error.h.in b/src/gpg-error.h.in index 2bf6a6f..c0ac0eb 100644 --- a/src/gpg-error.h.in +++ b/src/gpg-error.h.in @@ -712,6 +712,7 @@ int _gpgrt_pending_unlocked (gpgrt_stream_t stream); /* (private) */ int gpgrt_fflush (gpgrt_stream_t stream); int gpgrt_fseek (gpgrt_stream_t stream, long int offset, int whence); int gpgrt_fseeko (gpgrt_stream_t stream, gpgrt_off_t offset, int whence); +int gpgrt_ftruncate (estream_t stream, gpgrt_off_t length); long int gpgrt_ftell (gpgrt_stream_t stream); gpgrt_off_t gpgrt_ftello (gpgrt_stream_t stream); void gpgrt_rewind (gpgrt_stream_t stream); @@ -868,6 +869,7 @@ int gpgrt_vsnprintf (char *buf,size_t bufsize, # define es_fflush gpgrt_fflush # define es_fseek gpgrt_fseek # define es_fseeko gpgrt_fseeko +# define es_ftruncate gpgrt_ftruncate # define es_ftell gpgrt_ftell # define es_ftello gpgrt_ftello # define es_rewind gpgrt_rewind diff --git a/src/gpg-error.vers b/src/gpg-error.vers index 8c50a15..f9524d7 100644 --- a/src/gpg-error.vers +++ b/src/gpg-error.vers @@ -192,6 +192,7 @@ GPG_ERROR_1.0 { gpgrt_cmp_version; + gpgrt_ftruncate; local: *; }; diff --git a/src/gpgrt-int.h b/src/gpgrt-int.h index b5a4dd1..09aad11 100644 --- a/src/gpgrt-int.h +++ b/src/gpgrt-int.h @@ -208,12 +208,12 @@ void _gpgrt_internal_trace_end (void); /* * A private cookie function to implement an internal IOCTL service. - * and ist IOCTL numbers. */ typedef int (*cookie_ioctl_function_t) (void *cookie, int cmd, void *ptr, size_t *len); #define COOKIE_IOCTL_SNATCH_BUFFER 1 #define COOKIE_IOCTL_NONBLOCK 2 +#define COOKIE_IOCTL_TRUNCATE 3 /* An internal variant of gpgrt_cookie_close_function_t with a slot * for the ioctl function. */ @@ -366,6 +366,7 @@ int _gpgrt_fseeko (gpgrt_stream_t stream, gpgrt_off_t offset, int whence); long int _gpgrt_ftell (gpgrt_stream_t stream); gpgrt_off_t _gpgrt_ftello (gpgrt_stream_t stream); void _gpgrt_rewind (gpgrt_stream_t stream); +int _gpgrt_ftruncate (estream_t stream, gpgrt_off_t length); int _gpgrt_fgetc (gpgrt_stream_t stream); int _gpgrt_fputc (int c, gpgrt_stream_t stream); diff --git a/src/visibility.c b/src/visibility.c index ab5e383..1947111 100644 --- a/src/visibility.c +++ b/src/visibility.c @@ -390,6 +390,12 @@ gpgrt_rewind (estream_t stream) } int +gpgrt_ftruncate (estream_t stream, gpgrt_off_t length) +{ + return _gpgrt_ftruncate (stream, length); +} + +int gpgrt_fgetc (estream_t stream) { return _gpgrt_fgetc (stream); diff --git a/src/visibility.h b/src/visibility.h index d6933df..46383c7 100644 --- a/src/visibility.h +++ b/src/visibility.h @@ -102,6 +102,7 @@ MARK_VISIBLE (gpgrt_fseeko) MARK_VISIBLE (gpgrt_ftell) MARK_VISIBLE (gpgrt_ftello) MARK_VISIBLE (gpgrt_rewind) +MARK_VISIBLE (gpgrt_ftruncate) MARK_VISIBLE (gpgrt_fgetc) MARK_VISIBLE (_gpgrt_getc_underflow) MARK_VISIBLE (gpgrt_fputc) @@ -276,6 +277,7 @@ MARK_VISIBLE (gpgrt_cmp_version); #define gpgrt_ftell _gpgrt_USE_UNDERSCORED_FUNCTION #define gpgrt_ftello _gpgrt_USE_UNDERSCORED_FUNCTION #define gpgrt_rewind _gpgrt_USE_UNDERSCORED_FUNCTION +#define gpgrt_ftruncate _gpgrt_USE_UNDERSCORED_FUNCTION #define gpgrt_fgetc _gpgrt_USE_UNDERSCORED_FUNCTION #define _gpgrt_getc_underflow _gpgrt_USE_DBLUNDERSCO_FUNCTION #define gpgrt_fputc _gpgrt_USE_UNDERSCORED_FUNCTION diff --git a/tests/t-version.c b/tests/t-version.c index 240d4b4..d71f360 100644 --- a/tests/t-version.c +++ b/tests/t-version.c @@ -164,6 +164,7 @@ main (int argc, char **argv) fprintf (stderr, "%s: gpg_error_check_version did not return an error" " for a newer version\n", logpfx); errorcount++; + show ("\n"); /* Reference this function to silence gcc. */ } if (verbose || errorcount) { ----------------------------------------------------------------------- Summary of changes: NEWS | 4 ++ src/estream-printf.c | 67 +++++++++++++++++++++--------- src/estream-printf.h | 4 +- src/estream.c | 44 +++++++++++++++++--- src/gpg-error.def.in | 4 ++ src/gpg-error.h.in | 16 ++++++++ src/gpg-error.vers | 4 ++ src/gpgrt-int.h | 9 +++-- src/logging.c | 2 +- src/visibility.c | 48 +++++++++++++++++++--- src/visibility.h | 6 +++ tests/t-printf.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/t-version.c | 1 + 13 files changed, 285 insertions(+), 36 deletions(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 27 03:12:31 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Tue, 27 Nov 2018 03:12:31 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-287-g483e63f Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 483e63f9b5faead819ddd28308902ef43bf298ab (commit) from f12fcd907903742bde3ebb7ffef244c92d6d1611 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 483e63f9b5faead819ddd28308902ef43bf298ab Author: NIIBE Yutaka Date: Tue Nov 27 11:08:51 2018 +0900 agent: Better serialization for scdaemon access. * agent/call-scd.c (unlock_scd): Move lock before accessing IN_USE. (wait_child_thread): Add log_info for Windows, and fixed log_error message. -- The old code is still valid with cooperate threads, but this is better. Signed-off-by: NIIBE Yutaka diff --git a/agent/call-scd.c b/agent/call-scd.c index c6d062a..796e7d8 100644 --- a/agent/call-scd.c +++ b/agent/call-scd.c @@ -169,29 +169,25 @@ unlock_scd (ctrl_t ctrl, int rc) if (!rc) rc = gpg_error (GPG_ERR_INTERNAL); } + err = npth_mutex_lock (&start_scd_lock); + if (err) + { + log_error ("failed to acquire the start_scd lock: %s\n", strerror (err)); + return gpg_error (GPG_ERR_INTERNAL); + } ctrl->scd_local->in_use = 0; if (ctrl->scd_local->invalid) { - err = npth_mutex_lock (&start_scd_lock); - if (err) - { - log_error ("failed to acquire the start_scd lock: %s\n", - strerror (err)); - return gpg_error (GPG_ERR_INTERNAL); - } - assuan_release (ctrl->scd_local->ctx); ctrl->scd_local->ctx = NULL; - - err = npth_mutex_unlock (&start_scd_lock); - if (err) - { - log_error ("failed to release the start_scd lock: %s\n", - strerror (err)); - return gpg_error (GPG_ERR_INTERNAL); - } + ctrl->scd_local->invalid = 0; + } + err = npth_mutex_unlock (&start_scd_lock); + if (err) + { + log_error ("failed to release the start_scd lock: %s\n", strerror (err)); + return gpg_error (GPG_ERR_INTERNAL); } - ctrl->scd_local->invalid = 0; return rc; } @@ -219,6 +215,7 @@ wait_child_thread (void *arg) npth_unprotect (); WaitForSingleObject ((HANDLE)pid, INFINITE); npth_protect (); + log_info ("scdaemon finished\n"); #else int wstatus; pid_t pid = (pid_t)(uintptr_t)arg; @@ -278,8 +275,8 @@ wait_child_thread (void *arg) err = npth_mutex_unlock (&start_scd_lock); if (err) - log_error ("failed to release the start_scd lock while" - " doing the aliveness check: %s\n", strerror (err)); + log_error ("failed to release the start_scd lock after waitpid", + strerror (err)); } return NULL; ----------------------------------------------------------------------- Summary of changes: agent/call-scd.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 28 07:05:22 2018 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Wed, 28 Nov 2018 07:05:22 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-288-g47106ac Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 47106ac435e891ced67f0ad9bb6b2ee12098c880 (commit) from 483e63f9b5faead819ddd28308902ef43bf298ab (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 47106ac435e891ced67f0ad9bb6b2ee12098c880 Author: NIIBE Yutaka Date: Wed Nov 28 14:59:44 2018 +0900 scd: Serialize opening device by select_application. * scd/app.c (app_new_register): Don't lock APP_LIST_LOCK here. (select_application): Lock with APP_LIST_LOCK earlier. -- What we want to do here is to serialize the call of select_application. In the old code, it was possible that a call of select_application was blocked internally, and then another call of select_application entered. We can have a dedicated lock for call of select_application, but it is easier to re-use APP_LIST_LOCK. Signed-off-by: NIIBE Yutaka diff --git a/scd/app.c b/scd/app.c index a82db26..d16300e 100644 --- a/scd/app.c +++ b/scd/app.c @@ -299,11 +299,8 @@ app_new_register (int slot, ctrl_t ctrl, const char *name, } app->periodical_check_needed = periodical_check_needed; - - npth_mutex_lock (&app_list_lock); app->next = app_top; app_top = app; - npth_mutex_unlock (&app_list_lock); unlock_app (app); return 0; } @@ -322,6 +319,8 @@ select_application (ctrl_t ctrl, const char *name, app_t *r_app, *r_app = NULL; + npth_mutex_lock (&app_list_lock); + if (scan || !app_top) { struct dev_list *l; @@ -330,7 +329,10 @@ select_application (ctrl_t ctrl, const char *name, app_t *r_app, /* Scan the devices to find new device(s). */ err = apdu_dev_list_start (opt.reader_port, &l); if (err) - return err; + { + npth_mutex_unlock (&app_list_lock); + return err; + } while (1) { @@ -365,7 +367,6 @@ select_application (ctrl_t ctrl, const char *name, app_t *r_app, scd_kick_the_loop (); } - npth_mutex_lock (&app_list_lock); for (a = app_top; a; a = a->next) { lock_app (a, ctrl); ----------------------------------------------------------------------- Summary of changes: scd/app.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 28 10:46:01 2018 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 28 Nov 2018 10:46:01 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-82-ga9cfb6d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via a9cfb6dad8ac60543bcb06f4d0515f4a64ad897a (commit) from 1c92f3ff55ad0cdda06d05ad0a83193e3a147b7e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a9cfb6dad8ac60543bcb06f4d0515f4a64ad897a Author: Andre Heinecke Date: Wed Nov 28 10:44:17 2018 +0100 tests, json: Make them run on debian stable * tests/json/t-json.c (main): Relax version check a bit. diff --git a/tests/json/t-json.c b/tests/json/t-json.c index f574f57..e1fb6c1 100644 --- a/tests/json/t-json.c +++ b/tests/json/t-json.c @@ -478,10 +478,10 @@ main (int argc, char *argv[]) } } - if (!check_gpg_version ("2.2.0")) + if (!check_gpg_version ("2.1.18")) { /* Lets not break too much or have to test all combinations */ - printf ("Testsuite skipped. Minimum GnuPG version (2.2.0) " + printf ("Testsuite skipped. Minimum GnuPG version (2.1.18) " "not found.\n"); exit(0); } ----------------------------------------------------------------------- Summary of changes: tests/json/t-json.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 30 12:39:07 2018 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 30 Nov 2018 12:39:07 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.2.7-290-g3a90efb Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 3a90efb7cf13532cc82b45c11a7abdadfe0c81f1 (commit) via cd64af003d4b6b46b69dbd575f73d53359ae0bcc (commit) from 47106ac435e891ced67f0ad9bb6b2ee12098c880 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3a90efb7cf13532cc82b45c11a7abdadfe0c81f1 Author: Werner Koch Date: Fri Nov 30 12:38:51 2018 +0100 scd: Add strerror to new error message. * agent/call-scd.c (wait_child_thread): Add %s. Signed-off-by: Werner Koch diff --git a/agent/call-scd.c b/agent/call-scd.c index 796e7d8..d0d4794 100644 --- a/agent/call-scd.c +++ b/agent/call-scd.c @@ -275,7 +275,7 @@ wait_child_thread (void *arg) err = npth_mutex_unlock (&start_scd_lock); if (err) - log_error ("failed to release the start_scd lock after waitpid", + log_error ("failed to release the start_scd lock after waitpid: %s\n", strerror (err)); } commit cd64af003d4b6b46b69dbd575f73d53359ae0bcc Author: Werner Koch Date: Fri Nov 30 12:35:37 2018 +0100 gpg: Improve error message about failed keygrip computation. * g10/keyid.c (keygrip_from_pk): Print the fingerprint on failure. Signed-off-by: Werner Koch diff --git a/g10/keyid.c b/g10/keyid.c index a9034ee..3694c26 100644 --- a/g10/keyid.c +++ b/g10/keyid.c @@ -975,7 +975,12 @@ keygrip_from_pk (PKT_public_key *pk, unsigned char *array) if (!gcry_pk_get_keygrip (s_pkey, array)) { - log_info ("error computing keygrip\n"); + char *hexfpr; + + hexfpr = hexfingerprint (pk, NULL, 0); + log_info ("error computing keygrip (fpr=%s)\n", hexfpr); + xfree (hexfpr); + memset (array, 0, 20); err = gpg_error (GPG_ERR_GENERAL); } ----------------------------------------------------------------------- Summary of changes: agent/call-scd.c | 2 +- g10/keyid.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 30 22:16:59 2018 From: cvs at cvs.gnupg.org (by Ben McGinnes) Date: Fri, 30 Nov 2018 22:16:59 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.12.0-84-g2e3a681 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 2e3a681d0c35bbf6db584fedc9d7f0a010430b51 (commit) via 3b056a01a252bb72df5744409ba494e1a6e54d31 (commit) from a9cfb6dad8ac60543bcb06f4d0515f4a64ad897a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2e3a681d0c35bbf6db584fedc9d7f0a010430b51 Author: Ben McGinnes Date: Sat Dec 1 08:15:43 2018 +1100 python: documentation fixes * Typographic and whitespace error correction pertaining to the previous update. Signed-off-by: Ben McGinnes diff --git a/lang/python/doc/rst/maintenance-mode.rst b/lang/python/doc/rst/maintenance-mode.rst index 75cd947..bbd2521 100644 --- a/lang/python/doc/rst/maintenance-mode.rst +++ b/lang/python/doc/rst/maintenance-mode.rst @@ -78,6 +78,9 @@ decryption, verification, validation, trust levels and so on. Any wanted features lacking in the Python bindings are usually lacking because they are missing from GPGME itself (e.g. revoking keys via the API) and in such cases they are usually deliberately excluded. More +discussion of these issues can be found in the archives of the +`gnupg-devel mailing +list `__. Any features existing in the dynamically generated layer for which people want a specific, higher level function included to make it more diff --git a/lang/python/doc/src/gpgme-python-howto b/lang/python/doc/src/gpgme-python-howto index fe1fc2b..43d0c2b 100644 --- a/lang/python/doc/src/gpgme-python-howto +++ b/lang/python/doc/src/gpgme-python-howto @@ -21,7 +21,6 @@ | Author GPG Key: | [[https://hkps.pool.sks-keyservers.net/pks/lookup?search=0xDB4724E6FA4286C92B4E55C4321E4E2373590E5D&exact=on&op=get][DB4724E6FA4286C92B4E55C4321E4E2373590E5D]] | | Language: | Australian English, British English | | Language codes: | en-AU, en-GB, en | -#+TBLFM: This document provides basic instruction in how to use the GPGME Python bindings to programmatically leverage the GPGME library. diff --git a/lang/python/doc/src/maintenance-mode b/lang/python/doc/src/maintenance-mode index ef56e4e..e7a8f28 100644 --- a/lang/python/doc/src/maintenance-mode +++ b/lang/python/doc/src/maintenance-mode @@ -76,7 +76,9 @@ decryption, verification, validation, trust levels and so on. Any wanted features lacking in the Python bindings are usually lacking because they are missing from GPGME itself (e.g. revoking keys via the -API) and in such cases they are usually deliberately excluded. More +API) and in such cases they are usually deliberately excluded. More +discussion of these issues can be found in the archives of the +[[https://lists.gnupg.org/mailman/listinfo/gnupg-devel][gnupg-devel mailing list]]. Any features existing in the dynamically generated layer for which people want a specific, higher level function included to make it more diff --git a/lang/python/doc/texinfo/maintenance-mode.texi b/lang/python/doc/texinfo/maintenance-mode.texi index ad52606..a60236f 100644 --- a/lang/python/doc/texinfo/maintenance-mode.texi +++ b/lang/python/doc/texinfo/maintenance-mode.texi @@ -104,7 +104,9 @@ decryption, verification, validation, trust levels and so on. Any wanted features lacking in the Python bindings are usually lacking because they are missing from GPGME itself (e.g. revoking keys via the -API) and in such cases they are usually deliberately excluded. More +API) and in such cases they are usually deliberately excluded. More +discussion of these issues can be found in the archives of the + at uref{https://lists.gnupg.org/mailman/listinfo/gnupg-devel, gnupg-devel mailing list}. Any features existing in the dynamically generated layer for which people want a specific, higher level function included to make it more commit 3b056a01a252bb72df5744409ba494e1a6e54d31 Author: Ben McGinnes Date: Sat Dec 1 07:45:50 2018 +1100 python: documentation * Added long description to setup.py.in. * Added maintenance mode details with clarification for what type of things would be a bug as far as MM is concerned and what wouldn't be. ** Includes a not too subtle hint directed towards the donations page. * Miscellaneous tightening of documentation. Signed-off-by: Ben McGinnes diff --git a/lang/python/doc/rst/gpgme-python-howto.rst b/lang/python/doc/rst/gpgme-python-howto.rst index dae4c64..d1cb3fd 100644 --- a/lang/python/doc/rst/gpgme-python-howto.rst +++ b/lang/python/doc/rst/gpgme-python-howto.rst @@ -13,8 +13,11 @@ Introduction | | e/index.html#sec-1-5>`__ | | | | +-----------------------------------+-----------------------------------+ -| Author GPG Key: | DB4724E6FA4286C92B4E55C4321E4E237 | -| | 3590E5D | +| Author GPG Key: | `DB4724E6FA4286C92B4E55C4321E4E23 | +| | 73590E5D `__ | +-----------------------------------+-----------------------------------+ | Language: | Australian English, British | | | English | @@ -3009,34 +3012,37 @@ Draft Editions of this HOWTO Draft editions of this HOWTO may be periodically available directly from the author at any of the following URLs: -- `GPGME Python Bindings HOWTO draft (XHTML AWS S3 +- `GPGME Python Bindings HOWTO draft (XHTML single file, AWS S3 SSL) `__ -- `GPGME Python Bindings HOWTO draft (XHTML AWS S3 no - SSL) `__ -- `GPGME Python Bindings HOWTO draft (Texinfo file AWS S3 - SSL) `__ -- `GPGME Python Bindings HOWTO draft (Texinfo file AWS S3 no - SSL) `__ -- `GPGME Python Bindings HOWTO draft (Info file AWS S3 - SSL) `__ -- `GPGME Python Bindings HOWTO draft (Info file AWS S3 no - SSL) `__ -- `GPGME Python Bindings HOWTO draft (reST file AWS S3 - SSL) `__ -- `GPGME Python Bindings HOWTO draft (reST file AWS S3 no - SSL) `__ +- `GPGME Python Bindings HOWTO draft (XHTML single file, AWS S3 no + SS) `__ +- `GPGME Python Bindings HOWTO draft (XHTML multiple files, AWS S3 + SSL) `__ +- `GPGME Python Bindings HOWTO draft (XHTML multiple files, AWS S3 no + SSL) `__ All of these draft versions except for one have been generated from this -document via Emacs `Org mode `__ and `GNU +document via GNU Emacs `Org mode `__ and `GNU Texinfo `__. Though it is likely that the specific `file `__ `version `__ used will be on the same server with the generated output formats. -The one exception is the reStructuredText version, which was converted -using the latest version of Pandoc from the Org mode source file using -either of the following two commands: +The GNU Texinfo and reStructured Text versions ship with the software, +while the GNU Emacs Info verseion is generated from the Texinfo version +using GNU Texinfo or GNU Makeinfo. The Texinfo format is generated from +the original Org mode source file in Org mode itself either within GNU +Emacs or via the command line by invoking Emacs in batch mode: + +.. code:: shell + + emacs gpgme-python-howto.org --batch -f org-texinfo-export-to-texinfo --kill + emacs gpgme-python-howto --batch -f org-texinfo-export-to-texinfo --kill + +The reStructuredText format is also generated from the Org-mode source +file, except it is generated using `Pandoc `__ with +either of the following commands: .. code:: shell diff --git a/lang/python/doc/rst/index.rst b/lang/python/doc/rst/index.rst index 5f736c7..746391c 100644 --- a/lang/python/doc/rst/index.rst +++ b/lang/python/doc/rst/index.rst @@ -8,5 +8,8 @@ Contents - `A short history of the project `__ - `What\'s New `__ + + - `Maintenance Mode `__ (from January, 2019) + - `What Was New `__ - `GPGME Python Bindings HOWTO `__ diff --git a/lang/python/doc/rst/maintenance-mode.rst b/lang/python/doc/rst/maintenance-mode.rst new file mode 100644 index 0000000..75cd947 --- /dev/null +++ b/lang/python/doc/rst/maintenance-mode.rst @@ -0,0 +1,95 @@ +.. _maintenance-mode: + +Maintenance Mode from 2019 +========================== + ++-----------------------------------+-----------------------------------+ +| Version: | 0.0.1-draft | ++-----------------------------------+-----------------------------------+ +| GPGME Version: | 1.13.0 | ++-----------------------------------+-----------------------------------+ +| Author: | `Ben | +| | McGinnes `__ | +| | | ++-----------------------------------+-----------------------------------+ +| Author GPG Key: | `DB4724E6FA4286C92B4E55C4321E4E23 | +| | 73590E5D `__ | ++-----------------------------------+-----------------------------------+ +| Language: | Australian English, British | +| | English | ++-----------------------------------+-----------------------------------+ +| xml:lang: | en-AU, en-GB, en | ++-----------------------------------+-----------------------------------+ + +From the beginning of 2019 the Python bindings to GPGME will enter +maintenance mode, meaning that new features will not be added and only +bug fixes and security fixes will be made. This also means that +documentation beyond that existing at the end of 2018 will not be +developed further except to correct errors. + +Though use of these bindings appears to have been quite well received, +there has been no indication of what demand there is, if any for either +financial backing of the current Python bindings development or support +contracts with g10code GmbH citing the necessity of including the +bindings. + +.. _maintenance-mode-bm: + +Maintainer from 2019 onward +--------------------------- + +How does this affect the position of GnuPG Python Bindings Maintainer? + +Well, I will remain as maintainer of the bindings; but without funding +for that position, the amount of time I will be able to dedicate solely +to this task will be limited and reduced to volunteered time. As with +all volunteered time and effort in free software projects, this will be +subject to numerous external imperatives. + +.. _maintenance-mode-blade-runner: + +Using the Python Bindings from 2019 and beyond +---------------------------------------------- + +For most, if not all, Python developers using these bindings; they will +continue to "just work" the same as they always have. Expansions of +GPGME itself are usually handled by SWIG with the existing code and thus +bindings are generated properly when the bindings are installed +alongside GPGME and when the latter is built from source. + +In the rare circumstances where that is not enough to address some new +addition to GPGME, then that is a bug and thus subject to the +maintenance mode provisions (i.e. it will be fixed following a bug +report being raised and your humble author will need to remember where +the timesheet template was filed, depending on how many years off such +an event is). + +All the GPGME functionality will continue to be accessible via the lower +level, dynamically generated methods which match the GPGME C +documentation. While the more intuitively Pythonic higher level layer +already covers the vast majority of functionality people require with +key generation, signatures, certifications (key signing), encryption, +decryption, verification, validation, trust levels and so on. + +Any wanted features lacking in the Python bindings are usually lacking +because they are missing from GPGME itself (e.g. revoking keys via the +API) and in such cases they are usually deliberately excluded. More + +Any features existing in the dynamically generated layer for which +people want a specific, higher level function included to make it more +Pythonic (e.g. to avoid needing to learn or memorise cryptographic mode +values or GnuPG status code numbers), would be a feature request and +*not* a bug. + +It is still worthwhile requesting it, but the addition of such a feature +would not be guaranteed and provided on a purely volunteer basis. +Expediting such a request would require funding that request. + +Those with a commercial interest in expediting such a feature request +already know how to `expedite +it `__ (use the +message field to state what feature is being requested). diff --git a/lang/python/doc/rst/short-history.rst b/lang/python/doc/rst/short-history.rst index d6f0a5d..70f9b25 100644 --- a/lang/python/doc/rst/short-history.rst +++ b/lang/python/doc/rst/short-history.rst @@ -1,6 +1,28 @@ Overview ======== ++-----------------------------------+-----------------------------------+ +| Version: | 0.0.1-draft | ++-----------------------------------+-----------------------------------+ +| GPGME Version: | 1.13.0 | ++-----------------------------------+-----------------------------------+ +| Author: | `Ben | +| | McGinnes `__ | +| | | ++-----------------------------------+-----------------------------------+ +| Author GPG Key: | `DB4724E6FA4286C92B4E55C4321E4E23 | +| | 73590E5D `__ | ++-----------------------------------+-----------------------------------+ +| Language: | Australian English, British | +| | English | ++-----------------------------------+-----------------------------------+ +| xml:lang: | en-AU, en-GB, en | ++-----------------------------------+-----------------------------------+ + The GPGME Python bindings passed through many hands and numerous phases before, after a fifteen year journey, coming full circle to return to the source. This is a short explanation of that journey. diff --git a/lang/python/doc/rst/what-is-new.rst b/lang/python/doc/rst/what-is-new.rst index 0fca98f..b3ec06a 100644 --- a/lang/python/doc/rst/what-is-new.rst +++ b/lang/python/doc/rst/what-is-new.rst @@ -13,8 +13,11 @@ What\'s New | | e/index.html#sec-1-5>`__ | | | | +-----------------------------------+-----------------------------------+ -| Author GPG Key: | DB4724E6FA4286C92B4E55C4321E4E237 | -| | 3590E5D | +| Author GPG Key: | `DB4724E6FA4286C92B4E55C4321E4E23 | +| | 73590E5D `__ | +-----------------------------------+-----------------------------------+ | Language: | Australian English, British | | | English | @@ -23,8 +26,7 @@ What\'s New +-----------------------------------+-----------------------------------+ Last time the most obviously new thing was adding the *What\'s New* -section to the HOWTO. Now it\'s moving it out of the HOWTO. Not to -mention expanding on the documentation both generally and considerably. +section to the HOWTO. Now it\'s moving it out of the HOWTO. .. _new-stuff-1-13-0: @@ -41,3 +43,5 @@ Additions since GPGME 1.12.0 include: - Added ``gpg.version.versionintlist`` to make it easier for Python developers to check for a specific version number, even with beta versions (it will drop the \"-betaN\" part). +- Bindings enter `maintenance mode `__ from January, + 2019. diff --git a/lang/python/doc/rst/what-was-new.rst b/lang/python/doc/rst/what-was-new.rst index 23f3082..cc11bbf 100644 --- a/lang/python/doc/rst/what-was-new.rst +++ b/lang/python/doc/rst/what-was-new.rst @@ -13,8 +13,11 @@ What Was New | | e/index.html#sec-1-5>`__ | | | | +-----------------------------------+-----------------------------------+ -| Author GPG Key: | DB4724E6FA4286C92B4E55C4321E4E237 | -| | 3590E5D | +| Author GPG Key: | `DB4724E6FA4286C92B4E55C4321E4E23 | +| | 73590E5D `__ | +-----------------------------------+-----------------------------------+ | Language: | Australian English, British | | | English | diff --git a/lang/python/doc/src/gpgme-python-howto b/lang/python/doc/src/gpgme-python-howto index 4b02a93..fe1fc2b 100644 --- a/lang/python/doc/src/gpgme-python-howto +++ b/lang/python/doc/src/gpgme-python-howto @@ -17,10 +17,11 @@ | Version: | 0.1.4 | | GPGME Version: | 1.12.1 | -| Author: | [[https://gnupg.org/people/index.html#sec-1-5][Ben McGinnes]] | -| Author GPG Key: | DB4724E6FA4286C92B4E55C4321E4E2373590E5D | +| Author: | [[https://gnupg.org/people/index.html#sec-1-5][Ben McGinnes]] <[[mailto:ben at gnupg.org][ben at gnupg.org]]> | +| Author GPG Key: | [[https://hkps.pool.sks-keyservers.net/pks/lookup?search=0xDB4724E6FA4286C92B4E55C4321E4E2373590E5D&exact=on&op=get][DB4724E6FA4286C92B4E55C4321E4E2373590E5D]] | | Language: | Australian English, British English | | Language codes: | en-AU, en-GB, en | +#+TBLFM: This document provides basic instruction in how to use the GPGME Python bindings to programmatically leverage the GPGME library. @@ -2716,6 +2717,7 @@ Though neither requests nor pendulum are required modules for using the GPGME Python bindings, they are both highly recommended more generally. + * Advanced or Experimental Use Cases :PROPERTIES: :CUSTOM_ID: advanced-use @@ -3083,23 +3085,31 @@ Copyright (C) The GnuPG Project, 2018. Draft editions of this HOWTO may be periodically available directly from the author at any of the following URLs: -- [[https://files.au.adversary.org/crypto/gpgme-python-howto.html][GPGME Python Bindings HOWTO draft (XHTML AWS S3 SSL)]] -- [[http://files.au.adversary.org/crypto/gpgme-python-howto.html][GPGME Python Bindings HOWTO draft (XHTML AWS S3 no SSL)]] -- [[https://files.au.adversary.org/crypto/gpgme-python-howto.texi][GPGME Python Bindings HOWTO draft (Texinfo file AWS S3 SSL)]] -- [[http://files.au.adversary.org/crypto/gpgme-python-howto.texi][GPGME Python Bindings HOWTO draft (Texinfo file AWS S3 no SSL)]] -- [[https://files.au.adversary.org/crypto/gpgme-python-howto.info][GPGME Python Bindings HOWTO draft (Info file AWS S3 SSL)]] -- [[http://files.au.adversary.org/crypto/gpgme-python-howto.info][GPGME Python Bindings HOWTO draft (Info file AWS S3 no SSL)]] -- [[https://files.au.adversary.org/crypto/gpgme-python-howto.rst][GPGME Python Bindings HOWTO draft (reST file AWS S3 SSL)]] -- [[http://files.au.adversary.org/crypto/gpgme-python-howto.rst][GPGME Python Bindings HOWTO draft (reST file AWS S3 no SSL)]] +- [[https://files.au.adversary.org/crypto/gpgme-python-howto.html][GPGME Python Bindings HOWTO draft (XHTML single file, AWS S3 SSL)]] +- [[http://files.au.adversary.org/crypto/gpgme-python-howto.html][GPGME Python Bindings HOWTO draft (XHTML single file, AWS S3 no SS)]] +- [[https://files.au.adversary.org/crypto/gpgme-python-howto-split/index.html][GPGME Python Bindings HOWTO draft (XHTML multiple files, AWS S3 SSL)]] +- [[http://files.au.adversary.org/crypto/gpgme-python-howto-split/index.html][GPGME Python Bindings HOWTO draft (XHTML multiple files, AWS S3 no SSL)]] All of these draft versions except for one have been generated from -this document via Emacs [[https://orgmode.org/][Org mode]] and [[https://www.gnu.org/software/texinfo/][GNU Texinfo]]. Though it is likely -that the specific [[https://files.au.adversary.org/crypto/gpgme-python-howto][file]] [[http://files.au.adversary.org/crypto/gpgme-python-howto.org][version]] used will be on the same server with -the generated output formats. +this document via GNU Emacs [[https://orgmode.org/][Org mode]] and [[https://www.gnu.org/software/texinfo/][GNU Texinfo]]. Though it is +likely that the specific [[https://files.au.adversary.org/crypto/gpgme-python-howto][file]] [[http://files.au.adversary.org/crypto/gpgme-python-howto.org][version]] used will be on the same server +with the generated output formats. + +The GNU Texinfo and reStructured Text versions ship with the software, +while the GNU Emacs Info verseion is generated from the Texinfo +version using GNU Texinfo or GNU Makeinfo. The Texinfo format is +generated from the original Org mode source file in Org mode itself +either within GNU Emacs or via the command line by invoking Emacs in +batch mode: + +#+BEGIN_SRC shell + emacs gpgme-python-howto.org --batch -f org-texinfo-export-to-texinfo --kill + emacs gpgme-python-howto --batch -f org-texinfo-export-to-texinfo --kill +#+END_SRC -The one exception is the reStructuredText version, which was converted -using the latest version of Pandoc from the Org mode source file using -either of the following two commands: +The reStructuredText format is also generated from the Org-mode source +file, except it is generated using [[https://pandoc.org][Pandoc]] with either of the following +commands: #+BEGIN_SRC shell pandoc -f org -t rst+smart -o gpgme-python-howto.rst gpgme-python-howto.org diff --git a/lang/python/doc/src/index b/lang/python/doc/src/index index ce347ea..ec13c9a 100644 --- a/lang/python/doc/src/index +++ b/lang/python/doc/src/index @@ -24,5 +24,6 @@ - [[file:short-history][A short history of the project]] - [[file:what-is-new][What's New]] + - [[file:maintenance-mode][Maintenance Mode]] (from January, 2019) - [[file:what-was-new][What Was New]] - [[file:gpgme-python-howto][GPGME Python Bindings HOWTO]] diff --git a/lang/python/doc/src/maintenance-mode b/lang/python/doc/src/maintenance-mode new file mode 100644 index 0000000..ef56e4e --- /dev/null +++ b/lang/python/doc/src/maintenance-mode @@ -0,0 +1,93 @@ +# -*- mode: org -*- +#+TITLE: Maintenance Mode +#+AUTHOR: Ben McGinnes +#+LATEX_COMPILER: xelatex +#+LATEX_CLASS: article +#+LATEX_CLASS_OPTIONS: [12pt] +#+LATEX_HEADER: \usepackage{xltxtra} +#+LATEX_HEADER: \usepackage[margin=1in]{geometry} +#+LATEX_HEADER: \setmainfont[Ligatures={Common}]{Times New Roman} +#+LATEX_HEADER: \author{Ben McGinnes } + + +* Maintenance Mode from 2019 + :PROPERTIES: + :CUSTOM_ID: maintenance-mode + :END: + +| Version: | 0.0.1-draft | +| GPGME Version: | 1.13.0 | +| Author: | [[https://gnupg.org/people/index.html#sec-1-5][Ben McGinnes]] <[[mailto:ben at gnupg.org][ben at gnupg.org]]> | +| Author GPG Key: | [[https://hkps.pool.sks-keyservers.net/pks/lookup?search=0xDB4724E6FA4286C92B4E55C4321E4E2373590E5D&exact=on&op=get][DB4724E6FA4286C92B4E55C4321E4E2373590E5D]] | +| Language: | Australian English, British English | +| xml:lang: | en-AU, en-GB, en | + +From the beginning of 2019 the Python bindings to GPGME will enter +maintenance mode, meaning that new features will not be added and only +bug fixes and security fixes will be made. This also means that +documentation beyond that existing at the end of 2018 will not be +developed further except to correct errors. + +Though use of these bindings appears to have been quite well received, +there has been no indication of what demand there is, if any for +either financial backing of the current Python bindings development or +support contracts with g10code GmbH citing the necessity of including +the bindings. + + +** Maintainer from 2019 onward + :PROPERTIES: + :CUSTOM_ID: maintenance-mode-bm + :END: + +How does this affect the position of GnuPG Python Bindings Maintainer? + +Well, I will remain as maintainer of the bindings; but without funding +for that position, the amount of time I will be able to dedicate +solely to this task will be limited and reduced to volunteered time. +As with all volunteered time and effort in free software projects, +this will be subject to numerous external imperatives. + + +** Using the Python Bindings from 2019 and beyond + :PROPERTIES: + :CUSTOM_ID: maintenance-mode-blade-runner + :END: + +For most, if not all, Python developers using these bindings; they +will continue to ?just work? the same as they always have. Expansions +of GPGME itself are usually handled by SWIG with the existing code and +thus bindings are generated properly when the bindings are installed +alongside GPGME and when the latter is built from source. + +In the rare circumstances where that is not enough to address some new +addition to GPGME, then that is a bug and thus subject to the +maintenance mode provisions (i.e. it will be fixed following a bug +report being raised and your humble author will need to remember where +the timesheet template was filed, depending on how many years off such +an event is). + +All the GPGME functionality will continue to be accessible via the +lower level, dynamically generated methods which match the GPGME C +documentation. While the more intuitively Pythonic higher level layer +already covers the vast majority of functionality people require with +key generation, signatures, certifications (key signing), encryption, +decryption, verification, validation, trust levels and so on. + +Any wanted features lacking in the Python bindings are usually lacking +because they are missing from GPGME itself (e.g. revoking keys via the +API) and in such cases they are usually deliberately excluded. More + +Any features existing in the dynamically generated layer for which +people want a specific, higher level function included to make it more +Pythonic (e.g. to avoid needing to learn or memorise cryptographic +mode values or GnuPG status code numbers), would be a feature request +and /not/ a bug. + +It is still worthwhile requesting it, but the addition of such a +feature would not be guaranteed and provided on a purely volunteer +basis. Expediting such a request would require funding that request. + +Those with a commercial interest in expediting such a feature request +already know how to [[https://gnupg.org/cgi-bin/procdonate.cgi?mode=preset][expedite it]] (use the message field to state what +feature is being requested). diff --git a/lang/python/doc/src/short-history b/lang/python/doc/src/short-history index 6c5c96e..c91f029 100644 --- a/lang/python/doc/src/short-history +++ b/lang/python/doc/src/short-history @@ -5,13 +5,20 @@ #+LATEX_CLASS_OPTIONS: [12pt] #+LATEX_HEADER: \usepackage{xltxtra} #+LATEX_HEADER: \usepackage[margin=1in]{geometry} -#+LATEX_HEADER: \setmainfont[Ligatures={Common}]{Latin Modern Roman} +#+LATEX_HEADER: \setmainfont[Ligatures={Common}]{Times New Roman} * Overview :PROPERTIES: :CUSTOM_ID: overview :END: +| Version: | 0.0.1-draft | +| GPGME Version: | 1.13.0 | +| Author: | [[https://gnupg.org/people/index.html#sec-1-5][Ben McGinnes]] <[[mailto:ben at gnupg.org][ben at gnupg.org]]> | +| Author GPG Key: | [[https://hkps.pool.sks-keyservers.net/pks/lookup?search=0xDB4724E6FA4286C92B4E55C4321E4E2373590E5D&exact=on&op=get][DB4724E6FA4286C92B4E55C4321E4E2373590E5D]] | +| Language: | Australian English, British English | +| xml:lang: | en-AU, en-GB, en | + The GPGME Python bindings passed through many hands and numerous phases before, after a fifteen year journey, coming full circle to return to the source. This is a short explanation of that journey. @@ -27,6 +34,7 @@ return to the source. This is a short explanation of that journey. supporting it, though he left his work available on his Gopher site. + ** Keeping the flame alive :PROPERTIES: :CUSTOM_ID: keeping-the-flame-alive @@ -38,6 +46,7 @@ return to the source. This is a short explanation of that journey. but the current authors do hope he is well. We're assuming (or hoping) that life did what life does and made continuing untenable. + ** Passing the torch :PROPERTIES: :CUSTOM_ID: passing-the-torch @@ -50,6 +59,7 @@ return to the source. This is a short explanation of that journey. the original PyME release in Python 2.6 and 2.7 (available via PyPI). + ** Coming full circle :PROPERTIES: :CUSTOM_ID: ouroboros @@ -74,6 +84,7 @@ return to the source. This is a short explanation of that journey. Ben returned to maintain of gpgme Python bindings and continue building them from that point. + * Relics of the past :PROPERTIES: :CUSTOM_ID: relics-past @@ -103,6 +114,7 @@ SWIG itself, which are worth noting here. files. A regular repository version has been maintained should it be possible to implement this better in the future. + ** The Perils of PyPI :PROPERTIES: :CUSTOM_ID: the-perils-of-pypi @@ -145,6 +157,7 @@ SWIG itself, which are worth noting here. module and instead installing the current version of GPGME along with the Python bindings included with that package. + *** PyME 0?9?0 - Python support for GPGME GnuPG cryptography library :PROPERTIES: :CUSTOM_ID: pypi-gpgme-90 @@ -164,6 +177,7 @@ SWIG itself, which are worth noting here. this module, but it may lack a number of more recent features added to GPGME. + * Footnotes [fn:1] In all likelihood this would have been Python 2.2 or possibly diff --git a/lang/python/doc/src/what-is-new b/lang/python/doc/src/what-is-new index 5bcb5ae..ab94e3e 100644 --- a/lang/python/doc/src/what-is-new +++ b/lang/python/doc/src/what-is-new @@ -17,15 +17,13 @@ | Version: | 0.0.1-draft | | GPGME Version: | 1.13.0 | -| Author: | [[https://gnupg.org/people/index.html#sec-1-5][Ben McGinnes]] | -| Author GPG Key: | DB4724E6FA4286C92B4E55C4321E4E2373590E5D | +| Author: | [[https://gnupg.org/people/index.html#sec-1-5][Ben McGinnes]] <[[mailto:ben at gnupg.org][ben at gnupg.org]]> | +| Author GPG Key: | [[https://hkps.pool.sks-keyservers.net/pks/lookup?search=0xDB4724E6FA4286C92B4E55C4321E4E2373590E5D&exact=on&op=get][DB4724E6FA4286C92B4E55C4321E4E2373590E5D]] | | Language: | Australian English, British English | | xml:lang: | en-AU, en-GB, en | Last time the most obviously new thing was adding the /What's New/ -section to the HOWTO. Now it's moving it out of the HOWTO. Not to -mention expanding on the documentation both generally and -considerably. +section to the HOWTO. Now it's moving it out of the HOWTO. ** New in GPGME 1?13?0 @@ -42,3 +40,4 @@ Additions since GPGME 1.12.0 include: - Added =gpg.version.versionintlist= to make it easier for Python developers to check for a specific version number, even with beta versions (it will drop the "-betaN" part). +- Bindings enter [[file:maintenance-mode][maintenance mode]] from January, 2019. diff --git a/lang/python/doc/src/what-was-new b/lang/python/doc/src/what-was-new index 7c851b1..1d3494c 100644 --- a/lang/python/doc/src/what-was-new +++ b/lang/python/doc/src/what-was-new @@ -17,8 +17,8 @@ | Version: | 0.0.1-draft | | GPGME Version: | 1.13.0 | -| Author: | [[https://gnupg.org/people/index.html#sec-1-5][Ben McGinnes]] | -| Author GPG Key: | DB4724E6FA4286C92B4E55C4321E4E2373590E5D | +| Author: | [[https://gnupg.org/people/index.html#sec-1-5][Ben McGinnes]] <[[mailto:ben at gnupg.org][ben at gnupg.org]]> | +| Author GPG Key: | [[https://hkps.pool.sks-keyservers.net/pks/lookup?search=0xDB4724E6FA4286C92B4E55C4321E4E2373590E5D&exact=on&op=get][DB4724E6FA4286C92B4E55C4321E4E2373590E5D]] | | Language: | Australian English, British English | | xml:lang: | en-AU, en-GB, en | diff --git a/lang/python/doc/texinfo/gpgme-python-howto.texi b/lang/python/doc/texinfo/gpgme-python-howto.texi index 558bc87..ad3fbed 100644 --- a/lang/python/doc/texinfo/gpgme-python-howto.texi +++ b/lang/python/doc/texinfo/gpgme-python-howto.texi @@ -171,15 +171,15 @@ Copyright and Licensing @node Introduction @chapter Introduction - at multitable {aaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} + at multitable {aaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} @item Version: @tab 0.1.4 @item GPGME Version: @tab 1.12.1 @item Author: - at tab @uref{https://gnupg.org/people/index.html#sec-1-5, Ben McGinnes} + at tab @uref{https://gnupg.org/people/index.html#sec-1-5, Ben McGinnes} <@email{ben@@gnupg.org, ben@@gnupg.org}> @item Author GPG Key: - at tab DB4724E6FA4286C92B4E55C4321E4E2373590E5D + at tab @uref{https://hkps.pool.sks-keyservers.net/pks/lookup?search=0xDB4724E6FA4286C92B4E55C4321E4E2373590E5D&exact=on&op=get, DB4724E6FA4286C92B4E55C4321E4E2373590E5D} @item Language: @tab Australian English, British English @item Language codes: @@ -3200,31 +3200,35 @@ from the author at any of the following URLs: @itemize @item - at uref{https://files.au.adversary.org/crypto/gpgme-python-howto.html, GPGME Python Bindings HOWTO draft (XHTML AWS S3 SSL)} + at uref{https://files.au.adversary.org/crypto/gpgme-python-howto.html, GPGME Python Bindings HOWTO draft (XHTML single file, AWS S3 SSL)} @item - at uref{http://files.au.adversary.org/crypto/gpgme-python-howto.html, GPGME Python Bindings HOWTO draft (XHTML AWS S3 no SSL)} + at uref{http://files.au.adversary.org/crypto/gpgme-python-howto.html, GPGME Python Bindings HOWTO draft (XHTML single file, AWS S3 no SS)} @item - at uref{https://files.au.adversary.org/crypto/gpgme-python-howto.texi, GPGME Python Bindings HOWTO draft (Texinfo file AWS S3 SSL)} + at uref{https://files.au.adversary.org/crypto/gpgme-python-howto-split/index.html, GPGME Python Bindings HOWTO draft (XHTML multiple files, AWS S3 SSL)} @item - at uref{http://files.au.adversary.org/crypto/gpgme-python-howto.texi, GPGME Python Bindings HOWTO draft (Texinfo file AWS S3 no SSL)} - at item - at uref{https://files.au.adversary.org/crypto/gpgme-python-howto.info, GPGME Python Bindings HOWTO draft (Info file AWS S3 SSL)} - at item - at uref{http://files.au.adversary.org/crypto/gpgme-python-howto.info, GPGME Python Bindings HOWTO draft (Info file AWS S3 no SSL)} - at item - at uref{https://files.au.adversary.org/crypto/gpgme-python-howto.rst, GPGME Python Bindings HOWTO draft (reST file AWS S3 SSL)} - at item - at uref{http://files.au.adversary.org/crypto/gpgme-python-howto.rst, GPGME Python Bindings HOWTO draft (reST file AWS S3 no SSL)} + at uref{http://files.au.adversary.org/crypto/gpgme-python-howto-split/index.html, GPGME Python Bindings HOWTO draft (XHTML multiple files, AWS S3 no SSL)} @end itemize All of these draft versions except for one have been generated from -this document via Emacs @uref{https://orgmode.org/, Org mode} and @uref{https://www.gnu.org/software/texinfo/, GNU Texinfo}. Though it is likely -that the specific @uref{https://files.au.adversary.org/crypto/gpgme-python-howto, file} @uref{http://files.au.adversary.org/crypto/gpgme-python-howto.org, version} used will be on the same server with -the generated output formats. +this document via GNU Emacs @uref{https://orgmode.org/, Org mode} and @uref{https://www.gnu.org/software/texinfo/, GNU Texinfo}. Though it is +likely that the specific @uref{https://files.au.adversary.org/crypto/gpgme-python-howto, file} @uref{http://files.au.adversary.org/crypto/gpgme-python-howto.org, version} used will be on the same server +with the generated output formats. + +The GNU Texinfo and reStructured Text versions ship with the software, +while the GNU Emacs Info verseion is generated from the Texinfo +version using GNU Texinfo or GNU Makeinfo. The Texinfo format is +generated from the original Org mode source file in Org mode itself +either within GNU Emacs or via the command line by invoking Emacs in +batch mode: + + at example +emacs gpgme-python-howto.org --batch -f org-texinfo-export-to-texinfo --kill +emacs gpgme-python-howto --batch -f org-texinfo-export-to-texinfo --kill + at end example -The one exception is the reStructuredText version, which was converted -using the latest version of Pandoc from the Org mode source file using -either of the following two commands: +The reStructuredText format is also generated from the Org-mode source +file, except it is generated using @uref{https://pandoc.org, Pandoc} with either of the following +commands: @example pandoc -f org -t rst+smart -o gpgme-python-howto.rst gpgme-python-howto.org diff --git a/lang/python/doc/texinfo/index.texi b/lang/python/doc/texinfo/index.texi index 2ec5e24..2250d1e 100644 --- a/lang/python/doc/texinfo/index.texi +++ b/lang/python/doc/texinfo/index.texi @@ -47,6 +47,10 @@ GPGME Python Bindings @uref{short-history, A short history of the project} @item @uref{what-is-new, What's New} + at itemize + at item + at uref{maintenance-mode, Maintenance Mode} (from January, 2019) + at end itemize @item @uref{what-was-new, What Was New} @item diff --git a/lang/python/doc/texinfo/maintenance-mode.texi b/lang/python/doc/texinfo/maintenance-mode.texi new file mode 100644 index 0000000..ad52606 --- /dev/null +++ b/lang/python/doc/texinfo/maintenance-mode.texi @@ -0,0 +1,123 @@ +\input texinfo @c -*- texinfo -*- + at c %**start of header + at setfilename maintenance-mode.info + at settitle Maintenance Mode + at documentencoding UTF-8 + at documentlanguage en + at c %**end of header + + at finalout + at titlepage + at title Maintenance Mode + at author Ben McGinnes + at end titlepage + + at contents + + at ifnottex + at node Top + at top Maintenance Mode + at end ifnottex + + at menu +* Maintenance Mode from 2019:: + + at detailmenu +--- The Detailed Node Listing --- + +Maintenance Mode from 2019 + +* Maintainer from 2019 onward:: +* Using the Python Bindings from 2019 and beyond:: + + at end detailmenu + at end menu + + at node Maintenance Mode from 2019 + at chapter Maintenance Mode from 2019 + + at multitable {aaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} + at item Version: + at tab 0.0.1-draft + at item GPGME Version: + at tab 1.13.0 + at item Author: + at tab @uref{https://gnupg.org/people/index.html#sec-1-5, Ben McGinnes} <@email{ben@@gnupg.org, ben@@gnupg.org}> + at item Author GPG Key: + at tab @uref{https://hkps.pool.sks-keyservers.net/pks/lookup?search=0xDB4724E6FA4286C92B4E55C4321E4E2373590E5D&exact=on&op=get, DB4724E6FA4286C92B4E55C4321E4E2373590E5D} + at item Language: + at tab Australian English, British English + at item xml:lang: + at tab en-AU, en-GB, en + at end multitable + +From the beginning of 2019 the Python bindings to GPGME will enter +maintenance mode, meaning that new features will not be added and only +bug fixes and security fixes will be made. This also means that +documentation beyond that existing at the end of 2018 will not be +developed further except to correct errors. + +Though use of these bindings appears to have been quite well received, +there has been no indication of what demand there is, if any for +either financial backing of the current Python bindings development or +support contracts with g10code GmbH citing the necessity of including +the bindings. + + at menu +* Maintainer from 2019 onward:: +* Using the Python Bindings from 2019 and beyond:: + at end menu + + at node Maintainer from 2019 onward + at section Maintainer from 2019 onward + +How does this affect the position of GnuPG Python Bindings Maintainer? + +Well, I will remain as maintainer of the bindings; but without funding +for that position, the amount of time I will be able to dedicate +solely to this task will be limited and reduced to volunteered time. +As with all volunteered time and effort in free software projects, +this will be subject to numerous external imperatives. + + at node Using the Python Bindings from 2019 and beyond + at section Using the Python Bindings from 2019 and beyond + +For most, if not all, Python developers using these bindings; they +will continue to ?just work? the same as they always have. Expansions +of GPGME itself are usually handled by SWIG with the existing code and +thus bindings are generated properly when the bindings are installed +alongside GPGME and when the latter is built from source. + +In the rare circumstances where that is not enough to address some new +addition to GPGME, then that is a bug and thus subject to the +maintenance mode provisions (i.e. it will be fixed following a bug +report being raised and your humble author will need to remember where +the timesheet template was filed, depending on how many years off such +an event is). + +All the GPGME functionality will continue to be accessible via the +lower level, dynamically generated methods which match the GPGME C +documentation. While the more intuitively Pythonic higher level layer +already covers the vast majority of functionality people require with +key generation, signatures, certifications (key signing), encryption, +decryption, verification, validation, trust levels and so on. + +Any wanted features lacking in the Python bindings are usually lacking +because they are missing from GPGME itself (e.g. revoking keys via the +API) and in such cases they are usually deliberately excluded. More + +Any features existing in the dynamically generated layer for which +people want a specific, higher level function included to make it more +Pythonic (e.g. to avoid needing to learn or memorise cryptographic +mode values or GnuPG status code numbers), would be a feature request +and @emph{not} a bug. + +It is still worthwhile requesting it, but the addition of such a +feature would not be guaranteed and provided on a purely volunteer +basis. Expediting such a request would require funding that request. + +Those with a commercial interest in expediting such a feature request +already know how to @uref{https://gnupg.org/cgi-bin/procdonate.cgi?mode=preset, expedite it} (use the message field to state what +feature is being requested). + + at bye \ No newline at end of file diff --git a/lang/python/doc/texinfo/short-history.texi b/lang/python/doc/texinfo/short-history.texi index 395901f..480aebf 100644 --- a/lang/python/doc/texinfo/short-history.texi +++ b/lang/python/doc/texinfo/short-history.texi @@ -49,6 +49,21 @@ The Perils of PyPI @node Overview @chapter Overview + at multitable {aaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} + at item Version: + at tab 0.0.1-draft + at item GPGME Version: + at tab 1.13.0 + at item Author: + at tab @uref{https://gnupg.org/people/index.html#sec-1-5, Ben McGinnes} <@email{ben@@gnupg.org, ben@@gnupg.org}> + at item Author GPG Key: + at tab @uref{https://hkps.pool.sks-keyservers.net/pks/lookup?search=0xDB4724E6FA4286C92B4E55C4321E4E2373590E5D&exact=on&op=get, DB4724E6FA4286C92B4E55C4321E4E2373590E5D} + at item Language: + at tab Australian English, British English + at item xml:lang: + at tab en-AU, en-GB, en + at end multitable + The GPGME Python bindings passed through many hands and numerous phases before, after a fifteen year journey, coming full circle to return to the source. This is a short explanation of that journey. diff --git a/lang/python/doc/texinfo/what-is-new.texi b/lang/python/doc/texinfo/what-is-new.texi index 0b70d21..25d12c2 100644 --- a/lang/python/doc/texinfo/what-is-new.texi +++ b/lang/python/doc/texinfo/what-is-new.texi @@ -35,15 +35,15 @@ What's New @node What's New @chapter What's New - at multitable {aaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} + at multitable {aaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} @item Version: @tab 0.0.1-draft @item GPGME Version: @tab 1.13.0 @item Author: - at tab @uref{https://gnupg.org/people/index.html#sec-1-5, Ben McGinnes} + at tab @uref{https://gnupg.org/people/index.html#sec-1-5, Ben McGinnes} <@email{ben@@gnupg.org, ben@@gnupg.org}> @item Author GPG Key: - at tab DB4724E6FA4286C92B4E55C4321E4E2373590E5D + at tab @uref{https://hkps.pool.sks-keyservers.net/pks/lookup?search=0xDB4724E6FA4286C92B4E55C4321E4E2373590E5D&exact=on&op=get, DB4724E6FA4286C92B4E55C4321E4E2373590E5D} @item Language: @tab Australian English, British English @item xml:lang: @@ -51,9 +51,7 @@ What's New @end multitable Last time the most obviously new thing was adding the @emph{What's New} -section to the HOWTO. Now it's moving it out of the HOWTO. Not to -mention expanding on the documentation both generally and -considerably. +section to the HOWTO. Now it's moving it out of the HOWTO. @menu * New in GPGME 1?13?0:: @@ -75,6 +73,8 @@ Moving the preceding, archival, segments into @uref{what-was-new.org, another fi Added @samp{gpg.version.versionintlist} to make it easier for Python developers to check for a specific version number, even with beta versions (it will drop the "-betaN" part). + at item +Bindings enter @uref{maintenance-mode, maintenance mode} from January, 2019. @end itemize @bye \ No newline at end of file diff --git a/lang/python/doc/texinfo/what-was-new.texi b/lang/python/doc/texinfo/what-was-new.texi index f81e0c3..63317d8 100644 --- a/lang/python/doc/texinfo/what-was-new.texi +++ b/lang/python/doc/texinfo/what-was-new.texi @@ -39,15 +39,15 @@ What Was New in GPGME 1?12?0 @node What Was New @chapter What Was New - at multitable {aaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} + at multitable {aaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} @item Version: @tab 0.0.1-draft @item GPGME Version: @tab 1.13.0 @item Author: - at tab @uref{https://gnupg.org/people/index.html#sec-1-5, Ben McGinnes} + at tab @uref{https://gnupg.org/people/index.html#sec-1-5, Ben McGinnes} <@email{ben@@gnupg.org, ben@@gnupg.org}> @item Author GPG Key: - at tab DB4724E6FA4286C92B4E55C4321E4E2373590E5D + at tab @uref{https://hkps.pool.sks-keyservers.net/pks/lookup?search=0xDB4724E6FA4286C92B4E55C4321E4E2373590E5D&exact=on&op=get, DB4724E6FA4286C92B4E55C4321E4E2373590E5D} @item Language: @tab Australian English, British English @item xml:lang: diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in index f23015a..9785a28 100755 --- a/lang/python/setup.py.in +++ b/lang/python/setup.py.in @@ -30,50 +30,50 @@ import subprocess import sys # Out-of-tree build of the gpg bindings. -gpg_error_config = ["gpg-error-config"] -gpgme_config_flags = ["--thread=pthread"] -gpgme_config = ["gpgme-config"] + gpgme_config_flags -gpgme_h = "" +gpg_error_config = ['gpg-error-config'] +gpgme_config_flags = ['--thread=pthread'] +gpgme_config = ['gpgme-config'] + gpgme_config_flags +gpgme_h = '' include_dirs = [os.getcwd()] library_dirs = [] in_tree = False extra_swig_opts = [] extra_macros = dict() -top_builddir = os.environ.get("top_builddir") +top_builddir = os.environ.get('top_builddir') if top_builddir: # In-tree build. in_tree = True - gpgme_config = [os.path.join(top_builddir, "src/gpgme-config") + gpgme_config = [os.path.join(top_builddir, 'src/gpgme-config') ] + gpgme_config_flags - gpgme_h = os.path.join(top_builddir, "src/gpgme.h") + gpgme_h = os.path.join(top_builddir, 'src/gpgme.h') library_dirs = [os.path.join(top_builddir, - "src/.libs")] # XXX uses libtool internals + 'src/.libs')] # XXX uses libtool internals extra_macros.update( HAVE_CONFIG_H=1, HAVE_DATA_H=1, IN_TREE_BUILD=1, ) -if hasattr(subprocess, "DEVNULL"): +if hasattr(subprocess, 'DEVNULL'): devnull = subprocess.DEVNULL else: - devnull = open(os.devnull, "w") + devnull = open(os.devnull, 'w') try: subprocess.check_call(gpgme_config + ['--version'], stdout=devnull) except: - sys.exit("Could not find gpgme-config. " + - "Please install the libgpgme development package.") + sys.exit('Could not find gpgme-config. ' + + 'Please install the libgpgme development package.') def getconfig(what, config=gpgme_config): confdata = subprocess.Popen( - config + ["--%s" % what], stdout=subprocess.PIPE).communicate()[0] + config + ['--%s' % what], stdout=subprocess.PIPE).communicate()[0] return [x for x in confdata.decode('utf-8').split() if x != ''] -version = version_raw = getconfig("version")[0] +version = version_raw = getconfig('version')[0] if '-' in version: version = version.split('-')[0] major, minor, patch = map(int, version.split('.')) @@ -82,31 +82,31 @@ if not (major > 1 or (major == 1 and minor >= 7)): sys.exit('Need at least GPGME version 1.7, found {}.'.format(version_raw)) if not gpgme_h: - gpgme_h = os.path.join(getconfig("prefix")[0], "include", "gpgme.h") + gpgme_h = os.path.join(getconfig('prefix')[0], 'include', 'gpgme.h') define_macros = [] libs = getconfig('libs') # Define extra_macros for both the SWIG and C code for k, v in extra_macros.items(): - extra_swig_opts.append("-D{0}={1}".format(k, v)) + extra_swig_opts.append('-D{0}={1}'.format(k, v)) define_macros.append((k, str(v))) for item in getconfig('cflags'): - if item.startswith("-I"): + if item.startswith('-I'): include_dirs.append(item[2:]) - elif item.startswith("-D"): - defitem = item[2:].split("=", 1) + elif item.startswith('-D'): + defitem = item[2:].split('=', 1) if len(defitem) == 2: define_macros.append((defitem[0], defitem[1])) else: define_macros.append((defitem[0], None)) # Adjust include and library locations in case of win32 -uname_s = os.popen("uname -s").read() -if uname_s.startswith("MINGW32"): +uname_s = os.popen('uname -s').read() +if uname_s.startswith('MINGW32'): mnts = [ - x.split()[0:3:2] for x in os.popen("mount").read().split("\n") if x + x.split()[0:3:2] for x in os.popen('mount').read().split('\n') if x ] tmplist = sorted([(len(x[1]), x[1], x[0]) for x in mnts]) tmplist.reverse() @@ -120,7 +120,7 @@ if uname_s.startswith("MINGW32"): extra_dirs.append(os.path.join(tgt, item)) break include_dirs += extra_dirs - for item in [x[2:] for x in libs if x.startswith("-L")]: + for item in [x[2:] for x in libs if x.startswith('-L')]: for ln, mnt, tgt in tmplist: if item.startswith(mnt): item = os.path.normpath(item[ln:]) @@ -131,7 +131,7 @@ if uname_s.startswith("MINGW32"): def in_srcdir(name): - return os.path.join(os.environ.get("srcdir", ""), name) + return os.path.join(os.environ.get('srcdir', ''), name) def up_to_date(source, target): @@ -160,9 +160,9 @@ def up_to_date(source, target): class BuildExtFirstHack(build): def _read_header(self, header, cflags): - tmp_include = self._in_build_base("include1.h") + tmp_include = self._in_build_base('include1.h') with open(tmp_include, 'w') as f: - f.write("#include <%s>" % header) + f.write('#include <%s>' % header) return subprocess.check_output( os.environ.get('CPP', 'cc -E').split() + cflags + [tmp_include]).decode('utf-8') @@ -173,11 +173,11 @@ class BuildExtFirstHack(build): if f.read() == content: return - with open(target, "w") as sink: + with open(target, 'w') as sink: sink.write(content) def _generate_gpgme_h(self, source_name, sink_name): - print("Using gpgme.h from {}".format(source_name)) + print('Using gpgme.h from {}'.format(source_name)) shutil.copy2(source_name, sink_name) def _generate_errors_i(self): @@ -186,11 +186,11 @@ class BuildExtFirstHack(build): subprocess.check_call( gpg_error_config + ['--version'], stdout=devnull) except: - sys.exit("Could not find gpg-error-config. " + - "Please install the libgpg-error development package.") + sys.exit('Could not find gpg-error-config. ' + + 'Please install the libgpg-error development package.') gpg_error_content = self._read_header( - "gpg-error.h", getconfig("cflags", config=gpg_error_config)) + 'gpg-error.h', getconfig('cflags', config=gpg_error_config)) filter_re = re.compile(r'GPG_ERR_[^ ]* =') rewrite_re = re.compile(r' *(.*) = .*') @@ -203,7 +203,7 @@ class BuildExtFirstHack(build): r'%constant long \1 = \1;' + '\n', line.strip()) self._write_if_unchanged( - self._in_build_base("errors.i"), errors_i_content) + self._in_build_base('errors.i'), errors_i_content) def _in_build_base(self, name): return os.path.join(self.build_base, name) @@ -213,7 +213,7 @@ class BuildExtFirstHack(build): if not os.path.exists(self.build_base): os.makedirs(self.build_base) - self._generate_gpgme_h(gpgme_h, self._in_build_base("gpgme.h")) + self._generate_gpgme_h(gpgme_h, self._in_build_base('gpgme.h')) self._generate_errors_i() # Copy due to https://bugs.python.org/issue2624 @@ -225,9 +225,9 @@ class BuildExtFirstHack(build): shutil.copy2(source, target) # Append generated files via build_base - if not os.path.exists(os.path.join(self.build_lib, "gpg")): - os.makedirs(os.path.join(self.build_lib, "gpg")) - shutil.copy2("version.py", os.path.join(self.build_lib, "gpg")) + if not os.path.exists(os.path.join(self.build_lib, 'gpg')): + os.makedirs(os.path.join(self.build_lib, 'gpg')) + shutil.copy2('version.py', os.path.join(self.build_lib, 'gpg')) def run(self): self._generate() @@ -248,7 +248,7 @@ py3 = [] if sys.version_info.major < 3 else ['-py3'] swig_sources = [] swig_opts = ['-threads'] + py3 + extra_swig_opts swige = Extension( - "gpg._gpgme", + 'gpg._gpgme', sources=swig_sources, swig_opts=swig_opts, include_dirs=include_dirs, @@ -257,12 +257,34 @@ swige = Extension( extra_link_args=libs) setup( - name="gpg", + name='gpg', cmdclass={'build': BuildExtFirstHack}, - version="@VERSION@", - description='Python bindings for GPGME GnuPG cryptography library', - # TODO: add a long description - # long_description=long_description, + version='@VERSION@', + # Note: description appears as Summary in egg-info file. + description='Python bindings to the GPGME API of the GnuPG cryptography library.', + # Note: long-description appears as Description in egg-info file. + long_description='''Dynamically generated bindings to the C API of the GNU Privacy Guard. + +The GPG Made Easy (GPGME) library provides a high-level API in C to all the +component software and libraries in the GnuPG Project, including GPG itself +(the GnuPG OpenPGP implementation), libgcrypt, libgpg-error, libassuan and +more. + +The official CPython bindings to GPGME are generated during the compiling +process of GPGME itself and built for the specific C header and include files +produced when GPGME is compiled using SWIG. This provides access to over two +thousand functions, methods and values via both the lower level dynamically +generated bindings and a more intuitively pythonic higher level layer. + +While the lower level, dynamically generated bindings provide access to +everything which GPGME itself provides; the higher level layer is easier to use +by Python developers, provides access to the vast majority of functionality +developers would want from GnuPG and is extensively documented. + +GPGME and these bindings is available here: + + https://gnupg.org/software/gpgme/index.html +''', author='The GnuPG hackers', author_email='gnupg-devel at gnupg.org', url='https://www.gnupg.org', @@ -271,7 +293,7 @@ setup( 'gpg', 'gpg.constants', 'gpg.constants.data', 'gpg.constants.keylist', 'gpg.constants.sig', 'gpg.constants.tofu' ], - license="LGPL2.1+ (the library), GPL2+ (tests and examples)", + license='LGPL2.1+ (the library), GPL2+ (tests and examples)', classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', ----------------------------------------------------------------------- Summary of changes: lang/python/doc/rst/gpgme-python-howto.rst | 48 +++++---- lang/python/doc/rst/index.rst | 3 + lang/python/doc/rst/maintenance-mode.rst | 98 +++++++++++++++++++ lang/python/doc/rst/short-history.rst | 22 +++++ lang/python/doc/rst/what-is-new.rst | 12 ++- lang/python/doc/rst/what-was-new.rst | 7 +- lang/python/doc/src/gpgme-python-howto | 41 +++++--- lang/python/doc/src/index | 1 + lang/python/doc/src/maintenance-mode | 95 ++++++++++++++++++ lang/python/doc/src/short-history | 16 ++- lang/python/doc/src/what-is-new | 9 +- lang/python/doc/src/what-was-new | 4 +- lang/python/doc/texinfo/gpgme-python-howto.texi | 46 +++++---- lang/python/doc/texinfo/index.texi | 4 + lang/python/doc/texinfo/maintenance-mode.texi | 125 ++++++++++++++++++++++++ lang/python/doc/texinfo/short-history.texi | 15 +++ lang/python/doc/texinfo/what-is-new.texi | 12 +-- lang/python/doc/texinfo/what-was-new.texi | 6 +- lang/python/setup.py.in | 108 ++++++++++++-------- 19 files changed, 548 insertions(+), 124 deletions(-) create mode 100644 lang/python/doc/rst/maintenance-mode.rst create mode 100644 lang/python/doc/src/maintenance-mode create mode 100644 lang/python/doc/texinfo/maintenance-mode.texi hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org