not really known
Go to file
kubodera_yuichi 75a4d9c7cc 本番環境に近づけるために:librqcard.a と -lm をリンクするライブラリから除外
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_eFuse@155 ff987cc8-cf2f-4642-8568-d52cce064691
2010-01-07 08:48:21 +00:00
dummyKey ・ツリーの整理。 2010-01-05 10:51:17 +00:00
hsm_utils AESインポートの修正をECDSAインポートに逆輸入 2010-01-06 06:41:54 +00:00
package ・SFMTのパッケージおよびコードをツリーから削除。 2009-12-22 08:52:51 +00:00
realKey realKeyフォルダ内の鍵データを正式な鍵に差し替え。 2010-01-06 02:56:42 +00:00
tools ・ビルドスイッチの整理。 2009-12-22 08:35:27 +00:00
cr_alloc.c Add first files. 2009-12-21 08:45:37 +00:00
cr_alloc.h Add first files. 2009-12-21 08:45:37 +00:00
cr_device_cert.c 本番環境に近づけるためにsha1の箇所を削除 2010-01-07 08:17:39 +00:00
cr_enc_id.c ・ツリーの整理。 2010-01-05 10:51:17 +00:00
cr_generate_id_private.h ・ECDSA署名検証をOPENSSLで行うために、ECC公開鍵を単独でファイルからリードするよう変更。 2010-01-05 08:55:54 +00:00
cr_generate_id.c 本番鍵を読み出すよう変更、ECDSAにてHSMでも検証するのを復活 2010-01-06 06:56:18 +00:00
cr_generate_id.h ・ツリーの整理。 2010-01-05 10:51:17 +00:00
cr_hsm_alloc.c メモリリーク対策、HSM関連のアロケータを自前で用意 2010-01-06 00:45:24 +00:00
cr_hsm_alloc.h メモリリーク対策、HSM関連のアロケータを自前で用意 2010-01-06 00:45:24 +00:00
cr_hsm_bignum.c NFastApp_Malloc,NFastApp_Freeは登録した関数が呼び出されることが判明したのでカウンタはcr_hsm_allocにて統合 2010-01-07 08:11:07 +00:00
cr_hsm_bignum.h NFastApp_Malloc,NFastApp_Freeは登録した関数が呼び出されることが判明したのでカウンタはcr_hsm_allocにて統合 2010-01-07 08:11:07 +00:00
cr_hsm_code.c 本番環境に近づけるために:librqcard.a と -lm をリンクするライブラリから除外 2010-01-07 08:48:21 +00:00
cr_hsm_code.h Sha256ハッシュのビットシフト処理、署名再構築処理追加 2010-01-05 11:25:41 +00:00
cr_id_util.c SetErrorInfoでスタック分記録する方式に変更。 2009-12-25 07:06:54 +00:00
cr_keyPair.c ・エラーコードの整理。 2009-12-24 10:20:17 +00:00
LICENSE_en.txt Add first files. 2009-12-21 08:45:37 +00:00
LICENSE_jp.txt Add first files. 2009-12-21 08:45:37 +00:00
main.c deviceId -> device_id 2009-12-27 23:53:10 +00:00
Makefile 本番環境に近づけるために:librqcard.a と -lm をリンクするライブラリから除外 2010-01-07 08:48:21 +00:00
Makefile.sharp Add first files. 2009-12-21 08:45:37 +00:00
package.csh Add first files. 2009-12-21 08:45:37 +00:00
package.sh Add first files. 2009-12-21 08:45:37 +00:00
readme_openssl.txt Add first files. 2009-12-21 08:45:37 +00:00
readme.txt Add first files. 2009-12-21 08:45:37 +00:00

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CTR - ID生成関数について 2009/09/30

----------------------------
要、opensslライブラリバージョン0.9.8以上)
現在、openssl-1.0.0-beta2とopenssl-0.9.8kでテスト中。

-----------------------------
ファイル構成:
  readme.txt
  readme_openssl.txt
  LICENSE_en.txt
  LICENSE_jp.txt
 cr_generate_id.h 
 cr_generate_id.c 
 cr_alloc.h
 cr_alloc.c 
 cr_gen_id_rsa_key_priv.c
 cr_gen_id_rsa_key_priv.h
 cr_gen_id_rsa_key_pub.c
 cr_gen_id_rsa_key_pub.h
  maim.c(使用サンプル)
  Makefile(Windows cygwin環境用)

----------------------------
関数仕様:

#define CR_ID_BUF_SIZE                (2048/8)
#define CR_NUM_OF_SERIAL               5

typedef signed char  s8;
typedef unsigned char  u8;
typedef unsigned short u16;
typedef unsigned long  u32;
typedef unsigned long long u64;

int cr_generate_id(u32 counter[CR_NUM_OF_SERIAL], u8 id[ID_BUF_SIZE]);
/*
    Core2 Duo 2.66GHz 2GB で約0.016sec
*/
----------------------------
使用サンプル:

main()
{
     u8 id_buf[CR_ID_BUF_SIZE]; /* 256byte(2048bit) */
     u32 counter_array[CR_NUM_OF_SERIAL];

     u32 counter0 = 1;
     u64 counter1 = 2;
     u64 counter2 = 3;


     while( 1 ) {
	counter_array[0] = counter0;
	counter_array[1] = (u32)(counter1 & 0xffffffff );
	counter_array[2] = (u32)( (counter1 >> 32) & 0xffffffff );
	counter_array[3] = (u32)(counter2 & 0xffffffff );
	counter_array[4] = (u32)( (counter2 >> 32) & 0xffffffff ); 

	if( 0 != cr_generate_id(counter_array, id_buf) ) {
	    fprintf(stderr,"cr_generate_id failed c=0x%08x\n",counter0);
	}
	else {
	    fwrite(id, CR_ID_BUF_SIZE, 1, fp);
	}
	counter0++;
        counter1 += (u64)rand();
        counter2 += (u64)rand();
     }
}