From 31cda8f0d59aaeef5547757d146299cce3a7fe27 Mon Sep 17 00:00:00 2001 From: n2460 Date: Tue, 4 Jun 2013 07:46:44 +0000 Subject: [PATCH] =?UTF-8?q?genid:HSM=20=E3=81=8B=E3=82=89=E6=99=82?= =?UTF-8?q?=E5=88=BB=E3=82=92=E5=8F=96=E5=BE=97=E3=81=99=E3=82=8B=E3=81=AE?= =?UTF-8?q?=E3=81=AF=E9=83=BD=E5=90=88=E3=81=8C=E6=82=AA=E3=81=84=E3=81=AE?= =?UTF-8?q?=E3=81=A7=E5=BB=83=E6=AD=A2=E3=80=82=20PC=20=E3=81=8B=E3=82=89?= =?UTF-8?q?=E6=99=82=E5=88=BB=E5=8F=96=E5=BE=97=E3=82=92=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E5=A4=89=E6=9B=B4=E3=81=97=E3=80=81=E3=81=82?= =?UTF-8?q?=E3=81=BE=E3=82=8A=E3=81=AB=E5=8F=A4=E3=81=84=E6=99=82=E3=81=AF?= =?UTF-8?q?=E5=AE=9A=E7=BE=A9=E3=81=97=E3=81=9F=E6=A8=99=E6=BA=96=E6=99=82?= =?UTF-8?q?=E9=96=93=E3=82=92=E5=88=A9=E7=94=A8=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F=E3=80=82=20=E3=81=BE?= =?UTF-8?q?=E3=81=9F=E3=80=81=E4=B8=8A=E8=A8=98=E3=81=AE=E5=85=BC=E3=81=AD?= =?UTF-8?q?=E5=90=88=E3=81=84=E3=81=A7=E8=A8=BC=E6=98=8E=E6=9B=B8=E6=9C=9F?= =?UTF-8?q?=E9=99=90=E3=81=AF=E5=9B=BA=E5=AE=9A=E5=80=A4=E3=81=A8=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=81=93=E3=81=A8=E3=81=AB=E3=81=97=E3=81=9F=E3=80=82?= 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@207 ff987cc8-cf2f-4642-8568-d52cce064691 --- trunk/cr_device_cert.c | 2 +- trunk/cr_generate_id_private.h | 3 ++- trunk/cr_id_util.c | 48 ++++++++++++++++++++++++++++------ 3 files changed, 43 insertions(+), 10 deletions(-) diff --git a/trunk/cr_device_cert.c b/trunk/cr_device_cert.c index adbbc88..778794a 100644 --- a/trunk/cr_device_cert.c +++ b/trunk/cr_device_cert.c @@ -141,7 +141,7 @@ #include "cr_generate_id_private.h" -#define CR_CERT_EXPIRE_SECS ( 60*60*24*365* 20 ) // デバイス証明書期限 20年 ※うるう年は無視 +#define CR_CERT_EXPIRE_SECS ( 60*60*24*365*20 ) // デバイス証明書期限 20年 ※うるう年は無視 u8 tempSign[ 70 ]; diff --git a/trunk/cr_generate_id_private.h b/trunk/cr_generate_id_private.h index 087848b..e4490e1 100644 --- a/trunk/cr_generate_id_private.h +++ b/trunk/cr_generate_id_private.h @@ -137,9 +137,10 @@ extern "C" { #define ENCRYPT_AES 1 // `LFIX.iꂪ`̏ꍇAID̈ÍRSAɂȂBj -#define CR_GEN_ID_VERSION 5 // V[vւ̃[XƂUPB +#define CR_GEN_ID_VERSION 6 // V[vւ̃[XƂUPB // 2010/02/02 Release ver.4 // 2010/03/15 Release ver.5 +// TBD -----------------------------------> // 2013/06/XX Release ver.6 #ifdef USE_HSM #define CR_GEN_ID_MAGICCODE 0xdeadb00f; /* ŏIIɂ͂œB0xdeadbeefɂRSAŃRPB */ #else // !USE_HSM diff --git a/trunk/cr_id_util.c b/trunk/cr_id_util.c index c84c290..6f6c560 100644 --- a/trunk/cr_id_util.c +++ b/trunk/cr_id_util.c @@ -135,6 +135,20 @@ errorInfoStruct; static errorInfoStruct errorInfo; +// W : 2013/06/08(y) 12:15:30 +// PC ̎ꍇ̔sɎgp +#define DEFAULT_TM_SEC (30) // b +#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) // N (1900N̔N) + +// x[X(pTime)ɓ鐔, L̕Wbɕϊ +// ** l̕ύX͉”\łA2038N𒴂ƃI[ot[̂Ō듮삵܂B +// *Xɒ* ؖ쐬ɊƂĈȉ̒l20NZ邽2018NłKv܂B +#define TIMEVAL_DEFAULT_VALUE (1370661330) + // ^CX^v擾ăZbg int GetTimestamp( u8 *pYear, u8 *pMonth, u8 *pMday, u8 *pHour, u8 *pMin, u8 *pSec, time_t *pTime) { @@ -142,7 +156,10 @@ int GetTimestamp( u8 *pYear, u8 *pMonth, u8 *pMday, u8 *pHour, u8 *pMin, u8 *pSe struct tm *tm_time; struct timeval tv; -#ifdef USE_HSM +// 2013/06/04 +// USE_HSM ̎͂ HSM RTC 擾ĂA +// dr؂ RTC (ăG[ɂȂ)ߕK PC 玞Ԃ擾邱ƂɂB +#if 0 ret_code = hsm_get_rtc( &tv.tv_sec ); if( ret_code != CR_GENID_SUCCESS ) { SetErrorInfo( __FUNCTION__, __LINE__ ); @@ -154,13 +171,28 @@ int GetTimestamp( u8 *pYear, u8 *pMonth, u8 *pMday, u8 *pHour, u8 *pMin, u8 *pSe tm_time = gmtime( &tv.tv_sec ); - *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 (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 // ܂ɂԂÂꍇ͌Œl˂ + { + *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; #if 0 {