chiark / gitweb /
alg_msg_data: Remove "sig" from member names
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 1 Oct 2019 12:12:40 +0000 (13:12 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 1 Oct 2019 12:12:40 +0000 (13:12 +0100)
We are going to want to use this for other algorithms too.

Suggested-by: Mark Wooding <mdw@distorted.org.uk>
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
rsa.c
secnet.h

diff --git a/rsa.c b/rsa.c
index ccfc55690260ed2ff1da7e4e7fad839b0d30fe02..28a4c1b3225c3caefbb5a296f7582a149b63d245 100644 (file)
--- a/rsa.c
+++ b/rsa.c
@@ -217,9 +217,9 @@ static bool_t rsa_sig_unpick(void *sst, struct buffer_if *msg,
 {
     uint8_t *lp = buf_unprepend(msg, 2);
     if (!lp) return False;
 {
     uint8_t *lp = buf_unprepend(msg, 2);
     if (!lp) return False;
-    sig->siglen = get_uint16(lp);
-    sig->sigstart = buf_unprepend(msg, sig->siglen);
-    if (!sig->sigstart) return False;
+    sig->len = get_uint16(lp);
+    sig->start = buf_unprepend(msg, sig->len);
+    if (!sig->start) return False;
 
     /* In `rsa_sig_check' below, we assume that we can write a nul
      * terminator following the signature.  Make sure there's enough space.
 
     /* In `rsa_sig_check' below, we assume that we can write a nul
      * terminator following the signature.  Make sure there's enough space.
@@ -246,10 +246,10 @@ static bool_t rsa_sig_check(void *sst, uint8_t *data, int32_t datalen,
     emsa_pkcs1(&st->n, &a, st->common.hashbuf, st->common.hashi->hlen);
 
     /* Terminate signature with a '0' - already checked that this will fit */
     emsa_pkcs1(&st->n, &a, st->common.hashbuf, st->common.hashi->hlen);
 
     /* Terminate signature with a '0' - already checked that this will fit */
-    int save = sig->sigstart[sig->siglen];
-    sig->sigstart[sig->siglen] = 0;
-    mpz_set_str(&b, sig->sigstart, 16);
-    sig->sigstart[sig->siglen] = save;
+    int save = sig->start[sig->len];
+    sig->start[sig->len] = 0;
+    mpz_set_str(&b, sig->start, 16);
+    sig->start[sig->len] = save;
 
     mpz_powm(&c, &b, &st->e, &st->n);
 
 
     mpz_powm(&c, &b, &st->e, &st->n);
 
index c6e8f4966164762c4dd3d0a918f5e4c5308cefc8..eb8bf0cc011fc883980f90226f7fe7c90e56122d 100644 (file)
--- a/secnet.h
+++ b/secnet.h
@@ -379,8 +379,8 @@ extern init_module log_module;
 struct buffer_if;
 
 struct alg_msg_data {
 struct buffer_if;
 
 struct alg_msg_data {
-    uint8_t *sigstart;
-    int32_t siglen;
+    uint8_t *start;
+    int32_t len;
 };
 
 /* PURE closure requires no interface */
 };
 
 /* PURE closure requires no interface */