Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Wim Lewis
nettle
Commits
5bbf1a4d
Commit
5bbf1a4d
authored
Jun 08, 2004
by
Niels Möller
Browse files
Renamed log and ilog to gf2_log and gf2_exp.
Rev: src/nettle/aesdata.c:1.4
parent
8a6aff6e
Changes
1
Hide whitespace changes
Inline
Side-by-side
aesdata.c
View file @
5bbf1a4d
...
...
@@ -23,8 +23,8 @@
uint8_t
sbox
[
0x100
];
uint8_t
isbox
[
0x100
];
uint8_t
log
[
0x100
];
uint8_t
ilog
[
0x100
];
uint8_t
gf2_
log
[
0x100
];
uint8_t
gf2_exp
[
0x100
];
uint32_t
dtable
[
4
][
0x100
];
uint32_t
itable
[
4
][
0x100
];
...
...
@@ -51,30 +51,30 @@ compute_log(void)
unsigned
i
=
0
;
unsigned
x
=
1
;
memset
(
log
,
0
,
0x100
);
memset
(
gf2_
log
,
0
,
0x100
);
for
(
i
=
0
;
i
<
0x100
;
i
++
,
x
=
x
^
xtime
(
x
))
{
ilog
[
i
]
=
x
;
log
[
x
]
=
i
;
gf2_exp
[
i
]
=
x
;
gf2_
log
[
x
]
=
i
;
}
/* Invalid. */
log
[
0
]
=
0
;
/* The loop above sets log[1] = 0xff, which is correct,
* but log[1] = 0 is nicer. */
log
[
1
]
=
0
;
gf2_
log
[
0
]
=
0
;
/* The loop above sets
gf2_
log[1] = 0xff, which is correct,
* but
gf2_
log[1] = 0 is nicer. */
gf2_
log
[
1
]
=
0
;
}
static
unsigned
mult
(
unsigned
a
,
unsigned
b
)
{
return
(
a
&&
b
)
?
ilog
[
(
log
[
a
]
+
log
[
b
])
%
255
]
:
0
;
return
(
a
&&
b
)
?
gf2_exp
[
(
gf2_
log
[
a
]
+
gf2_
log
[
b
])
%
255
]
:
0
;
}
static
unsigned
invert
(
unsigned
x
)
{
return
x
?
ilog
[
0xff
-
log
[
x
]]
:
0
;
return
x
?
gf2_exp
[
0xff
-
gf2_
log
[
x
]]
:
0
;
}
static
unsigned
...
...
@@ -188,8 +188,8 @@ main(int argc, char **argv)
compute_log
();
if
(
argc
==
1
)
{
display_byte_table
(
"log"
,
log
);
display_byte_table
(
"
ilog"
,
ilog
);
display_byte_table
(
"
gf2_
log"
,
gf2_
log
);
display_byte_table
(
"
gf2_exp"
,
gf2_exp
);
compute_sbox
();
display_byte_table
(
"sbox"
,
sbox
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment