Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nettle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitry Baryshkov
nettle
Commits
3241b8d8
Commit
3241b8d8
authored
12 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
Prepare data generation programs for compilation with the build system compiler.
parent
bb32b4fd
No related branches found
No related tags found
No related merge requests found
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
ChangeLog
+14
-0
14 additions, 0 deletions
ChangeLog
aesdata.c
+19
-25
19 additions, 25 deletions
aesdata.c
desdata.c
+10
-11
10 additions, 11 deletions
desdata.c
gcmdata.c
+1
-4
1 addition, 4 deletions
gcmdata.c
shadata.c
+1
-5
1 addition, 5 deletions
shadata.c
twofishdata.c
+32
-34
32 additions, 34 deletions
twofishdata.c
with
77 additions
and
79 deletions
ChangeLog
+
14
−
0
View file @
3241b8d8
2013-03-07 Niels Möller <nisse@lysator.liu.se>
* aesdata.c: Deleted includes of config.h and nettle-types.h. Use
unsigned char and unsigned long instead of stdint.h types.
* desdata.c: Deleted includes of config.h and desCode.h.
(main): Return 1 on invalid argument. Don't use ROR macro. Use
unsigned long instead of uint32_t, and make it work if unsigned
long is larger than 32 bits.
* gcmdata.c: Deleted include of config.h and use UNUSED macro.
* shadata.c: Likewise.
* twofishdata.c: Deleted include of nettle-types.h. Use unsigned
char instead of stdint.h types.
* x86_64/ecc-521-modp.asm: New file. 2.4 time speedup.
2013-03-06 Niels Möller <nisse@lysator.liu.se>
...
...
This diff is collapsed.
Click to expand it.
aesdata.c
+
19
−
25
View file @
3241b8d8
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include
<assert.h>
#include
<stdlib.h>
#include
<stdio.h>
#include
<string.h>
#include
"nettle-types.h"
#if 1
# define BYTE_FORMAT "0x%02x"
# define BYTE_COLUMNS 8
...
...
@@ -17,18 +11,18 @@
# define BYTE_COLUMNS 0x10
#endif
#define WORD_FORMAT "0x%08x"
#define WORD_FORMAT "0x%08
l
x"
#define WORD_COLUMNS 4
u
int8_t
sbox
[
0x100
];
u
int8_t
isbox
[
0x100
];
u
nsigned
char
sbox
[
0x100
];
u
nsigned
char
isbox
[
0x100
];
u
int8_t
gf2_log
[
0x100
];
u
int8_t
gf2_exp
[
0x100
];
u
nsigned
char
gf2_log
[
0x100
];
u
nsigned
char
gf2_exp
[
0x100
];
u
int32_t
dtable
[
4
][
0x100
];
u
int32_t
itable
[
4
][
0x100
];
u
int32_t
mtable
[
4
][
0x100
];
u
nsigned
long
dtable
[
4
][
0x100
];
u
nsigned
long
itable
[
4
][
0x100
];
u
nsigned
long
mtable
[
4
][
0x100
];
static
unsigned
xtime
(
unsigned
x
)
...
...
@@ -109,7 +103,7 @@ compute_dtable(void)
{
unsigned
s
=
sbox
[
i
];
unsigned
j
;
u
int32_t
t
=
(
(
(
s
^
xtime
(
s
))
<<
24
)
u
nsigned
long
t
=
(
(
(
s
^
xtime
(
s
))
<<
24
)
|
(
s
<<
16
)
|
(
s
<<
8
)
|
xtime
(
s
)
);
...
...
@@ -128,7 +122,7 @@ compute_itable(void)
{
unsigned
s
=
isbox
[
i
];
unsigned
j
;
u
int32_t
t
=
(
(
mult
(
s
,
0xb
)
<<
24
)
u
nsigned
long
t
=
(
(
mult
(
s
,
0xb
)
<<
24
)
|
(
mult
(
s
,
0xd
)
<<
16
)
|
(
mult
(
s
,
0x9
)
<<
8
)
|
(
mult
(
s
,
0xe
)
));
...
...
@@ -146,7 +140,7 @@ compute_mtable(void)
for
(
i
=
0
;
i
<
0x100
;
i
++
)
{
unsigned
j
;
u
int32_t
t
=
(
(
mult
(
i
,
0xb
)
<<
24
)
u
nsigned
long
t
=
(
(
mult
(
i
,
0xb
)
<<
24
)
|
(
mult
(
i
,
0xd
)
<<
16
)
|
(
mult
(
i
,
0x9
)
<<
8
)
|
(
mult
(
i
,
0xe
)
));
...
...
@@ -157,7 +151,7 @@ compute_mtable(void)
}
static
void
display_byte_table
(
const
char
*
name
,
u
int8_t
*
table
)
display_byte_table
(
const
char
*
name
,
u
nsigned
char
*
table
)
{
unsigned
i
,
j
;
...
...
@@ -174,7 +168,7 @@ display_byte_table(const char *name, uint8_t *table)
}
static
void
display_table
(
const
char
*
name
,
u
int32_t
table
[][
0x100
])
display_table
(
const
char
*
name
,
u
nsigned
long
table
[][
0x100
])
{
unsigned
i
,
j
,
k
;
...
...
This diff is collapsed.
Click to expand it.
desdata.c
+
10
−
11
View file @
3241b8d8
...
...
@@ -11,16 +11,10 @@
*
*/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include
<stdio.h>
#include
"desinfo.h"
#include
"desCode.h"
/* list of weak and semi-weak keys
...
...
@@ -65,13 +59,18 @@ int sorder[] = {
};
int
main
(
int
argc
UNUSED
,
char
**
argv
UNUSED
)
main
(
int
argc
,
char
**
argv
)
{
u
int32_t
d
,
i
,
j
,
k
,
l
,
m
,
n
,
s
;
u
nsigned
long
d
,
i
,
j
,
k
,
l
,
m
,
n
,
s
;
/* Always at least 32 bits */
char
b
[
256
],
ksr
[
56
];
if
(
argc
<=
1
)
return
1
;
switch
(
argv
[
1
][
0
]
)
{
default:
return
1
;
/*
* <<< make the key parity table >>>
*/
...
...
@@ -179,11 +178,11 @@ case 'k':
/* perform p permutation */
for
(
m
=
j
=
0
;
j
<
32
;
j
++
)
if
(
n
&
(
1
<<
(
SP
[
j
]
-
1
))
)
m
|=
(
1
<<
j
);
m
|=
(
1
UL
<<
j
);
/* rotate right (alg keeps everything rotated by 1) */
ROR
(
m
,
1
,
31
);
m
=
(
m
>>
1
)
|
((
m
&
1
)
<<
31
);
/* print it out */
printf
(
" 0x%08lx,"
,
(
long
)
m
);
printf
(
" 0x%08lx,"
,
m
);
if
(
(
d
&
3
)
==
3
)
printf
(
"
\n
"
);
}
...
...
This diff is collapsed.
Click to expand it.
gcmdata.c
+
1
−
4
View file @
3241b8d8
...
...
@@ -26,9 +26,6 @@
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02111-1301, USA.
*/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include
<stdio.h>
#include
<stdlib.h>
...
...
@@ -50,7 +47,7 @@ reduce(unsigned x)
}
int
main
(
int
argc
UNUSED
,
char
**
argv
UNUSED
)
main
(
int
argc
,
char
**
argv
)
{
unsigned
i
;
printf
(
"4-bit table:
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
shadata.c
+
1
−
5
View file @
3241b8d8
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include
<math.h>
#include
<stdio.h>
...
...
@@ -16,7 +12,7 @@ static const unsigned primes[64] =
283
,
293
,
307
,
311
};
int
main
(
int
argc
UNUSED
,
char
**
argv
UNUSED
)
int
main
(
int
argc
,
char
**
argv
)
{
int
i
;
static
const
double
third
=
1
.
0
/
3
;
...
...
This diff is collapsed.
Click to expand it.
twofishdata.c
+
32
−
34
View file @
3241b8d8
...
...
@@ -19,84 +19,82 @@
#include
<stdio.h>
#include
"nettle-stdint.h"
#define ror4(x) (((x) >> 1) | (((x) & 1) << 3))
static
u
int8_t
q0
(
uint8_t
x
)
static
u
nsigned
char
q0
(
unsigned
char
x
)
{
static
const
u
int8_t
t0
[
16
]
=
{
static
const
u
nsigned
char
t0
[
16
]
=
{
0x8
,
0x1
,
0x7
,
0xD
,
0x6
,
0xF
,
0x3
,
0x2
,
0x0
,
0xB
,
0x5
,
0x9
,
0xE
,
0xC
,
0xA
,
0x4
};
static
const
u
int8_t
t1
[
16
]
=
{
static
const
u
nsigned
char
t1
[
16
]
=
{
0xE
,
0xC
,
0xB
,
0x8
,
0x1
,
0x2
,
0x3
,
0x5
,
0xF
,
0x4
,
0xA
,
0x6
,
0x7
,
0x0
,
0x9
,
0xD
};
static
const
u
int8_t
t2
[
16
]
=
{
static
const
u
nsigned
char
t2
[
16
]
=
{
0xB
,
0xA
,
0x5
,
0xE
,
0x6
,
0xD
,
0x9
,
0x0
,
0xC
,
0x8
,
0xF
,
0x3
,
0x2
,
0x4
,
0x7
,
0x1
};
static
const
u
int8_t
t3
[
16
]
=
{
static
const
u
nsigned
char
t3
[
16
]
=
{
0xD
,
0x7
,
0xF
,
0x4
,
0x1
,
0x2
,
0x6
,
0xE
,
0x9
,
0xB
,
0x3
,
0x0
,
0x8
,
0x5
,
0xC
,
0xA
};
u
int8_t
a0
=
x
/
16
;
u
int8_t
b0
=
x
%
16
;
u
nsigned
char
a0
=
x
/
16
;
u
nsigned
char
b0
=
x
%
16
;
u
int8_t
a1
=
a0
^
b0
;
u
int8_t
b1
=
a0
^
ror4
(
b0
)
^
((
8
*
a0
)
%
16
);
u
nsigned
char
a1
=
a0
^
b0
;
u
nsigned
char
b1
=
a0
^
ror4
(
b0
)
^
((
8
*
a0
)
%
16
);
u
int8_t
a2
=
t0
[
a1
];
u
int8_t
b2
=
t1
[
b1
];
u
nsigned
char
a2
=
t0
[
a1
];
u
nsigned
char
b2
=
t1
[
b1
];
u
int8_t
a3
=
a2
^
b2
;
u
int8_t
b3
=
a2
^
ror4
(
b2
)
^
((
8
*
a2
)
%
16
);
u
nsigned
char
a3
=
a2
^
b2
;
u
nsigned
char
b3
=
a2
^
ror4
(
b2
)
^
((
8
*
a2
)
%
16
);
u
int8_t
a4
=
t2
[
a3
];
u
int8_t
b4
=
t3
[
b3
];
u
nsigned
char
a4
=
t2
[
a3
];
u
nsigned
char
b4
=
t3
[
b3
];
u
int8_t
y
=
16
*
b4
+
a4
;
u
nsigned
char
y
=
16
*
b4
+
a4
;
return
y
;
}
static
u
int8_t
q1
(
uint8_t
x
)
static
u
nsigned
char
q1
(
unsigned
char
x
)
{
static
const
u
int8_t
t0
[
16
]
=
{
static
const
u
nsigned
char
t0
[
16
]
=
{
0x2
,
0x8
,
0xB
,
0xD
,
0xF
,
0x7
,
0x6
,
0xE
,
0x3
,
0x1
,
0x9
,
0x4
,
0x0
,
0xA
,
0xC
,
0x5
};
static
const
u
int8_t
t1
[
16
]
=
{
static
const
u
nsigned
char
t1
[
16
]
=
{
0x1
,
0xE
,
0x2
,
0xB
,
0x4
,
0xC
,
0x3
,
0x7
,
0x6
,
0xD
,
0xA
,
0x5
,
0xF
,
0x9
,
0x0
,
0x8
};
static
const
u
int8_t
t2
[
16
]
=
{
static
const
u
nsigned
char
t2
[
16
]
=
{
0x4
,
0xC
,
0x7
,
0x5
,
0x1
,
0x6
,
0x9
,
0xA
,
0x0
,
0xE
,
0xD
,
0x8
,
0x2
,
0xB
,
0x3
,
0xF
};
static
const
u
int8_t
t3
[
16
]
=
{
static
const
u
nsigned
char
t3
[
16
]
=
{
0xB
,
0x9
,
0x5
,
0x1
,
0xC
,
0x3
,
0xD
,
0xE
,
0x6
,
0x4
,
0x7
,
0xF
,
0x2
,
0x0
,
0x8
,
0xA
};
u
int8_t
a0
=
x
/
16
;
u
int8_t
b0
=
x
%
16
;
u
nsigned
char
a0
=
x
/
16
;
u
nsigned
char
b0
=
x
%
16
;
u
int8_t
a1
=
a0
^
b0
;
u
int8_t
b1
=
a0
^
ror4
(
b0
)
^
((
8
*
a0
)
%
16
);
u
nsigned
char
a1
=
a0
^
b0
;
u
nsigned
char
b1
=
a0
^
ror4
(
b0
)
^
((
8
*
a0
)
%
16
);
u
int8_t
a2
=
t0
[
a1
];
u
int8_t
b2
=
t1
[
b1
];
u
nsigned
char
a2
=
t0
[
a1
];
u
nsigned
char
b2
=
t1
[
b1
];
u
int8_t
a3
=
a2
^
b2
;
u
int8_t
b3
=
a2
^
ror4
(
b2
)
^
((
8
*
a2
)
%
16
);
u
nsigned
char
a3
=
a2
^
b2
;
u
nsigned
char
b3
=
a2
^
ror4
(
b2
)
^
((
8
*
a2
)
%
16
);
u
int8_t
a4
=
t2
[
a3
];
u
int8_t
b4
=
t3
[
b3
];
u
nsigned
char
a4
=
t2
[
a3
];
u
nsigned
char
b4
=
t3
[
b3
];
u
int8_t
y
=
16
*
b4
+
a4
;
u
nsigned
char
y
=
16
*
b4
+
a4
;
return
y
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment