Sat May 14 16:26:23 2011 UTC ()
Turn on WARNS to 4, so that magically -std=gnu99 gets turned on and fix
the few warnings. Since the kernel uses c99, this makes kernel code that
uses c99 features compile.


(christos)
diff -r1.7 -r1.8 src/regress/sys/crypto/Makefile.inc
diff -r1.5 -r1.6 src/regress/sys/crypto/blowfish/bftest.c
diff -r1.7 -r1.8 src/regress/sys/crypto/rijndael/rijndaeltest.c

cvs diff -r1.7 -r1.8 src/regress/sys/crypto/Attic/Makefile.inc (expand / switch to unified diff)

--- src/regress/sys/crypto/Attic/Makefile.inc 2002/09/18 04:16:01 1.7
+++ src/regress/sys/crypto/Attic/Makefile.inc 2011/05/14 16:26:23 1.8
@@ -1,20 +1,20 @@ @@ -1,20 +1,20 @@
1# $NetBSD: Makefile.inc,v 1.7 2002/09/18 04:16:01 lukem Exp $ 1# $NetBSD: Makefile.inc,v 1.8 2011/05/14 16:26:23 christos Exp $
2# $KAME: Makefile.inc,v 1.3 2000/11/08 05:58:24 itojun Exp $ 2# $KAME: Makefile.inc,v 1.3 2000/11/08 05:58:24 itojun Exp $
3 3
4.if !target(regress) 4.if !target(regress)
5.include <bsd.own.mk> 5.include <bsd.own.mk>
6 6
7SYSDIR= ${NETBSDSRCDIR}/sys 7SYSDIR= ${NETBSDSRCDIR}/sys
8WARNS?= 1 8WARNS?= 4
9 9
10regress: 10regress:
11 @./${PROG} 11 @./${PROG}
12 12
13BENCHROUNDS?= 10000 13BENCHROUNDS?= 10000
14 14
15benchmark: 15benchmark:
16 @time ./${PROG} ${BENCHROUNDS} 16 @time ./${PROG} ${BENCHROUNDS}
17.endif 17.endif
18 18
19# do not install regression test programs 19# do not install regression test programs
20proginstall:: 20proginstall::

cvs diff -r1.5 -r1.6 src/regress/sys/crypto/blowfish/Attic/bftest.c (expand / switch to unified diff)

--- src/regress/sys/crypto/blowfish/Attic/bftest.c 2005/02/06 06:05:19 1.5
+++ src/regress/sys/crypto/blowfish/Attic/bftest.c 2011/05/14 16:26:23 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bftest.c,v 1.5 2005/02/06 06:05:19 perry Exp $ */ 1/* $NetBSD: bftest.c,v 1.6 2011/05/14 16:26:23 christos Exp $ */
2/* $KAME: bftest.c,v 1.3 2000/11/08 05:58:24 itojun Exp $ */ 2/* $KAME: bftest.c,v 1.3 2000/11/08 05:58:24 itojun Exp $ */
3 3
4/* 4/*
5 * Copyright (C) 2000 WIDE Project. 5 * Copyright (C) 2000 WIDE Project.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -87,27 +87,27 @@ @@ -87,27 +87,27 @@
87 * [including the GNU Public Licence.] 87 * [including the GNU Public Licence.]
88 */ 88 */
89 89
90#include <sys/cdefs.h> 90#include <sys/cdefs.h>
91#include <sys/types.h> 91#include <sys/types.h>
92 92
93#include <stdio.h> 93#include <stdio.h>
94#include <string.h> 94#include <string.h>
95#include <stdlib.h> 95#include <stdlib.h>
96#include <unistd.h> 96#include <unistd.h>
97 97
98#include <crypto/blowfish/blowfish.h> 98#include <crypto/blowfish/blowfish.h>
99 99
100static char *bf_key[2]={ 100static const char *bf_key[2]={
101 "abcdefghijklmnopqrstuvwxyz", 101 "abcdefghijklmnopqrstuvwxyz",
102 "Who is John Galt?" 102 "Who is John Galt?"
103}; 103};
104 104
105/* big endian */ 105/* big endian */
106static const char *bf_plain[2] = { 106static const char *bf_plain[2] = {
107 "424c4f5746495348", "fedcba9876543210" 107 "424c4f5746495348", "fedcba9876543210"
108}; 108};
109 109
110static const char *bf_cipher[2] = { 110static const char *bf_cipher[2] = {
111 "324ed0fef413a203", "cc91732b8022f684" 111 "324ed0fef413a203", "cc91732b8022f684"
112}; 112};
113 113
@@ -155,27 +155,28 @@ main(argc, argv) @@ -155,27 +155,28 @@ main(argc, argv)
155 int n, error = 0; 155 int n, error = 0;
156 BF_KEY key; 156 BF_KEY key;
157 BF_LONG data[2], plain[2], cipher[2];  157 BF_LONG data[2], plain[2], cipher[2];
158 int rounds; 158 int rounds;
159 159
160 if (argc > 1) 160 if (argc > 1)
161 rounds = atoi(argv[1]); 161 rounds = atoi(argv[1]);
162 else 162 else
163 rounds = 1; 163 rounds = 1;
164 164
165 printf("testing blowfish in raw ecb mode\n"); 165 printf("testing blowfish in raw ecb mode\n");
166again: 166again:
167 for (n = 0; n < 2; n++) { 167 for (n = 0; n < 2; n++) {
168 BF_set_key(&key, strlen(bf_key[n]), (unsigned char *)bf_key[n]); 168 BF_set_key(&key, strlen(bf_key[n]),
 169 (const unsigned char *)bf_key[n]);
169 170
170 hex2bin((u_int8_t *)plain, bf_plain[n]); 171 hex2bin((u_int8_t *)plain, bf_plain[n]);
171 hex2bin((u_int8_t *)cipher, bf_cipher[n]); 172 hex2bin((u_int8_t *)cipher, bf_cipher[n]);
172 173
173 memcpy(data, plain, 8); 174 memcpy(data, plain, 8);
174 175
175 data[0] = (BF_LONG)ntohl(data[0]); 176 data[0] = (BF_LONG)ntohl(data[0]);
176 data[1] = (BF_LONG)ntohl(data[1]); 177 data[1] = (BF_LONG)ntohl(data[1]);
177 BF_encrypt(data, &key); 178 BF_encrypt(data, &key);
178 data[0] = (BF_LONG)htonl(data[0]); 179 data[0] = (BF_LONG)htonl(data[0]);
179 data[1] = (BF_LONG)htonl(data[1]); 180 data[1] = (BF_LONG)htonl(data[1]);
180 if (memcmp(data, cipher, 8) != 0) { 181 if (memcmp(data, cipher, 8) != 0) {
181 printf("BF_encrypt error encrypting\n"); 182 printf("BF_encrypt error encrypting\n");

cvs diff -r1.7 -r1.8 src/regress/sys/crypto/rijndael/Attic/rijndaeltest.c (expand / switch to unified diff)

--- src/regress/sys/crypto/rijndael/Attic/rijndaeltest.c 2006/05/12 01:56:39 1.7
+++ src/regress/sys/crypto/rijndael/Attic/rijndaeltest.c 2011/05/14 16:26:23 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rijndaeltest.c,v 1.7 2006/05/12 01:56:39 mrg Exp $ */ 1/* $NetBSD: rijndaeltest.c,v 1.8 2011/05/14 16:26:23 christos Exp $ */
2/* $KAME: rijndaeltest.c,v 1.7 2001/05/27 01:56:45 itojun Exp $ */ 2/* $KAME: rijndaeltest.c,v 1.7 2001/05/27 01:56:45 itojun Exp $ */
3 3
4/* 4/*
5 * Copyright (C) 2000 WIDE Project. 5 * Copyright (C) 2000 WIDE Project.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -82,27 +82,27 @@ struct { @@ -82,27 +82,27 @@ struct {
82 NULL, NULL, NULL, 82 NULL, NULL, NULL,
83 }, 83 },
84}; 84};
85 85
86static void hex2key(u_int8_t *, size_t, const char *); 86static void hex2key(u_int8_t *, size_t, const char *);
87int main(int, char **); 87int main(int, char **);
88 88
89static void 89static void
90hex2key(p, l, s) 90hex2key(p, l, s)
91 u_int8_t *p; 91 u_int8_t *p;
92 size_t l; 92 size_t l;
93 const char *s; 93 const char *s;
94{ 94{
95 int i; 95 size_t i;
96 u_int v; 96 u_int v;
97 97
98 for (i = 0; i < l && *s; i++) { 98 for (i = 0; i < l && *s; i++) {
99 sscanf(s, "%02x", &v); 99 sscanf(s, "%02x", &v);
100 *p++ = v & 0xff; 100 *p++ = v & 0xff;
101 s += 2; 101 s += 2;
102 } 102 }
103 103
104 if (*s) { 104 if (*s) {
105 errx(1, "hex2key overrun"); 105 errx(1, "hex2key overrun");
106 /*NOTREACHED*/ 106 /*NOTREACHED*/
107 } 107 }
108} 108}