others/fw-verif/8051secureboot/fw/rsa.c
// remove OAEP from message at location rsa_regs.opaddr
remove OAEP from message at location rsa_regs.opaddr
remove OAEP from message at location rsa_regs . opaddr
void removeOAEP()
{
    assume (gprg == (unsigned char*)0xF8E0);
    unsigned int i,j;
    HMAC(Hseed, H, decrypted->m, N-K2-1);
    unlock(page, rsa_regs.opaddr, rsa_regs.opaddr + N);
    for(i=0; i< K2; i++)
        writec(page, decrypted->r+i,decrypted->r[i] ^ sha_regs.wr_addr[i], 1);
    lock(page, rsa_regs.opaddr, rsa_regs.opaddr+N);
    PRGinit(decrypted->r, K2, gprg);
    PRG(gprg);
    unlock(page, rsa_regs.opaddr, rsa_regs.opaddr + N);
    i=0; j=0;
    while(i < N-K2-1)
    {
        if(j == H)
        {
            lock(page, rsa_regs.opaddr, rsa_regs.opaddr+N);
            PRG(gprg);
            j = 0;
            unlock(page, rsa_regs.opaddr, rsa_regs.opaddr + N);
        }
        writec(page, decrypted->m+i, decrypted->m[i] ^ sha_regs.wr_addr[j], 1);
        i++;
        j++;
    }
    lock(page, rsa_regs.opaddr, rsa_regs.opaddr+N);
}
void removeOAEP ( ) { assume ( gprg == ( unsigned char * ) 0xF8E0 ) ; unsigned int i , j ; HMAC ( Hseed , H , decrypted -> m , N - K2 - 1 ) ; unlock ( page , rsa_regs . opaddr , rsa_regs . opaddr + N ) ; for ( i = 0 ; i < K2 ; i ++ ) writec ( page , decrypted -> r + i , decrypted -> r [ i ] ^ sha_regs . wr_addr [ i ] , 1 ) ; lock ( page , rsa_regs . opaddr , rsa_regs . opaddr + N ) ; PRGinit ( decrypted -> r , K2 , gprg ) ; PRG ( gprg ) ; unlock ( page , rsa_regs . opaddr , rsa_regs . opaddr + N ) ; i = 0 ; j = 0 ; while ( i < N - K2 - 1 ) { if ( j == H ) { lock ( page , rsa_regs . opaddr , rsa_regs . opaddr + N ) ; PRG ( gprg ) ; j = 0 ; unlock ( page , rsa_regs . opaddr , rsa_regs . opaddr + N ) ; } writec ( page , decrypted -> m + i , decrypted -> m [ i ] ^ sha_regs . wr_addr [ j ] , 1 ) ; i ++ ; j ++ ; } lock ( page , rsa_regs . opaddr , rsa_regs . opaddr + N ) ; }
remove OAEP from message at location rsa_regs.opaddr
remove OAEP from message at location rsa_regs . opaddr
// FIXME // compute r // copy r to message // find m