better errors for generate on non-supported algorithm or slot

This commit is contained in:
Klas Lindfors
2015-06-24 13:22:02 +02:00
parent a73d708c25
commit bc27d98bf7
+8 -1
View File
@@ -125,7 +125,14 @@ static bool generate_key(ykpiv_state *state, const char *slot,
fprintf(stderr, "Failed to communicate.\n"); fprintf(stderr, "Failed to communicate.\n");
goto generate_out; goto generate_out;
} else if(sw != 0x9000) { } else if(sw != 0x9000) {
fprintf(stderr, "Failed to generate new key.\n"); fprintf(stderr, "Failed to generate new key (");
if(sw == 0x6b00) {
fprintf(stderr, "slot not supported?)\n");
} else if(sw == 0x6a80) {
fprintf(stderr, "algorithm not supported?)\n");
} else {
fprintf(stderr, "error %x)\n", sw);
}
goto generate_out; goto generate_out;
} }
/* to drop the 90 00 and the 7f 49 at the start */ /* to drop the 90 00 and the 7f 49 at the start */