User's Manual
59
key.data[16] = key_index;
key.command = AES_SCRAMBLE_MODE;
msclink(&key);
if (key.status != 0) {
MessageBox(NULL, "Error using the AES key", "Error", MB_ICONERROR |
MB_SYSTEMMODAL);
exit(1);
}
aes_set_key(aes, aeskey + key_index*16, 16);
aes_decrypt(aes, key.data, result_buffer);
for(i=0;i<16;++i)
result_buffer[i] ^= random_buffer[i];
if (memcmp(result_buffer, serial, 16) != 0) {
MessageBox(NULL, "Wrong serial", "Error", MB_ICONERROR |
MB_SYSTEMMODAL);
exit(1);
}
MessageBox(NULL, "Correct serial", "Information", MB_ICONINFORMATION |
MB_SYSTEMMODAL);
return 0;
}