access rpmb partition

Post Reply
yfpb
Posts: 11
Joined: Tue May 21, 2019 12:31 pm
languages_spoken: english, korean (not native)
Has thanked: 0
Been thanked: 0
Contact:

access rpmb partition

Unread post by yfpb » Fri Jun 07, 2019 4:04 pm

Hi,

Has anybody ever tried accessing the rpmb partition on the emmc modules? I'm using the microsd emmc module reader (https://www.hardkernel.com/shop/emmc-mo ... os-upgrade) with the 16GB eMMC Module N2 (for both Linux and Android). When trying to write something to the rpmb partition, the key couldn't be verified. When trying to write a key to it, the message type is wrong. When dumping the data frames from the module, seems like it's just returning all 0s. Any ideas? Please help! Thanks!

Verifying Key
Request
Dumping data frame 0:
000000003f09d3a4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003f09d3b4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003f09d3c4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003f09d3d4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003f09d3e4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003f09d3f4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003f09d404 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003f09d414 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003f09d424 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003f09d434 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003f09d444 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003f09d454 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003f09d464 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003f09d474 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003f09d484 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003f09d494 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003f09d4a4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003f09d4b4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003f09d4c4 4e a7 88 8c 79 b3 fe 69 1c b9 7d 7b 8d 30 d9 b0
000000003f09d4d4 00 00 00 00 00 00 00 00 00 00 00 02

Response
Dumping data frame 0:
000000003ae040c4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae040d4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae040e4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae040f4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae04104 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae04114 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae04124 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae04134 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae04144 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae04154 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae04164 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae04174 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae04184 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae04194 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae041a4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae041b4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae041c4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae041d4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae041e4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000000003ae041f4 00 00 00 00 00 00 00 00 00 00 00 00

Error
Unexpected msg_type (0x0000 != 0x0200)

User avatar
tobetter
Posts: 3679
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 28 times
Been thanked: 115 times
Contact:

Re: access rpmb partition

Unread post by tobetter » Fri Jun 07, 2019 4:10 pm

How did you access the RPMB partition?
We have not verified the RPMB can be accessible.

yfpb
Posts: 11
Joined: Tue May 21, 2019 12:31 pm
languages_spoken: english, korean (not native)
Has thanked: 0
Been thanked: 0
Contact:

Re: access rpmb partition

Unread post by yfpb » Fri Jun 07, 2019 4:18 pm

Using ioctl calls from c code.

User avatar
tobetter
Posts: 3679
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 28 times
Been thanked: 115 times
Contact:

Re: access rpmb partition

Unread post by tobetter » Fri Jun 07, 2019 4:34 pm

yfpb wrote:
Fri Jun 07, 2019 4:18 pm
Using ioctl calls from c code.
Since we've not tested the feature in any ODROID boards, we are not sure if it can be supported or not.
I've seen the code and driver of 'depend_key which seems to use eMMC RPMB, not it's also not verified.

yfpb
Posts: 11
Joined: Tue May 21, 2019 12:31 pm
languages_spoken: english, korean (not native)
Has thanked: 0
Been thanked: 0
Contact:

Re: access rpmb partition

Unread post by yfpb » Fri Jun 07, 2019 5:31 pm

I know it's been done before by others, but it was using an older emmc module - v0.3 for the U2/U3 boards (https://web.archive.org/web/20161221144 ... 5393511084). The emmc modules I have are v0.4 for the N2 boards. Not sure if there are differences? Can the hardkernel engineers confirm please?

User avatar
tobetter
Posts: 3679
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 28 times
Been thanked: 115 times
Contact:

Re: access rpmb partition

Unread post by tobetter » Fri Jun 07, 2019 6:22 pm

yfpb wrote:
Fri Jun 07, 2019 5:31 pm
I know it's been done before by others, but it was using an older emmc module - v0.3 for the U2/U3 boards (https://web.archive.org/web/20161221144 ... 5393511084). The emmc modules I have are v0.4 for the N2 boards. Not sure if there are differences? Can the hardkernel engineers confirm please?
Do you know the article about how it was done?
Can you share the code what you are testing?

yfpb
Posts: 11
Joined: Tue May 21, 2019 12:31 pm
languages_spoken: english, korean (not native)
Has thanked: 0
Been thanked: 0
Contact:

Re: access rpmb partition

Unread post by yfpb » Fri Jun 07, 2019 6:55 pm

@tobetter Thanks! Are you hardkernel engineer?
Please see slide 8 @ https://www.slideshare.net/linaroorg/la ... s-in-optee.
The test code is run using op-tee (trustzone), but odroid isn't supported in optee (https://optee.readthedocs.io/general/pl ... -supported).
Maybe someone can create a port?

User avatar
tobetter
Posts: 3679
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 28 times
Been thanked: 115 times
Contact:

Re: access rpmb partition

Unread post by tobetter » Fri Jun 07, 2019 7:07 pm

yfpb wrote:
Fri Jun 07, 2019 6:55 pm
@tobetter Thanks! Are you hardkernel engineer?
Please see slide 8 @ https://www.slideshare.net/linaroorg/la ... s-in-optee.
The test code is run using op-tee (trustzone), but odroid isn't supported in optee (https://optee.readthedocs.io/general/pl ... -supported).
Maybe someone can create a port?
Yes, I am and as I mentioned that we have not tested the security features.
Exynos5422 on ODROID-XU4, it enables the TEE by default while another CPUs (Amlogic) for ODROID is not and we are not capable to support TEE features.

yfpb
Posts: 11
Joined: Tue May 21, 2019 12:31 pm
languages_spoken: english, korean (not native)
Has thanked: 0
Been thanked: 0
Contact:

Re: access rpmb partition

Unread post by yfpb » Fri Jun 07, 2019 7:14 pm

Ok, I understand, but actually the rpmb test code by itself (https://github.com/OP-TEE/optee_client/ ... src/rpmb.c) doesn't depend on TEE and can probably be written as a linux application.
Or if the odroid rootfs can support (i.e. install and run) mmc-utils, it can be used to verify rpmb functionalities. It's easier.
Thanks.

https://manpages.debian.org/unstable/mm ... .1.en.html

yfpb
Posts: 11
Joined: Tue May 21, 2019 12:31 pm
languages_spoken: english, korean (not native)
Has thanked: 0
Been thanked: 0
Contact:

Re: access rpmb partition

Unread post by yfpb » Sat Jun 15, 2019 2:20 am

Ok, got it to work.

elatllat
Posts: 1354
Joined: Tue Sep 01, 2015 8:54 am
languages_spoken: english
ODROIDs: XU4, N1, N2
Has thanked: 5 times
Been thanked: 18 times
Contact:

Re: access rpmb partition

Unread post by elatllat » Sun Jun 16, 2019 8:23 pm

In the past I have used

echo 0 > /sys/block/mmcblk0boot0/force_ro
cat /dev/mmcblk0boot0 > rpmb_p0.img
cat /dev/zero > /dev/mmcblk0boot0

I'll have to see what mmc can do.

Post Reply

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 2 guests