if both slots are configured and one is deleted programming sequence will be
counted up as usual. when the last slot is deleted programming sequence will
be set to 0. try to handle this.
return 0;
yk_errno = YK_EWRITEERR;
- if (cfg) {
- return stat.pgmSeq != seq;
- }
- return stat.pgmSeq == 0;
+ /* 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(!cfg && stat.pgmSeq == 0) {
+ return 1;
+ }
+ return stat.pgmSeq != seq;
}
int yk_write_config(YK_KEY *yk, YK_CONFIG *cfg, int confnum,