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

Subversion Repositories csa

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

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

Rev 41 Rev 42
Line 382... Line 382...
    N = (188 - offset) / 8;
    N = (188 - offset) / 8;
    residue = (188 - offset) % 8;
    residue = (188 - offset) % 8;
 
 
    /*  1st 8 bytes of initialisation */
    /*  1st 8 bytes of initialisation */
    stream_cypher(1, ck, &encrypted[offset], ib);
    stream_cypher(1, ck, &encrypted[offset], ib);
    DEBUG_OUTPUT_ARR(ib,8);
 
 
 
    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 */
Line 399... Line 400...
        else {
        else {
            /*  last block - sb[N+1] = IV(initialisation vetor)(=0) */
            /*  last block - sb[N+1] = IV(initialisation vetor)(=0) */
            for(i=0; i<8; i++)  ib[i] = 0;
            for(i=0; i<8; i++)  ib[i] = 0;
        }
        }
 
 
 
#if 0
 
              fprintf(stderr,"output \n");
 
           DEBUG_OUTPUT_ARR(ib,8);
 
           DEBUG_OUTPUT_ARR(block,8);
 
           #endif
 
 
        /*  xor ib x block */
        /*  xor ib x block */
        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];
    } /* for(j=1; j<(N+1); j++) */
    } /* for(j=1; j<(N+1); j++) */
 
 

powered by: WebSVN 2.1.0

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