1
0
mirror of https://github.com/Yubico/yubikey-ksm.git synced 2025-02-20 12:54:24 +01:00

Improve debugging.

This commit is contained in:
Simon Josefsson 2009-03-18 17:23:37 +00:00
parent bbd50c0ce7
commit 4426aa592e

View File

@ -79,19 +79,20 @@ $internalName = $row['internalName'];
$ciphertext = modhex2hex($modhex_ciphertext); $ciphertext = modhex2hex($modhex_ciphertext);
$plaintext = aes128ecb_decrypt($aesKey, $ciphertext); $plaintext = aes128ecb_decrypt($aesKey, $ciphertext);
syslog(LOG_INFO, "OTP $otp OUT $plaintext")
or die("ERR Log error\n");
if (!crc_is_good($plaintext)) { if (!crc_is_good($plaintext)) {
syslog(LOG_ERR, "CRC error: $otp"); syslog(LOG_ERR, "CRC error: $otp: $plaintext");
die("ERR Corrupt OTP\n"); die("ERR Corrupt OTP\n");
} }
if (strcmp(substr($plaintext, 0, 12), $internalName) != 0) { $uid = substr($plaintext, 0, 12);
syslog(LOG_ERR, "Internal name mismatch: $otp"); if (strcmp($uid, $internalName) != 0) {
syslog(LOG_ERR, "UID error: $otp $plaintext: $uid vs $internalName");
die("ERR Corrupt OTP\n");; die("ERR Corrupt OTP\n");;
} }
syslog(LOG_INFO, "OTP $otp OUT $plaintext")
or die("ERR Log error\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);