[SECNET RFC PATCH 1/4] sig: Make closure interface not contain sig alg name "rsa"
Ian Jackson
ijackson at chiark.greenend.org.uk
Fri Sep 27 19:19:10 BST 2019
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 at chiark.greenend.org.uk>
---
rsa.c | 10 +++++-----
secnet.h | 20 ++++++++++----------
site.c | 8 ++++----
3 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/rsa.c b/rsa.c
index 01d97c3..f17c256 100644
--- 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;
diff --git a/secnet.h b/secnet.h
index 818e946..4f96113 100644
--- 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 c702c78..d308f4c 100644
--- a/site.c
+++ b/site.c
@@ -310,8 +310,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;
@@ -2146,12 +2146,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);
--
2.11.0
More information about the sgo-software-discuss
mailing list