[SECNET PATCH 2/6] rsa: Provide dict context argument in load_ctx

Ian Jackson ijackson at chiark.greenend.org.uk
Thu Feb 13 17:52:08 GMT 2020


This is going to be used to make the old rsa-public and rsa-private
names honour a "hash" dictionary key in the context.

The new generic privcache and keyset machinery will use a fixed hash
so does not pass the dictionary.

Signed-off-by: Ian Jackson <ijackson at chiark.greenend.org.uk>
---
 rsa.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/rsa.c b/rsa.c
index 3f6c7f92f..145df5e46 100644
--- a/rsa.c
+++ b/rsa.c
@@ -53,6 +53,7 @@ struct load_ctx {
 		   const char *message, va_list args);
     bool_t (*postreadcheck)(struct load_ctx *l, FILE *f);
     const char *what;
+    dict_t *deprdict; /* used only to look up hash */
     struct cloc loc;
     union {
 	struct {
@@ -378,6 +379,7 @@ static list_t *rsapub_apply(closure_t *self, struct cloc loc, dict_t *context,
     l->verror=verror_cfgfatal;
     l->postreadcheck=0;
     l->what="rsa-public";
+    l->deprdict=context;
     l->loc=loc;
 
 #define RSAPUB_APPLY_GETBN(ix,en,what)				\
@@ -413,6 +415,7 @@ bool_t rsa1_loadpub(const struct sigscheme_info *algo,
     l->verror=verror_tryload;
     l->postreadcheck=0;
     l->what="rsa1_loadpub";
+    l->deprdict=0;
     l->loc=loc;
     l->u.tryload.log=log;
 
@@ -735,6 +738,7 @@ bool_t rsa1_loadpriv(const struct sigscheme_info *algo,
     l->what="rsa1priv load";
     l->verror=verror_tryload;
     l->postreadcheck=postreadcheck_tryload;
+    l->deprdict=0;
     l->loc=loc;
     l->u.tryload.log=log;
 
@@ -770,6 +774,7 @@ static list_t *rsapriv_apply(closure_t *self, struct cloc loc, dict_t *context,
     l->what="rsa-private";
     l->verror=verror_cfgfatal;
     l->postreadcheck=postreadcheck_apply;
+    l->deprdict=context;
     l->loc=loc;
 
     /* Argument is filename pointing to SSH1 private key file */
-- 
2.11.0




More information about the sgo-software-discuss mailing list