chiark / gitweb /
sigpubkey/sigprivkey: Provide a dispose() method
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 29 Sep 2019 13:21:31 +0000 (14:21 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 30 Dec 2019 13:15:49 +0000 (13:15 +0000)
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 <ijackson@chiark.greenend.org.uk>
rsa.c
secnet.h

diff --git a/rsa.c b/rsa.c
index 4761d1607294e15fbeb85837ecba054b5d3d9ba5..1c37ef98acf3abec9e641267d532e720efa74f27 100644 (file)
--- 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 */
index b72bfc7fc42bc6ca26b65017851b8ffb6147f323..77ba017bbbdb1bf9b7f86581f7bcb95d35954f3d 100644 (file)
--- 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 */