-# $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
CDIAGFLAGS+= -Wunused
CDIAGFLAGS+= -Wsign-compare
CDIAGFLAGS+= -Wbounded
-CDIAGFLAGS+= -Wshadow
+#CDIAGFLAGS+= -Wshadow
REGRESS_TARGETS= run-regress-${PROG}
.PATH: ${DIR}/crypto/
run-regress-${PROG}: ${PROG}
- ./${PROG} | diff - ${PROG}.txt
+ ./${PROG} | diff - ${.CURDIR}/${PROG}.txt
.include <bsd.regress.mk>
+/*-
+ * 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;
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++) {
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,
-# $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
CDIAGFLAGS+= -Wunused
CDIAGFLAGS+= -Wsign-compare
CDIAGFLAGS+= -Wbounded
-CDIAGFLAGS+= -Wshadow
+#CDIAGFLAGS+= -Wshadow
REGRESS_TARGETS= run-regress-${PROG}
.PATH: ${DIR}/crypto/
run-regress-${PROG}: ${PROG}
- ./${PROG} | diff - ${PROG}.txt
+ ./${PROG} | diff - ${.CURDIR}/${PROG}.txt
.include <bsd.regress.mk>
+/*-
+ * 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;
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);
-# $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
CDIAGFLAGS+= -Wunused
CDIAGFLAGS+= -Wsign-compare
CDIAGFLAGS+= -Wbounded
-CDIAGFLAGS+= -Wshadow
+#CDIAGFLAGS+= -Wshadow
REGRESS_TARGETS= run-regress-${PROG}
.PATH: ${DIR}/crypto/
run-regress-${PROG}: ${PROG}
- ./${PROG} | diff - ${PROG}.txt
+ ./${PROG} | diff - ${.CURDIR}/${PROG}.txt
.include <bsd.regress.mk>
+/*-
+ * 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;
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;