if (!yk_get_status(k, &st))
return 0;
- if (!((st.versionMajor == 0 &&
- (st.versionMinor == 9 ||
- st.versionBuild == 9)) ||
- (st.versionMajor == 1 &&
- (st.versionMinor == 0 ||
- st.versionMinor == 1 ||
- st.versionMinor == 2 ||
- st.versionMinor == 3)) ||
- (st.versionMajor == 2 &&
- (st.versionMinor == 0 ||
- st.versionMinor == 1 ||
- st.versionMinor == 2 ||
- st.versionMinor == 3)) ||
- (st.versionMajor == 3 &&
- (st.versionMinor == 0)))) {
+
+ return yk_check_firmware_version2(&st);
+}
+
+
+int yk_check_firmware_version2(YK_STATUS *st)
+{
+ if (!((st->versionMajor == 0 &&
+ (st->versionMinor == 9 ||
+ st->versionBuild == 9)) ||
+ (st->versionMajor == 1 &&
+ (st->versionMinor == 0 ||
+ st->versionMinor == 1 ||
+ st->versionMinor == 2 ||
+ st->versionMinor == 3)) ||
+ (st->versionMajor == 2 &&
+ (st->versionMinor == 0 ||
+ st->versionMinor == 1 ||
+ st->versionMinor == 2 ||
+ st->versionMinor == 3)) ||
+ (st->versionMajor == 3 &&
+ (st->versionMinor == 0)))) {
yk_errno = YK_EFIRMWARE;
return 0;
}
extern int yk_get_status(YK_KEY *k, YK_STATUS *status /*, int forceUpdate */);
/* checks that the firmware revision of the key is supported */
extern int yk_check_firmware_version(YK_KEY *k);
+extern int yk_check_firmware_version2(YK_STATUS *status);
/* Read the factory set serial number from a YubiKey 2.0 or higher. */
extern int yk_get_serial(YK_KEY *yk, uint8_t slot, unsigned int flags, unsigned int *serial);
/* Wait for the key to either set or clear bits in it's status byte */
else
printf("Unconfigured\n");
- if (!(yk_check_firmware_version(yk))) {
+ if (!(yk_check_firmware_version2(st))) {
if (yk_errno == YK_EFIRMWARE) {
printf("Unsupported firmware revision - some "
"features may not be available\n"