From 49056aa624bf2d0315df29e2ae97c7f02cc54fff Mon Sep 17 00:00:00 2001 From: n2460 Date: Tue, 25 Jun 2013 04:42:00 +0000 Subject: [PATCH] =?UTF-8?q?cr=5Fid=5Futil.c:r207=20=E3=81=AE=E5=B7=AE?= =?UTF-8?q?=E3=81=97=E6=88=BB=E3=81=97=E3=80=82=E3=81=A4=E3=81=BE=E3=82=8A?= =?UTF-8?q?=20HSM=20RTC=20=E6=99=82=E9=96=93=E5=8F=96=E5=BE=97=E5=BB=83?= =?UTF-8?q?=E6=AD=A2=E3=81=AE=E5=BB=83=E6=AD=A2=EF=BC=88=E3=82=84=E3=82=84?= =?UTF-8?q?=E3=81=93=E3=81=97=E3=81=84=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_eFuse@217 ff987cc8-cf2f-4642-8568-d52cce064691 --- trunk/cr_id_util.c | 48 ++++++++-------------------------------------- 1 file changed, 8 insertions(+), 40 deletions(-) diff --git a/trunk/cr_id_util.c b/trunk/cr_id_util.c index 6f6c560..c84c290 100644 --- a/trunk/cr_id_util.c +++ b/trunk/cr_id_util.c @@ -135,20 +135,6 @@ errorInfoStruct; static errorInfoStruct errorInfo; -// 標準時刻 : 2013/06/08(土) 12:15:30 -// PC の時刻がおかしい場合の発行時刻に使用 -#define DEFAULT_TM_SEC (30) // 秒 -#define DEFAULT_TM_MINUTE (15) // 分 -#define DEFAULT_TM_HOUR (12) // 時 -#define DEFAULT_TM_DAY (8) // 日 -#define DEFAULT_TM_MONTH (6) // 月 -#define DEFAULT_TM_YEAR (113) // 年 (1900年からの年数) - -// 期限ベース(pTime)に入れる数, 上記の標準時刻を秒数に変換したもの -// *注意* 値の変更は可能ですが、2038年を超えるとオーバフローするので誤動作します。 -// *更に注意* 証明書作成時に期限として以下の値に20年加算するため2018年未満である必要もあります。 -#define TIMEVAL_DEFAULT_VALUE (1370661330) - // タイムスタンプを取得してセット int GetTimestamp( u8 *pYear, u8 *pMonth, u8 *pMday, u8 *pHour, u8 *pMin, u8 *pSec, time_t *pTime) { @@ -156,10 +142,7 @@ int GetTimestamp( u8 *pYear, u8 *pMonth, u8 *pMday, u8 *pHour, u8 *pMin, u8 *pSe struct tm *tm_time; struct timeval tv; -// 2013/06/04 -// USE_HSM の時はここで HSM から RTC を取得していたが、 -// 電池切れで RTC が飛ぶ(そしてエラーになる)ため必ず PC から時間を取得することにする。 -#if 0 +#ifdef USE_HSM ret_code = hsm_get_rtc( &tv.tv_sec ); if( ret_code != CR_GENID_SUCCESS ) { SetErrorInfo( __FUNCTION__, __LINE__ ); @@ -171,28 +154,13 @@ int GetTimestamp( u8 *pYear, u8 *pMonth, u8 *pMday, u8 *pHour, u8 *pMin, u8 *pSe tm_time = gmtime( &tv.tv_sec ); - if (tm_time->tm_year + 1900 >= 2013) - { - *pYear = (u8)tm_time->tm_year; - *pMonth = (u8)tm_time->tm_mon + 1; - *pMday = (u8)tm_time->tm_mday; - *pHour = (u8)tm_time->tm_hour; - *pMin = (u8)tm_time->tm_min; - *pSec = (u8)tm_time->tm_sec; - } - else // あまりにも時間が古い場合は固定値を突っ込む - { - *pYear = DEFAULT_TM_YEAR; - *pMonth = DEFAULT_TM_MONTH; - *pMday = DEFAULT_TM_DAY; - *pHour = DEFAULT_TM_HOUR; - *pMin = DEFAULT_TM_MINUTE; - *pSec = DEFAULT_TM_SEC; - } - - - //*pTime = tv.tv_sec; - *pTime = TIMEVAL_DEFAULT_VALUE; + *pYear = (u8)tm_time->tm_year; + *pMonth = (u8)tm_time->tm_mon + 1; + *pMday = (u8)tm_time->tm_mday; + *pHour = (u8)tm_time->tm_hour; + *pMin = (u8)tm_time->tm_min; + *pSec = (u8)tm_time->tm_sec; + *pTime = tv.tv_sec; #if 0 {