chiark / gitweb /
sig: Make closure interface not contain sig alg name "rsa"
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 26 Sep 2019 21:29:02 +0000 (22:29 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 29 Sep 2019 14:56:21 +0000 (15:56 +0100)
We intend to be able to support other signature algorithms.  This will
be done with this closure, but it ought to have a generic name.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
rsa.c
secnet.h
site.c

diff --git a/rsa.c b/rsa.c
index 01d97c3..f17c256 100644 (file)
--- a/rsa.c
+++ b/rsa.c
@@ -42,7 +42,7 @@
 
 struct rsapriv {
     closure_t cl;
-    struct rsaprivkey_if ops;
+    struct sigprivkey_if ops;
     struct cloc loc;
     MP_INT n;
     MP_INT p, dp;
@@ -51,7 +51,7 @@ struct rsapriv {
 };
 struct rsapub {
     closure_t cl;
-    struct rsapubkey_if ops;
+    struct sigpubkey_if ops;
     struct cloc loc;
     MP_INT e;
     MP_INT n;
@@ -167,7 +167,7 @@ static string_t rsa_sign(void *sst, uint8_t *data, int32_t datalen)
     return signature;
 }
 
-static rsa_checksig_fn rsa_sig_check;
+static sig_checksig_fn rsa_sig_check;
 static bool_t rsa_sig_check(void *sst, uint8_t *data, int32_t datalen,
                            cstring_t signature)
 {
@@ -203,7 +203,7 @@ static list_t *rsapub_apply(closure_t *self, struct cloc loc, dict_t *context,
 
     NEW(st);
     st->cl.description="rsapub";
-    st->cl.type=CL_RSAPUBKEY;
+    st->cl.type=CL_SIGPUBKEY;
     st->cl.apply=NULL;
     st->cl.interface=&st->ops;
     st->ops.st=st;
@@ -281,7 +281,7 @@ static list_t *rsapriv_apply(closure_t *self, struct cloc loc, dict_t *context,
 
     NEW(st);
     st->cl.description="rsapriv";
-    st->cl.type=CL_RSAPRIVKEY;
+    st->cl.type=CL_SIGPRIVKEY;
     st->cl.apply=NULL;
     st->cl.interface=&st->ops;
     st->ops.st=st;
index f2840db..99662a4 100644 (file)
--- a/secnet.h
+++ b/secnet.h
@@ -363,8 +363,8 @@ extern init_module log_module;
 #define CL_PURE         0
 #define CL_RESOLVER     1
 #define CL_RANDOMSRC    2
-#define CL_RSAPUBKEY    3
-#define CL_RSAPRIVKEY   4
+#define CL_SIGPUBKEY    3
+#define CL_SIGPRIVKEY   4
 #define CL_COMM         5
 #define CL_IPIF         6
 #define CL_LOG          7
@@ -411,21 +411,21 @@ struct random_if {
     random_fn *generate;
 };
 
-/* RSAPUBKEY interface */
+/* SIGPUBKEY interface */
 
-typedef bool_t rsa_checksig_fn(void *st, uint8_t *data, int32_t datalen,
+typedef bool_t sig_checksig_fn(void *st, uint8_t *data, int32_t datalen,
                               cstring_t signature);
-struct rsapubkey_if {
+struct sigpubkey_if {
     void *st;
-    rsa_checksig_fn *check;
+    sig_checksig_fn *check;
 };
 
-/* RSAPRIVKEY interface */
+/* SIGPRIVKEY interface */
 
-typedef string_t rsa_makesig_fn(void *st, uint8_t *data, int32_t datalen);
-struct rsaprivkey_if {
+typedef string_t sig_makesig_fn(void *st, uint8_t *data, int32_t datalen);
+struct sigprivkey_if {
     void *st;
-    rsa_makesig_fn *sign;
+    sig_makesig_fn *sign;
 };
 
 /* COMM interface */
diff --git a/site.c b/site.c
index 67227e6..9e93ef1 100644 (file)
--- a/site.c
+++ b/site.c
@@ -312,8 +312,8 @@ struct site {
     struct resolver_if *resolver;
     struct log_if *log;
     struct random_if *random;
-    struct rsaprivkey_if *privkey;
-    struct rsapubkey_if *pubkey;
+    struct sigprivkey_if *privkey;
+    struct sigpubkey_if *pubkey;
     struct transform_if **transforms;
     int ntransforms;
     struct dh_if *dh;
@@ -2189,12 +2189,12 @@ static list_t *site_apply(closure_t *self, struct cloc loc, dict_t *context,
     st->log=find_cl_if(dict,"log",CL_LOG,True,"site",loc);
     st->random=find_cl_if(dict,"random",CL_RANDOMSRC,True,"site",loc);
 
-    st->privkey=find_cl_if(dict,"local-key",CL_RSAPRIVKEY,True,"site",loc);
+    st->privkey=find_cl_if(dict,"local-key",CL_SIGPRIVKEY,True,"site",loc);
     st->addresses=dict_read_string_array(dict,"address",False,"site",loc,0);
     if (st->addresses)
        st->remoteport=dict_read_number(dict,"port",True,"site",loc,0);
     else st->remoteport=0;
-    st->pubkey=find_cl_if(dict,"key",CL_RSAPUBKEY,True,"site",loc);
+    st->pubkey=find_cl_if(dict,"key",CL_SIGPUBKEY,True,"site",loc);
 
     GET_CLOSURE_LIST("transform",transforms,ntransforms,CL_TRANSFORM);