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

Subversion Repositories present

[/] [present/] [trunk/] [DecodeTesting/] [rtl/] [vhdl/] [keyupd_inv.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 gajos
-----------------------------------------------------------------------
2
----                                                               ----
3
---- Present - a lightweight block cipher project                  ----
4
----                                                               ----
5
---- This file is part of the Present - a lightweight block        ----
6
---- cipher project                                                ----
7
---- http://www.http://opencores.org/project,present               ----
8
----                                                               ----
9
---- Description:                                                  ----
10
----     Inverse Key update module for present cipher decoding     ----
11
---- it is 'signal mixing' made by rotation right by 61 bits,      ---- 
12
---- using one s-box, and output of the counter. Note, that order  ----
13
---- of this operatins must be inverse in comparison with key_upd. ----
14
---- For more information see                                      ----
15
---- http://homes.esat.kuleuven.be/~abogdano/papers/               ----
16
---- present_ches07.pdf                                            ----
17
---- To Do:                                                        ----
18
----                                                               ----
19
---- Author(s):                                                    ----
20
---- - Krzysztof Gajewski, gajos@opencores.org                     ----
21
----                       k.gajewski@gmail.com                    ----
22
----                                                               ----
23
-----------------------------------------------------------------------
24
----                                                               ----
25
---- Copyright (C) 2013 Authors and OPENCORES.ORG                  ----
26
----                                                               ----
27
---- This source file may be used and distributed without          ----
28
---- restriction provided that this copyright statement is not     ----
29
---- removed from the file and that any derivative work contains   ----
30
---- the original copyright notice and the associated disclaimer.  ----
31
----                                                               ----
32
---- This source file is free software; you can redistribute it    ----
33
---- and-or modify it under the terms of the GNU Lesser General    ----
34
---- Public License as published by the Free Software Foundation;  ----
35
---- either version 2.1 of the License, or (at your option) any    ----
36
---- later version.                                                ----
37
----                                                               ----
38
---- This source is distributed in the hope that it will be        ----
39
---- useful, but WITHOUT ANY WARRANTY; without even the implied    ----
40
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR       ----
41
---- PURPOSE. See the GNU Lesser General Public License for more   ----
42
---- details.                                                      ----
43
----                                                               ----
44
---- You should have received a copy of the GNU Lesser General     ----
45
---- Public License along with this source; if not, download it    ----
46
---- from http://www.opencores.org/lgpl.shtml                      ----
47
----                                                               ----
48
-----------------------------------------------------------------------
49 3 gajos
library IEEE;
50
use IEEE.STD_LOGIC_1164.ALL;
51
use IEEE.STD_LOGIC_ARITH.ALL;
52
use IEEE.STD_LOGIC_UNSIGNED.ALL;
53
 
54
entity keyupd_inv is
55
        generic(
56
                w_80: integer := 80;
57
                w_5 : integer := 5;
58
                w_4 : integer := 4);
59
        port(
60
                key : in std_logic_vector(w_80-1 downto 0);
61
                num : in std_logic_vector(w_5-1 downto 0);
62
                keyout : out std_logic_vector(w_80-1 downto 0)
63
        );
64
end keyupd_inv;
65
 
66
architecture Behavioral of keyupd_inv is
67
 
68
        component slayer_inv is
69
                generic(w_4: integer := 4);
70
                port(
71
                        input : in std_logic_vector(w_4-1 downto 0);
72
                        output : out std_logic_vector(w_4-1 downto 0)
73
                );
74
        end component;
75
 
76
        signal changed : std_logic_vector(w_4-1 downto 0);
77
        signal changin : std_logic_vector(w_4-1 downto 0);
78
        signal keytemp : std_logic_vector(w_80-1 downto 0);
79
 
80
        begin
81
                s1: slayer_inv port map(input => changin, output => changed);
82
                changin <= key(79 downto 76);
83
                keytemp(79 downto 76)<= changed;
84
                keytemp(75 downto 20) <= key(75 downto 20);
85
                keytemp(19 downto 15)<= key(19 downto 15) xor num;
86
                keytemp(14 downto 0) <= key(14 downto 0);
87
                keyout <= keytemp(60 downto 0) & keytemp(79 downto 61);
88
        end Behavioral;

powered by: WebSVN 2.1.0

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