aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2016-05-03 15:39:37 +0200
committerGravatar Christian Hesse <mail@eworm.de>2016-05-03 15:39:37 +0200
commit7c34c05c6c40c1349cbccbcb04fa88fa006db613 (patch)
tree03a0fb13c69d7826ad222c4e40d0fb411b452bc1 /bin
parent4b246704af65c92fa27634423d992b85c5ac3e2c (diff)
downloadmkinitcpio-ykfde-7c34c05c6c40c1349cbccbcb04fa88fa006db613.tar.gz
mkinitcpio-ykfde-7c34c05c6c40c1349cbccbcb04fa88fa006db613.tar.zst
define new constant for max second factor length
Diffstat (limited to 'bin')
-rw-r--r--bin/ykfde.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/ykfde.c b/bin/ykfde.c
index 21e7bea..2f1e73a 100644
--- a/bin/ykfde.c
+++ b/bin/ykfde.c
@@ -43,6 +43,7 @@
#define CHALLENGELEN SHA1_MAX_BLOCK_SIZE
#define RESPONSELEN SHA1_MAX_BLOCK_SIZE
#define PASSPHRASELEN SHA1_DIGEST_SIZE * 2
+#define MAX2FLEN CHALLENGELEN / 2
const static char optstring[] = "hn:s:V";
const static struct option options_long[] = {
@@ -229,7 +230,7 @@ int main(int argc, char **argv) {
* add second factor to new challenge */
tmp = new_2nd_factor ? new_2nd_factor : payload;
plen = strlen(tmp);
- memcpy(challenge_new, tmp, plen < CHALLENGELEN / 2 ? plen : CHALLENGELEN / 2);
+ memcpy(challenge_new, tmp, plen < MAX2FLEN ? plen : MAX2FLEN);
/* do challenge/response and encode to hex */
if ((rc = yk_challenge_response(yk, yk_slot, true,
@@ -278,7 +279,7 @@ int main(int argc, char **argv) {
/* copy the second factor */
plen = strlen(payload);
- memcpy(challenge_old, payload, plen < CHALLENGELEN / 2 ? plen : CHALLENGELEN / 2);
+ memcpy(challenge_old, payload, plen < MAX2FLEN ? plen : MAX2FLEN);
/* do challenge/response and encode to hex */
if ((rc = yk_challenge_response(yk, yk_slot, true,