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 {