2 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015,
4 Ben Kibbey <bjk@luxsci.net>
6 This file is part of pwmd.
8 Pwmd is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
11 (at your option) any later version.
13 Pwmd is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with Pwmd. If not, see <http://www.gnu.org/licenses/>.
25 #include <gpg-error.h>
32 char **pubkey
; /* keyid's */
33 char **sigkey
; /* keyid's */
34 void *doc
; /* AES-128 encrypted */
36 unsigned char *crc
; /* Checksum of the data file. */
41 char **grip
; /* Public keygrips. */
42 char **siggrip
; /* Signing keygrips. */
43 char *filename
; /* Associated filename. */
44 int timeout
; /* cache_timer_thread(). */
45 int reset
; /* To reset .timeout. */
46 int defer_clear
; /* Another thread wants to clear the cache
47 entry for this file. Prevent resetting the
48 timer until this flag is cleared. */
49 pthread_mutex_t
*mutex
; /* Data file mutex. */
50 struct cache_data_s
*data
;
54 gpg_error_t
cache_kill_scd ();
55 void cache_adjust_timeout ();
56 gpg_error_t
cache_set_timeout (const char *, int timeout
);
57 gpg_error_t
cache_iscached (const char *, int *defer
, int agent
, int sign
);
58 gpg_error_t
cache_clear (struct client_s
*, const char *, int agent
);
59 gpg_error_t
cache_add_file (const char *, struct cache_data_s
*, int timeout
);
61 gpg_error_t
cache_init ();
62 void cache_mutex_init ();
63 unsigned cache_file_count ();
64 struct cache_data_s
*cache_get_data (const char *);
65 gpg_error_t
cache_set_data (const char *, struct cache_data_s
*);
66 gpg_error_t
cache_lock_mutex (void *ctx
, const char *, long mutex_timeout
,
67 int add
, int timeout
);
68 gpg_error_t
cache_unlock_mutex (const char *, int remove
);
71 void cache_release_mutex ();
72 void cache_free_data_once (struct cache_data_s
*data
);
73 gpg_error_t
cache_defer_clear (const char *);
74 gpg_error_t
cache_encrypt (struct crypto_s
*);
75 gpg_error_t
cache_decrypt (struct crypto_s
*);
76 gpg_error_t
cache_clear_agent_keys (const char *, int decrypt
, int sign
);