05ba9a343bd7dfe86c55bd370f8ce33c6bcdc3a2
[u/mdw/catacomb] / key.h
1 /* -*-c-*-
2 *
3 * $Id: key.h,v 1.10 2004/04/08 01:02:49 mdw Exp $
4 *
5 * Simple key management
6 *
7 * (c) 1999 Straylight/Edgeware
8 */
9
10 /*----- Licensing notice --------------------------------------------------*
11 *
12 * This file is part of Catacomb.
13 *
14 * Catacomb is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
18 *
19 * Catacomb is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
23 *
24 * You should have received a copy of the GNU Library General Public
25 * License along with Catacomb; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27 * MA 02111-1307, USA.
28 */
29
30 /*----- Revision history --------------------------------------------------*
31 *
32 * $Log: key.h,v $
33 * Revision 1.10 2004/04/08 01:02:49 mdw
34 * key-binary.c
35 *
36 * Revision 1.9 2001/06/22 19:37:59 mdw
37 * New interface to enquire whether a key has expired.
38 *
39 * Revision 1.8 2001/02/03 11:57:38 mdw
40 * Allow creating keyfiles with no file attached.
41 *
42 * Revision 1.7 2000/12/06 20:33:27 mdw
43 * Make flags be macros rather than enumerations, to ensure that they're
44 * unsigned.
45 *
46 * Revision 1.6 2000/06/17 11:27:43 mdw
47 * Add key fetching interface.
48 *
49 * Revision 1.5 2000/02/12 18:55:40 mdw
50 * Make it all compile properly.
51 *
52 * Revision 1.4 2000/02/12 18:21:02 mdw
53 * Overhaul of key management (again).
54 *
55 * Revision 1.3 1999/12/22 15:47:48 mdw
56 * Major key-management revision.
57 *
58 * Revision 1.2 1999/12/10 23:29:48 mdw
59 * Change header file guard names.
60 *
61 * Revision 1.1 1999/09/03 08:41:12 mdw
62 * Initial import.
63 *
64 */
65
66 #ifndef CATACOMB_KEY_H
67 #define CATACOMB_KEY_H
68
69 #ifdef __cplusplus
70 extern "C" {
71 #endif
72
73 /*----- Header files ------------------------------------------------------*/
74
75 #include <stdio.h>
76 #include <time.h>
77
78 #include <mLib/bits.h>
79 #include <mLib/dstr.h>
80 #include <mLib/hash.h>
81 #include <mLib/sym.h>
82
83 #ifndef CATACOMB_KEY_DATA_H
84 # include "key-data.h"
85 #endif
86
87 #ifndef CATACOMB_GHASH_H
88 # include "ghash.h"
89 #endif
90
91 #ifndef CATACOMB_MP_H
92 # include "mp.h"
93 #endif
94
95 /*----- Data structures ---------------------------------------------------*/
96
97 /* --- Key attributes --- *
98 *
99 * Each attribute is stored as a symbol in a symbol table. The value is
100 * the plain (not url-encoded) text to be written to the the file. If the
101 * value is binary data, then by this point it's base-64 encoded.
102 */
103
104 typedef struct key_attr {
105 sym_base _b; /* Symbol table data */
106 char *p; /* Pointer to attribute value */
107 } key_attr;
108
109 /* --- Main key structure --- *
110 *
111 * Each key is stored in two symbol tables, one indexed by keyid, and the
112 * other indexed by type. Because many keys can have the same type, the type
113 * table contains a list of keys, sorted in descending order of expiry.
114 */
115
116 typedef struct key {
117
118 /* --- Hashtable management --- */
119
120 hash_base _b; /* Symbol table data */
121 struct key *next; /* Next key of the same type */
122
123 /* --- Basic key attributes --- */
124
125 uint32 id; /* Key id used to name it */
126 char *tag; /* Textual tag name */
127 char *type; /* Textual key type */
128 time_t exp, del; /* Expiry times for keys */
129
130 /* --- The key data itself --- */
131
132 key_data k; /* The actual key data */
133
134 /* --- Other attributes and commentary --- */
135
136 sym_table a; /* Hashtable of key attributes */
137 char *c; /* Any additional comments */
138 } key;
139
140 /* --- The keys-by-type entries --- */
141
142 typedef struct key_ref {
143 sym_base _b; /* Symbol table data */
144 key *k; /* Pointer to first key in list */
145 } key_ref;
146
147 /* --- A key file --- */
148
149 typedef struct key_file {
150 FILE *fp; /* File pointer open on file */
151 char *name; /* Filename used to create it */
152 unsigned f; /* Various useful flags */
153 hash_table byid; /* Table of keys by keyid */
154 sym_table bytype; /* Table of keys by type */
155 sym_table bytag; /* Table of keys by tag */
156 size_t idload; /* Loading on id table */
157 } key_file;
158
159 /* --- Key file flags --- */
160
161 #define KF_WRITE 1u /* File opened for writing */
162 #define KF_MODIFIED 2u /* File has been modified */
163
164 /* --- Iterating over keys --- *
165 *
166 * Both of these are simple symbol table iterators, but they're made distinct
167 * types for the dubious benefits that type safety brings.
168 */
169
170 typedef struct { hash_iter i; time_t t; } key_iter;
171 typedef struct { sym_iter i; } key_attriter;
172
173 /* --- Key fetching --- */
174
175 typedef struct key_fetchdef {
176 char *name; /* Name of item */
177 size_t off; /* Offset into target structure */
178 unsigned e; /* Flags for the item */
179 const struct key_fetchdef *kf; /* Substructure pointer */
180 } key_fetchdef;
181
182 /* --- File opening options --- */
183
184 #define KOPEN_READ 0u
185 #define KOPEN_WRITE 1u
186 #define KOPEN_MASK 0xff
187 #define KOPEN_NOFILE 0x100
188
189 /* --- Various other magic numbers --- */
190
191 #define KEXP_FOREVER ((time_t)-1) /* Never expire this key */
192 #define KEXP_EXPIRE ((time_t)-2) /* Expire this key when unused */
193
194 /* --- Key error codes --- */
195
196 enum {
197 KERR_OK = 0, /* No error */
198 KERR_BADTAG = -1, /* Malformed tag string */
199 KERR_BADTYPE = -2, /* Malformed type string */
200 KERR_BADCOMMENT = -3, /* Malformed comment string */
201 KERR_DUPID = -4, /* Duplicate keyid */
202 KERR_DUPTAG = -5, /* Duplicate key tag string */
203 KERR_READONLY = -6, /* Key file is read-only */
204 KERR_WILLEXPIRE = -7, /* Key will eventually expire */
205 KERR_EXPIRED = -8, /* Key has already expired */
206 KERR_BADFLAGS = -9, /* Error in flags string */
207 KERR_BADPASS = -10, /* Error decrypting locked key */
208 KERR_WRONGTYPE = -11, /* Key has incorrect type */
209 KERR_NOTFOUND = -12, /* Key couldn't be found */
210 KERR_BADATTR = -13, /* Malformed attribute name */
211 KERR_MAX /* Largest possible error */
212 };
213
214 /* --- Write error codes --- */
215
216 enum {
217 KWRITE_OK, /* Everything went fine */
218 KWRITE_FAIL = -1, /* Close attempt failed */
219 KWRITE_BROKEN = -2 /* Key ring needs manual fixing */
220 };
221
222 /* --- Error reporting functions for @key_merge@ and @key_open@ --- */
223
224 typedef void key_reporter(const char */*file*/, int /*line*/,
225 const char */*err*/, void */*p*/);
226
227 /* --- Macros for testing expiry --- */
228
229 #define KEY_EXPIRED(now, exp) \
230 ((exp) == KEXP_EXPIRE || ((exp) != KEXP_FOREVER && (exp) < (now)))
231
232 /*----- Reading and writing keys and files --------------------------------*/
233
234 /* --- @key_merge@ --- *
235 *
236 * Arguments: @key_file *f@ = pointer to file structure
237 * @const char *file@ = name of file (for error messages)
238 * @FILE *fp@ = file handle to read from
239 * @key_reporter *rep@ = error reporting function
240 * @void *arg@ = argument for function
241 *
242 * Returns: Error code (one of the @KERR@ constants).
243 *
244 * Use: Reads keys from a file, and inserts them into the file.
245 */
246
247 extern int key_merge(key_file */*f*/, const char */*file*/, FILE */*fp*/,
248 key_reporter */*rep*/, void */*arg*/);
249
250 /* --- @key_extract@ --- *
251 *
252 * Arguments: @key_file *f@ = pointer to file structure
253 * @key *k@ = key to extract
254 * @FILE *fp@ = file to write on
255 * @const key_filter *kf@ = pointer to key selection block
256 *
257 * Returns: Zero if OK, EOF on error.
258 *
259 * Use: Extracts a key to an ouptut file.
260 */
261
262 extern int key_extract(key_file */*f*/, key */*k*/, FILE */*fp*/,
263 const key_filter */*kf*/);
264
265 /* --- @key_open@ --- *
266 *
267 * Arguments: @key_file *f@ = pointer to file structure to initialize
268 * @const char *file@ = pointer to the file name
269 * @unsigned how@ = opening options (@KOPEN_*@).
270 * @key_reporter *rep@ = error reporting function
271 * @void *arg@ = argument for function
272 *
273 * Returns: Zero if it worked, nonzero otherwise.
274 *
275 * Use: Opens a key file, reads its contents, and stores them in a
276 * structure. The file is locked appropriately until closed
277 * using @key_close@. On an error, everything is cleared away
278 * tidily. If the file is opened with @KOPEN_WRITE@, it's
279 * created if necessary, with read and write permissions for its
280 * owner only.
281 */
282
283 extern int key_open(key_file */*f*/, const char */*file*/, unsigned /*how*/,
284 key_reporter */*rep*/, void */*arg*/);
285
286 /* --- @key_close@ --- *
287 *
288 * Arguments: @key_file *f@ = pointer to key file block
289 *
290 * Returns: A @KWRITE_@ code indicating how it went.
291 *
292 * Use: Frees all the key data, writes any changes. Make sure that
293 * all hell breaks loose if this returns @KWRITE_BROKEN@.
294 */
295
296 extern int key_close(key_file */*f*/);
297
298 /* --- @key_save@ --- *
299 *
300 * Arguments: @key_file *f@ = pointer to key file block
301 *
302 * Returns: A @KWRITE_@ code indicating how well it worked.
303 *
304 * Use: Writes a key file's data back to the actual file. This code
305 * is extremely careful about error handling. It should usually
306 * be able to back out somewhere sensible, but it can tell when
307 * it's got itself into a real pickle and starts leaving well
308 * alone.
309 *
310 * Callers, please make sure that you ring alarm bells when this
311 * function returns @KWRITE_BROKEN@.
312 */
313
314 extern int key_save(key_file */*f*/);
315
316 /* --- @key_lockfile@ --- *
317 *
318 * Arguments: @key_file *f@ = pointer to file structure to initialize
319 * @const char *file@ = pointer to the file name
320 * @unsigned how@ = opening options (@KOPEN_*@).
321 *
322 * Returns: Zero if it worked, nonzero otherwise.
323 *
324 * Use: Opens a keyfile and stores the information needed for
325 * continued access in the structure.
326 *
327 * If the file is opened with @KOPEN_WRITE@, it's created if
328 * necessary with read and write permissions for owner only, and
329 * locked for update while it's open.
330 *
331 * This is a system-dependent routine, and only really intended
332 * for the private use of @key_open@.
333 */
334
335 extern int key_lockfile(key_file */*f*/, const char */*file*/,
336 unsigned /*how*/);
337
338 /*----- Creating and manipulating keys ------------------------------------*/
339
340 /* --- @key_new@ ---
341 *
342 * Arguments: @key_file *f@ = pointer to key file
343 * @uint32 id@ = keyid to set
344 * @const char *type@ = the type of this key
345 * @time_t exp@ = when the key expires
346 * @int *err@ = where to store the error condition
347 *
348 * Returns: Key block containing new data, or null if it couldn't be
349 * done.
350 *
351 * Use: Attaches a new key to a key file. You must have a writable
352 * key file for this to work.
353 *
354 * The type is a key type string. This interface doesn't care
355 * about how type strings are formatted: it just treats them as
356 * opaque gobs of text. Clients are advised to choose some
357 * standard for representing key types, though.
358 *
359 * The expiry time should either be a time in the future, or the
360 * magic value @KEXP_FOREVER@ which means `never expire this
361 * key'. Be careful with `forever' keys. If I were you, I'd
362 * use a more sophisticated key management system than this for
363 * them.
364 *
365 * You have to set the actual key yourself.
366 */
367
368 extern key *key_new(key_file */*f*/, uint32 /*id*/, const char */*type*/,
369 time_t /*exp*/, int */*err*/);
370
371 /* --- @key_delete@ --- *
372 *
373 * Arguments: @key_file *f@ = pointer to file block
374 * @key *k@ = key to delete
375 *
376 * Returns: Error code (one of the @KERR@ constants).
377 *
378 * Use: Removes the given key from the list. The key file must be
379 * writable. (Due to the horridness of the data structures,
380 * deleted keys aren't actually removed, just marked so that
381 * they can't be looked up or iterated over. One upshot of
382 * this is that they don't get written back to the file when
383 * it's closed.)
384 */
385
386 extern int key_delete(key_file */*f*/, key */*k*/);
387
388 /* --- @key_expired@ --- *
389 *
390 * Arguments: @key *k@ = pointer to key block
391 *
392 * Returns: Zero if the key is OK, nonzero if it's expired.
393 */
394
395 int key_expired(key */*k*/);
396
397 /* --- @key_expire@ --- *
398 *
399 * Arguments: @key_file *f@ = pointer to file block
400 * @key *k@ = pointer to key block
401 *
402 * Returns: Error code (one of the @KERR@ constants).
403 *
404 * Use: Immediately marks the key as expired. It may be removed
405 * immediately, if it is no longer required, and will be removed
406 * by a tidy operation when it is no longer required. The key
407 * file must be writable.
408 */
409
410 extern int key_expire(key_file */*f*/, key */*k*/);
411
412 /* --- @key_used@ --- *
413 *
414 * Arguments: @key_file *f@ = pointer to key file
415 * @key *k@ = pointer to key block
416 * @time_t t@ = when key can be removed
417 *
418 * Returns: Zero if OK, nonzero on failure.
419 *
420 * Use: Marks a key as being required until a given time. Even
421 * though the key may expire before then (and won't be returned
422 * by type after that time), it will still be available when
423 * requested explicitly by id. The key file must be writable.
424 *
425 * The only (current) reason for failure is attempting to use
426 * a key which can expire for something which can't.
427 */
428
429 extern int key_used(key_file */*f*/, key */*k*/, time_t /*t*/);
430
431 /* --- @key_fingerprint@ --- *
432 *
433 * Arguments: @key *k@ = the key to fingerprint
434 * @ghash *h@ = the hash to use
435 * @const key_filter *kf@ = filter to apply
436 *
437 * Returns: Nonzero if the key slightly matched the filter.
438 *
439 * Use: Updates the hash context with the key contents.
440 */
441
442 extern int key_fingerprint(key */*k*/, ghash */*h*/,
443 const key_filter */*kf*/);
444
445 /*----- Setting and reading attributes ------------------------------------*/
446
447 /* --- @key_chkident@ --- *
448 *
449 * Arguments: @const char *p@ = pointer to a type string
450 *
451 * Returns: Zero if OK, -1 on error.
452 *
453 * Use: Checks whether an identification component string is OK.
454 */
455
456 extern int key_chkident(const char */*p*/);
457
458 /* --- @key_chkcomment@ --- *
459 *
460 * Arguments: @const char *p@ = pointer to a comment string
461 *
462 * Returns: Zero if OK, -1 on error.
463 *
464 * Use: Checks whether a comment string is OK.
465 */
466
467 extern int key_chkcomment(const char */*p*/);
468
469 /* --- @key_setcomment@ --- *
470 *
471 * Arguments: @key_file *f@ = pointer to key file block
472 * @key *k@ = pointer to key block
473 * @const char *c@ = pointer to comment to set, or zero
474 *
475 * Returns: Error code (one of the @KERR@ constants).
476 *
477 * Use: Replaces the key's current comment with a new one.
478 */
479
480 extern int key_setcomment(key_file */*f*/, key */*k*/, const char */*c*/);
481
482 /* --- @key_settag@ --- *
483 *
484 * Arguments: @key_file *f@ = pointer to key file block
485 * @key *k@ = pointer to key block
486 * @const char *tag@ = pointer to comment to set, or zero
487 *
488 * Returns: Error code (one of the @KERR@ constants).
489 *
490 * Use: Replaces the key's current tag with a new one.
491 */
492
493 extern int key_settag(key_file */*f*/, key */*k*/, const char */*tag*/);
494
495 /* --- @key_fulltag@ --- *
496 *
497 * Arguments: @key *k@ = pointer to key
498 * @dstr *d@ = pointer to destination string
499 *
500 * Returns: ---
501 *
502 * Use: Emits the key's full tag, which has the form
503 * `ID:TYPE[:TAG]'. This is used in the textual file format,
504 * and to identify passphrases for locked keys.
505 */
506
507 extern void key_fulltag(key */*k*/, dstr */*d*/);
508
509 /* --- @key_qtag@ --- *
510 *
511 * Arguments: @key_file *f@ = key file to find a key from
512 * @const char *tag@ = pointer to tag string
513 * @dstr *d@ = pointer to string for full tag name
514 * @key **k@ = where to store the key pointer
515 * @key_data **kd@ = where to store the key data pointer
516 *
517 * Returns: Zero if OK, nonzero if it failed.
518 *
519 * Use: Performs a full lookup on a qualified tag name. The tag is
520 * qualified by the names of subkeys, separated by dots. Hence,
521 * a qualified tag is ID|TAG[.TAG...]. The various result
522 * pointers can be null to indicate that the result isn't
523 * interesting.
524 */
525
526 extern int key_qtag(key_file */*f*/, const char */*tag*/,
527 dstr */*d*/, key **/*k*/, key_data **/*kd*/);
528
529 /* --- @key_getattr@ --- *
530 *
531 * Arguments: @key_file *f@ = pointer to file
532 * @key *k@ = pointer to key
533 * @const char *n@ = pointer to attribute name
534 *
535 * Returns: Pointer to attribute value, or null if not found.
536 *
537 * Use: Returns the value of a key attribute.
538 */
539
540 extern const char *key_getattr(key_file */*f*/, key */*k*/,
541 const char */*n*/);
542
543 /* --- @key_putattr@ --- *
544 *
545 * Arguments: @key_file *f@ = pointer to file
546 * @key *k@ = pointer to key
547 * @const char *n@ = pointer to attribute name
548 * @const char *v@ = pointer to attribute value or null
549 *
550 * Returns: Error code (one of the @KERR@ constants).
551 *
552 * Use: Inserts an attribute on a key. If an attribute with the same
553 * name already exists, it is deleted. Setting a null value
554 * removes the attribute.
555 */
556
557 extern int key_putattr(key_file */*f*/, key */*k*/,
558 const char */*n*/, const char */*v*/);
559
560 /* --- @key_mkattriter@ --- *
561 *
562 * Arguments: @key_attriter *i@ = pointer to attribute iterator
563 * @key *k@ = pointer to key
564 *
565 * Returns: ---
566 *
567 * Use: Initializes an attribute iterator. The attributes are
568 * returned by @key_nextattr@.
569 */
570
571 extern void key_mkattriter(key_attriter */*i*/, key */*k*/);
572
573 /* --- @key_nextattr@ --- *
574 *
575 * Arguments: @key_attriter *i@ = pointer to attribute iterator
576 * @const char **n, **v@ = pointers to name and value
577 *
578 * Returns: Zero if no attribute available, or nonzero if returned OK.
579 *
580 * Use: Returns the next attribute.
581 */
582
583 extern int key_nextattr(key_attriter */*i*/,
584 const char **/*n*/, const char **/*v*/);
585
586 /*----- Searching and iterating -------------------------------------------*/
587
588 /* --- @key_bytype@ --- *
589 *
590 * Arguments: @key_file *f@ = key file we want a key from
591 * @const char *type@ = type string for desired key
592 *
593 * Returns: Pointer to the best key to use, or null.
594 *
595 * Use: Looks up a key by its type. Returns the key with the latest
596 * expiry time. This function will not return an expired key.
597 */
598
599 extern key *key_bytype(key_file */*f*/, const char */*type*/);
600
601 /* --- @key_byid@ --- *
602 *
603 * Arguments: @key_file *f@ = key file to find a key from
604 * @uint32 id@ = id to look for
605 *
606 * Returns: Key with matching id.
607 *
608 * Use: Returns a key given its id. This function will return an
609 * expired key, but not a deleted one.
610 */
611
612 extern key *key_byid(key_file */*f*/, uint32 /*id*/);
613
614 /* --- @key_bytag@ --- *
615 *
616 * Arguments: @key_file *f@ = key file to find a key from
617 * @const char *tag@ = pointer to tag string
618 *
619 * Returns: Key with matching id or tag.
620 *
621 * Use: Returns a key given its tag or id. This function will return
622 * an expired key, but not a deleted one.
623 */
624
625 extern key *key_bytag(key_file */*f*/, const char */*tag*/);
626
627 /* --- @key_mkiter@ --- *
628 *
629 * Arguments: @key_iter *i@ = pointer to iterator object
630 * @key_file *f@ = pointer to file structure
631 *
632 * Returns: ---
633 *
634 * Use: Initializes a key iterator. The keys are returned by
635 * @key_next@.
636 */
637
638 extern void key_mkiter(key_iter */*i*/, key_file */*f*/);
639
640 /* --- @key_next@ --- *
641 *
642 * Arguments: @key_iter *i@ = pointer to iterator object
643 *
644 * Returns: Pointer to next key, or null.
645 *
646 * Use: Returns the next key in some arbitrary sequence.
647 */
648
649 extern key *key_next(key_iter */*i*/);
650
651 /*----- Fetching key data conveniently ------------------------------------*/
652
653 /* --- @key_fetchinit@ --- *
654 *
655 * Arguments: @const key_fetchdef *kf@ = pointer to base definition
656 * @key_packstruct *kps@ = pointer to destination packing def
657 * @void *p@ = pointer to destination block
658 *
659 * Returns: Pointer to packing definition.
660 *
661 * Use: Initializes a packing definition (@key_packdef@ structure).
662 * If @kps@ is null on entry, an appropriately sized block is
663 * allocated automatically. Otherwise it must be large enough.
664 */
665
666 extern key_packdef *key_fetchinit(const key_fetchdef */*kf*/,
667 key_packstruct */*kp*/, void */*p*/);
668
669 /* --- @key_fetch@ --- *
670 *
671 * Arguments: @key_packdef *kp@ = pointer to packing structure
672 * @key *k@ = key file containing desired key
673 *
674 * Returns: Error code, or zero.
675 *
676 * Use: Fetches an unpacked key from a packed one.
677 */
678
679 extern int key_fetch(key_packdef */*kp*/, key */*k*/);
680
681 /* --- @key_fetchbyname@ --- *
682 *
683 * Arguments: @key_packdef *kp@ = pointer to packing structure
684 * @key_file *kf@ = key file containing desired key
685 * @const char *tag@ = user's tag describing the key
686 *
687 * Returns: Error code, or zero.
688 *
689 * Use: Fetches a named key from a key file and unpacks it
690 * conveniently.
691 */
692
693 extern int key_fetchbyname(key_packdef */*kp*/,
694 key_file */*kf*/, const char */*tag*/);
695
696 /* --- @key_fetchdone@ --- *
697 *
698 * Arguments: @key_packdef *kp@ = pointer to packing structure
699 *
700 * Returns: ---
701 *
702 * Use: Frees a packing structure. If the structure was allocated by
703 * @key_fetchinit@ then it is freed.
704 */
705
706 extern void key_fetchdone(key_packdef */*kp*/);
707
708 /*----- Other functions ---------------------------------------------------*/
709
710 /* --- @key_moan@ --- *
711 *
712 * Arguments: @const char *file@ = name of the file
713 * @int line@ = line number in file
714 * @const char *msg@ = error message
715 * @void *p@ = argument pointer
716 *
717 * Returns: ---
718 *
719 * Use: Reports an error message about loading a key file.
720 */
721
722 extern void key_moan(const char */*file*/, int /*line*/,
723 const char */*msg*/, void */*p*/);
724
725 /* --- @key_strerror@ --- *
726 *
727 * Arguments: @int err@ = error code from @key_new@
728 *
729 * Returns: Pointer to error string.
730 *
731 * Use: Translates a @KERR@ error code into a human-readable string.
732 */
733
734 extern const char *key_strerror(int /*err*/);
735
736 /*----- That's all, folks -------------------------------------------------*/
737
738 #ifdef __cplusplus
739 }
740 #endif
741
742 #endif