X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/9f1b58fea081b172581719412abe83e660469f97..578a86d91941a0f722b87973d88e84ec2cf9a608:/key.h diff --git a/key.h b/key.h index 09bcad5..ada6260 100644 --- a/key.h +++ b/key.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: key.h,v 1.8 2001/02/03 11:57:38 mdw Exp $ + * $Id: key.h,v 1.11 2004/04/08 01:36:15 mdw Exp $ * * Simple key management * @@ -27,36 +27,6 @@ * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: key.h,v $ - * Revision 1.8 2001/02/03 11:57:38 mdw - * Allow creating keyfiles with no file attached. - * - * Revision 1.7 2000/12/06 20:33:27 mdw - * Make flags be macros rather than enumerations, to ensure that they're - * unsigned. - * - * Revision 1.6 2000/06/17 11:27:43 mdw - * Add key fetching interface. - * - * Revision 1.5 2000/02/12 18:55:40 mdw - * Make it all compile properly. - * - * Revision 1.4 2000/02/12 18:21:02 mdw - * Overhaul of key management (again). - * - * Revision 1.3 1999/12/22 15:47:48 mdw - * Major key-management revision. - * - * Revision 1.2 1999/12/10 23:29:48 mdw - * Change header file guard names. - * - * Revision 1.1 1999/09/03 08:41:12 mdw - * Initial import. - * - */ - #ifndef CATACOMB_KEY_H #define CATACOMB_KEY_H @@ -78,6 +48,10 @@ # include "key-data.h" #endif +#ifndef CATACOMB_GHASH_H +# include "ghash.h" +#endif + #ifndef CATACOMB_MP_H # include "mp.h" #endif @@ -197,6 +171,7 @@ enum { KERR_BADPASS = -10, /* Error decrypting locked key */ KERR_WRONGTYPE = -11, /* Key has incorrect type */ KERR_NOTFOUND = -12, /* Key couldn't be found */ + KERR_BADATTR = -13, /* Malformed attribute name */ KERR_MAX /* Largest possible error */ }; @@ -374,6 +349,15 @@ extern key *key_new(key_file */*f*/, uint32 /*id*/, const char */*type*/, extern int key_delete(key_file */*f*/, key */*k*/); +/* --- @key_expired@ --- * + * + * Arguments: @key *k@ = pointer to key block + * + * Returns: Zero if the key is OK, nonzero if it's expired. + */ + +int key_expired(key */*k*/); + /* --- @key_expire@ --- * * * Arguments: @key_file *f@ = pointer to file block @@ -408,6 +392,20 @@ extern int key_expire(key_file */*f*/, key */*k*/); extern int key_used(key_file */*f*/, key */*k*/, time_t /*t*/); +/* --- @key_fingerprint@ --- * + * + * Arguments: @key *k@ = the key to fingerprint + * @ghash *h@ = the hash to use + * @const key_filter *kf@ = filter to apply + * + * Returns: Nonzero if the key slightly matched the filter. + * + * Use: Updates the hash context with the key contents. + */ + +extern int key_fingerprint(key */*k*/, ghash */*h*/, + const key_filter */*kf*/); + /*----- Setting and reading attributes ------------------------------------*/ /* --- @key_chkident@ --- *