From 6e4266c8860e9e76e218a0908c1b7dd3fce7453f Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Wed, 4 May 2016 22:33:33 +0200 Subject: [PATCH] Add YKPIV_ALGO_TAG Replace the magic constant 0x80 when sending a packet to the key --- lib/ykpiv.h | 1 + tool/yubico-piv-tool.c | 2 +- ykcs11/token_vendors.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ykpiv.h b/lib/ykpiv.h index f567d0e..8bd8fb4 100644 --- a/lib/ykpiv.h +++ b/lib/ykpiv.h @@ -110,6 +110,7 @@ extern "C" const unsigned char *ec_data, unsigned char ec_data_len, const unsigned char pin_policy, const unsigned char touch_policy); +#define YKPIV_ALGO_TAG 0x80 #define YKPIV_ALGO_3DES 0x03 #define YKPIV_ALGO_RSA1024 0x06 #define YKPIV_ALGO_RSA2048 0x07 diff --git a/tool/yubico-piv-tool.c b/tool/yubico-piv-tool.c index 934d8d1..c244a37 100644 --- a/tool/yubico-piv-tool.c +++ b/tool/yubico-piv-tool.c @@ -145,7 +145,7 @@ static bool generate_key(ykpiv_state *state, const char *slot, *in_ptr++ = 0xac; *in_ptr++ = 3; - *in_ptr++ = 0x80; + *in_ptr++ = YKPIV_ALGO_TAG; *in_ptr++ = 1; *in_ptr++ = get_piv_algorithm(algorithm); if(in_data[4] == 0) { diff --git a/ykcs11/token_vendors.c b/ykcs11/token_vendors.c index 9cda842..e798a63 100644 --- a/ykcs11/token_vendors.c +++ b/ykcs11/token_vendors.c @@ -67,7 +67,7 @@ static CK_RV COMMON_token_generate_key(ykpiv_state *state, CK_BBOOL rsa, *in_ptr++ = 0xac; *in_ptr++ = 3; - *in_ptr++ = 0x80; + *in_ptr++ = YKPIV_ALGO_TAG; *in_ptr++ = 1; switch(key_len) {