summaryrefslogtreecommitdiff
path: root/regress/sys/crypto
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2008-09-02 12:55:45 +0000
committerDamien Miller <djm@cvs.openbsd.org>2008-09-02 12:55:45 +0000
commitee2a82e80d8ecc5ec99d668a3d6b9c289ba4eb5e (patch)
tree381d58e915ac1a8492613d6a23234c67eef29a5f /regress/sys/crypto
parentaf8762c8bd5971c07c227cc092130f4235b21274 (diff)
fix builds for when obj/ present
fix gcc warnings add licenses ok damien@
Diffstat (limited to 'regress/sys/crypto')
-rw-r--r--regress/sys/crypto/cmac/Makefile6
-rw-r--r--regress/sys/crypto/cmac/cmac_test.c25
-rw-r--r--regress/sys/crypto/hmac/Makefile6
-rw-r--r--regress/sys/crypto/hmac/hmac_test.c20
-rw-r--r--regress/sys/crypto/key_wrap/Makefile6
-rw-r--r--regress/sys/crypto/key_wrap/key_wrap_test.c24
6 files changed, 71 insertions, 16 deletions
diff --git a/regress/sys/crypto/cmac/Makefile b/regress/sys/crypto/cmac/Makefile
index 03e87879a9c..541697d30c0 100644
--- a/regress/sys/crypto/cmac/Makefile
+++ b/regress/sys/crypto/cmac/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.1 2008/08/12 15:49:07 damien Exp $
+# $OpenBSD: Makefile,v 1.2 2008/09/02 12:55:44 djm Exp $
DIR=${.CURDIR}/../../../../sys
@@ -13,7 +13,7 @@ CDIAGFLAGS+= -Wmissing-prototypes
CDIAGFLAGS+= -Wunused
CDIAGFLAGS+= -Wsign-compare
CDIAGFLAGS+= -Wbounded
-CDIAGFLAGS+= -Wshadow
+#CDIAGFLAGS+= -Wshadow
REGRESS_TARGETS= run-regress-${PROG}
@@ -22,6 +22,6 @@ CFLAGS+= -I${DIR}
.PATH: ${DIR}/crypto/
run-regress-${PROG}: ${PROG}
- ./${PROG} | diff - ${PROG}.txt
+ ./${PROG} | diff - ${.CURDIR}/${PROG}.txt
.include <bsd.regress.mk>
diff --git a/regress/sys/crypto/cmac/cmac_test.c b/regress/sys/crypto/cmac/cmac_test.c
index 5241e780903..b2ffb2a8ac4 100644
--- a/regress/sys/crypto/cmac/cmac_test.c
+++ b/regress/sys/crypto/cmac/cmac_test.c
@@ -1,8 +1,26 @@
+/*-
+ * Copyright (c) 2008 Damien Bergamini <damien.bergamini@free.fr>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
#include <sys/param.h>
#include <crypto/rijndael.h>
#include <crypto/cmac.h>
+#include <stdio.h>
-void print_hex(char *str, unsigned char *buf, int len)
+static void
+print_hex(char *str, unsigned char *buf, int len)
{
int i;
@@ -15,7 +33,8 @@ void print_hex(char *str, unsigned char *buf, int len)
if ( (i % 16) != 0 ) printf("\n");
}
-void print128(unsigned char *bytes)
+static void
+print128(unsigned char *bytes)
{
int j;
for (j=0; j<16;j++) {
@@ -27,7 +46,7 @@ void print128(unsigned char *bytes)
int
main(void)
{
- unsigned char L[16], K1[16], K2[16], T[16], TT[12];
+ unsigned char T[16];
unsigned char M[64] = {
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
diff --git a/regress/sys/crypto/hmac/Makefile b/regress/sys/crypto/hmac/Makefile
index f31af2246e3..5515c659c52 100644
--- a/regress/sys/crypto/hmac/Makefile
+++ b/regress/sys/crypto/hmac/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.1 2008/08/12 15:49:08 damien Exp $
+# $OpenBSD: Makefile,v 1.2 2008/09/02 12:55:44 djm Exp $
DIR=${.CURDIR}/../../../../sys
@@ -13,7 +13,7 @@ CDIAGFLAGS+= -Wmissing-prototypes
CDIAGFLAGS+= -Wunused
CDIAGFLAGS+= -Wsign-compare
CDIAGFLAGS+= -Wbounded
-CDIAGFLAGS+= -Wshadow
+#CDIAGFLAGS+= -Wshadow
REGRESS_TARGETS= run-regress-${PROG}
@@ -22,6 +22,6 @@ CFLAGS+= -I${DIR}
.PATH: ${DIR}/crypto/
run-regress-${PROG}: ${PROG}
- ./${PROG} | diff - ${PROG}.txt
+ ./${PROG} | diff - ${.CURDIR}/${PROG}.txt
.include <bsd.regress.mk>
diff --git a/regress/sys/crypto/hmac/hmac_test.c b/regress/sys/crypto/hmac/hmac_test.c
index 83495aa8e83..7a0d34c2883 100644
--- a/regress/sys/crypto/hmac/hmac_test.c
+++ b/regress/sys/crypto/hmac/hmac_test.c
@@ -1,10 +1,27 @@
+/*-
+ * Copyright (c) 2008 Damien Bergamini <damien.bergamini@free.fr>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
#include <stdio.h>
#include <crypto/md5.h>
#include <crypto/sha1.h>
#include <crypto/sha2.h>
#include <crypto/hmac.h>
+#include <string.h>
-void
+static void
print_hex(unsigned char *buf, int len)
{
int i;
@@ -22,7 +39,6 @@ main(void)
HMAC_SHA1_CTX sha1;
HMAC_SHA256_CTX sha256;
u_int8_t data[50], output[32];
- int i;
HMAC_MD5_Init(&md5, "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", 16);
HMAC_MD5_Update(&md5, "Hi There", 8);
diff --git a/regress/sys/crypto/key_wrap/Makefile b/regress/sys/crypto/key_wrap/Makefile
index 2be26cc4c47..e63d0ff0139 100644
--- a/regress/sys/crypto/key_wrap/Makefile
+++ b/regress/sys/crypto/key_wrap/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.1 2008/08/12 15:49:08 damien Exp $
+# $OpenBSD: Makefile,v 1.2 2008/09/02 12:55:44 djm Exp $
DIR=${.CURDIR}/../../../../sys
@@ -13,7 +13,7 @@ CDIAGFLAGS+= -Wmissing-prototypes
CDIAGFLAGS+= -Wunused
CDIAGFLAGS+= -Wsign-compare
CDIAGFLAGS+= -Wbounded
-CDIAGFLAGS+= -Wshadow
+#CDIAGFLAGS+= -Wshadow
REGRESS_TARGETS= run-regress-${PROG}
@@ -22,6 +22,6 @@ CFLAGS+= -I${DIR}
.PATH: ${DIR}/crypto/
run-regress-${PROG}: ${PROG}
- ./${PROG} | diff - ${PROG}.txt
+ ./${PROG} | diff - ${.CURDIR}/${PROG}.txt
.include <bsd.regress.mk>
diff --git a/regress/sys/crypto/key_wrap/key_wrap_test.c b/regress/sys/crypto/key_wrap/key_wrap_test.c
index dfd990fdb68..52e34e0bae3 100644
--- a/regress/sys/crypto/key_wrap/key_wrap_test.c
+++ b/regress/sys/crypto/key_wrap/key_wrap_test.c
@@ -1,8 +1,28 @@
+/*-
+ * Copyright (c) 2008 Damien Bergamini <damien.bergamini@free.fr>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <string.h>
#include <stdio.h>
#include <crypto/rijndael.h>
#include <crypto/key_wrap.h>
void
+ovbcopy(const void *src, void *dst, size_t len);
+
+static void
print_hex(const char *str, unsigned char *buf, int len)
{
int i;
@@ -23,13 +43,13 @@ ovbcopy(const void *src, void *dst, size_t len)
memmove(dst, src, len);
}
-void
+static void
do_test(u_int kek_len, u_int data_len)
{
aes_key_wrap_ctx ctx;
u_int8_t kek[32], data[32];
u_int8_t output[64];
- int i;
+ u_int i;
for (i = 0; i < kek_len; i++)
kek[i] = i;