From: Klas Lindfors Date: Tue, 4 Dec 2012 19:11:32 +0000 (+0100) Subject: only accept sequence 0 as success if no config is valid X-Git-Tag: v1.10.0~10 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7cab4d8cadccc24f0a7c8b39fac895cfda6eff1f;p=yubikey-personalization only accept sequence 0 as success if no config is valid --- diff --git a/ykcore/ykcore.c b/ykcore/ykcore.c index 2ad4a72..e65296b 100644 --- a/ykcore/ykcore.c +++ b/ykcore/ykcore.c @@ -209,7 +209,7 @@ static int _yk_write(YK_KEY *yk, uint8_t yk_cmd, unsigned char *buf, size_t len) /* when both configurations from a YubiKey is erased it will return * pgmSeq 0, if one is still configured after an erase pgmSeq is * counted up as usual. */ - if(stat.pgmSeq == 0) { + if((stat.touchLevel & (CONFIG1_VALID | CONFIG2_VALID)) == 0 && stat.pgmSeq == 0) { return 1; } return stat.pgmSeq != seq;