1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2025-02-12 15:54:27 +01:00

Cosmetic changes.

This commit is contained in:
Jean Paul Galea 2015-07-17 21:38:00 +02:00
parent 8edf9ba465
commit 45ea62445c

View File

@ -215,25 +215,32 @@ function retrieveURLasync ($ident, $urls, $logger, $ans_req=1, $match="^OK", $re
return $str; return $str;
} }
function KSMdecryptOTP($urls, $logger, $curlopts) { function KSMdecryptOTP($urls, $logger, $curlopts)
{
$ret = array(); $ret = array();
if (!is_array($urls)) {
if (!is_array($urls))
{
$urls = array($urls); $urls = array($urls);
} }
$response = retrieveURLasync ("YK-KSM", $urls, $logger, $ans_req=1, $match="^OK", $returl=False, $timeout=10, $curlopts); $response = retrieveURLasync("YK-KSM", $urls, $logger, $ans_req=1, $match="^OK", $returl=False, $timeout=10, $curlopts);
if (is_array($response)) {
if (is_array($response))
{
$response = $response[0]; $response = $response[0];
} }
if ($response) {
if ($response)
{
$logger->log(LOG_DEBUG, log_format("YK-KSM response: ", $response)); $logger->log(LOG_DEBUG, log_format("YK-KSM response: ", $response));
} }
if (sscanf ($response,
"OK counter=%04x low=%04x high=%02x use=%02x", if (sscanf($response, "OK counter=%04x low=%04x high=%02x use=%02x", $ret["session_counter"], $ret["low"], $ret["high"], $ret["session_use"]) != 4)
$ret["session_counter"], $ret["low"], $ret["high"], {
$ret["session_use"]) != 4) {
return false; return false;
} }
return $ret; return $ret;
} }