Commit 763b40b4906b951e58c8583ec3253f4c8ac76315

Francois Perrad 2019-10-06T15:24:17

use same parameter name as in the prototype

diff --git a/bn_mp_from_sbin.c b/bn_mp_from_sbin.c
index 780639a..20e4597 100644
--- a/bn_mp_from_sbin.c
+++ b/bn_mp_from_sbin.c
@@ -4,17 +4,17 @@
 /* SPDX-License-Identifier: Unlicense */
 
 /* read signed bin, big endian, first byte is 0==positive or 1==negative */
-mp_err mp_from_sbin(mp_int *a, const unsigned char *b, size_t c)
+mp_err mp_from_sbin(mp_int *a, const unsigned char *buf, size_t size)
 {
    mp_err err;
 
    /* read magnitude */
-   if ((err = mp_from_ubin(a, b + 1, c - 1u)) != MP_OKAY) {
+   if ((err = mp_from_ubin(a, buf + 1, size - 1u)) != MP_OKAY) {
       return err;
    }
 
    /* first byte is 0 for positive, non-zero for negative */
-   if (b[0] == (unsigned char)0) {
+   if (buf[0] == (unsigned char)0) {
       a->sign = MP_ZPOS;
    } else {
       a->sign = MP_NEG;
diff --git a/bn_mp_from_ubin.c b/bn_mp_from_ubin.c
index 78a4cf1..7f73cbc 100644
--- a/bn_mp_from_ubin.c
+++ b/bn_mp_from_ubin.c
@@ -4,7 +4,7 @@
 /* SPDX-License-Identifier: Unlicense */
 
 /* reads a unsigned char array, assumes the msb is stored first [big endian] */
-mp_err mp_from_ubin(mp_int *a, const unsigned char *b, size_t size)
+mp_err mp_from_ubin(mp_int *a, const unsigned char *buf, size_t size)
 {
    mp_err err;
 
@@ -25,11 +25,11 @@ mp_err mp_from_ubin(mp_int *a, const unsigned char *b, size_t size)
       }
 
 #ifndef MP_8BIT
-      a->dp[0] |= *b++;
+      a->dp[0] |= *buf++;
       a->used += 1;
 #else
-      a->dp[0] = (*b & MP_MASK);
-      a->dp[1] |= ((*b++ >> 7) & 1u);
+      a->dp[0] = (*buf & MP_MASK);
+      a->dp[1] |= ((*buf++ >> 7) & 1u);
       a->used += 2;
 #endif
    }
diff --git a/bn_mp_to_sbin.c b/bn_mp_to_sbin.c
index b736f98..e28dcce 100644
--- a/bn_mp_to_sbin.c
+++ b/bn_mp_to_sbin.c
@@ -4,20 +4,20 @@
 /* SPDX-License-Identifier: Unlicense */
 
 /* store in signed [big endian] format */
-mp_err mp_to_sbin(const mp_int *a, unsigned char *b, size_t maxlen, size_t *written)
+mp_err mp_to_sbin(const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written)
 {
    mp_err err;
    if (maxlen == 0u) {
       return MP_VAL;
    }
 
-   if ((err = mp_to_ubin(a, b + 1, maxlen - 1u, written)) != MP_OKAY) {
+   if ((err = mp_to_ubin(a, buf + 1, maxlen - 1u, written)) != MP_OKAY) {
       return err;
    }
    if (written != NULL) {
       (*written)++;
    }
-   b[0] = (a->sign == MP_ZPOS) ? (unsigned char)0 : (unsigned char)1;
+   buf[0] = (a->sign == MP_ZPOS) ? (unsigned char)0 : (unsigned char)1;
    return MP_OKAY;
 }
 #endif
diff --git a/bn_mp_to_ubin.c b/bn_mp_to_ubin.c
index 80c14ab..a6ded96 100644
--- a/bn_mp_to_ubin.c
+++ b/bn_mp_to_ubin.c
@@ -4,13 +4,13 @@
 /* SPDX-License-Identifier: Unlicense */
 
 /* store in unsigned [big endian] format */
-mp_err mp_to_ubin(const mp_int *a, unsigned char *b, size_t maxlen, size_t *written)
+mp_err mp_to_ubin(const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written)
 {
    size_t    x;
    mp_err  err;
    mp_int  t;
 
-   if (b == NULL) {
+   if (buf == NULL) {
       return MP_MEM;
    }
 
@@ -30,15 +30,15 @@ mp_err mp_to_ubin(const mp_int *a, unsigned char *b, size_t maxlen, size_t *writ
       }
       maxlen--;
 #ifndef MP_8BIT
-      b[x++] = (unsigned char)(t.dp[0] & 255u);
+      buf[x++] = (unsigned char)(t.dp[0] & 255u);
 #else
-      b[x++] = (unsigned char)(t.dp[0] | ((t.dp[1] & 1u) << 7));
+      buf[x++] = (unsigned char)(t.dp[0] | ((t.dp[1] & 1u) << 7));
 #endif
       if ((err = mp_div_2d(&t, 8, &t, NULL)) != MP_OKAY) {
          goto LBL_ERR;
       }
    }
-   s_mp_reverse(b, x);
+   s_mp_reverse(buf, x);
    err = MP_OKAY;
 
    if (written != NULL) {