Moderator: pcwzrd13
Code: Select all
if (sslObj->randomBytesFromServer[4FC + -0x4c] == 3) {
step = sslObj->state;
if (step == 1) {
step = SSL_sendClientHello(sslObj);
if (step != 0) {
return step;
}
sslObj->state = 2;
goto LAB_8c14ec60;
}
if (step == 2) {
step = SSL_readServerHello(sslObj);
if (step == 0) {
step = 3;
goto LAB_8c14ed92;
}
if (step != -8) {
return step;
}
sslObj->randomBytesFromServer[4FC + -0x4c] = 2;
goto LAB_8c14ec60;
}
if (step == 3) {
step = SSL_readCertificate(sslObj);
if (step != 0) {
return step;
}
step = 4;
}
else if (step == 6) {
step = SSL_readServerKeyExchange(sslObj);
if (step != 0) {
return step;
}
step = 5;
}
else if ((step == 4) || (step == 5)) {
step = SSL_readServerHelloDone(sslObj);
if (step == 0) {
step = 7;
}
else {
if (step != -0x32) {
return step;
}
step = 6;
}
}
else if (step == 7) {
step = SSL_sendClientCipherKeyExchange(sslObj);
if (step != 0) {
return step;
}
step = 8;
}
else {
if (step != 8) {
if (step == 9) {
step = SSL_readServerFinished(sslObj);
if (step != 0) {
return step;
}
goto LAB_8c14eda6;
}
goto joined_r0x8c14ec98;
}
step = SSL_sendClientFinished(sslObj);
if (step != 0) {
return step;
}
step = 9;
}
}
Code: Select all
void rsaModExpAlg(big_num_t *dataOut,big_num_t *dataIn,big_num_t *exponent,big_num_t *modulus)
{
int isExpNot0;
uint nextByte;
int i;
int j;
uint 80000000h;
int e_size;
uint *e_buffPos;
undefined4 bigNum1;
undefined auStack44 [4];
undefined4 bigNum2;
undefined4 local_24;
undefined *bigNumMod;
undefined *bigNumMulti;
isExpNot0 = (*(code *)PTR_checkIfEValid_8c166094)(exponent);
if (isExpNot0 == 0) {
(*(code *)PTR_setBigNum_8c166098)(dataOut,1);
}
else {
(*(code *)PTR_initBigNum_8c16609c)(&bigNum2);
(*(code *)PTR_initBigNum_8c16609c)(&bigNum1);
e_size = exponent->size;
e_buffPos = exponent->value + e_size;
(*(code *)PTR_setBigNum_8c166098)(&bigNum2,1);
bigNumMod = PTR_modBigNum_8c1660a4;
bigNumMulti = PTR_multiBigNum_8c1660a0;
while (e_buffPos = e_buffPos + -1, i = e_size + -1, e_size != 0) {
j = 0x20;
nextByte = *e_buffPos;
80000000h = DAT_8c1660a8;
do {
(*(code *)bigNumMulti)(bigNum1,auStack44,bigNum2,local_24,bigNum2,local_24);
(*(code *)bigNumMod)(&bigNum2,&bigNum1,modulus);
if ((nextByte & 80000000h) != 0) {
(*(code *)bigNumMulti)(bigNum1,auStack44,bigNum2,local_24,dataIn->value,dataIn->size);
(*(code *)bigNumMod)(&bigNum2,&bigNum1,modulus);
}
80000000h = 80000000h >> 1;
j = j + -1;
e_size = i;
} while (j != 0);
}
(*(code *)PTR_copyBigNum_8c1660ac)(dataOut,&bigNum2);
(*(code *)PTR_releaseBigNum_8c1660b0)(&bigNum2);
(*(code *)PTR_releaseBigNum_8c1660b0)(&bigNum1);
}
return;
}
Code: Select all
// The Modular Exponentiation Algorithm
int MEA(int p, int e, int n){
int r2 = 1;
int r1 = 0;
int Q = 0;
int R = 0;
while( e != 0 ){
R = (e % 2);
Q = ((e - R) / 2);
r1 = ((p * p) % n);
if(R == 1){
r2 = ((r2 * p) % n);
}
p = r1;
e = Q;
}
return r2;
}
Users browsing this forum: No registered users