Commit 077695fe authored by Niels Möller's avatar Niels Möller

Constified.

Rev: src/symmetric/desCode.h:1.4
Rev: src/symmetric/desKerb.c:1.3
Rev: src/symmetric/desTest.c:1.6
Rev: src/symmetric/desUtil.c:1.3
parent 2d429c0f
/* /* desCode.h
* des - fast & portable DES encryption & decryption. *
* $Id$ */
/* des - fast & portable DES encryption & decryption.
* Copyright (C) 1992 Dana L. How * Copyright (C) 1992 Dana L. How
* Please see the file `README' for the complete copyright notice. * Please see the file `descore.README' for the complete copyright notice.
*/ */
#include "des.h" #include "des.h"
#include "RCSID.h" #include "RCSID.h"
...@@ -344,7 +345,7 @@ extern UINT32 des_keymap[], des_bigmap[]; ...@@ -344,7 +345,7 @@ extern UINT32 des_keymap[], des_bigmap[];
\ \
void \ void \
NAME(REGISTER BYTE *D, \ NAME(REGISTER BYTE *D, \
REGISTER UINT32 *r, \ REGISTER const UINT32 *r, \
REGISTER const UINT8 *s) \ REGISTER const UINT8 *s) \
{ \ { \
register UINT32 x, y, z; \ register UINT32 x, y, z; \
...@@ -380,7 +381,7 @@ NAME(REGISTER BYTE *D, \ ...@@ -380,7 +381,7 @@ NAME(REGISTER BYTE *D, \
\ \
void \ void \
NAME(REGISTER BYTE *D, \ NAME(REGISTER BYTE *D, \
REGISTER UINT32 *r, \ REGISTER const UINT32 *r, \
REGISTER const UINT8 *s) \ REGISTER const UINT8 *s) \
{ \ { \
register UINT32 x, y, z; \ register UINT32 x, y, z; \
......
/* /*
* des - fast & portable DES encryption & decryption. * des - fast & portable DES encryption & decryption.
* Copyright (C) 1992 Dana L. How * Copyright (C) 1992 Dana L. How
* Please see the file `README' for the complete copyright notice. * Please see the file `descore.README' for the complete copyright notice.
*/ */
#include "des.h" #include "des.h"
...@@ -16,7 +16,7 @@ DesFunc *DesCryptFuncs[2] = { DesSmallFipsDecrypt, DesSmallFipsEncrypt }; ...@@ -16,7 +16,7 @@ DesFunc *DesCryptFuncs[2] = { DesSmallFipsDecrypt, DesSmallFipsEncrypt };
/* kerberos-compatible key schedule function */ /* kerberos-compatible key schedule function */
int int
des_key_sched(UINT8 *k, UINT32 *s) des_key_sched(const UINT8 *k, UINT32 *s)
{ {
return DesMethod(s, k); return DesMethod(s, k);
} }
...@@ -24,7 +24,7 @@ des_key_sched(UINT8 *k, UINT32 *s) ...@@ -24,7 +24,7 @@ des_key_sched(UINT8 *k, UINT32 *s)
/* kerberos-compatible des coding function */ /* kerberos-compatible des coding function */
int int
des_ecb_encrypt(UINT8 *s, UINT8 *d, UINT32 *r, int e) des_ecb_encrypt(const UINT8 *s, UINT8 *d, const UINT32 *r, int e)
{ {
(*DesCryptFuncs[e])(d, r, s); (*DesCryptFuncs[e])(d, r, s);
return 0; return 0;
......
/* /* desTest.c
* des - fast & portable DES encryption & decryption. *
* Copyright (C) 1992 Dana L. How * Exercise the DES routines and collect performance statistics.
* Please see the file `README' for the complete copyright notice.
* *
* Exercise the DES routines and collect performance statistics. * $ID:$ */
/* des - fast & portable DES encryption & decryption.
* Copyright (C) 1992 Dana L. How
* Please see the file `descore.README' for the complete copyright notice.
*/ */
#ifndef lint #ifndef lint
...@@ -15,15 +18,16 @@ char desTest_cRcs[] = "$Id$"; ...@@ -15,15 +18,16 @@ char desTest_cRcs[] = "$Id$";
/* define now(w) to be the elapsed time in hundredths of a second */ /* define now(w) to be the elapsed time in hundredths of a second */
#if 1
/* FIXME: Let autoconf look for getrusage */
#define now(w) 0;
#else /* false */
#ifndef __NT__ #ifndef __NT__
#include <sys/time.h> #include <sys/time.h>
#include <sys/resource.h> #include <sys/resource.h>
#include <unistd.h> #include <unistd.h>
#if 1
/* FIXME: Let autoconf look for getrusage */
#define now(w) 0;
#else /* false */
/* extern getrusage(); */ /* extern getrusage(); */
static struct rusage usage; static struct rusage usage;
#define now(w) ( \ #define now(w) ( \
...@@ -59,9 +63,7 @@ UINT8 cipher[8], output[8]; ...@@ -59,9 +63,7 @@ UINT8 cipher[8], output[8];
/* noisy interfaces to the routines under test */ /* noisy interfaces to the routines under test */
static void static void method(const UINT8 *key)
method(key)
UINT8 *key;
{ {
int j; int j;
...@@ -74,8 +76,7 @@ UINT8 *key; ...@@ -74,8 +76,7 @@ UINT8 *key;
} }
static void static void
encode(src, dst) encode(const UINT8 *src, UINT8 *dst)
UINT8 *src, *dst;
{ {
int j; int j;
...@@ -92,8 +93,7 @@ UINT8 *src, *dst; ...@@ -92,8 +93,7 @@ UINT8 *src, *dst;
} }
static void static void
decode(src, dst, check) decode(const UINT8 *src, UINT8 *dst, const UINT8 *check)
UINT8 *src, *dst, *check;
{ {
int j; int j;
...@@ -116,9 +116,11 @@ UINT8 *src, *dst, *check; ...@@ -116,9 +116,11 @@ UINT8 *src, *dst, *check;
/* run the tests */ /* run the tests */
int int
main(int argc, char **argv) main(int argc UNUSED, char **argv UNUSED)
{ {
int j, m, e, n; int j, m, e, n;
/* FIXME: Don't use this untyped function pointer. */
void (*f)(); void (*f)();
static char * expect[] = { static char * expect[] = {
"57 99 F7 2A D2 3F AE 4C", "9C C6 2D F4 3B 6E ED 74", "57 99 F7 2A D2 3F AE 4C", "9C C6 2D F4 3B 6E ED 74",
...@@ -126,14 +128,15 @@ main(int argc, char **argv) ...@@ -126,14 +128,15 @@ main(int argc, char **argv)
"43 5C FF C5 68 B3 70 1D", "25 DD AC 3E 96 17 64 67", "43 5C FF C5 68 B3 70 1D", "25 DD AC 3E 96 17 64 67",
"80 B5 07 E1 E6 A7 47 3D", "3F A4 0E 8A 98 4D 48 15", "80 B5 07 E1 E6 A7 47 3D", "3F A4 0E 8A 98 4D 48 15",
}; };
static void (*funcs[])() = { /* static void (*funcs[])() = { */
DesQuickCoreEncrypt, DesQuickFipsEncrypt, static DesFunc *funcs[] = {
DesSmallCoreEncrypt, DesSmallFipsEncrypt, DesQuickCoreEncrypt, DesQuickFipsEncrypt,
DesQuickCoreDecrypt, DesQuickFipsDecrypt, DesSmallCoreEncrypt, DesSmallFipsEncrypt,
DesSmallCoreDecrypt, DesSmallFipsDecrypt }; DesQuickCoreDecrypt, DesQuickFipsDecrypt,
DesSmallCoreDecrypt, DesSmallFipsDecrypt };
static char * names[] = { static char * names[] = {
"QuickCore", "QuickFips", "QuickCore", "QuickFips",
"SmallCore", "SmallFips" }; "SmallCore", "SmallFips" };
n = 0; n = 0;
DesQuickInit(); DesQuickInit();
......
/* /* desUtil.c
* des - fast & portable DES encryption & decryption. *
* $id:$ */
/* des - fast & portable DES encryption & decryption.
* Copyright (C) 1992 Dana L. How * Copyright (C) 1992 Dana L. How
* Please see the file `README' for the complete copyright notice. * Please see the file `descore.README' for the complete copyright notice.
*/ */
#include "desCode.h" #include "desCode.h"
...@@ -28,7 +31,7 @@ RCSID2(ego, "\n\nFast DES Library Copyright (c) 1991 Dana L. How\n\n"); ...@@ -28,7 +31,7 @@ RCSID2(ego, "\n\nFast DES Library Copyright (c) 1991 Dana L. How\n\n");
/* set up the method list from the key */ /* set up the method list from the key */
int int
DesMethod(UINT32 *method, UINT8 *k) DesMethod(UINT32 *method, const UINT8 *k)
{ {
register UINT32 n, w; register UINT32 n, w;
register char * b0, * b1; register char * b0, * b1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment