2 Copyright (C) 2006-2024 Ben Kibbey <bjk@luxsci.net>
4 This file is part of pwmd.
6 Pwmd is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License version 2 as
8 published by the Free Software Foundation.
10 Pwmd is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with Pwmd. If not, see <http://www.gnu.org/licenses/>.
22 #include <gpg-error.h>
23 #include <libxml/tree.h>
30 char **pubkey
; /* keyid's */
31 char *sigkey
; /* signing keyid */
32 void *doc
; /* AES-128 encrypted */
34 unsigned refcount
; /* for .plaintext */
36 unsigned char *crc
; /* Checksum of the data file. */
42 char **grip
; /* Public keygrips. */
43 char *siggrip
; /* Signing keygrip. */
44 char *filename
; /* Associated filename. */
45 long timeout
; /* cache_timer_thread(). */
46 long reset
; /* To reset .timeout. */
47 int defer_clear
; /* Another thread wants to clear the cache
48 entry for this file. Prevent resetting the
49 timer until this flag is cleared. */
50 pthread_mutex_t
*mutex
; /* Data file mutex. */
51 struct cache_data_s
*data
;
56 gpg_error_t
cache_kill_scd ();
57 void cache_adjust_timeout ();
58 gpg_error_t
cache_set_timeout (const char *, long timeout
);
59 gpg_error_t
cache_iscached (const char *, int *defer
, int agent
, int sign
);
60 gpg_error_t
cache_clear (struct client_s
*, const char *, int agent
, int force
);
61 gpg_error_t
cache_add_file (const char *, struct cache_data_s
*, long timeout
,
64 gpg_error_t
cache_init ();
65 void cache_mutex_init ();
66 unsigned cache_file_count ();
67 gpg_error_t
cache_is_shadowed (const char *filename
);
68 struct cache_data_s
*cache_get_data (const char *, int *defer
);
69 gpg_error_t
cache_set_data (const char *, struct cache_data_s
*);
70 gpg_error_t
cache_lock_mutex (void *ctx
, const char *, long mutex_timeout
,
71 int add
, long timeout
);
72 gpg_error_t
cache_unlock_mutex (const char *, int remove
);
75 void cache_free_data_once (struct cache_data_s
*data
);
76 gpg_error_t
cache_defer_clear (const char *);
77 gpg_error_t
cache_encrypt (struct crypto_s
*);
78 gpg_error_t
cache_decrypt (struct crypto_s
*);
79 gpg_error_t
cache_clear_agent_keys (const char *, int decrypt
, int sign
);
80 gpg_error_t
cache_agent_command (const char *);
81 gpg_error_t
cache_plaintext_get (const char *filename
, xmlDocPtr
*plain
);
82 gpg_error_t
cache_plaintext_release (xmlDocPtr
*);
83 gpg_error_t
cache_plaintext_set (const char *filename
, xmlDocPtr doc
,