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

Subversion Repositories csa

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 42 to Rev 43
    Reverse comparison

Rev 42 → Rev 43

/csa/trunk/rtl/group_decrypt.v
12,27 → 12,35
, input [ 8*8-1:0] group
, input [ 4-1:0] bytes
 
, output reg valid
, output reg [ 8*8-1:0] ogroup
, output reg [ 4-1:0] obytes
, output valid
, output [ 8*8-1:0] ogroup
, output [ 4-1:0] obytes
);
 
reg init_d;
wire [8*8-1:0] sc_cb;
wire [8*8-1:0] stream;
reg [8*8-1:0] stream_d;
wire [8*8-1:0] ib;
reg [8*8-1:0] sc_cb_d;
reg [8*8-1:0] bco_d;
wire [8*8-1:0] bco;
reg en_d;
 
 
always @(posedge clk)
begin
en_d<=en;
init_d<=init;
if(en)
begin
sc_cb_d<=sc_cb;
stream_d<=stream;
end
if(en_d)
bco_d<=bco;
 
end
end
 
assign ib=(init_d)?group:group^stream;
 
stream_cypher stream_cypher(
.clk (clk)
41,10 → 49,9
, .init (init)
, .ck (ck)
, .sb (group)
, .cb (sc_cb)
, .cb (stream)
);
 
assign ib=init?sc_cb_d:group^sc_cb;
block_decypher block_decypher(
.kk (kk)
, .ib (ib)
51,5 → 58,10
, .bd (bco)
);
 
assign ogroup=group^bco_d^stream;
 
assign valid=en_d & ~init_d;
assign obytes=4'h8;
 
endmodule
/csa/trunk/sw_sim/csa.c
387,13 → 387,13
 
for(j=1; j<(N+1); j++) {
block_decypher(kk, ib, block);
DEBUG_OUTPUT_ARR(ib,8);
DEBUG_OUTPUT_ARR(block,8);
 
if (j != N) {
stream_cypher(0, ck, NULL, 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++)
ib[i] = encrypted[offset+8*j+i] ^ stream[i];
}
409,8 → 409,10
#endif
 
/* xor ib x block */
DEBUG_OUTPUT_ARR(block,8);
for(i=0; i<8; 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++) */
 
if (residue) {

powered by: WebSVN 2.1.0

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