OpenCores
URL https://opencores.org/ocsvn/camellia-vhdl/camellia-vhdl/trunk

Subversion Repositories camellia-vhdl

[/] [camellia-vhdl/] [trunk/] [looping/] [fl.vhd] - Blame information for rev 10

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 pfulgoni
 
2
--------------------------------------------------------------------------------
3
-- Designer:      Paolo Fulgoni <pfulgoni@opencores.org>
4
--
5
-- Create Date:   01/22/2008
6
-- Last Update:   02/21/2008
7
-- Project Name:  camellia-vhdl
8
-- Description:   Asynchronous FL and FL^-1 functions
9
--
10
-- Copyright (C) 2008  Paolo Fulgoni
11
-- This file is part of camellia-vhdl.
12
-- camellia-vhdl is free software; you can redistribute it and/or modify
13
-- it under the terms of the GNU General Public License as published by
14
-- the Free Software Foundation; either version 3 of the License, or
15
-- (at your option) any later version.
16
-- camellia-vhdl is distributed in the hope that it will be useful,
17
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
18
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
-- GNU General Public License for more details.
20
-- You should have received a copy of the GNU General Public License
21
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
--
23
-- The Camellia cipher algorithm is 128 bit cipher developed by NTT and
24
-- Mitsubishi Electric researchers.
25
-- http://info.isl.ntt.co.jp/crypt/eng/camellia/
26
--------------------------------------------------------------------------------
27
library IEEE;
28
use IEEE.std_logic_1164.all;
29
 
30
 
31
entity FL is
32
    port(
33
            fl_in   : in  STD_LOGIC_VECTOR (0 to 63);
34
            fli_in  : in  STD_LOGIC_VECTOR (0 to 63);
35
            fl_k    : in  STD_LOGIC_VECTOR (0 to 63);
36
            fli_k   : in  STD_LOGIC_VECTOR (0 to 63);
37
            fl_out  : out STD_LOGIC_VECTOR (0 to 63);
38
            fli_out : out STD_LOGIC_VECTOR (0 to 63)
39
            );
40
end FL;
41
 
42
architecture RTL of FL is
43
 
44
    signal fl_a1  : STD_LOGIC_VECTOR (0 to 31);
45
    signal fl_a2  : STD_LOGIC_VECTOR (0 to 31);
46
    signal fl_b1  : STD_LOGIC_VECTOR (0 to 31);
47
    signal fl_b2  : STD_LOGIC_VECTOR (0 to 31);
48
    signal fli_a1 : STD_LOGIC_VECTOR (0 to 31);
49
    signal fli_a2 : STD_LOGIC_VECTOR (0 to 31);
50
    signal fli_b1 : STD_LOGIC_VECTOR (0 to 31);
51
    signal fli_b2 : STD_LOGIC_VECTOR (0 to 31);
52
 
53
    begin
54
 
55
    --FL function
56
    fl_a1 <= fl_in(0 to 31) and fl_k(0 to 31);
57
    fl_a2 <= (fl_a1(1 to 31) & fl_a1(0)) xor fl_in(32 to 63);
58
 
59
    fl_b1 <= fl_a2 or fl_k(32 to 63);
60
    fl_b2 <= fl_in(0 to 31) xor fl_b1;
61
 
62
    fl_out <= fl_b2 & fl_a2;
63
 
64
    --FL^-1 function
65
    fli_a1 <= fli_in(32 to 63) or fli_k(32 to 63);
66
    fli_a2 <= fli_in(0 to 31) xor fli_a1;
67
 
68
    fli_b1 <= fli_a2 and fli_k(0 to 31);
69
    fli_b2 <= (fli_b1(1 to 31) & fli_b1(0)) xor fli_in(32 to 63);
70
 
71
    fli_out <= fli_a2 & fli_b2;
72
 
73
end RTL;

powered by: WebSVN 2.1.0

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