OpenCores
URL https://opencores.org/ocsvn/csa/csa/trunk

Subversion Repositories csa

[/] [csa/] [trunk/] [sw_sim/] [csa.c] - Diff between revs 42 and 43

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 42 Rev 43
Line 385... Line 385...
    /*  1st 8 bytes of initialisation */
    /*  1st 8 bytes of initialisation */
    stream_cypher(1, ck, &encrypted[offset], ib);
    stream_cypher(1, ck, &encrypted[offset], ib);
 
 
    for(j=1; j<(N+1); j++) {
    for(j=1; j<(N+1); j++) {
                block_decypher(kk, ib, block);
                block_decypher(kk, ib, block);
                DEBUG_OUTPUT_ARR(ib,8);
 
                DEBUG_OUTPUT_ARR(block,8);
 
 
 
        if (j != N) {
        if (j != N) {
            stream_cypher(0, ck, NULL, stream);
            stream_cypher(0, ck, NULL, stream);
 
 
            /*  xor sb x stream */
            /*  xor sb x stream */
 
            DEBUG_OUTPUT_ARR(&encrypted[offset+8*j+0],8);
 
            DEBUG_OUTPUT_ARR(stream,8);
            for(i=0; i<8; i++)
            for(i=0; i<8; i++)
                ib[i] = encrypted[offset+8*j+i] ^ stream[i];
                ib[i] = encrypted[offset+8*j+i] ^ stream[i];
        }
        }
        else {
        else {
            /*  last block - sb[N+1] = IV(initialisation vetor)(=0) */
            /*  last block - sb[N+1] = IV(initialisation vetor)(=0) */
Line 407... Line 407...
           DEBUG_OUTPUT_ARR(ib,8);
           DEBUG_OUTPUT_ARR(ib,8);
           DEBUG_OUTPUT_ARR(block,8);
           DEBUG_OUTPUT_ARR(block,8);
           #endif
           #endif
 
 
        /*  xor ib x block */
        /*  xor ib x block */
 
            DEBUG_OUTPUT_ARR(block,8);
        for(i=0; i<8; i++)
        for(i=0; i<8; i++)
                 decrypted[offset+8*(j-1)+i] = ib[i] ^ block[i];
                 decrypted[offset+8*(j-1)+i] = ib[i] ^ block[i];
 
            DEBUG_OUTPUT_ARR(&decrypted[offset+8*(j-1)+0],8);
    } /* for(j=1; j<(N+1); j++) */
    } /* for(j=1; j<(N+1); j++) */
 
 
    if (residue) {
    if (residue) {
       stream_cypher(0, ck, NULL, stream);
       stream_cypher(0, ck, NULL, stream);
       for (i=0;i<residue;i++)
       for (i=0;i<residue;i++)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.