]> err.no Git - yubikey-personalization/commitdiff
add neo checks for slot2 and the vcheck_v21_or_greater
authorKlas Lindfors <klas@yubico.com>
Wed, 25 Apr 2012 10:46:11 +0000 (12:46 +0200)
committerKlas Lindfors <klas@yubico.com>
Wed, 25 Apr 2012 10:46:11 +0000 (12:46 +0200)
ykpers.c

index 2336da28c5c273bc37dbe831f27635409ecedfb6..8f48485f7e28e592973694ed1c5da610506205a5 100644 (file)
--- a/ykpers.c
+++ b/ykpers.c
@@ -129,6 +129,12 @@ int ykp_configure_command(YKP_CONFIG *cfg, uint8_t command)
                        ykp_errno = YKP_EOLDYUBIKEY;
                        return 0;
                }
+               /* The NEO Beta key is versioned from 2.1.4 but doesn't support slot2 */
+               else if( cfg->yk_major_version == 2 && cfg->yk_minor_version == 1 &&
+                         cfg->yk_build_version >= 4 && cfg->yk_build_version != 9) {
+                       ykp_errno = YKP_EYUBIKEYVER;
+                       return 0;
+               }
                break;
        case SLOT_UPDATE1:
        case SLOT_UPDATE2:
@@ -335,9 +341,10 @@ static bool vcheck_no_v1(const YKP_CONFIG *cfg)
 
 static bool vcheck_v21_or_greater(const YKP_CONFIG *cfg)
 {
-       return (cfg->yk_major_version == 2 &&
-               cfg->yk_minor_version >= 1) ||
-               cfg->yk_major_version > 2;
+       /* the NEO Beta is versioned from 2.1.4 but shouldn't be identified as a 2.1 above key */
+       return (cfg->yk_major_version == 2 && cfg->yk_minor_version > 1) ||
+               (cfg->yk_major_version == 2 && cfg->yk_minor_version == 1 && cfg->yk_build_version <= 3)
+               || cfg->yk_major_version > 2;
 }
 
 static bool vcheck_v22_or_greater(const YKP_CONFIG *cfg)