summaryrefslogtreecommitdiffstats
path: root/kbx/keybox-defs.h
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2013-11-15 15:54:31 +0100
committerWerner Koch <wk@gnupg.org>2013-11-15 15:54:31 +0100
commit5499942571a88a1223a7318992605c6d29858866 (patch)
tree6ee1f5c177484beed5e6142bb11d7ac7179fc0a9 /kbx/keybox-defs.h
parentFix minor compiler warnings. (diff)
downloadgnupg2-5499942571a88a1223a7318992605c6d29858866.tar.xz
gnupg2-5499942571a88a1223a7318992605c6d29858866.zip
kbx: Implement update operation for OpenPGP keyblocks.
* kbx/keybox-update.c (keybox_update_keyblock): Implement. * kbx/keybox-search.c (get_blob_flags): Move to ... * kbx/keybox-defs.h (blob_get_type): here. * kbx/keybox-file.c (_keybox_read_blob2): Fix calling without R_BLOB. * g10/keydb.c (build_keyblock_image): Allow calling without R_SIGSTATUS. (keydb_update_keyblock): Implement for keybox. * kbx/keybox-dump.c (_keybox_dump_blob): Fix printing of the unhashed size. Print "does not expire" also on 64 bit platforms. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'kbx/keybox-defs.h')
-rw-r--r--kbx/keybox-defs.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/kbx/keybox-defs.h b/kbx/keybox-defs.h
index ad8e49d3f..f79c093fd 100644
--- a/kbx/keybox-defs.h
+++ b/kbx/keybox-defs.h
@@ -1,4 +1,4 @@
-/* keybox-defs.h - interal Keybox defintions
+/* keybox-defs.h - internal Keybox definitions
* Copyright (C) 2001, 2004 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
@@ -193,6 +193,20 @@ gpg_err_code_t _keybox_get_flag_location (const unsigned char *buffer,
int what,
size_t *flag_off, size_t *flag_size);
+static inline int
+blob_get_type (KEYBOXBLOB blob)
+{
+ const unsigned char *buffer;
+ size_t length;
+
+ buffer = _keybox_get_blob_image (blob, &length);
+ if (length < 32)
+ return -1; /* blob too short */
+
+ return buffer[4];
+}
+
+
/*-- keybox-dump.c --*/
int _keybox_dump_blob (KEYBOXBLOB blob, FILE *fp);
int _keybox_dump_file (const char *filename, int stats_only, FILE *outfp);