chiark / gitweb /
rsa: Provide dict context argument in load_ctx
[secnet.git] / pubkeys.c
index 903103f8399ae487f4f31ef92a6f26f5d9d30658..efcfa77fc31d717ab9a93d79edc312e1d16be121 100644 (file)
--- a/pubkeys.c
+++ b/pubkeys.c
@@ -49,15 +49,8 @@ const struct sigscheme_info *sigscheme_lookup(const char *name)
 static list_t *makepublic_apply(closure_t *self, struct cloc loc,
                                dict_t *context, list_t *args)
 {
-#define ARG(ix,vn,what)                                                        \
-    item_t *vn##_i=list_elem(args,ix);                                 \
-    if (!vn##_i) cfgfatal(loc,"make-public","need " what);             \
-    if (vn##_i->type!=t_string) cfgfatal(vn##_i->loc,"make-public",    \
-                                   what "must be string");             \
-    const char *vn=vn##_i->data.string
-
-    ARG(0,algname,"algorithm name");
-    ARG(1,b91d,"base91s-encoded public key");
+    CL_GET_STR_ARG(0,algname,"algorithm name");
+    CL_GET_STR_ARG(1,b91d,"base91s-encoded public key");
 
     const struct sigscheme_info *sch=sigscheme_lookup(algname);
     if (!sch) cfgfatal(algname_i->loc,"make-public",
@@ -77,9 +70,12 @@ static list_t *makepublic_apply(closure_t *self, struct cloc loc,
     buf.size += base91s_decode_end(&b91,buf.start+buf.size);
     assert(buf.size <= buf.alloclen);
 
+    struct cfgfile_log log;
+    cfgfile_log_init(&log,loc,"make-public");
+
     struct sigpubkey_if *pubkey;
     closure_t *cl;
-    bool_t ok=sch->loadpub(sch,&buf,&pubkey,&cl,system_log,loc);
+    bool_t ok=sch->loadpub(sch,&buf,&pubkey,&cl,&log.log,loc);
     if (!ok) cfgfatal(loc,"make-public","public key loading failed");
 
     if (pubkey->sethash) {