m943040028 / try_se_api

1 stars 0 forks source link

some questions for try_se_api #1

Open loonyma opened 8 years ago

loonyma commented 8 years ago

I'd like to test SE SPI with vsmartcard by following try_se_api steps. I have some questions as below: 1 "vsmartcard/virtualsmartcard/src/vpcd" make failed under ubuntu, there is no target in makefile 2 "git checkout -b se_api sy_repo/se_api" failed, there is no remote branch se_api all of them as below: remotes/sy_repo/block_cache remotes/sy_repo/issue554 remotes/sy_repo/master remotes/sy_repo/mdbg remotes/sy_repo/mem_leak remotes/sy_repo/netcat 3 i don't have serial_0.sh and serial_1.sh, where are they?

loonyma commented 8 years ago

question 1 has already fixed. just need to execute "autoreconf --verbose --install" and "./configure --sysconfdir=/etc", then "make install" but how to fix question 2 and 3 ?

m943040028 commented 8 years ago

Hi,

This document is outdated. And SE API is already merged to official OP-TEE. (Thus, the branch is removed)

Please follow the following page to setup an OP-TEE development on QEMU https://github.com/OP-TEE/optee_os/blob/master/README.md SE_API is enabled by default.

You should replace the QEMU with what you just built. (with pcsc passthru enabled)

loonyma commented 8 years ago

Hi Sheng Yu Chiu, Many thanks for your answers! You mean I still need to use modified qemu with "sy_repo/smart_card_emul" branch,right? there is a virtual pcsc device in qemu to be used for invoke the real PCSC interface, is that right?

m943040028 commented 8 years ago

Yes, you are right.

loonyma commented 8 years ago

Unfortunately I didn't get my expect results, my test sequence as below 1 repo sync with default_stable.xml, make all run, then I can get into the linux console on the normal world. means everything is ok. 2 cd qemu; git checkout -b smart_card_emul remotes/sy_repo/smart_card_emul 3 make all run; after a while i get the two serial console on two side 4 java -cp jcardsim.jar org.linaro.seapi.VpcdClient; I got a dead loop like "java.net.SocketException: Socket is not connected at java.net.Socket.getInputStream(Socket.java:878) at org.linaro.seapi.VpcdClient.mainLoop(VpcdClient.java:145) at org.linaro.seapi.VpcdClient.main(VpcdClient.java:210)" 5 input 'c' with an enter in the qemu console; then I got an error on the secure world ERR TEE-CORE:_assert_log:38 Assertion '!(read32(gic.gicd_base + GICD_IGROUPR(idx)) & mask)' failed at core/drivers/gic.c:204

loonyma commented 8 years ago

Hi Sheng Yu Chiu,

I can get into linux console on the normal side if I change the qemu branch from smart_card_emul to remotes/linaro-swg/secure_element. In that case, above issue is disappeared.

But I got another issue on the secure side. that is "DBG TEE-CORE:tee_se_reader_open_session:200:assertion failed" what should I do for the next?

m943040028 commented 8 years ago

Hi,

I don't have environment to reproduce your issue now.

Here is the old script that is used to generate SE API test environment, see if this helps https://github.com/OP-TEE/optee_os/commit/700c3514109e9d3076407d1007fcf5217f3cc93d

If you have problem to execute jcardsim Please make sure if your pcscd is running and vpcd is installed correctly. You can check it with pcsc_scan

I will find some time to check this issue tomorrow (if possible)

loonyma commented 8 years ago

Hi Sheng Yu Chiu,

The jcardsim issue is fine now, pcscd seems not be executed correctly. pcsc_scan can detect the reader and insert action.

as above mentioned, now I have used qemu with secure_element branch. In that case, the se_api_self_test of ta on the secure side failed at tee_se_manager_get_reads func.

I checked out the passthru_reader code, i got 0 reader detected when read the reg via PCSC_REG_NUM_READERS.

info from pcsc_scan as below:

PC/SC device scanner V 1.4.22 (c) 2001-2011, Ludovic Rousseau ludovic.rousseau@free.fr Compiled with PC/SC lite version: 1.8.10 Using reader plug'n play mechanism Scanning present readers... 0: Virtual PCD 00 00 1: Virtual PCD 00 01

Wed Mar 23 11:35:32 2016 Reader 0: Virtual PCD 00 00 Card state: Card inserted, ATR: 3B FA 18 00 00 81 31 FE 45 4A 43 4F 50 33 31 56 32 33 32 98

ATR: 3B FA 18 00 00 81 31 FE 45 4A 43 4F 50 33 31 56 32 33 32 98

Possibly identified card (using /usr/share/pcsc/smartcard_list.txt): NONE

find: `/home/loony/.cache/smartcard_list.txt': 没有那个文件或目录 Your card is not present in the database. Please submit your unknown card at: http://smartcard-atr.appspot.com/parse?ATR=3BFA1800008131FE454A434F5033315632333298 Reader 1: Virtual PCD 00 01 Card state: Card removed,

loonyma commented 8 years ago

Hi Sheng Yu Chiu,

For qemu with "secure_element " branch, I found hw/pcsc hasn't been involved in compiling. so I modified qemu configuration to make pcsc="yes", then run the se_api_self_test, all of test cases pass except "test_logical_channel" and "test_transmit".

Do you have any suggestion about the failed test cases?

m943040028 commented 8 years ago

You might use old version of jcardsim.jar You can download latest release here: https://github.com/m943040028/jcardsim/releases/download/release2/jcardsim.jar

loonyma commented 8 years ago

Hi Sheng Yu Chiu,

Both failed. but the error info is little bit different.

"test_logical_channel" case error on the old version: ERR TEE-CORE:internal_manage_channel:174: operation failed, sw1:6A, sw2:81 ERR TEE-CORE:internal_select:130: operation failed,sw1:69 sw2:86 ERR TEE-CORE:internal_manage_channel:174: operation failed, sw1:69, sw2:86 "test_transmit" case error on the old one version: ERR TEE-CORE:test_transmit:411: assertion 'ret == TEE_ERROR_ITEM_NOT_FOUND' failed at core/arch/arm/sta/se_api_self_tests.c:411

"test_logical_channel" case error on the new version: ERR TEE-CORE:internal_manage_channel:174: operation failed, sw1:6A, sw2:81 ERR TEE-CORE:internal_select:130: operation failed, sw1:69, sw2:86 "test_transmit" case error on the new version: ERR TEE-CORE:internal_select:130: operation failed, sw1:6A, sw2:83

m943040028 commented 8 years ago

Hi,

I try to reproduce your issue. But, currently official OP-TEE is during transition from old linux driver to new one. It is a bit unstable now. And I don't have much time to build a workable environment right now.

Could you try to debug this issue? jcardsim source code is available here: https://github.com/linaro-swg/jcardsim

loonyma commented 8 years ago

Hi Sheng Yu Chiu,

I'm out of my office for these two days, I'll try to fix it ASAP after returning.