URL
https://opencores.org/ocsvn/tiny_aes/tiny_aes/trunk
Subversion Repositories tiny_aes
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 1 to Rev 2
- ↔ Reverse comparison
Rev 1 → Rev 2
/tiny_aes/trunk/testbench/test_endian.v
0,0 → 1,32
/* |
* Copyright 2012, Homer Hsing <homer.hsing@gmail.com> |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* you may not use this file except in compliance with the License. |
* You may obtain a copy of the License at |
* |
* http://www.apache.org/licenses/LICENSE-2.0 |
* |
* Unless required by applicable law or agreed to in writing, software |
* distributed under the License is distributed on an "AS IS" BASIS, |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* See the License for the specific language governing permissions and |
* limitations under the License. |
*/ |
|
`timescale 1ns / 1ps |
|
module test_endian; |
|
reg [31:0] i; |
|
initial begin |
i = 32'h12345678; // big endian |
#100; |
$display("%h %h %h %h", i[31:24], i[23:16], i[15:8], i[7:0]); |
// 12 34 56 78 |
$finish; |
end |
|
endmodule |
|
/tiny_aes/trunk/testbench/test_final_round.v
0,0 → 1,70
/* |
* Copyright 2012, Homer Hsing <homer.hsing@gmail.com> |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* you may not use this file except in compliance with the License. |
* You may obtain a copy of the License at |
* |
* http://www.apache.org/licenses/LICENSE-2.0 |
* |
* Unless required by applicable law or agreed to in writing, software |
* distributed under the License is distributed on an "AS IS" BASIS, |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* See the License for the specific language governing permissions and |
* limitations under the License. |
*/ |
|
`timescale 1ns / 1ps |
|
module test_final_round; |
|
// Inputs |
reg clk; |
reg [127:0] state_in; |
reg [127:0] key_in; |
reg [7:0] rcon; |
|
// Outputs |
wire [127:0] state_out; |
wire [31:0] s0, s1, s2, s3; |
|
// Instantiate the Unit Under Test (UUT) |
final_round uut ( |
.clk(clk), |
.state_in(state_in), |
.key_in(key_in), |
.state_out(state_out), |
.rcon(rcon) |
); |
|
assign {s0, s1, s2, s3} = state_out; |
|
initial begin |
clk = 0; |
state_in = 0; |
key_in = 0; |
rcon = 0; |
|
#100; |
@ (negedge clk); |
state_in = {32'heb_40_f2_1e, 32'h59_2e_38_84, 32'h8b_a1_13_e7, 32'h1b_c3_42_d2}; |
key_in = {32'hac_77_66_f3, 32'h19_fa_dc_21, 32'h28_d1_29_41, 32'h57_5c_00_6e}; |
rcon = 8'h36; |
#10; |
state_in = 0; |
key_in = 0; |
rcon = 0; |
#10; |
|
if(s0 != 32'h39_25_84_1d) begin $display("E"); $finish; end |
if(s1 != 32'h02_dc_09_fb) begin $display("E"); $finish; end |
if(s2 != 32'hdc_11_85_97) begin $display("E"); $finish; end |
if(s3 != 32'h19_6a_0b_32) begin $display("E"); $finish; end |
|
$display("Good."); |
$finish; |
end |
|
always #5 clk = ~clk; |
endmodule |
|
/tiny_aes/trunk/testbench/test_table_lookup.v
0,0 → 1,57
/* |
* Copyright 2012, Homer Hsing <homer.hsing@gmail.com> |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* you may not use this file except in compliance with the License. |
* You may obtain a copy of the License at |
* |
* http://www.apache.org/licenses/LICENSE-2.0 |
* |
* Unless required by applicable law or agreed to in writing, software |
* distributed under the License is distributed on an "AS IS" BASIS, |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* See the License for the specific language governing permissions and |
* limitations under the License. |
*/ |
|
`timescale 1ns / 1ps |
|
module test_table_lookup; |
|
// Inputs |
reg clk; |
reg [31:0] state; |
|
// Outputs |
wire [31:0] p0; |
wire [31:0] p1; |
wire [31:0] p2; |
wire [31:0] p3; |
|
// Instantiate the Unit Under Test (UUT) |
table_lookup uut ( |
.clk(clk), |
.state(state), |
.p0(p0), |
.p1(p1), |
.p2(p2), |
.p3(p3) |
); |
|
initial begin |
clk = 0; |
state = 0; |
#100; |
state = 31'h193de3be; |
#10; |
if (p0 !== 32'hb3_d4_d4_67) begin $display("E"); $finish; end |
if (p1 !== 32'h69_4e_27_27) begin $display("E"); $finish; end |
if (p2 !== 32'h11_33_22_11) begin $display("E"); $finish; end |
if (p3 !== 32'hae_ae_e9_47) begin $display("E"); $finish; end |
$display("Good."); |
$finish; |
end |
|
always #5 clk = ~clk; |
endmodule |
|
/tiny_aes/trunk/testbench/test_aes_128.v
0,0 → 1,79
/* |
* Copyright 2012, Homer Hsing <homer.hsing@gmail.com> |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* you may not use this file except in compliance with the License. |
* You may obtain a copy of the License at |
* |
* http://www.apache.org/licenses/LICENSE-2.0 |
* |
* Unless required by applicable law or agreed to in writing, software |
* distributed under the License is distributed on an "AS IS" BASIS, |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* See the License for the specific language governing permissions and |
* limitations under the License. |
*/ |
|
`timescale 1ns / 1ps |
|
module test_aes_128; |
|
// Inputs |
reg clk; |
reg [127:0] state; |
reg [127:0] key; |
|
// Outputs |
wire [127:0] out; |
|
// Instantiate the Unit Under Test (UUT) |
aes_128 uut ( |
.clk(clk), |
.state(state), |
.key(key), |
.out(out) |
); |
|
initial begin |
clk = 0; |
state = 0; |
key = 0; |
|
#100; |
@ (negedge clk); |
state = 128'h3243f6a8_885a308d_313198a2_e0370734; |
key = 128'h2b7e1516_28aed2a6_abf71588_09cf4f3c; |
#10; |
state = 128'h00112233_44556677_8899aabb_ccddeeff; |
key = 128'h00010203_04050607_08090a0b_0c0d0e0f; |
#10; |
state = 128'h0; |
key = 128'h0; |
#10; |
state = 128'h0; |
key = 128'h1; |
#10; |
state = 128'h1; |
key = 128'h0; |
#170; |
if (out !== 128'h3925841d02dc09fbdc118597196a0b32) |
begin $display("E"); $finish; end |
#10; |
if (out !== 128'h69_c4_e0_d8_6a_7b_04_30_d8_cd_b7_80_70_b4_c5_5a) |
begin $display("E"); $finish; end |
#10; |
if (out !== 128'h66_e9_4b_d4_ef_8a_2c_3b_88_4c_fa_59_ca_34_2b_2e) |
begin $display("E"); $finish; end |
#10; |
if (out !== 128'h05_45_aa_d5_6d_a2_a9_7c_36_63_d1_43_2a_3d_1c_84) |
begin $display("E"); $finish; end |
#10; |
if (out !== 128'h58_e2_fc_ce_fa_7e_30_61_36_7f_1d_57_a4_e7_45_5a) |
begin $display("E"); $finish; end |
$display("Good."); |
$finish; |
end |
|
always #5 clk = ~clk; |
endmodule |
|
/tiny_aes/trunk/testbench/test_one_round.v
0,0 → 1,77
/* |
* Copyright 2012, Homer Hsing <homer.hsing@gmail.com> |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* you may not use this file except in compliance with the License. |
* You may obtain a copy of the License at |
* |
* http://www.apache.org/licenses/LICENSE-2.0 |
* |
* Unless required by applicable law or agreed to in writing, software |
* distributed under the License is distributed on an "AS IS" BASIS, |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* See the License for the specific language governing permissions and |
* limitations under the License. |
*/ |
|
`timescale 1ns / 1ps |
|
module test_one_round; |
|
// Inputs |
reg clk; |
reg [127:0] state_in; |
reg [127:0] key_in; |
reg [7:0] rcon; |
|
// Outputs |
wire [127:0] state_out; |
wire [127:0] key_out; |
wire [31:0] k0, k1, k2, k3, s0, s1, s2, s3; |
|
// Instantiate the Unit Under Test (UUT) |
one_round uut ( |
.clk(clk), |
.state_in(state_in), |
.key_in(key_in), |
.state_out(state_out), |
.key_out(key_out), |
.rcon(rcon) |
); |
|
assign {k0, k1, k2, k3} = key_out; |
assign {s0, s1, s2, s3} = state_out; |
|
initial begin |
clk = 0; |
state_in = 0; |
key_in = 0; |
rcon = 0; |
|
#100; |
@ (negedge clk); |
state_in = {32'h19_3d_e3_be, 32'ha0_f4_e2_2b, 32'h9a_c6_8d_2a, 32'he9_f8_48_08}; |
key_in = {32'h2b_7e_15_16, 32'h28_ae_d2_a6, 32'hab_f7_15_88, 32'h09_cf_4f_3c}; |
rcon = 1; |
#10; |
state_in = 0; |
key_in = 0; |
rcon = 0; |
#10; |
if(k0 != 32'ha0_fa_fe_17) begin $display("E"); $finish; end |
if(k1 != 32'h88_54_2c_b1) begin $display("E"); $finish; end |
if(k2 != 32'h23_a3_39_39) begin $display("E"); $finish; end |
if(k3 != 32'h2a_6c_76_05) begin $display("E"); $finish; end |
|
if(s0 != 32'ha4_9c_7f_f2) begin $display("E"); $finish; end |
if(s1 != 32'h68_9f_35_2b) begin $display("E"); $finish; end |
if(s2 != 32'h6b_5b_ea_43) begin $display("E"); $finish; end |
if(s3 != 32'h02_6a_50_49) begin $display("E"); $finish; end |
|
$display("Good."); |
$finish; |
end |
|
always #5 clk = ~clk; |
endmodule |
|
/tiny_aes/trunk/rtl/table.v
0,0 → 1,576
/* |
* Copyright 2012, Homer Hsing <homer.hsing@gmail.com> |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* you may not use this file except in compliance with the License. |
* You may obtain a copy of the License at |
* |
* http://www.apache.org/licenses/LICENSE-2.0 |
* |
* Unless required by applicable law or agreed to in writing, software |
* distributed under the License is distributed on an "AS IS" BASIS, |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* See the License for the specific language governing permissions and |
* limitations under the License. |
*/ |
|
module table_lookup (clk, state, p0, p1, p2, p3); |
input clk; |
input [31:0] state; |
output [31:0] p0, p1, p2, p3; |
wire [7:0] b0, b1, b2, b3; |
|
assign {b0, b1, b2, b3} = state; |
T |
t0 (clk, b0, {p0[23:0], p0[31:24]}), |
t1 (clk, b1, {p1[15:0], p1[31:16]}), |
t2 (clk, b2, {p2[7:0], p2[31:8]} ), |
t3 (clk, b3, p3); |
endmodule |
|
/* substitue four bytes in a word */ |
module S4 (clk, in, out); |
input clk; |
input [31:0] in; |
output [31:0] out; |
|
S |
S_0 (clk, in[31:24], out[31:24]), |
S_1 (clk, in[23:16], out[23:16]), |
S_2 (clk, in[15:8], out[15:8] ), |
S_3 (clk, in[7:0], out[7:0] ); |
endmodule |
|
/* S_box, S_box, S_box*(x+1), S_box*x */ |
module T (clk, in, out); |
input clk; |
input [7:0] in; |
output reg [31:0] out; |
|
always @ (posedge clk) |
case (in) |
8'h00: out <= 32'h6363a5c6; |
8'h01: out <= 32'h7c7c84f8; |
8'h02: out <= 32'h777799ee; |
8'h03: out <= 32'h7b7b8df6; |
8'h04: out <= 32'hf2f20dff; |
8'h05: out <= 32'h6b6bbdd6; |
8'h06: out <= 32'h6f6fb1de; |
8'h07: out <= 32'hc5c55491; |
8'h08: out <= 32'h30305060; |
8'h09: out <= 32'h01010302; |
8'h0a: out <= 32'h6767a9ce; |
8'h0b: out <= 32'h2b2b7d56; |
8'h0c: out <= 32'hfefe19e7; |
8'h0d: out <= 32'hd7d762b5; |
8'h0e: out <= 32'hababe64d; |
8'h0f: out <= 32'h76769aec; |
8'h10: out <= 32'hcaca458f; |
8'h11: out <= 32'h82829d1f; |
8'h12: out <= 32'hc9c94089; |
8'h13: out <= 32'h7d7d87fa; |
8'h14: out <= 32'hfafa15ef; |
8'h15: out <= 32'h5959ebb2; |
8'h16: out <= 32'h4747c98e; |
8'h17: out <= 32'hf0f00bfb; |
8'h18: out <= 32'hadadec41; |
8'h19: out <= 32'hd4d467b3; |
8'h1a: out <= 32'ha2a2fd5f; |
8'h1b: out <= 32'hafafea45; |
8'h1c: out <= 32'h9c9cbf23; |
8'h1d: out <= 32'ha4a4f753; |
8'h1e: out <= 32'h727296e4; |
8'h1f: out <= 32'hc0c05b9b; |
8'h20: out <= 32'hb7b7c275; |
8'h21: out <= 32'hfdfd1ce1; |
8'h22: out <= 32'h9393ae3d; |
8'h23: out <= 32'h26266a4c; |
8'h24: out <= 32'h36365a6c; |
8'h25: out <= 32'h3f3f417e; |
8'h26: out <= 32'hf7f702f5; |
8'h27: out <= 32'hcccc4f83; |
8'h28: out <= 32'h34345c68; |
8'h29: out <= 32'ha5a5f451; |
8'h2a: out <= 32'he5e534d1; |
8'h2b: out <= 32'hf1f108f9; |
8'h2c: out <= 32'h717193e2; |
8'h2d: out <= 32'hd8d873ab; |
8'h2e: out <= 32'h31315362; |
8'h2f: out <= 32'h15153f2a; |
8'h30: out <= 32'h04040c08; |
8'h31: out <= 32'hc7c75295; |
8'h32: out <= 32'h23236546; |
8'h33: out <= 32'hc3c35e9d; |
8'h34: out <= 32'h18182830; |
8'h35: out <= 32'h9696a137; |
8'h36: out <= 32'h05050f0a; |
8'h37: out <= 32'h9a9ab52f; |
8'h38: out <= 32'h0707090e; |
8'h39: out <= 32'h12123624; |
8'h3a: out <= 32'h80809b1b; |
8'h3b: out <= 32'he2e23ddf; |
8'h3c: out <= 32'hebeb26cd; |
8'h3d: out <= 32'h2727694e; |
8'h3e: out <= 32'hb2b2cd7f; |
8'h3f: out <= 32'h75759fea; |
8'h40: out <= 32'h09091b12; |
8'h41: out <= 32'h83839e1d; |
8'h42: out <= 32'h2c2c7458; |
8'h43: out <= 32'h1a1a2e34; |
8'h44: out <= 32'h1b1b2d36; |
8'h45: out <= 32'h6e6eb2dc; |
8'h46: out <= 32'h5a5aeeb4; |
8'h47: out <= 32'ha0a0fb5b; |
8'h48: out <= 32'h5252f6a4; |
8'h49: out <= 32'h3b3b4d76; |
8'h4a: out <= 32'hd6d661b7; |
8'h4b: out <= 32'hb3b3ce7d; |
8'h4c: out <= 32'h29297b52; |
8'h4d: out <= 32'he3e33edd; |
8'h4e: out <= 32'h2f2f715e; |
8'h4f: out <= 32'h84849713; |
8'h50: out <= 32'h5353f5a6; |
8'h51: out <= 32'hd1d168b9; |
8'h52: out <= 32'h00000000; |
8'h53: out <= 32'heded2cc1; |
8'h54: out <= 32'h20206040; |
8'h55: out <= 32'hfcfc1fe3; |
8'h56: out <= 32'hb1b1c879; |
8'h57: out <= 32'h5b5bedb6; |
8'h58: out <= 32'h6a6abed4; |
8'h59: out <= 32'hcbcb468d; |
8'h5a: out <= 32'hbebed967; |
8'h5b: out <= 32'h39394b72; |
8'h5c: out <= 32'h4a4ade94; |
8'h5d: out <= 32'h4c4cd498; |
8'h5e: out <= 32'h5858e8b0; |
8'h5f: out <= 32'hcfcf4a85; |
8'h60: out <= 32'hd0d06bbb; |
8'h61: out <= 32'hefef2ac5; |
8'h62: out <= 32'haaaae54f; |
8'h63: out <= 32'hfbfb16ed; |
8'h64: out <= 32'h4343c586; |
8'h65: out <= 32'h4d4dd79a; |
8'h66: out <= 32'h33335566; |
8'h67: out <= 32'h85859411; |
8'h68: out <= 32'h4545cf8a; |
8'h69: out <= 32'hf9f910e9; |
8'h6a: out <= 32'h02020604; |
8'h6b: out <= 32'h7f7f81fe; |
8'h6c: out <= 32'h5050f0a0; |
8'h6d: out <= 32'h3c3c4478; |
8'h6e: out <= 32'h9f9fba25; |
8'h6f: out <= 32'ha8a8e34b; |
8'h70: out <= 32'h5151f3a2; |
8'h71: out <= 32'ha3a3fe5d; |
8'h72: out <= 32'h4040c080; |
8'h73: out <= 32'h8f8f8a05; |
8'h74: out <= 32'h9292ad3f; |
8'h75: out <= 32'h9d9dbc21; |
8'h76: out <= 32'h38384870; |
8'h77: out <= 32'hf5f504f1; |
8'h78: out <= 32'hbcbcdf63; |
8'h79: out <= 32'hb6b6c177; |
8'h7a: out <= 32'hdada75af; |
8'h7b: out <= 32'h21216342; |
8'h7c: out <= 32'h10103020; |
8'h7d: out <= 32'hffff1ae5; |
8'h7e: out <= 32'hf3f30efd; |
8'h7f: out <= 32'hd2d26dbf; |
8'h80: out <= 32'hcdcd4c81; |
8'h81: out <= 32'h0c0c1418; |
8'h82: out <= 32'h13133526; |
8'h83: out <= 32'hecec2fc3; |
8'h84: out <= 32'h5f5fe1be; |
8'h85: out <= 32'h9797a235; |
8'h86: out <= 32'h4444cc88; |
8'h87: out <= 32'h1717392e; |
8'h88: out <= 32'hc4c45793; |
8'h89: out <= 32'ha7a7f255; |
8'h8a: out <= 32'h7e7e82fc; |
8'h8b: out <= 32'h3d3d477a; |
8'h8c: out <= 32'h6464acc8; |
8'h8d: out <= 32'h5d5de7ba; |
8'h8e: out <= 32'h19192b32; |
8'h8f: out <= 32'h737395e6; |
8'h90: out <= 32'h6060a0c0; |
8'h91: out <= 32'h81819819; |
8'h92: out <= 32'h4f4fd19e; |
8'h93: out <= 32'hdcdc7fa3; |
8'h94: out <= 32'h22226644; |
8'h95: out <= 32'h2a2a7e54; |
8'h96: out <= 32'h9090ab3b; |
8'h97: out <= 32'h8888830b; |
8'h98: out <= 32'h4646ca8c; |
8'h99: out <= 32'heeee29c7; |
8'h9a: out <= 32'hb8b8d36b; |
8'h9b: out <= 32'h14143c28; |
8'h9c: out <= 32'hdede79a7; |
8'h9d: out <= 32'h5e5ee2bc; |
8'h9e: out <= 32'h0b0b1d16; |
8'h9f: out <= 32'hdbdb76ad; |
8'ha0: out <= 32'he0e03bdb; |
8'ha1: out <= 32'h32325664; |
8'ha2: out <= 32'h3a3a4e74; |
8'ha3: out <= 32'h0a0a1e14; |
8'ha4: out <= 32'h4949db92; |
8'ha5: out <= 32'h06060a0c; |
8'ha6: out <= 32'h24246c48; |
8'ha7: out <= 32'h5c5ce4b8; |
8'ha8: out <= 32'hc2c25d9f; |
8'ha9: out <= 32'hd3d36ebd; |
8'haa: out <= 32'hacacef43; |
8'hab: out <= 32'h6262a6c4; |
8'hac: out <= 32'h9191a839; |
8'had: out <= 32'h9595a431; |
8'hae: out <= 32'he4e437d3; |
8'haf: out <= 32'h79798bf2; |
8'hb0: out <= 32'he7e732d5; |
8'hb1: out <= 32'hc8c8438b; |
8'hb2: out <= 32'h3737596e; |
8'hb3: out <= 32'h6d6db7da; |
8'hb4: out <= 32'h8d8d8c01; |
8'hb5: out <= 32'hd5d564b1; |
8'hb6: out <= 32'h4e4ed29c; |
8'hb7: out <= 32'ha9a9e049; |
8'hb8: out <= 32'h6c6cb4d8; |
8'hb9: out <= 32'h5656faac; |
8'hba: out <= 32'hf4f407f3; |
8'hbb: out <= 32'heaea25cf; |
8'hbc: out <= 32'h6565afca; |
8'hbd: out <= 32'h7a7a8ef4; |
8'hbe: out <= 32'haeaee947; |
8'hbf: out <= 32'h08081810; |
8'hc0: out <= 32'hbabad56f; |
8'hc1: out <= 32'h787888f0; |
8'hc2: out <= 32'h25256f4a; |
8'hc3: out <= 32'h2e2e725c; |
8'hc4: out <= 32'h1c1c2438; |
8'hc5: out <= 32'ha6a6f157; |
8'hc6: out <= 32'hb4b4c773; |
8'hc7: out <= 32'hc6c65197; |
8'hc8: out <= 32'he8e823cb; |
8'hc9: out <= 32'hdddd7ca1; |
8'hca: out <= 32'h74749ce8; |
8'hcb: out <= 32'h1f1f213e; |
8'hcc: out <= 32'h4b4bdd96; |
8'hcd: out <= 32'hbdbddc61; |
8'hce: out <= 32'h8b8b860d; |
8'hcf: out <= 32'h8a8a850f; |
8'hd0: out <= 32'h707090e0; |
8'hd1: out <= 32'h3e3e427c; |
8'hd2: out <= 32'hb5b5c471; |
8'hd3: out <= 32'h6666aacc; |
8'hd4: out <= 32'h4848d890; |
8'hd5: out <= 32'h03030506; |
8'hd6: out <= 32'hf6f601f7; |
8'hd7: out <= 32'h0e0e121c; |
8'hd8: out <= 32'h6161a3c2; |
8'hd9: out <= 32'h35355f6a; |
8'hda: out <= 32'h5757f9ae; |
8'hdb: out <= 32'hb9b9d069; |
8'hdc: out <= 32'h86869117; |
8'hdd: out <= 32'hc1c15899; |
8'hde: out <= 32'h1d1d273a; |
8'hdf: out <= 32'h9e9eb927; |
8'he0: out <= 32'he1e138d9; |
8'he1: out <= 32'hf8f813eb; |
8'he2: out <= 32'h9898b32b; |
8'he3: out <= 32'h11113322; |
8'he4: out <= 32'h6969bbd2; |
8'he5: out <= 32'hd9d970a9; |
8'he6: out <= 32'h8e8e8907; |
8'he7: out <= 32'h9494a733; |
8'he8: out <= 32'h9b9bb62d; |
8'he9: out <= 32'h1e1e223c; |
8'hea: out <= 32'h87879215; |
8'heb: out <= 32'he9e920c9; |
8'hec: out <= 32'hcece4987; |
8'hed: out <= 32'h5555ffaa; |
8'hee: out <= 32'h28287850; |
8'hef: out <= 32'hdfdf7aa5; |
8'hf0: out <= 32'h8c8c8f03; |
8'hf1: out <= 32'ha1a1f859; |
8'hf2: out <= 32'h89898009; |
8'hf3: out <= 32'h0d0d171a; |
8'hf4: out <= 32'hbfbfda65; |
8'hf5: out <= 32'he6e631d7; |
8'hf6: out <= 32'h4242c684; |
8'hf7: out <= 32'h6868b8d0; |
8'hf8: out <= 32'h4141c382; |
8'hf9: out <= 32'h9999b029; |
8'hfa: out <= 32'h2d2d775a; |
8'hfb: out <= 32'h0f0f111e; |
8'hfc: out <= 32'hb0b0cb7b; |
8'hfd: out <= 32'h5454fca8; |
8'hfe: out <= 32'hbbbbd66d; |
8'hff: out <= 32'h16163a2c; |
endcase |
endmodule |
|
/* S box */ |
module S (clk, in, out); |
input clk; |
input [7:0] in; |
output reg [7:0] out; |
|
always @ (posedge clk) |
case (in) |
8'h00: out <= 8'h63; |
8'h01: out <= 8'h7c; |
8'h02: out <= 8'h77; |
8'h03: out <= 8'h7b; |
8'h04: out <= 8'hf2; |
8'h05: out <= 8'h6b; |
8'h06: out <= 8'h6f; |
8'h07: out <= 8'hc5; |
8'h08: out <= 8'h30; |
8'h09: out <= 8'h01; |
8'h0a: out <= 8'h67; |
8'h0b: out <= 8'h2b; |
8'h0c: out <= 8'hfe; |
8'h0d: out <= 8'hd7; |
8'h0e: out <= 8'hab; |
8'h0f: out <= 8'h76; |
8'h10: out <= 8'hca; |
8'h11: out <= 8'h82; |
8'h12: out <= 8'hc9; |
8'h13: out <= 8'h7d; |
8'h14: out <= 8'hfa; |
8'h15: out <= 8'h59; |
8'h16: out <= 8'h47; |
8'h17: out <= 8'hf0; |
8'h18: out <= 8'had; |
8'h19: out <= 8'hd4; |
8'h1a: out <= 8'ha2; |
8'h1b: out <= 8'haf; |
8'h1c: out <= 8'h9c; |
8'h1d: out <= 8'ha4; |
8'h1e: out <= 8'h72; |
8'h1f: out <= 8'hc0; |
8'h20: out <= 8'hb7; |
8'h21: out <= 8'hfd; |
8'h22: out <= 8'h93; |
8'h23: out <= 8'h26; |
8'h24: out <= 8'h36; |
8'h25: out <= 8'h3f; |
8'h26: out <= 8'hf7; |
8'h27: out <= 8'hcc; |
8'h28: out <= 8'h34; |
8'h29: out <= 8'ha5; |
8'h2a: out <= 8'he5; |
8'h2b: out <= 8'hf1; |
8'h2c: out <= 8'h71; |
8'h2d: out <= 8'hd8; |
8'h2e: out <= 8'h31; |
8'h2f: out <= 8'h15; |
8'h30: out <= 8'h04; |
8'h31: out <= 8'hc7; |
8'h32: out <= 8'h23; |
8'h33: out <= 8'hc3; |
8'h34: out <= 8'h18; |
8'h35: out <= 8'h96; |
8'h36: out <= 8'h05; |
8'h37: out <= 8'h9a; |
8'h38: out <= 8'h07; |
8'h39: out <= 8'h12; |
8'h3a: out <= 8'h80; |
8'h3b: out <= 8'he2; |
8'h3c: out <= 8'heb; |
8'h3d: out <= 8'h27; |
8'h3e: out <= 8'hb2; |
8'h3f: out <= 8'h75; |
8'h40: out <= 8'h09; |
8'h41: out <= 8'h83; |
8'h42: out <= 8'h2c; |
8'h43: out <= 8'h1a; |
8'h44: out <= 8'h1b; |
8'h45: out <= 8'h6e; |
8'h46: out <= 8'h5a; |
8'h47: out <= 8'ha0; |
8'h48: out <= 8'h52; |
8'h49: out <= 8'h3b; |
8'h4a: out <= 8'hd6; |
8'h4b: out <= 8'hb3; |
8'h4c: out <= 8'h29; |
8'h4d: out <= 8'he3; |
8'h4e: out <= 8'h2f; |
8'h4f: out <= 8'h84; |
8'h50: out <= 8'h53; |
8'h51: out <= 8'hd1; |
8'h52: out <= 8'h00; |
8'h53: out <= 8'hed; |
8'h54: out <= 8'h20; |
8'h55: out <= 8'hfc; |
8'h56: out <= 8'hb1; |
8'h57: out <= 8'h5b; |
8'h58: out <= 8'h6a; |
8'h59: out <= 8'hcb; |
8'h5a: out <= 8'hbe; |
8'h5b: out <= 8'h39; |
8'h5c: out <= 8'h4a; |
8'h5d: out <= 8'h4c; |
8'h5e: out <= 8'h58; |
8'h5f: out <= 8'hcf; |
8'h60: out <= 8'hd0; |
8'h61: out <= 8'hef; |
8'h62: out <= 8'haa; |
8'h63: out <= 8'hfb; |
8'h64: out <= 8'h43; |
8'h65: out <= 8'h4d; |
8'h66: out <= 8'h33; |
8'h67: out <= 8'h85; |
8'h68: out <= 8'h45; |
8'h69: out <= 8'hf9; |
8'h6a: out <= 8'h02; |
8'h6b: out <= 8'h7f; |
8'h6c: out <= 8'h50; |
8'h6d: out <= 8'h3c; |
8'h6e: out <= 8'h9f; |
8'h6f: out <= 8'ha8; |
8'h70: out <= 8'h51; |
8'h71: out <= 8'ha3; |
8'h72: out <= 8'h40; |
8'h73: out <= 8'h8f; |
8'h74: out <= 8'h92; |
8'h75: out <= 8'h9d; |
8'h76: out <= 8'h38; |
8'h77: out <= 8'hf5; |
8'h78: out <= 8'hbc; |
8'h79: out <= 8'hb6; |
8'h7a: out <= 8'hda; |
8'h7b: out <= 8'h21; |
8'h7c: out <= 8'h10; |
8'h7d: out <= 8'hff; |
8'h7e: out <= 8'hf3; |
8'h7f: out <= 8'hd2; |
8'h80: out <= 8'hcd; |
8'h81: out <= 8'h0c; |
8'h82: out <= 8'h13; |
8'h83: out <= 8'hec; |
8'h84: out <= 8'h5f; |
8'h85: out <= 8'h97; |
8'h86: out <= 8'h44; |
8'h87: out <= 8'h17; |
8'h88: out <= 8'hc4; |
8'h89: out <= 8'ha7; |
8'h8a: out <= 8'h7e; |
8'h8b: out <= 8'h3d; |
8'h8c: out <= 8'h64; |
8'h8d: out <= 8'h5d; |
8'h8e: out <= 8'h19; |
8'h8f: out <= 8'h73; |
8'h90: out <= 8'h60; |
8'h91: out <= 8'h81; |
8'h92: out <= 8'h4f; |
8'h93: out <= 8'hdc; |
8'h94: out <= 8'h22; |
8'h95: out <= 8'h2a; |
8'h96: out <= 8'h90; |
8'h97: out <= 8'h88; |
8'h98: out <= 8'h46; |
8'h99: out <= 8'hee; |
8'h9a: out <= 8'hb8; |
8'h9b: out <= 8'h14; |
8'h9c: out <= 8'hde; |
8'h9d: out <= 8'h5e; |
8'h9e: out <= 8'h0b; |
8'h9f: out <= 8'hdb; |
8'ha0: out <= 8'he0; |
8'ha1: out <= 8'h32; |
8'ha2: out <= 8'h3a; |
8'ha3: out <= 8'h0a; |
8'ha4: out <= 8'h49; |
8'ha5: out <= 8'h06; |
8'ha6: out <= 8'h24; |
8'ha7: out <= 8'h5c; |
8'ha8: out <= 8'hc2; |
8'ha9: out <= 8'hd3; |
8'haa: out <= 8'hac; |
8'hab: out <= 8'h62; |
8'hac: out <= 8'h91; |
8'had: out <= 8'h95; |
8'hae: out <= 8'he4; |
8'haf: out <= 8'h79; |
8'hb0: out <= 8'he7; |
8'hb1: out <= 8'hc8; |
8'hb2: out <= 8'h37; |
8'hb3: out <= 8'h6d; |
8'hb4: out <= 8'h8d; |
8'hb5: out <= 8'hd5; |
8'hb6: out <= 8'h4e; |
8'hb7: out <= 8'ha9; |
8'hb8: out <= 8'h6c; |
8'hb9: out <= 8'h56; |
8'hba: out <= 8'hf4; |
8'hbb: out <= 8'hea; |
8'hbc: out <= 8'h65; |
8'hbd: out <= 8'h7a; |
8'hbe: out <= 8'hae; |
8'hbf: out <= 8'h08; |
8'hc0: out <= 8'hba; |
8'hc1: out <= 8'h78; |
8'hc2: out <= 8'h25; |
8'hc3: out <= 8'h2e; |
8'hc4: out <= 8'h1c; |
8'hc5: out <= 8'ha6; |
8'hc6: out <= 8'hb4; |
8'hc7: out <= 8'hc6; |
8'hc8: out <= 8'he8; |
8'hc9: out <= 8'hdd; |
8'hca: out <= 8'h74; |
8'hcb: out <= 8'h1f; |
8'hcc: out <= 8'h4b; |
8'hcd: out <= 8'hbd; |
8'hce: out <= 8'h8b; |
8'hcf: out <= 8'h8a; |
8'hd0: out <= 8'h70; |
8'hd1: out <= 8'h3e; |
8'hd2: out <= 8'hb5; |
8'hd3: out <= 8'h66; |
8'hd4: out <= 8'h48; |
8'hd5: out <= 8'h03; |
8'hd6: out <= 8'hf6; |
8'hd7: out <= 8'h0e; |
8'hd8: out <= 8'h61; |
8'hd9: out <= 8'h35; |
8'hda: out <= 8'h57; |
8'hdb: out <= 8'hb9; |
8'hdc: out <= 8'h86; |
8'hdd: out <= 8'hc1; |
8'hde: out <= 8'h1d; |
8'hdf: out <= 8'h9e; |
8'he0: out <= 8'he1; |
8'he1: out <= 8'hf8; |
8'he2: out <= 8'h98; |
8'he3: out <= 8'h11; |
8'he4: out <= 8'h69; |
8'he5: out <= 8'hd9; |
8'he6: out <= 8'h8e; |
8'he7: out <= 8'h94; |
8'he8: out <= 8'h9b; |
8'he9: out <= 8'h1e; |
8'hea: out <= 8'h87; |
8'heb: out <= 8'he9; |
8'hec: out <= 8'hce; |
8'hed: out <= 8'h55; |
8'hee: out <= 8'h28; |
8'hef: out <= 8'hdf; |
8'hf0: out <= 8'h8c; |
8'hf1: out <= 8'ha1; |
8'hf2: out <= 8'h89; |
8'hf3: out <= 8'h0d; |
8'hf4: out <= 8'hbf; |
8'hf5: out <= 8'he6; |
8'hf6: out <= 8'h42; |
8'hf7: out <= 8'h68; |
8'hf8: out <= 8'h41; |
8'hf9: out <= 8'h99; |
8'hfa: out <= 8'h2d; |
8'hfb: out <= 8'h0f; |
8'hfc: out <= 8'hb0; |
8'hfd: out <= 8'h54; |
8'hfe: out <= 8'hbb; |
8'hff: out <= 8'h16; |
endcase |
endmodule |
/tiny_aes/trunk/rtl/aes.v
0,0 → 1,133
/* |
* Copyright 2012, Homer Hsing <homer.hsing@gmail.com> |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* you may not use this file except in compliance with the License. |
* You may obtain a copy of the License at |
* |
* http://www.apache.org/licenses/LICENSE-2.0 |
* |
* Unless required by applicable law or agreed to in writing, software |
* distributed under the License is distributed on an "AS IS" BASIS, |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* See the License for the specific language governing permissions and |
* limitations under the License. |
*/ |
|
module aes_128(clk, state, key, out); |
input clk; |
input [127:0] state, key; |
output [127:0] out; |
reg [127:0] s0, k0; |
wire [127:0] s1, k1, s2, k2, s3, k3, s4, k4, s5, k5, |
s6, k6, s7, k7, s8, k8, s9, k9, s10; |
|
always @ (posedge clk) |
begin |
s0 <= state ^ key; |
k0 <= key; |
end |
assign out = s10; |
one_round |
r1 (clk, s0, k0, s1, k1, 8'h1), |
r2 (clk, s1, k1, s2, k2, 8'h2), |
r3 (clk, s2, k2, s3, k3, 8'h4), |
r4 (clk, s3, k3, s4, k4, 8'h8), |
r5 (clk, s4, k4, s5, k5, 8'h10), |
r6 (clk, s5, k5, s6, k6, 8'h20), |
r7 (clk, s6, k6, s7, k7, 8'h40), |
r8 (clk, s7, k7, s8, k8, 8'h80), |
r9 (clk, s8, k8, s9, k9, 8'h1b); |
final_round |
rf (clk, s9, k9, s10, 8'h36); |
endmodule |
|
module one_round(clk, state_in, key_in, state_out, key_out, rcon); |
input clk; |
input [127:0] state_in, key_in; |
input [7:0] rcon; |
output reg [127:0] state_out, key_out; |
wire [31:0] s0, s1, s2, s3, |
v0, v1, v2, v3, |
z0, z1, z2, z3, |
p00, p01, p02, p03, |
p10, p11, p12, p13, |
p20, p21, p22, p23, |
p30, p31, p32, p33, |
k0, k1, k2, k3; |
reg [31:0] k0a, k1a, k2a, k3a; |
wire [31:0] k0b, k1b, k2b, k3b, k4a; |
|
assign {k0, k1, k2, k3} = key_in; |
assign v0 = {k0[31:24] ^ rcon, k0[23:0]}; |
assign v1 = v0 ^ k1; |
assign v2 = v1 ^ k2; |
assign v3 = v2 ^ k3; |
always @ (posedge clk) |
{k0a, k1a, k2a, k3a} <= {v0, v1, v2, v3}; |
S4 |
S4_0 (clk, {k3[23:0], k3[31:24]}, k4a); |
assign k0b = k0a ^ k4a; |
assign k1b = k1a ^ k4a; |
assign k2b = k2a ^ k4a; |
assign k3b = k3a ^ k4a; |
always @ (posedge clk) |
key_out <= {k0b, k1b, k2b, k3b}; |
|
assign {s0, s1, s2, s3} = state_in; |
table_lookup |
t0 (clk, s0, p00, p01, p02, p03), |
t1 (clk, s1, p10, p11, p12, p13), |
t2 (clk, s2, p20, p21, p22, p23), |
t3 (clk, s3, p30, p31, p32, p33); |
assign z0 = p00 ^ p11 ^ p22 ^ p33 ^ k0b; |
assign z1 = p03 ^ p10 ^ p21 ^ p32 ^ k1b; |
assign z2 = p02 ^ p13 ^ p20 ^ p31 ^ k2b; |
assign z3 = p01 ^ p12 ^ p23 ^ p30 ^ k3b; |
always @ (posedge clk) |
state_out <= {z0, z1, z2, z3}; |
endmodule |
|
module final_round(clk, state_in, key_in, state_out, rcon); |
input clk; |
input [127:0] state_in, key_in; |
input [7:0] rcon; |
output reg [127:0] state_out; |
wire [31:0] s0, s1, s2, s3, |
v0, v1, v2, v3, |
z0, z1, z2, z3, |
k0, k1, k2, k3; |
reg [31:0] k0a, k1a, k2a, k3a; |
wire [31:0] k0b, k1b, k2b, k3b, k4a; |
wire [7:0] p00, p01, p02, p03, |
p10, p11, p12, p13, |
p20, p21, p22, p23, |
p30, p31, p32, p33; |
|
assign {k0, k1, k2, k3} = key_in; |
assign v0 = {k0[31:24] ^ rcon, k0[23:0]}; |
assign v1 = v0 ^ k1; |
assign v2 = v1 ^ k2; |
assign v3 = v2 ^ k3; |
always @ (posedge clk) |
{k0a, k1a, k2a, k3a} <= {v0, v1, v2, v3}; |
S4 |
S4_0 (clk, {k3[23:0], k3[31:24]}, k4a); |
assign k0b = k0a ^ k4a; |
assign k1b = k1a ^ k4a; |
assign k2b = k2a ^ k4a; |
assign k3b = k3a ^ k4a; |
|
assign {s0, s1, s2, s3} = state_in; |
S4 |
S4_1 (clk, s0, {p00, p01, p02, p03}), |
S4_2 (clk, s1, {p10, p11, p12, p13}), |
S4_3 (clk, s2, {p20, p21, p22, p23}), |
S4_4 (clk, s3, {p30, p31, p32, p33}); |
assign z0 = {p00, p11, p22, p33} ^ k0b; |
assign z1 = {p10, p21, p32, p03} ^ k1b; |
assign z2 = {p20, p31, p02, p13} ^ k2b; |
assign z3 = {p30, p01, p12, p23} ^ k3b; |
always @ (posedge clk) |
state_out <= {z0, z1, z2, z3}; |
endmodule |
/tiny_aes/trunk/NOTICE
0,0 → 1,13
Copyright 2012, Homer Hsing <homer.hsing@gmail.com> |
|
Licensed under the Apache License, Version 2.0 (the "License"); |
you may not use this file except in compliance with the License. |
You may obtain a copy of the License at |
|
http://www.apache.org/licenses/LICENSE-2.0 |
|
Unless required by applicable law or agreed to in writing, software |
distributed under the License is distributed on an "AS IS" BASIS, |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
See the License for the specific language governing permissions and |
limitations under the License. |
/tiny_aes/trunk/LICENSE
0,0 → 1,202
|
Apache License |
Version 2.0, January 2004 |
http://www.apache.org/licenses/ |
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION |
|
1. Definitions. |
|
"License" shall mean the terms and conditions for use, reproduction, |
and distribution as defined by Sections 1 through 9 of this document. |
|
"Licensor" shall mean the copyright owner or entity authorized by |
the copyright owner that is granting the License. |
|
"Legal Entity" shall mean the union of the acting entity and all |
other entities that control, are controlled by, or are under common |
control with that entity. For the purposes of this definition, |
"control" means (i) the power, direct or indirect, to cause the |
direction or management of such entity, whether by contract or |
otherwise, or (ii) ownership of fifty percent (50%) or more of the |
outstanding shares, or (iii) beneficial ownership of such entity. |
|
"You" (or "Your") shall mean an individual or Legal Entity |
exercising permissions granted by this License. |
|
"Source" form shall mean the preferred form for making modifications, |
including but not limited to software source code, documentation |
source, and configuration files. |
|
"Object" form shall mean any form resulting from mechanical |
transformation or translation of a Source form, including but |
not limited to compiled object code, generated documentation, |
and conversions to other media types. |
|
"Work" shall mean the work of authorship, whether in Source or |
Object form, made available under the License, as indicated by a |
copyright notice that is included in or attached to the work |
(an example is provided in the Appendix below). |
|
"Derivative Works" shall mean any work, whether in Source or Object |
form, that is based on (or derived from) the Work and for which the |
editorial revisions, annotations, elaborations, or other modifications |
represent, as a whole, an original work of authorship. For the purposes |
of this License, Derivative Works shall not include works that remain |
separable from, or merely link (or bind by name) to the interfaces of, |
the Work and Derivative Works thereof. |
|
"Contribution" shall mean any work of authorship, including |
the original version of the Work and any modifications or additions |
to that Work or Derivative Works thereof, that is intentionally |
submitted to Licensor for inclusion in the Work by the copyright owner |
or by an individual or Legal Entity authorized to submit on behalf of |
the copyright owner. For the purposes of this definition, "submitted" |
means any form of electronic, verbal, or written communication sent |
to the Licensor or its representatives, including but not limited to |
communication on electronic mailing lists, source code control systems, |
and issue tracking systems that are managed by, or on behalf of, the |
Licensor for the purpose of discussing and improving the Work, but |
excluding communication that is conspicuously marked or otherwise |
designated in writing by the copyright owner as "Not a Contribution." |
|
"Contributor" shall mean Licensor and any individual or Legal Entity |
on behalf of whom a Contribution has been received by Licensor and |
subsequently incorporated within the Work. |
|
2. Grant of Copyright License. Subject to the terms and conditions of |
this License, each Contributor hereby grants to You a perpetual, |
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
copyright license to reproduce, prepare Derivative Works of, |
publicly display, publicly perform, sublicense, and distribute the |
Work and such Derivative Works in Source or Object form. |
|
3. Grant of Patent License. Subject to the terms and conditions of |
this License, each Contributor hereby grants to You a perpetual, |
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
(except as stated in this section) patent license to make, have made, |
use, offer to sell, sell, import, and otherwise transfer the Work, |
where such license applies only to those patent claims licensable |
by such Contributor that are necessarily infringed by their |
Contribution(s) alone or by combination of their Contribution(s) |
with the Work to which such Contribution(s) was submitted. If You |
institute patent litigation against any entity (including a |
cross-claim or counterclaim in a lawsuit) alleging that the Work |
or a Contribution incorporated within the Work constitutes direct |
or contributory patent infringement, then any patent licenses |
granted to You under this License for that Work shall terminate |
as of the date such litigation is filed. |
|
4. Redistribution. You may reproduce and distribute copies of the |
Work or Derivative Works thereof in any medium, with or without |
modifications, and in Source or Object form, provided that You |
meet the following conditions: |
|
(a) You must give any other recipients of the Work or |
Derivative Works a copy of this License; and |
|
(b) You must cause any modified files to carry prominent notices |
stating that You changed the files; and |
|
(c) You must retain, in the Source form of any Derivative Works |
that You distribute, all copyright, patent, trademark, and |
attribution notices from the Source form of the Work, |
excluding those notices that do not pertain to any part of |
the Derivative Works; and |
|
(d) If the Work includes a "NOTICE" text file as part of its |
distribution, then any Derivative Works that You distribute must |
include a readable copy of the attribution notices contained |
within such NOTICE file, excluding those notices that do not |
pertain to any part of the Derivative Works, in at least one |
of the following places: within a NOTICE text file distributed |
as part of the Derivative Works; within the Source form or |
documentation, if provided along with the Derivative Works; or, |
within a display generated by the Derivative Works, if and |
wherever such third-party notices normally appear. The contents |
of the NOTICE file are for informational purposes only and |
do not modify the License. You may add Your own attribution |
notices within Derivative Works that You distribute, alongside |
or as an addendum to the NOTICE text from the Work, provided |
that such additional attribution notices cannot be construed |
as modifying the License. |
|
You may add Your own copyright statement to Your modifications and |
may provide additional or different license terms and conditions |
for use, reproduction, or distribution of Your modifications, or |
for any such Derivative Works as a whole, provided Your use, |
reproduction, and distribution of the Work otherwise complies with |
the conditions stated in this License. |
|
5. Submission of Contributions. Unless You explicitly state otherwise, |
any Contribution intentionally submitted for inclusion in the Work |
by You to the Licensor shall be under the terms and conditions of |
this License, without any additional terms or conditions. |
Notwithstanding the above, nothing herein shall supersede or modify |
the terms of any separate license agreement you may have executed |
with Licensor regarding such Contributions. |
|
6. Trademarks. This License does not grant permission to use the trade |
names, trademarks, service marks, or product names of the Licensor, |
except as required for reasonable and customary use in describing the |
origin of the Work and reproducing the content of the NOTICE file. |
|
7. Disclaimer of Warranty. Unless required by applicable law or |
agreed to in writing, Licensor provides the Work (and each |
Contributor provides its Contributions) on an "AS IS" BASIS, |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
implied, including, without limitation, any warranties or conditions |
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A |
PARTICULAR PURPOSE. You are solely responsible for determining the |
appropriateness of using or redistributing the Work and assume any |
risks associated with Your exercise of permissions under this License. |
|
8. Limitation of Liability. In no event and under no legal theory, |
whether in tort (including negligence), contract, or otherwise, |
unless required by applicable law (such as deliberate and grossly |
negligent acts) or agreed to in writing, shall any Contributor be |
liable to You for damages, including any direct, indirect, special, |
incidental, or consequential damages of any character arising as a |
result of this License or out of the use or inability to use the |
Work (including but not limited to damages for loss of goodwill, |
work stoppage, computer failure or malfunction, or any and all |
other commercial damages or losses), even if such Contributor |
has been advised of the possibility of such damages. |
|
9. Accepting Warranty or Additional Liability. While redistributing |
the Work or Derivative Works thereof, You may choose to offer, |
and charge a fee for, acceptance of support, warranty, indemnity, |
or other liability obligations and/or rights consistent with this |
License. However, in accepting such obligations, You may act only |
on Your own behalf and on Your sole responsibility, not on behalf |
of any other Contributor, and only if You agree to indemnify, |
defend, and hold each Contributor harmless for any liability |
incurred by, or claims asserted against, such Contributor by reason |
of your accepting any such warranty or additional liability. |
|
END OF TERMS AND CONDITIONS |
|
APPENDIX: How to apply the Apache License to your work. |
|
To apply the Apache License to your work, attach the following |
boilerplate notice, with the fields enclosed by brackets "[]" |
replaced with your own identifying information. (Don't include |
the brackets!) The text should be enclosed in the appropriate |
comment syntax for the file format. We also recommend that a |
file or class name and description of purpose be included on the |
same "printed page" as the copyright notice for easier |
identification within third-party archives. |
|
Copyright [yyyy] [name of copyright owner] |
|
Licensed under the Apache License, Version 2.0 (the "License"); |
you may not use this file except in compliance with the License. |
You may obtain a copy of the License at |
|
http://www.apache.org/licenses/LICENSE-2.0 |
|
Unless required by applicable law or agreed to in writing, software |
distributed under the License is distributed on an "AS IS" BASIS, |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
See the License for the specific language governing permissions and |
limitations under the License. |