Se05x_API_PBKDF2 Failed in WiFiKDF_derive example

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Se05x_API_PBKDF2 Failed in WiFiKDF_derive example

596 Views
Tlabs
Contributor I

Hi all,

 

i tried the ex_se05x-WiFiKDF_derive example which allways fails on my SE051. Using this example with default ECKeys and an ECKey Session based on the rapsberry pi examples. I will attach the debug output.

I tried to call Se05x_API_PBKDF2 in the ex_se05_WiFiKDF_example on the raspberry pi.

App :INFO :Deriving PBKDF2 for wifi_ssid='some-wifi-ssid', WIFI_COUNT='10000'

it allways fails with:

sss :WARN :nxEnsure:'ret == SM_OK' failed. At Line:6992 Function:sss_se05x_TXn
App :ERROR:Se05x_API_PBKDF2 Failed
App :INFO :Done
App :INFO :ex_sss Finished
App :ERROR:ex_sss_entry Failed

 

---------------------

 

 

 

App :INFO :Deriving PBKDF2 for wifi_ssid='some-wifi-ssid', WIFI_COUNT='10000'

APDU :DEBUG:PBKDF2 []
APDU :DEBUG:kSE05x_TAG_1 [4-byte password identifier (object type must be HMACKey)] = 0x7D51F001
APDU :DEBUG:kSE05x_TAG_2 [salt] (Len=14)
73 6F 6D 65 2D 77 69 66 69 2D 73 73 69 64
APDU :DEBUG:kSE05x_TAG_3 [count] = 0x2710
APDU :DEBUG:kSE05x_TAG_4 [requestedLen] = 0x20
scp :DEBUG:FN: nxSCP03_Encrypt_CommandAPDU
scp :DEBUG: Input:cmdBuf (Len=30)
41 04 7D 51 F0 01 42 0E 73 6F 6D 65 2D 77 69 66
69 2D 73 73 69 64 43 02 27 10 44 02 00 20
scp :DEBUG:FN: nxSCP03_PadCommandAPDU
scp :DEBUG:Input: cmdBuf (Len=30)
41 04 7D 51 F0 01 42 0E 73 6F 6D 65 2D 77 69 66
69 2D 73 73 69 64 43 02 27 10 44 02 00 20
scp :DEBUG:Ouput: cmdBuf (Len=32)
41 04 7D 51 F0 01 42 0E 73 6F 6D 65 2D 77 69 66
69 2D 73 73 69 64 43 02 27 10 44 02 00 20 80 00
scp :DEBUG:FN: nxSCP03_Calculate_CommandICV
scp :DEBUG: Output: (Len=8)
C8 1E 96 37 77 FC AE 12
scp :DEBUG:Encrypt CommandAPDU
scp :DEBUG:cmdBuf (Len=32)
10 3C 38 8F 36 62 2A A8 9A C4 B8 AD 38 48 11 FE
4F 28 36 48 C7 DB 82 53 CC B3 18 7A 2B 70 D4 FC
scp :DEBUG:Output: EncryptedcmdBuf (Len=32)
10 3C 38 8F 36 62 2A A8 9A C4 B8 AD 38 48 11 FE
4F 28 36 48 C7 DB 82 53 CC B3 18 7A 2B 70 D4 FC
scp :DEBUG:FN: nxpSCP03_CalculateMac_CommandAPDU
scp :DEBUG:Input: cmdBuf (Len=37)
84 03 00 2E 28 10 3C 38 8F 36 62 2A A8 9A C4 B8
AD 38 48 11 FE 4F 28 36 48 C7 DB 82 53 CC B3 18
7A 2B 70 D4 FC
scp :DEBUG:Output: mac (Len=8)
3A 69 CE 15 98 FB 0B FD
smCom :DEBUG:APDU Tx> (Len=62)
80 05 00 00 39 10 08 01 9F 0A DD A0 37 6E 9E 41
2D 84 03 00 2E 28 10 3C 38 8F 36 62 2A A8 9A C4
B8 AD 38 48 11 FE 4F 28 36 48 C7 DB 82 53 CC B3
18 7A 2B 70 D4 FC 3A 69 CE 15 98 FB 0B FD
smCom :DEBUG:Enter phNxpEseProto7816_Transceive
smCom :DEBUG:Transceive data ptr 0x0xbee9e000 len:62
smCom :DEBUG:I-Frame Data Len: 62 Seq. no:1
smCom :DEBUG:TransceiveProcess nextTransceiveState 1
smCom :DEBUG:phNxpEse_WriteFrame Enter ..
smCom :DEBUG:RAW Tx> (Len=67)
5A 40 3E 80 05 00 00 39 10 08 01 9F 0A DD A0 37
6E 9E 41 2D 84 03 00 2E 28 10 3C 38 8F 36 62 2A
A8 9A C4 B8 AD 38 48 11 FE 4F 28 36 48 C7 DB 82
53 CC B3 18 7A 2B 70 D4 FC 3A 69 CE 15 98 FB 0B
FD 8F 46
smCom :DEBUG:phNxpEse_read Enter ..
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:phNxpEse_readPacket Read HDR
smCom :DEBUG:phNxpEse_readPacket SOF FOUND
smCom :DEBUG:phPalEse_i2c_read Read Requested 1 bytes
smCom :DEBUG:poll_sof_chained_delay value is 0
smCom :DEBUG:phPalEse_i2c_read Read Requested 4 bytes
smCom :DEBUG:RAW Rx< (Len=7)
A5 40 02 69 86 9B F3
smCom :DEBUG:phNxpEseProto7816_ProcessResponse p_data ----> 0x186b3b0 len ----> 0x7
smCom :DEBUG:Received CRC:0x9bf3 Calculated CRC:0x9bf3
smCom :DEBUG:Retry Counter = 0
smCom :DEBUG:phNxpEseProto7816_DecodeFrame I-Frame Received
smCom :DEBUG:phNxpEseProto7816_DecodeFrame I-Frame lastRcvdIframeInfo.seqNo:0x1
smCom :DEBUG:Data[0]=0x69 len=2 Data[1]=0x69 Data[2]=0x86
smCom :DEBUG: phNxpEse_Transceive Exit status 0x0
smCom :DEBUG:APDU Rx< (Len=2)
69 86
scp :DEBUG:Inc_CommandCounter value (Len=16)
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03
sss :WARN :nxEnsure:'ret == SM_OK' failed. At Line:6992 Function:sss_se05x_TXn
App :ERROR:Se05x_API_PBKDF2 Failed
App :INFO :Done
App :INFO :ex_sss Finished
App :ERROR:ex_sss_entry Failed

APDU :DEBUG:CloseSession []
scp :DEBUG:FN: nxSCP03_Encrypt_CommandAPDU
scp :DEBUG: Input:cmdBuf (Len=0)
scp :DEBUG:FN: nxpSCP03_CalculateMac_CommandAPDU
scp :DEBUG:Input: cmdBuf (Len=5)
84 04 00 1C 08
scp :DEBUG:Output: mac (Len=8)
36 7D F2 32 70 06 6B FB
smCom :DEBUG:APDU Tx> (Len=30)
80 05 00 00 19 10 08 01 9F 0A DD A0 37 6E 9E 41
0D 84 04 00 1C 08 36 7D F2 32 70 06 6B FB
smCom :DEBUG:Enter phNxpEseProto7816_Transceive
smCom :DEBUG:Transceive data ptr 0x0xbee9e0a8 len:30
smCom :DEBUG:I-Frame Data Len: 30 Seq. no:0
smCom :DEBUG:TransceiveProcess nextTransceiveState 1
smCom :DEBUG:phNxpEse_WriteFrame Enter ..
smCom :DEBUG:RAW Tx> (Len=35)
5A 00 1E 80 05 00 00 19 10 08 01 9F 0A DD A0 37
6E 9E 41 0D 84 04 00 1C 08 36 7D F2 32 70 06 6B
FB 9F F2
smCom :DEBUG:phNxpEse_read Enter ..
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:_i2c_read() error : 13
smCom :DEBUG:_i2c_read() [HDR]errno : 79 ret : FFFFFFFF
smCom :DEBUG:phNxpEse_readPacket Normal Pkt, delay read 1ms
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:phNxpEse_readPacket Read HDR
smCom :DEBUG:phNxpEse_readPacket SOF FOUND
smCom :DEBUG:phPalEse_i2c_read Read Requested 1 bytes
smCom :DEBUG:poll_sof_chained_delay value is 0
smCom :DEBUG:phPalEse_i2c_read Read Requested 12 bytes
smCom :DEBUG:RAW Rx< (Len=15)
A5 00 0A 1E 15 ED DD 2A A3 2C E7 90 00 06 C1
smCom :DEBUG:phNxpEseProto7816_ProcessResponse p_data ----> 0x186b3b0 len ----> 0xf
smCom :DEBUG:Received CRC:0x6c1 Calculated CRC:0x6c1
smCom :DEBUG:Retry Counter = 0
smCom :DEBUG:phNxpEseProto7816_DecodeFrame I-Frame Received
smCom :DEBUG:phNxpEseProto7816_DecodeFrame I-Frame lastRcvdIframeInfo.seqNo:0x0
smCom :DEBUG:Data[0]=0x1e len=10 Data[9]=0x90 Data[10]=0x0
smCom :DEBUG: phNxpEse_Transceive Exit status 0x0
smCom :DEBUG:APDU Rx< (Len=10)
1E 15 ED DD 2A A3 2C E7 90 00
scp :DEBUG:FN: nxpSCP03_Decrypt_ResponseAPDU
scp :DEBUG: Input:rspBuf (Len=10)
1E 15 ED DD 2A A3 2C E7 90 00
scp :DEBUG: Calculated RMAC : (Len=16)
1E 15 ED DD 2A A3 2C E7 1C 63 E8 5E BB F1 81 62
scp :DEBUG:Verify MAC
scp :DEBUG:RMAC verified successfully...Decrypt Response Data
scp :DEBUG:Inc_CommandCounter value (Len=16)
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04
smCom :DEBUG:TransceiveProcess nextTransceiveState 6
smCom :DEBUG:S-Frame PCB: c5
smCom :DEBUG:phNxpEse_WriteFrame Enter ..
smCom :DEBUG:RAW Tx> (Len=5)
5A C5 00 47 82
smCom :DEBUG:phNxpEse_read Enter ..
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:phNxpEse_readPacket Read HDR
smCom :DEBUG:phNxpEse_readPacket SOF FOUND
smCom :DEBUG:phPalEse_i2c_read Read Requested 1 bytes
smCom :DEBUG:poll_sof_chained_delay value is 0
smCom :DEBUG:phPalEse_i2c_read Read Requested 2 bytes
smCom :DEBUG:RAW Rx< (Len=5)
A5 E5 00 87 67
smCom :DEBUG:phNxpEseProto7816_ProcessResponse p_data ----> 0x186b3b0 len ----> 0x5
smCom :DEBUG:Received CRC:0x8767 Calculated CRC:0x8767
smCom :DEBUG:Retry Counter = 0
smCom :DEBUG:phNxpEseProto7816_DecodeFrame S-Frame Received
smCom :DEBUG:phNxpEse_close - ESE Context deinit completed
App :INFO :Closing Host Session
App :ERROR:!ERROR! ret != 0.

 

 

0 Kudos
6 Replies

563 Views
Tlabs
Contributor I

Now its working but if i set the Count to 10.000 is not working with:

App :INFO :ex_sss_entry started
App :INFO :Deriving PBKDF2 for wifi_ssid='some-wifi-ssid', WIFI_COUNT='10000'
smCom :ERROR:phNxpEseProto7816_DecodeFrame Interface Reset to eSE wtx count reached!!!
sss :WARN :nxEnsure:'ret == SM_OK' failed. At Line:6992 Function:sss_se05x_TXn
App :ERROR:Se05x_API_PBKDF2 Failed
App :INFO :Done
App :INFO :ex_sss Finished
App :ERROR:ex_sss_entry Failed
scp :ERROR: RESPONSE MAC DID NOT VERIFY 7042
sss :WARN :nxEnsure:'ret == SM_OK' failed.

 

Does anybody know the reason?

0 Kudos

526 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @Tlabs ,

 

Do you mean it works with count of 4096 but failed with count of 10000? Please kindly clarify.

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

520 Views
Tlabs
Contributor I

Hi Kan,

 

Yes 4096 is working but 10.000 not.

 

Any idea?

 

Thx.

 

Torsten

0 Kudos

432 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @Tlabs ,

 

I just got the solution from the expert team, and they suggested increasing PH_PROTO_WTX_DEFAULT_COUNT in simw-top\hostlib\hostLib\libCommon\smCom\T1oI2C\phNxpEseProto7816_3.h and this solution has been verified on my side. please kindly refer to the following for details.

Kan_Li_0-1700707590673.png

 

In my test, PH_PROTO_WTX_DEFAULT_COUNT was updated to 1000, you may try it as well on your side.

 

Please kindly let me if the problem is still there.

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

 

0 Kudos

506 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @Tlabs ,

 

Thanks for the clarification! but why do you use 10k iterations of PBKDF2? The Wifi spec uses only 4096 as far as I know. I will check if it is possible to run with 10k count.

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

569 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @Tlabs ,

 

There is some issue with the policy of the symmetric key injected by ex_se05x_WiFiKDF_inject, so that it leads to the failure in WiFiKDF_derive example. Please apply the attached patch and try again.

Apply patch as

cd simw-top\demos

git apply ex_se05x_WiFiKDF.patch

 

Hope that helps,

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos