chiark
/
gitweb
/
~mdw
/
tripe
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rearrange so as not to include Linux headers unless we need to.
[tripe]
/
keymgmt.c
diff --git
a/keymgmt.c
b/keymgmt.c
index 960b9c93a946c3ab43fc553469be6901904ddb46..54a31b0b981e6fb686a0cf4779743d9ef8f85459 100644
(file)
--- a/
keymgmt.c
+++ b/
keymgmt.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: keymgmt.c,v 1.
1 2001/02/03 20:26:37
mdw Exp $
+ * $Id: keymgmt.c,v 1.
3 2001/06/22 19:40:36
mdw Exp $
*
* Key loading and storing
*
*
* Key loading and storing
*
@@
-29,6
+29,12
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: keymgmt.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: keymgmt.c,v $
+ * Revision 1.3 2001/06/22 19:40:36 mdw
+ * Support expiry of other peers' public keys.
+ *
+ * Revision 1.2 2001/06/19 22:07:09 mdw
+ * Cosmetic fixes.
+ *
* Revision 1.1 2001/02/03 20:26:37 mdw
* Initial checkin.
*
* Revision 1.1 2001/02/03 20:26:37 mdw
* Initial checkin.
*
@@
-53,7
+59,7
@@
static fwatch w_priv, w_pub;
/* --- @keymoan@ --- *
*
/* --- @keymoan@ --- *
*
- * Arguments: @
@
const char *file@ = name of the file
+ * Arguments: @const char *file@ = name of the file
* @int line@ = line number in file
* @const char *msg@ = error message
* @void *p@ = argument pointer
* @int line@ = line number in file
* @const char *msg@ = error message
* @void *p@ = argument pointer
@@
-230,21
+236,26
@@
void km_init(const char *priv, const char *pub, const char *tag)
*
* Arguments: @const char *tag@ = public key tag to load
* @dh_pub *kpub@ = where to put the public key
*
* Arguments: @const char *tag@ = public key tag to load
* @dh_pub *kpub@ = where to put the public key
+ * @time_t *t_exp@ = where to put the expiry time
*
* Returns: Zero if OK, nonzero if it failed.
*
* Use: Fetches a public key from the keyring.
*/
*
* Returns: Zero if OK, nonzero if it failed.
*
* Use: Fetches a public key from the keyring.
*/
-int km_getpubkey(const char *tag, dh_pub *kpub)
+int km_getpubkey(const char *tag, dh_pub *kpub
, time_t *t_exp
)
{
key_packstruct kps[DH_PUBFETCHSZ];
key_packdef *kp;
{
key_packstruct kps[DH_PUBFETCHSZ];
key_packdef *kp;
+ key *k;
dh_pub dp;
int e;
kp = key_fetchinit(dh_pubfetch, kps, &dp);
dh_pub dp;
int e;
kp = key_fetchinit(dh_pubfetch, kps, &dp);
- e = key_fetchbyname(kp, kf_pub, tag);
+ if ((k = key_bytag(kf_pub, tag)) == 0)
+ e = KERR_NOTFOUND;
+ else
+ e = key_fetch(kp, k);
key_fetchdone(kp);
if (e) {
a_warn("error loading public key `%s': %s", tag, key_strerror(e));
key_fetchdone(kp);
if (e) {
a_warn("error loading public key `%s': %s", tag, key_strerror(e));
@@
-269,6
+280,7
@@
int km_getpubkey(const char *tag, dh_pub *kpub)
kpub->dp.q = MP_COPY(dp.dp.q);
kpub->dp.g = MP_COPY(dp.dp.g);
kpub->y = MP_COPY(dp.y);
kpub->dp.q = MP_COPY(dp.dp.q);
kpub->dp.g = MP_COPY(dp.dp.g);
kpub->y = MP_COPY(dp.y);
+ *t_exp = k->exp;
return (0);
}
return (0);
}