71 lines
1.8 KiB
ReStructuredText
71 lines
1.8 KiB
ReStructuredText
|
===================
|
||
|
MIB3 Key derivation
|
||
|
===================
|
||
|
This section is dedicated to the key derivation process on the MIB3 High (VAG) head unit.
|
||
|
|
||
|
As per this:
|
||
|
|
||
|
.. code-block:: c
|
||
|
|
||
|
void fscryptUnlock(char *path)
|
||
|
|
||
|
{
|
||
|
int iVar1;
|
||
|
1.
|
||
|
local_8 = ___stack_chk_guard;
|
||
|
fprintf(_stdout,"Call to fscryptUnlock with Path %s\n",path,&stdout,0);
|
||
|
iVar1 = waitfor_timeout("/dev/mobicore-userif",0xffffffffffffffff,0xffffffffffffffff,1);
|
||
|
if (iVar1 == 0) {
|
||
|
iVar1 = get_key_desc?(path,&local_60);
|
||
|
if (iVar1 == 0) {
|
||
|
iVar2 = KeyStoreOpen();
|
||
|
if (iVar2 == 0) {
|
||
|
iVar2 = KeyStoreGet(&local_60,0x10,&local_48,0x40);
|
||
|
if (iVar2 == 0) {
|
||
|
KeyStoreClose();
|
||
|
iVar2 = fscryptKeyAdd(&local_48,&local_60);
|
||
|
if (iVar2 < 0) {
|
||
|
iVar1 = -5;
|
||
|
fscryptKeyWipe(&local_48,0x40);
|
||
|
}
|
||
|
else {
|
||
|
fscryptKeyWipe(&local_48,0x40);
|
||
|
}
|
||
|
}
|
||
|
else {
|
||
|
KeyStoreClose();
|
||
|
iVar1 = -3;
|
||
|
}
|
||
|
}
|
||
|
else {
|
||
|
iVar1 = -3;
|
||
|
perror("Failed to connect to TEE");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
else {
|
||
|
iVar1 = -3;
|
||
|
fwrite("Failed to wait for kinibi interface\n",1,0x24,_stderr);
|
||
|
}
|
||
|
if (local_8 == ___stack_chk_guard) {
|
||
|
return;
|
||
|
}
|
||
|
/* WARNING: Subroutine does not return */
|
||
|
__stack_chk_fail(iVar1);
|
||
|
}
|
||
|
|
||
|
Or in a diagram:
|
||
|
|
||
|
.. figure:: images/fscrypt.drawio.svg
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
.. code-block:: c
|
||
|
|
||
|
void KeyStoreGet(void *key_id,uint id_len,void *key_buffer,uint key_len)
|
||
|
|
||
|
|
||
|
TODO:
|
||
|
|
||
|
* What is located at ``/dev/mobicore-userif`` in domu1?
|