Fix user-provided keys handling

This makes mfoc try user-provided keys even if the built-in
ones are removed from the code (for efficiency).
This commit is contained in:
Kirill Elagin 2015-04-11 23:30:58 +03:00
parent b872a328e3
commit f3ebde09ef

View file

@ -284,7 +284,7 @@ int main(int argc, char *const argv[])
n = sizeof(defaultKeys) / sizeof(defaultKeys[0]); n = sizeof(defaultKeys) / sizeof(defaultKeys[0]);
size_t defKey_bytes_todo = defKeys_len; size_t defKey_bytes_todo = defKeys_len;
key = 0; key = 0;
while (key < n) { while (key < n || defKey_bytes_todo) {
if (defKey_bytes_todo > 0) { if (defKey_bytes_todo > 0) {
memcpy(mp.mpa.abtKey, defKeys + defKeys_len - defKey_bytes_todo, sizeof(mp.mpa.abtKey)); memcpy(mp.mpa.abtKey, defKeys + defKeys_len - defKey_bytes_todo, sizeof(mp.mpa.abtKey));
defKey_bytes_todo -= sizeof(mp.mpa.abtKey); defKey_bytes_todo -= sizeof(mp.mpa.abtKey);