[Sony Cross-Device General] munjeni:
I'm still searching how to go trought sake authentification, curently i see a lot of functions which points to the sake auth function but still unable to get how it working or how we can go trought it. There is a lot of keys in array, pickup tables and many more, public keys... etc

Edit:

Can't figure out how this working

__int64 __fastcall sub_2AEDC(_QWORD *a1)
{
void **v1; // x23@1
_BYTE *v2; // x24@1
__int64 v3; // x27@1
void **v4; // x19@1
char v5; // w22@2
unsigned int v6; // w28@2
_BYTE *v7; // x0@3
__int64 v8; // x3@3
__int64 v9; // x4@3
__int64 v10; // x5@3
__int64 v11; // x6@3
__int64 v12; // x7@3
_BYTE *v13; // x25@4
__int64 v14; // x21@5
__int64 v15; // x0@5
char *v16; // x21@5
signed int v17; // w26@9
unsigned __int64 *v18; // x23@10
__int64 v19; // x0@11
__int64 v20; // x26@11
__int64 v21; // x0@12
__int64 v22; // x22@12
signed __int64 v23; // x26@14
void *v24; // x0@16
_BYTE *v25; // x0@18
__int64 v26; // x3@18
__int64 v27; // x4@18
__int64 v28; // x5@18
__int64 v29; // x6@18
__int64 v30; // x7@18
void *v31; // x22@18
void *v32; // x0@19
_BYTE *v33; // x0@21
__int64 v34; // x3@21
__int64 v35; // x4@21
__int64 v36; // x5@21
__int64 v37; // x7@21
_BYTE *v38; // x0@22
__int64 v39; // x4@22
__int64 v40; // x5@22
__int64 v41; // x6@22
_BYTE *v42; // x0@24
__int64 v43; // x3@24
__int64 v44; // x4@24
__int64 v45; // x5@24
__int64 v46; // x6@24
__int64 v47; // x7@24
_BYTE *v48; // x0@25
__int64 v49; // x3@25
__int64 v50; // x4@25
__int64 v51; // x5@25
__int64 v52; // x6@25
__int64 v53; // x7@25
__int64 v54; // x24@26
__int64 v55; // x3@27
__int64 v56; // x4@27
__int64 v57; // x5@27
__int64 v58; // x6@27
__int64 v59; // x7@27
_BYTE *v60; // x0@30
__int64 v61; // x3@30
__int64 v62; // x4@30
__int64 v63; // x5@30
__int64 v64; // x6@30
__int64 v65; // x7@30
_BYTE *v66; // x0@31
__int64 v67; // x3@31
__int64 v68; // x4@31
__int64 v69; // x5@31
__int64 v70; // x6@31
__int64 v71; // x7@31
_BYTE *v72; // x0@35
__int64 v73; // x3@35
__int64 v74; // x4@35
__int64 v75; // x5@35
__int64 v76; // x6@35
__int64 v77; // x7@35
_BYTE *v78; // x0@39
__int64 v79; // x3@39
__int64 v80; // x4@39
__int64 v81; // x5@39
__int64 v82; // x6@39
__int64 v83; // x7@39
const void *v84; // x26@41
unsigned __int64 v85; // x25@41
const void *v86; // x21@41
char *v87; // x21@43
unsigned __int64 v88; // x0@43
__int64 v89; // x22@43
size_t v90; // x26@43
const void *v91; // x25@43
char *v92; // x27@45
unsigned __int64 v93; // x0@45
__int64 v94; // x22@45
size_t v95; // x25@45
const void *v96; // x21@45
unsigned __int8 *v97; // x9@47
int v98; // w10@47
char v99; // w22@49
unsigned __int8 *v100; // x8@50
int v101; // w9@50
_DWORD *v102; // x0@55
_DWORD *v103; // x21@55
__int64 v104; // x0@55
_BOOL4 v105; // w17@57
_BOOL4 v106; // w18@57
unsigned int v107; // w8@58
_DWORD *v108; // x0@67
_DWORD *v109; // x25@67
__int64 v110; // x0@67
_BOOL4 v111; // w18@69
char *v112; // x25@84
unsigned __int64 v113; // x27@84
const void *v114; // x21@84
char *v115; // x21@86
unsigned __int64 v116; // x23@86
const void *v117; // x25@86
void **v118; // x28@86
char *v119; // x27@88
unsigned __int64 v120; // x22@88
const void *v121; // x21@88
char *v122; // x23@90
unsigned __int64 v123; // x21@90
const void *v124; // x25@90
char *v125; // x22@92
unsigned __int64 v126; // x25@92
const void *v127; // x21@92
__int64 v128; // x0@97
__int64 v129; // x1@97
void **i; // x27@102
const char *v131; // x24@105
void **v132; // x25@105
__int64 v133; // x0@105
__int64 v134; // x22@105
unsigned __int64 v135; // x23@105
__int64 v136; // x0@105
__int64 v137; // x6@106
char *v138; // x23@109
unsigned __int64 v139; // x26@109
const void *v140; // x22@109
char *v141; // x22@111
unsigned __int64 v142; // x23@111
const void *v143; // x26@111
_BYTE *v144; // x0@118
__int64 v145; // x3@118
__int64 v146; // x4@118
__int64 v147; // x5@118
__int64 v148; // x6@118
__int64 v149; // x7@118
_BYTE *v150; // x0@118
__int64 v151; // x4@118
__int64 v152; // x5@118
__int64 v153; // x6@118
__int64 v154; // x7@118
__int64 v155; // ST00_8@118
__int64 v156; // x12@118
_BYTE *v157; // x0@121
__int64 v158; // x4@121
__int64 v159; // x5@121
__int64 v160; // x6@121
__int64 v161; // x7@121
__int64 v162; // x27@125
_BYTE *v163; // x0@127
__int64 v164; // x3@127
__int64 v165; // x4@127
__int64 v166; // x6@127
__int64 v167; // x7@127
_BYTE *v168; // x0@128
__int64 v169; // x3@128
__int64 v170; // x4@128
__int64 v171; // x5@128
__int64 v172; // x6@128
__int64 v173; // x7@128
_BYTE *v174; // x3@129
_BYTE *v175; // x4@129
__int64 v176; // x5@129
__int64 v177; // x6@129
__int64 v178; // x7@129
const char *v179; // x0@129
__int64 v180; // x2@129
__int64 v181; // x1@129
__int64 v182; // x19@132
__int64 v184; // [xsp+0h] [xbp-D0h]@0
__int64 v185; // [xsp+30h] [xbp-A0h]@17
__int64 v186; // [xsp+38h] [xbp-98h]@13
_BYTE *v187; // [xsp+40h] [xbp-90h]@7
_QWORD *v188; // [xsp+48h] [xbp-88h]@1
unsigned int v189; // [xsp+54h] [xbp-7Ch]@29
__int64 **v190; // [xsp+58h] [xbp-78h]@29
__int64 *v191; // [xsp+60h] [xbp-70h]@10
__int64 v192; // [xsp+78h] [xbp-58h]@1

v1 = &off_139110;
v2 = a1;
v3 = _stack_chk_guard;
v192 = _stack_chk_guard;
v4 = (void **)off_139118[0];
v188 = a1;
if ( off_139118[0] == &off_139110 )
{
v7 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/protocol/fastboot.c");
sub_4D838("[ERROR @ %s:%d]:\nFastboot command list is empty\n", (__int64)v7, 2247LL, v8, v9, v10, v11, v12, v184);
v6 = -22;
goto LABEL_134;
}
v5 = 0;
v6 = 0;
do
{
v84 = *(v4 - 3);
v85 = __strlen_chk();
v86 = (const void *)(*(_QWORD *)v2 + 8LL);
if ( v85 <= __strlen_chk() && !memcmp(v86, v84, v85) )
{
v87 = off_139028[0];
v88 = __strlen_chk();
v89 = *(_QWORD *)v2;
v90 = v88;
v91 = (const void *)(*(_QWORD *)v2 + 8LL);
if ( v88 > __strlen_chk() || memcmp(v91, v87, v90) )
{
v92 = off_139038[0];
v93 = __strlen_chk();
v94 = *(_QWORD *)v2;
v95 = v93;
v96 = (const void *)(*(_QWORD *)v2 + 8LL);
if ( v93 > __strlen_chk() || memcmp(v96, v92, v95) )
goto LABEL_82;
v97 = (unsigned __int8 *)(v94 + v95 + 8);
v98 = *v97;
if ( v98 == 49 )
{
v99 = 1;
}
else
{
if ( v98 != 50 )
{
v99 = 0;
goto LABEL_77;
}
v99 = 2;
}
if ( v97[1] == 58 )
{
__strlcpy_chk();
v108 = (_DWORD *)__errno();
v109 = v108;
*v108 = 0;
v110 = strtol((const char *)&v191, (char **)&v190, 10);
if ( *v109 != 34 || (unsigned __int64)(v110 - 0x7FFFFFFFFFFFFFFFLL) >= 2 )
{
v111 = v110 == 0 && *v109 != 0 || v190 == &v191;
if ( v111 )
v107 = 0;
else
v107 = v110;
if ( v111 )
v6 = -22;
else
v6 = 0;
goto LABEL_78;
}
}
LABEL_77:
v107 = 0;
v6 = -22;
LABEL_78:
if ( v6 )
{
v168 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/protocol/fastboot.c");
sub_4D838(
"[ERROR @ %s:%d]:\nFail to extract partition and/or unit",
(__int64)v168,
378LL,
v169,
v170,
v171,
v172,
v173,
v184);
goto LABEL_132;
}
if ( v99 == 2 && v107 >= 0x10000 && v2[16] != 1 )
{
LABEL_118:
v144 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/protocol/fastboot.c");
sub_4D838(
"[ERROR @ %s:%d]:\nAuthentication required ",
(__int64)v144,
2278LL,
v145,
v146,
v147,
v148,
v149,
v184);
v150 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/protocol/fastboot.c");
sub_4D838(
"[ERROR @ %s:%d]:\ncommand %s\n",
(__int64)v150,
2279LL,
*(_QWORD *)v2 + 8LL,
v151,
v152,
v153,
v154,
v155);
v156 = *(_QWORD *)v2;
__snprintf_chk();
v5 = 1;
v6 = -1027;
goto LABEL_119;
}
LABEL_82:
if ( !*((_BYTE *)v4 - 8) || *((unsigned __int8 *)v4 - 8) == (unsigned __int8)v2[16] )
{
LABEL_123:
v6 = ((__int64 (__fastcall *)(_BYTE *))*(v4 - 2))(v2);
v3 = _stack_chk_guard;
goto LABEL_134;
}
v112 = off_139060[0];
v113 = __strlen_chk();
v114 = (const void *)(*(_QWORD *)v2 + 8LL);
if ( v113 <= __strlen_chk() && !memcmp(v114, v112, v113) )
{
v16 = sub_2A71C((__int64)v112, (__int64)v114);
v118 = &off_139130;
}
else
{
v115 = off_139018[0];
v116 = __strlen_chk();
v117 = (const void *)(*(_QWORD *)v2 + 8LL);
v118 = &off_139130;
if ( v116 <= __strlen_chk() && !memcmp(v117, v115, v116) )
{
v128 = (__int64)v115;
v129 = (__int64)v117;
}
else
{
v119 = off_139068[0];
v120 = __strlen_chk();
v121 = (const void *)(*(_QWORD *)v2 + 8LL);
if ( v120 > __strlen_chk() || memcmp(v121, v119, v120) )
{
v122 = off_139098[0];
v123 = __strlen_chk();
v124 = (const void *)(*(_QWORD *)v2 + 8LL);
if ( v123 > __strlen_chk() || memcmp(v124, v122, v123) )
{
v125 = off_139108[0];
v126 = __strlen_chk();
v127 = (const void *)(*(_QWORD *)v2 + 8LL);
if ( v126 <= __strlen_chk() )
{
v1 = &off_139110;
if ( !memcmp(v127, v125, v126) )
goto LABEL_123;
v17 = 0;
v16 = 0LL;
v31 = 0LL;
v6 = 0;
}
else
{
v17 = 0;
v16 = 0LL;
v31 = 0LL;
v6 = 0;
v1 = &off_139110;
}
goto LABEL_116;
}
v13 = sub_2A71C((__int64)v122, (__int64)v124);
if ( v13 )
{
v14 = __strlen_chk();
v15 = __strlen_chk();
v16 = (char *)malloc(v14 + v15 + 2);
if ( v16 )
{
__strlen_chk();
__strlen_chk();
__strlcpy_chk();
if ( __strlen_chk() )
{
__strlen_chk();
__strlcat_chk();
__strlen_chk();
__strlen_chk();
v187 = v13;
__strlcat_chk();
}
else
{
v187 = v13;
}
goto LABEL_102;
}
v175 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/protocol/fastboot.c");
v179 = "[ERROR @ %s:%d]:\nOut of memory\n";
v180 = 420LL;
v181 = (__int64)v175;
}
else
{
v174 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/protocol/fastboot.c");
v179 = "[ERROR @ %s:%d]:\nOut of memory\n";
v180 = 414LL;
v181 = (__int64)v174;
}
sub_4D838(v179, v181, v180, (__int64)v174, (__int64)v175, v176, v177, v178, v184);
v6 = -12;
goto LABEL_132;
}
v128 = (__int64)v119;
v129 = (__int64)v121;
}
v16 = sub_2A71C(v128, v129);
}
if ( v16 )
{
v187 = 0LL;
LABEL_102:
for ( i = (void **)v118[1]; ; i = (void **)i[1] )
{
if ( i == v118 )
{
v17 = 0;
v6 = 0;
goto LABEL_114;
}
v132 = i - 2;
v131 = (const char *)*(i - 2);
v133 = __strlen_chk();
v134 = v133;
v135 = v133 + 1;
v136 = __strlen_chk();
v137 = v135 >= v136 + 1 ? v136 : v134;
if ( !strncmp(v131, v16, v137 + 1) )
break;
}
v138 = off_139018[0];
v139 = __strlen_chk();
v140 = (const void *)(*v188 + 8LL);
if ( v139 > __strlen_chk() || memcmp(v140, v138, v139) )
{
v141 = off_139098[0];
v2 = v188;
v142 = __strlen_chk();
v143 = (const void *)(*v188 + 8LL);
if ( v142 > __strlen_chk() )
{
v6 = 0;
v17 = 1;
LABEL_115:
v31 = v187;
v1 = &off_139110;
goto LABEL_116;
}
if ( memcmp(v143, v141, v142) )
{
v6 = 0;
v17 = 1;
LABEL_114:
v2 = v188;
goto LABEL_115;
}
}
v18 = (unsigned __int64 *)*(i - 1);
v191 = 0LL;
if ( v18 )
{
v19 = sub_32998((__int64)"heap", (__int64)"flash.bin");
v2 = v188;
v20 = v19;
if ( v19 )
{
v21 = sub_29EC0(v19);
v22 = v21;
if ( v21 & 0x8000000000000000LL )
{
v42 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/protocol/fastboot.c");
sub_4D838("[ERROR @ %s:%d]:\nIO Error\n", (__int64)v42, 220LL, v43, v44, v45, v46, v47, v184);
v31 = v187;
v32 = 0LL;
v6 = -5;
}
else
{
v186 = v20;
if ( v21 >= 104857600 )
v23 = 104857600LL;
else
v23 = v21;
v24 = malloc(v23);
if ( v24 )
{
v185 = (__int64)v24;
v6 = sub_45868(&v191);
if ( v6 )
{
v25 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/protocol/fastboot.c");
sub_4D838(
"[ERROR @ %s:%d]:\nFail to init download hash\n",
(__int64)v25,
237LL,
v26,
v27,
v28,
v29,
v30,
v184);
v31 = v187;
}
else
{
do
{
v54 = sub_32ADC(v186);
if ( v54 & 0x8000000000000000LL )
{
v66 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/protocol/fastboot.c");
sub_4D838("[ERROR @ %s:%d]:\nRead fail\n", (__int64)v66, 244LL, v67, v68, v69, v70, v71, v184);
v2 = v188;
v32 = (void *)v185;
v6 = -5;
goto LABEL_32;
}
v6 = sub_45A04((__int64)v191, v185, v23);
if ( v6 )
{
v78 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/protocol/fastboot.c");
sub_4D838(
"[ERROR @ %s:%d]:\nFail to calculate download hash\n",
(__int64)v78,
252LL,
v79,
v80,
v81,
v82,
v83,
v184);
v31 = v187;
v2 = v188;
v32 = (void *)v185;
v20 = v186;
goto LABEL_33;
}
v22 -= v54;
}
while ( v22 );
v31 = v187;
v2 = v188;
v6 = sub_45A9C((__int64)v191, (__int64 *)&v190, &v189, v55, v56, v57, v58, v59);
if ( v6 )
{
v60 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/protocol/fastboot.c");
sub_4D838(
"[ERROR @ %s:%d]:\nFail to finalize download hash\n",
(__int64)v60,
262LL,
v61,
v62,
v63,
v64,
v65,
v184);
}
else
{
v6 = sub_4D488(v18, v190, v189);
}
}
v32 = (void *)v185;
v20 = v186;
}
else
{
v48 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/protocol/fastboot.c");
sub_4D838("[ERROR @ %s:%d]:\nOut of memory\n", (__int64)v48, 229LL, v49, v50, v51, v52, v53, v184);
v32 = 0LL;
v6 = -12;
LABEL_32:
v20 = v186;
v31 = v187;
}
}
LABEL_33:
free(v32);
sub_459C4(v191);
sub_32A44(v20);
v1 = &off_139110;
goto LABEL_34;
}
v38 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/protocol/fastboot.c");
sub_4D838(
"[ERROR @ %s:%d]:\nunable to open ramdisk file %s\n",
(__int64)v38,
214LL,
(__int64)"flash.bin",
v39,
v40,
v41,
(__int64)v38,
v184);
v6 = -22;
}
else
{
v33 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/protocol/fastboot.c");
sub_4D838(
"[ERROR @ %s:%d]:\nInvalid parameter\n",
(__int64)v33,
206LL,
v34,
v35,
v36,
(__int64)v33,
v37,
v184);
v2 = v188;
v6 = -22;
}
v31 = v187;
v1 = &off_139110;
LABEL_34:
if ( v6 )
{
*((_QWORD *)*i + 1) = i[1];
*(_QWORD *)i[1] = *i;
free(*(i - 2));
j__free(*(i - 1));
free(v132);
v72 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/protocol/fastboot.c");
sub_4D838("[ERROR @ %s:%d]:\nFail to verify download\n", (__int64)v72, 472LL, v73, v74, v75, v76, v77, v184);
v17 = 0;
}
else
{
if ( !(sub_4D464(*(i - 1)) & 1) )
{
*((_QWORD *)*i + 1) = i[1];
*(_QWORD *)i[1] = *i;
free(*(i - 2));
j__free(*(i - 1));
free(v132);
}
v31 = v187;
v6 = 0;
v17 = 1;
}
LABEL_116:
free(v31);
free(v16);
if ( !v6 )
{
if ( v17 )
goto LABEL_123;
goto LABEL_118;
}
v162 = *(_QWORD *)v2;
if ( v6 == -1025 )
{
__snprintf_chk();
v6 = -1025;
v3 = _stack_chk_guard;
goto LABEL_134;
}
LABEL_133:
v3 = _stack_chk_guard;
__snprintf_chk();
goto LABEL_134;
}
v163 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/protocol/fastboot.c");
sub_4D838(
"[ERROR @ %s:%d]:\nInput value fail\n",
(__int64)v163,
447LL,
v164,
v165,
(__int64)v163,
v166,
v167,
v184);
v6 = -22;
LABEL_132:
v182 = *(_QWORD *)v2;
goto LABEL_133;
}
v100 = (unsigned __int8 *)(v89 + v90 + 8);
v101 = *v100;
if ( v101 == 49 )
{
v99 = 1;
}
else
{
if ( v101 != 50 )
{
v99 = 0;
goto LABEL_77;
}
v99 = 2;
}
if ( v100[1] == 58 )
{
__strlcpy_chk();
v102 = (_DWORD *)__errno();
v103 = v102;
*v102 = 0;
v104 = strtol((const char *)&v191, (char **)&v190, 10);
if ( *v103 != 34 || (unsigned __int64)(v104 - 0x7FFFFFFFFFFFFFFFLL) >= 2 )
{
v105 = v104 == 0 && *v103 != 0;
v106 = v190 == &v191;
if ( v105 || v106 )
v107 = 0;
else
v107 = v104;
if ( v105 || v106 )
v6 = -22;
else
v6 = 0;
goto LABEL_78;
}
}
goto LABEL_77;
}
LABEL_119:
v4 = (void **)v4[1];
}
while ( v4 != v1 );
v3 = _stack_chk_guard;
if ( !(v5 & 1) )
{
v157 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/protocol/fastboot.c");
sub_4D838(
"[ERROR @ %s:%d]:\nNOT SUP %s\n",
(__int64)v157,
2288LL,
*(_QWORD *)v2 + 8LL,
v158,
v159,
v160,
v161,
v184);
if ( *(_QWORD *)v2 )
{
__snprintf_chk();
v6 = 0;
}
else
{
v6 = -12;
}
}
LABEL_134:
if ( v3 != v192 )
__stack_chk_fail();
return v6;
}

I'm researched this:

v99 == 2 && v107 >= 0x10000 && v2[16] != 1

v99 hrefs me to some functions and v2[16] also to some functions, researching for it it confuse me a lot :( v107 is clear (can't read units > 0x10000 if not authentificated), but the rest uh.

This function doesn't have any hrefs which is indication for (unused? Or probably something external call it?):

__int64 __fastcall sub_277D0(__int64 *a1, void *a2, size_t *a3)
{
__int128 v3; // q0@1
size_t *v4; // x19@1
void *v5; // x20@1
unsigned __int8 ***v6; // x22@1
__int64 v7; // x23@1
unsigned int v8; // w21@2
unsigned __int8 *v9; // x1@4
unsigned int v10; // w0@4
unsigned int v11; // w21@4
_BYTE *v12; // x0@5
__int64 v13; // x4@5
__int64 v14; // x5@5
__int64 v15; // x6@5
__int64 v16; // x7@5
int v17; // w21@7
_BYTE *v18; // x0@8
__int64 v19; // x3@8
__int64 v20; // x4@8
__int64 v21; // x5@8
__int64 v22; // x6@8
__int64 v23; // x7@8
void *v24; // x19@10
__int128 v26; // [xsp+0h] [xbp-B0h]@4
__int128 v27; // [xsp+10h] [xbp-A0h]@4
__int128 v28; // [xsp+20h] [xbp-90h]@4
__int64 v29; // [xsp+30h] [xbp-80h]@4
__int128 v30; // [xsp+38h] [xbp-78h]@1
__int128 v31; // [xsp+48h] [xbp-68h]@1
__int128 v32; // [xsp+58h] [xbp-58h]@1
__int64 v33; // [xsp+68h] [xbp-48h]@1
__int64 v34; // [xsp+70h] [xbp-40h]@1
__int64 v35; // [xsp+78h] [xbp-38h]@1

*(_QWORD *)&v3 = 0LL;
*((_QWORD *)&v3 + 1) = 0LL;
v4 = a3;
v5 = a2;
v6 = (unsigned __int8 ***)a1;
v7 = _stack_chk_guard;
v35 = _stack_chk_guard;
v34 = 0LL;
v33 = 0LL;
v32 = v3;
v31 = v3;
v30 = v3;
if ( a2 )
{
v8 = sub_27988(*a1);
if ( !v8 )
{
v8 = sub_27CC0((__int64)&v34, (signed __int64 (__fastcall **)(__int64 *, int))&v30);
if ( !v8 )
{
v9 = **v6;
v29 = v33;
v27 = v31;
v28 = v32;
v26 = v30;
sub_4B014((_QWORD *)v34, v9, v9 + 4, v9 + 274, (long double *)&v26);
v11 = v10;
if ( v10 )
{
v12 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/authenticate.c");
sub_4D838(
"[ERROR @ %s:%d]:\nFailed to initialize SAKE (%d)\n",
(__int64)v12,
705LL,
v11,
v13,
v14,
v15,
v16,
v26);
v8 = -1007;
}
else
{
v17 = sub_4B714(
*(_QWORD *)v34,
v4,
(const void *)(v34 + 24),
*(_QWORD *)(v34 + 280),
*(unsigned __int8 **)(v34 + 8),
*(unsigned __int8 **)(v34 + 16),
*(char **)(v34 + 288),
*(unsigned __int16 *)(v34 + 296));
sub_4B6CC(*(_QWORD *)v34, v5, *v4);
if ( v17 )
{
v18 = sub_23338("vendor/semc/fs/build/../main/build/linux/../../loader/authenticate.c");
sub_4D838("[ERROR @ %s:%d]:\nFailed to get sake_hello\n", (__int64)v18, 718LL, v19, v20, v21, v22, v23, v26);
v8 = -1007;
}
else
{
memcpy(&unk_13E154, (const void *)(v34 + 24), *(_QWORD *)(v34 + 280));
v8 = 0;
}
}
}
v24 = (void *)v34;
if ( v34 )
{
free(*(void **)(v34 + 16));
free(v24);
}
}
}
else
{
v8 = -22;
}
if ( v7 != v35 )
__stack_chk_fail();
return v8;
}