author | Olivier Brunel
<jjk@jjacky.com> 2023-04-22 12:24:54 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2023-04-25 15:02:08 UTC |
parent | 1bb906f31384b077a6c120fd7f4c3877250897fe |
src/ssp/add.c | +2 | -2 |
src/ssp/edit.c | +2 | -2 |
src/ssp/import.c | +2 | -2 |
src/ssp/show.c | +2 | -2 |
diff --git a/src/ssp/add.c b/src/ssp/add.c index eae60eb..2e3f686 100644 --- a/src/ssp/add.c +++ b/src/ssp/add.c @@ -157,7 +157,7 @@ add_main(int argc, const char *argv[], const char *env[], const char usage[], vo } const char *secret = argv[i]; - ssize_t l = base32_scan(NULL, secret, strlen(secret)); + ssize_t l = base32_scan(NULL, secret, strlen(secret), 0); if (l < 0) dief(EX_DATA_ERR, "invalid secret: Not in base32"); if (!l) @@ -168,7 +168,7 @@ add_main(int argc, const char *argv[], const char *env[], const char usage[], vo struct otp *p = (struct otp *) buf; memcpy(p, &add.otp, sizeof(add.otp)); p->slen = l; - base32_scan(p->data, secret, strlen(secret)); + base32_scan(p->data, secret, strlen(secret), 0); if (clen >= 2 && add.comments[0] == '"' && add.comments[clen - 1] == '"') { ++add.comments; clen -= 2; diff --git a/src/ssp/edit.c b/src/ssp/edit.c index 61965ca..a0701f7 100644 --- a/src/ssp/edit.c +++ b/src/ssp/edit.c @@ -151,7 +151,7 @@ edit_main(int argc, const char *argv[], const char *env[], const char usage[], v if (!edit.secret) { slen = cur->slen; } else { - slen = base32_scan(NULL, edit.secret, strlen(edit.secret)); + slen = base32_scan(NULL, edit.secret, strlen(edit.secret), 0); if (slen < 0) dief(EX_DATA_ERR, "invalid secret: Not in base32"); if (!slen) @@ -179,7 +179,7 @@ edit_main(int argc, const char *argv[], const char *env[], const char usage[], v p->slen = slen; if (edit.secret) - base32_scan(p->data, edit.secret, strlen(edit.secret)); + base32_scan(p->data, edit.secret, strlen(edit.secret), 0); else memcpy(p->data, cur->data, slen); diff --git a/src/ssp/import.c b/src/ssp/import.c index 5da09eb..2188e53 100644 --- a/src/ssp/import.c +++ b/src/ssp/import.c @@ -55,7 +55,7 @@ import_main(int argc, const char *argv[], const char *env[], const char usage[], struct otp *p = (struct otp *) buf; memcpy(p, &otp, sizeof(otp)); p->slen = slen; - base32_scan(p->data, secret, slen32); + base32_scan(p->data, secret, slen32, 0); if (clen >= 2 && comments[0] == '"' && comments[clen - 1] == '"') { ++comments; clen -= 2; @@ -132,7 +132,7 @@ import_main(int argc, const char *argv[], const char *env[], const char usage[], if (r < 0) goto err; otp.precision = r; } else if (copa_nlen(&copa) == 6 && !strncmp(copa_name(&copa), "secret", 6)) { - slen = base32_scan(NULL, copa_value(&copa), copa_vlen(&copa)); + slen = base32_scan(NULL, copa_value(&copa), copa_vlen(&copa), 0); if (slen < 0) dief(EX_DATA_ERR, "invalid secret in section/entry ", ESC, LEN(name, nlen), ESC, ": Not in base32: ", diff --git a/src/ssp/show.c b/src/ssp/show.c index a1a363b..54b9a24 100644 --- a/src/ssp/show.c +++ b/src/ssp/show.c @@ -97,9 +97,9 @@ show_entry_ini(unsigned options, struct ssp *ctx) } else { out("digits=", PUTMSG_UINT(otp->digits)); } - size_t l = base32_fmt(NULL, otp->data, otp->slen, 0); + size_t l = base32_fmt(NULL, otp->data, otp->slen, 1); char buf[l + 1]; - base32_fmt(buf, otp->data, otp->slen, 0); + base32_fmt(buf, otp->data, otp->slen, 1); buf[l] = 0; out("secret=", buf); if (!(options & OPT_NO_COMMENTS) && otp->data[otp->slen])