From: Ian Jackson Date: Sun, 29 Sep 2019 13:21:31 +0000 (+0100) Subject: sigpubkey/sigprivkey: Provide a dispose() method X-Git-Tag: v0.6.0~212 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=secnet.git;a=commitdiff_plain;h=cd8a1c31b9aab10493806953a077c4a75fb91104 sigpubkey/sigprivkey: Provide a dispose() method This is needed allow the site code to load and unload keys dynamically. This is just the interface, with no implemntation and no callers, split out like this for early review. The two xxx's will be fixed rather later in "rsa1: Provide dispose functions" (but, obviously, before we add any callers). Signed-off-by: Ian Jackson --- diff --git a/rsa.c b/rsa.c index 4761d16..1c37ef9 100644 --- a/rsa.c +++ b/rsa.c @@ -276,6 +276,7 @@ static list_t *rsapub_apply(closure_t *self, struct cloc loc, dict_t *context, st->ops.unpick=rsa_sig_unpick; st->ops.check=rsa_sig_check; st->ops.hash=0; + st->ops.dispose=0; /* xxx */ st->loc=loc; i=list_elem(args,0); @@ -357,6 +358,7 @@ static list_t *rsapriv_apply(closure_t *self, struct cloc loc, dict_t *context, st->common.hashbuf=NULL; st->ops.sign=rsa_sign; st->ops.hash=0; + st->ops.dispose=0; /* xxx */ st->loc=loc; /* Argument is filename pointing to SSH1 private key file */ diff --git a/secnet.h b/secnet.h index b72bfc7..77ba017 100644 --- a/secnet.h +++ b/secnet.h @@ -451,6 +451,8 @@ struct random_if { /* SIGPUBKEY interface */ typedef void sig_sethash_fn(void *st, struct hash_if *hash); +typedef void sig_dispose_fn(void *st); + typedef bool_t sig_unpick_fn(void *sst, struct buffer_if *msg, struct alg_msg_data *sig); typedef bool_t sig_checksig_fn(void *st, uint8_t *data, int32_t datalen, @@ -461,6 +463,7 @@ struct sigpubkey_if { sig_unpick_fn *unpick; sig_checksig_fn *check; const struct hash_if *hash; + sig_dispose_fn *dispose; }; /* SIGPRIVKEY interface */ @@ -474,6 +477,7 @@ struct sigprivkey_if { sig_sethash_fn *sethash; /* must be called before use, if non-0 */ sig_makesig_fn *sign; const struct hash_if *hash; + sig_dispose_fn *dispose; }; /* COMM interface */