summaryrefslogtreecommitdiff
path: root/desdata.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2013-03-07 14:43:40 +0100
committerNiels Möller <nisse@lysator.liu.se>2013-03-07 14:43:40 +0100
commit3241b8d896f00be5cefc42651e48add9bfd79c51 (patch)
tree3a1333db0d4f22fdd0bf1fc5a1c1d19266b29c3a /desdata.c
parentbb32b4fd89132a15909ebba66ba9b045bdd57fc1 (diff)
downloadnettle-3241b8d896f00be5cefc42651e48add9bfd79c51.tar.gz
Prepare data generation programs for compilation with the build system compiler.
Diffstat (limited to 'desdata.c')
-rw-r--r--desdata.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/desdata.c b/desdata.c
index 2d46b955..f1c65043 100644
--- a/desdata.c
+++ b/desdata.c
@@ -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)
{
- uint32_t d, i, j, k, l, m, n, s;
+ unsigned 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 |= (1UL << 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");
}