aboutsummaryrefslogtreecommitdiffstats
path: root/common/util.h
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2016-04-08 17:21:12 +0000
committerJustus Winter <[email protected]>2016-04-21 12:38:53 +0000
commit12af2630cf4d1a39179179925fac8f2cce7504ff (patch)
tree80af197fe8c5b17f037bb9c6edad5a97e4a33d29 /common/util.h
parentcommon: Add 'free_strlist_wipe' which wipes memory. (diff)
downloadgnupg-12af2630cf4d1a39179179925fac8f2cce7504ff.tar.gz
gnupg-12af2630cf4d1a39179179925fac8f2cce7504ff.zip
common: Add support for the new extended private key format.
* agent/findkey.c (write_extended_private_key): New function. (agent_write_private_key): Detect if an existing file is in extended format and update the key within if it is. (read_key_file): Handle the new format. * agent/keyformat.txt: Document the new format. * common/Makefile.am: Add the new files. * common/private-keys.c: New file. * common/private-keys.h: Likewise. * common/t-private-keys.c: Likewise. * common/util.h (alphap, alnump): New macros. * tests/migrations: Add test demonstrating that we can cope with the new format. -- GnuPG 2.3+ will use a new format to store private keys that is both more flexible and easier to read and edit by human beings. The new format stores name,value-pairs using the common mail and http header convention. This patch adds the parser and support code and prepares GnuPG 2.1 for the new format. Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to '')
-rw-r--r--common/util.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/util.h b/common/util.h
index 6410b11d4..466c519bd 100644
--- a/common/util.h
+++ b/common/util.h
@@ -333,6 +333,9 @@ int _gnupg_isatty (int fd);
/*-- Macros to replace ctype ones to avoid locale problems. --*/
#define spacep(p) (*(p) == ' ' || *(p) == '\t')
#define digitp(p) (*(p) >= '0' && *(p) <= '9')
+#define alphap(p) ((*(p) >= 'A' && *(p) <= 'Z') \
+ || (*(p) >= 'a' && *(p) <= 'z'))
+#define alnump(p) (alphap (p) || digitp (p))
#define hexdigitp(a) (digitp (a) \
|| (*(a) >= 'A' && *(a) <= 'F') \
|| (*(a) >= 'a' && *(a) <= 'f'))