• slider image 71
  • slider image 72
  • slider image 73
:::


Browsing this Thread:   1 Anonymous Users






ATECC508A的ECDH與Auth的問題
#1
新會員
新會員


查看用戶資訊
各位先進好:

小弟想請問在 ATECC508A 上,將 Read Key 的 bit 3 與 bit 2 設定成1,可以讓 ECDH 結果的 Master Secret 存入下一個 Slot 中,但是我在執行的時候 ECDH 指令一直顯示 EXECUTION_ERROR ,想請問我的 Config Zone 是否有設定錯誤。

Slot 0 2 6 是 ECC 的私鑰
Slot 1 3 7 是 ECDH 的 Master Secret
Slot 9 是 AuthKey 用的 Public Key

我想用 Slot 2 產生的 ECDH Master Secret 當作 Read Key 來讀取 Slot 0 產生出來了 Master Secret。

縮圖


uint8_t default_config_zone[] = {
    
0x000x000x000x00// Skip
    
0x000x000x000x00// Skip
    
0x000x000x000x00// Skip
    
0x000x000x000x00// Skip

    
0xc00x000xaa0x00// I2C_Addr, 0x00, OTP, Mode

    // Slot Config Bit order:
    // IsSecret, EncryptRead, LimitedUse, NoMac, ReadKey[3-0]
    // WriteConfig, WriteKey
    
0x8d0xb00xc30xa0// Slot 0
    
0x8d0xb00xc30xa0// Slot 2
    
0xc30x430x850xa0// Slot 4
    
0x8d0xb00xc70xa6// Slot 6
    
0x000x000x000x00// Slot 8
    
0x850xa00x850xa0// Slot 10
    
0x850xa00x850xa0// Slot 12
    
0x850xa00x850xa0// Slot 14

    
0xff0xff0xff0xff// Counter
    
0x000x000x000x000xff0xff0xff0xff0x000x000x000x00,
    
0x000x000x000x00// LastKeyUse
    
0x000x000x000x000x000x000x000x000x000x000x000x00,
    
0x000x000x000x00// Extra, Selector, DATA_LOCK, CFG_LOCK
    
0xff0xff0x000x00// SlotLock, SlotLock, RFU, RFU
    
0x000x000x000x00// X509format
    
0xf30x090xfc0x09// Key Format 0
    
0xf30x090xfc0x09// Key Format 2
    
0xfc0x090x330x00// Key Format 4
    
0xf30x090xfc0x09// Key Format 6
    
0x3c0x000x300x00// Key Format 8
    
0x330x000x330x00// Key Format 10
    
0x330x000x330x00// Key Format 12
    
0x330x000x330x00  // Key Format 14
};



程式輸出
Chip connected
Config zone locked 
Auth PrivKey
31CEF9B39083728D915DF3F96A0D8C1D4BB38AA0C342698DD35AAD3138CE92F0 
Auth PubKey
8E75454E8927FF6DEBC4366CBC596DA2546029BB2BB45F103475464E0C6F3F66E030162CAE4E609BBFB6364FEF6D24E5BE411885900790EAE3CF5E5A594E6A5F 
TempKey valid
: 0081 
AuthKey is verified 
Auth success by key 9
004D 
State 
Public KeyE961D4BE46882BA2F19F412C4825F2E66E20904409F4AD7C8341B2E0DF10AE83C3412263F025E28BB59403F8DB4DF48193C99DE2CC88BC6D9C894D4DC1AC768A 
Read 
Public Key909DDF1655ACFE4CDBFFAA38C8B5736F1BF5AD0D9BBA6204079BFB0FF63FFB88032512AA9F69C71ADB92C9F27AE4042F4BCA409F87366875BD55411F29714F5F 
Read 2 
Public Key251ACE17E2E9C8D39C469FC5350782443C6ED0D7B57393827DAD93CD465020F383DF1AB145B4C532C249A8B253CC5AD45A4AFFD56D8F4DF1A0EBBE38B63F75DB 
ECDH Failed -- StatusF4
 ECDH failed ret
=f4


// Create nonce
esp_fill_random(nonce_in32);
atcab_nonce_rand(nonce_inmessage);

// Sign by host private key
uECC_sign(privkeymessage32signcurve);

// Verify AuthKey
atcab_verify_stored(messagesign9, &is_verified);

// Generate key at slot 2
atcab_genkey(0read_pubkey);

// Create master secret at host as read key
uECC_shared_secret(read_pubkeyprivkeyread_keycurve);

// Create master secret at ATECC508a
atcab_ecdh(2pubkeypms);

// Read slot 0 ECDH master secret by ReadKey 3
atcab_ecdh_enc(0pubkeypmsread_key3);


謝謝

發表於: 2019/10/17 12:10
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: ATECC508A的ECDH與Auth的問題
#2
版主
版主


查看用戶資訊
你的問題是比較深入的問題, 無法在論壇上回覆。Libra 有發的email給你請你跟他聯絡。

發表於: 2019/10/17 19:01
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]