[SECNET RFC PATCH 4/5] sigpubkey/sigprivkey: Provide a dispose() method

Ian Jackson ijackson at chiark.greenend.org.uk
Sun Sep 29 14:47:20 BST 2019


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.

Signed-off-by: Ian Jackson <ijackson at chiark.greenend.org.uk>
---
 rsa.c    | 2 ++
 secnet.h | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/rsa.c b/rsa.c
index 86766d10..e769c3d5 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 529bc315..53a2b6d4 100644
--- a/secnet.h
+++ b/secnet.h
@@ -420,6 +420,8 @@ struct random_if {
 /* SIGPUBKEY interface */
 
 typedef void sig_sethash_fn(void *st, struct hash_if *hash);
+typedef bool_t 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,
@@ -430,6 +432,7 @@ struct sigpubkey_if {
     sig_unpick_fn *unpick;
     sig_checksig_fn *check;
     const struct hash_if *hash;
+    sig_dispose_fn *dispose;
 };
 
 /* SIGPRIVKEY interface */
@@ -443,6 +446,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 */
-- 
2.11.0




More information about the sgo-software-discuss mailing list