mirror of
https://github.com/Yubico/yubikey-ksm.git
synced 2025-01-31 16:52:12 +01:00
Reorder UID/CRC check so we get only the interesting CRC errors.
This commit is contained in:
parent
d29fce0bfc
commit
42bd2d68b0
@ -79,17 +79,17 @@ $internalName = $row['internalName'];
|
|||||||
$ciphertext = modhex2hex($modhex_ciphertext);
|
$ciphertext = modhex2hex($modhex_ciphertext);
|
||||||
$plaintext = aes128ecb_decrypt($aesKey, $ciphertext);
|
$plaintext = aes128ecb_decrypt($aesKey, $ciphertext);
|
||||||
|
|
||||||
if (!crc_is_good($plaintext)) {
|
|
||||||
syslog(LOG_ERR, "CRC error: $otp: $plaintext");
|
|
||||||
die("ERR Corrupt OTP\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
$uid = substr($plaintext, 0, 12);
|
$uid = substr($plaintext, 0, 12);
|
||||||
if (strcmp($uid, $internalName) != 0) {
|
if (strcmp($uid, $internalName) != 0) {
|
||||||
syslog(LOG_ERR, "UID error: $otp $plaintext: $uid vs $internalName");
|
syslog(LOG_ERR, "UID error: $otp $plaintext: $uid vs $internalName");
|
||||||
die("ERR Corrupt OTP\n");;
|
die("ERR Corrupt OTP\n");;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!crc_is_good($plaintext)) {
|
||||||
|
syslog(LOG_ERR, "CRC error: $otp: $plaintext");
|
||||||
|
die("ERR Corrupt OTP\n");
|
||||||
|
}
|
||||||
|
|
||||||
# Mask out interesting fields
|
# Mask out interesting fields
|
||||||
$counter = substr($plaintext, 14, 2) . substr($plaintext, 12, 2);
|
$counter = substr($plaintext, 14, 2) . substr($plaintext, 12, 2);
|
||||||
$low = substr($plaintext, 18, 2) . substr($plaintext, 16, 2);
|
$low = substr($plaintext, 18, 2) . substr($plaintext, 16, 2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user