Hi,
What is the BAUD rate of the phone clock? You must know it for sniffing the communication between the phone and SIM card. And does Wireshark output all the communication between the phone and the SIM card? Please let me know.
Thanks, Vishal
On 14. Jul 2017, at 18:07, Vishal Vaidhyanathan Vishal.Vaidhyanathan@privoro.com wrote:
Hi,
Hi Vishal,
What is the BAUD rate of the phone clock? You must know it for sniffing the communication between the phone and SIM card. And does Wireshark output all the communication between the phone and the SIM card? Please let me know.
It depends on the ATR. SIMtrace firmware sniffes and then adjusts clock. Have a look at the sourcecode.
What do you think is missing in wireshark?
holger
On 14. Jul 2017, at 18:50, Vishal Vaidhyanathan Vishal.Vaidhyanathan@privoro.com wrote:
Hi Holger,
Hi!
please don't take a public discussion private. It is considered rude in the FOSS community. But I (and others) offer consulting services too.
So I receive the ATR at 9600 Baud rate. After that I send the APDU commands in the exact order I see in Wireshark. One SIM card responds exactly as I see in Wireshark. Few other SIM cards don’t respond after ATR. So I want to know how the phone does it and want to verify that Wireshark is not missing something after ATR. This is the reason I want to know the baud rate of the phone clock.
Where exactly should I look at the source to figure out the Baud rate of the phone?
http://git.osmocom.org/openpcd/tree/firmware/src/simtrace/iso7816_uart.c#n11...
follow the usage of the fi_table and di_table
Hi,
Sorry about that. Didn’t realize I was taking it private. I’ve a couple more questions. If the ATR comes back at 9600, doesn’t it stay the same until we send PPS?
So I went through that link, according to that, after ATR, we use the Fi and Di values to calculate UART Baud rate and send commands in that rate? But I want to know what baud rate the phone uses? Does it change using PPS? Wireshark doesn’t show any PPS after ATR. Does that mean the phone read the ATR and adjusted the clock accordingly? Basically I’m trying to sniff the entire phone communication to SIM in a file and I need the correct Baud rate to do that?
Thanks, Vishal
On Jul 14, 2017, at 9:54 AM, Holger Freyther holger@freyther.de wrote:
On 14. Jul 2017, at 18:50, Vishal Vaidhyanathan Vishal.Vaidhyanathan@privoro.com wrote:
Hi Holger,
Hi!
please don't take a public discussion private. It is considered rude in the FOSS community. But I (and others) offer consulting services too.
So I receive the ATR at 9600 Baud rate. After that I send the APDU commands in the exact order I see in Wireshark. One SIM card responds exactly as I see in Wireshark. Few other SIM cards don’t respond after ATR. So I want to know how the phone does it and want to verify that Wireshark is not missing something after ATR. This is the reason I want to know the baud rate of the phone clock.
Where exactly should I look at the source to figure out the Baud rate of the phone?
http://git.osmocom.org/openpcd/tree/firmware/src/simtrace/iso7816_uart.c#n11...
follow the usage of the fi_table and di_table
On 14. Jul 2017, at 19:13, Vishal Vaidhyanathan Vishal.Vaidhyanathan@privoro.com wrote:
Hi,
Hi!
Sorry about that. Didn’t realize I was taking it private. I’ve a couple more questions. If the ATR comes back at 9600, doesn’t it stay the same until we send PPS?
Right.
So I went through that link, according to that, after ATR, we use the Fi and Di values to calculate UART Baud rate and send commands in that rate? But I want to know what baud rate the phone uses? Does it change using PPS? Wireshark doesn’t show any PPS after ATR. Does that mean the phone read the ATR and adjusted the clock accordingly? Basically I’m trying to sniff the entire phone communication to SIM in a file and I need the correct Baud rate to do that?
You are right. If you look at process_byte it will not forward PTS related bytes (goto out_silent). At least in the debug output of the SIMtrace you should be able to see fi/di changes.
holger
Hi Holger,
Well I looked into the code and figured ATMEL MCU used here takes Fi/Di as an input parameter for setting it’s UART. My question how do you figure the phone clock speed and baud rate?
I know that Baud Rate = Phone clock speed/(Fi/Di). So I need to know these parameters to sniff communication.
My Goal is to sniff the entire process of phone communication with SIM and store in a File. For that I need to know the phone’s clock speed and Baud rate of UART at different times.
Thanks, Vishal
On Jul 14, 2017, at 10:23 AM, Holger Freyther holger@freyther.de wrote:
On 14. Jul 2017, at 19:13, Vishal Vaidhyanathan Vishal.Vaidhyanathan@privoro.com wrote:
Hi,
Hi!
Sorry about that. Didn’t realize I was taking it private. I’ve a couple more questions. If the ATR comes back at 9600, doesn’t it stay the same until we send PPS?
Right.
So I went through that link, according to that, after ATR, we use the Fi and Di values to calculate UART Baud rate and send commands in that rate? But I want to know what baud rate the phone uses? Does it change using PPS? Wireshark doesn’t show any PPS after ATR. Does that mean the phone read the ATR and adjusted the clock accordingly? Basically I’m trying to sniff the entire phone communication to SIM in a file and I need the correct Baud rate to do that?
You are right. If you look at process_byte it will not forward PTS related bytes (goto out_silent). At least in the debug output of the SIMtrace you should be able to see fi/di changes.
holger
On Fri, Jul 14, 2017 at 08:50:27PM +0000, Vishal Vaidhyanathan wrote:
Hi Holger,
Well I looked into the code and figured ATMEL MCU used here takes Fi/Di as an input parameter for setting it’s UART. My question how do you figure the phone clock speed and baud rate?
the ISO7816 mode of the USART peripheral is used, where the micro-controller doesn't need to know the clock speed. compared to UART where both sides need to know the clock speed (asynchronous mode), in ISO7816 mode there is a dedicated clock signal provided by the phone (synchronous mode) and the bit is sampled on the rising edge of the clock (no matter the frequency). the phone (i.e. the master) can change the frequency (1 to 5 MHz at the beginning) while communicating.
if you are using a simple UART adapter you would have to synchronise to the clock signal (or measure its frequency using a timer, most of the time this works too).
Hi Holger,
You said simtrace doesn’t show PTS related information. Is there an option to enable it and see it on Wireshark? How do I enable debug mode?
Thanks,
Vishal
On Jul 14, 2017, at 10:23 AM, Holger Freyther holger@freyther.de wrote:
On 14. Jul 2017, at 19:13, Vishal Vaidhyanathan Vishal.Vaidhyanathan@privoro.com wrote:
Hi,
Hi!
Sorry about that. Didn’t realize I was taking it private. I’ve a couple more questions. If the ATR comes back at 9600, doesn’t it stay the same until we send PPS?
Right.
So I went through that link, according to that, after ATR, we use the Fi and Di values to calculate UART Baud rate and send commands in that rate? But I want to know what baud rate the phone uses? Does it change using PPS? Wireshark doesn’t show any PPS after ATR. Does that mean the phone read the ATR and adjusted the clock accordingly? Basically I’m trying to sniff the entire phone communication to SIM in a file and I need the correct Baud rate to do that?
You are right. If you look at process_byte it will not forward PTS related bytes (goto out_silent). At least in the debug output of the SIMtrace you should be able to see fi/di changes.
holger