summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorderaadt <>2004-02-04 21:31:10 +0000
committerderaadt <>2004-02-04 21:31:10 +0000
commitacb76436eeac44bb2432cf37441f3eba95b589a5 (patch)
treead3c701ffebb1a5b9484a42f00c30f291be79ad1
parentb5f1b51f776a16e2dfaf65d9bb74fbc361a8e032 (diff)
downloadopenbsd-acb76436eeac44bb2432cf37441f3eba95b589a5.tar.gz
openbsd-acb76436eeac44bb2432cf37441f3eba95b589a5.tar.bz2
openbsd-acb76436eeac44bb2432cf37441f3eba95b589a5.zip
remove some debug code and cleanup..
-rw-r--r--src/lib/libcrypto/engine/hw_cryptodev.c24
-rw-r--r--src/lib/libssl/src/crypto/engine/hw_cryptodev.c24
2 files changed, 12 insertions, 36 deletions
diff --git a/src/lib/libcrypto/engine/hw_cryptodev.c b/src/lib/libcrypto/engine/hw_cryptodev.c
index b1eb38325d..2fe84a5002 100644
--- a/src/lib/libcrypto/engine/hw_cryptodev.c
+++ b/src/lib/libcrypto/engine/hw_cryptodev.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (c) 2002-2004 Theo de Raadt
2 * Copyright (c) 2002 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2002 Bob Beck <beck@openbsd.org>
3 * Copyright (c) 2002 Theo de Raadt
4 * Copyright (c) 2002 Markus Friedl 4 * Copyright (c) 2002 Markus Friedl
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
@@ -55,8 +55,6 @@ ENGINE_load_cryptodev(void)
55#include <crypto/cryptodev.h> 55#include <crypto/cryptodev.h>
56#include <sys/ioctl.h> 56#include <sys/ioctl.h>
57 57
58#include <ssl/aes.h>
59
60#include <errno.h> 58#include <errno.h>
61#include <stdio.h> 59#include <stdio.h>
62#include <unistd.h> 60#include <unistd.h>
@@ -70,6 +68,9 @@ ENGINE_load_cryptodev(void)
70#include <sys/sysctl.h> 68#include <sys/sysctl.h>
71#include <machine/cpu.h> 69#include <machine/cpu.h>
72#include <machine/specialreg.h> 70#include <machine/specialreg.h>
71
72#include <ssl/aes.h>
73
73static int check_viac3aes(void); 74static int check_viac3aes(void);
74#endif 75#endif
75 76
@@ -261,7 +262,7 @@ get_cryptodev_ciphers(const int **cnids)
261 * On i386, always check for the VIA C3 AES instructions; 262 * On i386, always check for the VIA C3 AES instructions;
262 * even if /dev/crypto is disabled. 263 * even if /dev/crypto is disabled.
263 */ 264 */
264 if (check_viac3aes() == 1) { 265 if (check_viac3aes() >= 1) {
265 int have_NID_aes_128_cbc = 0; 266 int have_NID_aes_128_cbc = 0;
266 int have_NID_aes_192_cbc = 0; 267 int have_NID_aes_192_cbc = 0;
267 int have_NID_aes_256_cbc = 0; 268 int have_NID_aes_256_cbc = 0;
@@ -709,16 +710,9 @@ xcrypt_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
709 const unsigned char *iv, int enc) 710 const unsigned char *iv, int enc)
710{ 711{
711 AES_KEY *k = ctx->cipher_data; 712 AES_KEY *k = ctx->cipher_data;
712 u_long *kk = (u_long *)key;
713 int i; 713 int i;
714 714
715 bzero(k, sizeof *k); 715 bzero(k, sizeof *k);
716#ifdef notdef
717 for (i = 0; i < ctx->key_len / 4; i++)
718 printf("%08x ", kk[i]);
719 printf("\n");
720#endif
721
722 if (enc) 716 if (enc)
723 AES_set_encrypt_key(key, ctx->key_len * 8, k); 717 AES_set_encrypt_key(key, ctx->key_len * 8, k);
724 else 718 else
@@ -728,12 +722,6 @@ xcrypt_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
728 for (i = 0; i < 4 * (AES_MAXNR + 1); i++) 722 for (i = 0; i < 4 * (AES_MAXNR + 1); i++)
729 k->rd_key[i] = htonl(k->rd_key[i]); 723 k->rd_key[i] = htonl(k->rd_key[i]);
730 724
731#ifdef notdef
732 for (i = 0; i < 4 * (AES_MAXNR + 1); i++)
733 printf("%08x ", k->rd_key[i]);
734 printf("\n");
735#endif
736
737 return (1); 725 return (1);
738} 726}
739 727
@@ -770,7 +758,7 @@ check_viac3aes(void)
770 cryptodev_aes_256_cbc.do_cipher = xcrypt_cipher; 758 cryptodev_aes_256_cbc.do_cipher = xcrypt_cipher;
771 cryptodev_aes_256_cbc.cleanup = xcrypt_cleanup; 759 cryptodev_aes_256_cbc.cleanup = xcrypt_cleanup;
772 cryptodev_aes_256_cbc.ctx_size = sizeof(AES_KEY); 760 cryptodev_aes_256_cbc.ctx_size = sizeof(AES_KEY);
773 return (1); 761 return (value);
774} 762}
775#endif /* __i386__ */ 763#endif /* __i386__ */
776 764
diff --git a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c
index b1eb38325d..2fe84a5002 100644
--- a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c
+++ b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (c) 2002-2004 Theo de Raadt
2 * Copyright (c) 2002 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2002 Bob Beck <beck@openbsd.org>
3 * Copyright (c) 2002 Theo de Raadt
4 * Copyright (c) 2002 Markus Friedl 4 * Copyright (c) 2002 Markus Friedl
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
@@ -55,8 +55,6 @@ ENGINE_load_cryptodev(void)
55#include <crypto/cryptodev.h> 55#include <crypto/cryptodev.h>
56#include <sys/ioctl.h> 56#include <sys/ioctl.h>
57 57
58#include <ssl/aes.h>
59
60#include <errno.h> 58#include <errno.h>
61#include <stdio.h> 59#include <stdio.h>
62#include <unistd.h> 60#include <unistd.h>
@@ -70,6 +68,9 @@ ENGINE_load_cryptodev(void)
70#include <sys/sysctl.h> 68#include <sys/sysctl.h>
71#include <machine/cpu.h> 69#include <machine/cpu.h>
72#include <machine/specialreg.h> 70#include <machine/specialreg.h>
71
72#include <ssl/aes.h>
73
73static int check_viac3aes(void); 74static int check_viac3aes(void);
74#endif 75#endif
75 76
@@ -261,7 +262,7 @@ get_cryptodev_ciphers(const int **cnids)
261 * On i386, always check for the VIA C3 AES instructions; 262 * On i386, always check for the VIA C3 AES instructions;
262 * even if /dev/crypto is disabled. 263 * even if /dev/crypto is disabled.
263 */ 264 */
264 if (check_viac3aes() == 1) { 265 if (check_viac3aes() >= 1) {
265 int have_NID_aes_128_cbc = 0; 266 int have_NID_aes_128_cbc = 0;
266 int have_NID_aes_192_cbc = 0; 267 int have_NID_aes_192_cbc = 0;
267 int have_NID_aes_256_cbc = 0; 268 int have_NID_aes_256_cbc = 0;
@@ -709,16 +710,9 @@ xcrypt_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
709 const unsigned char *iv, int enc) 710 const unsigned char *iv, int enc)
710{ 711{
711 AES_KEY *k = ctx->cipher_data; 712 AES_KEY *k = ctx->cipher_data;
712 u_long *kk = (u_long *)key;
713 int i; 713 int i;
714 714
715 bzero(k, sizeof *k); 715 bzero(k, sizeof *k);
716#ifdef notdef
717 for (i = 0; i < ctx->key_len / 4; i++)
718 printf("%08x ", kk[i]);
719 printf("\n");
720#endif
721
722 if (enc) 716 if (enc)
723 AES_set_encrypt_key(key, ctx->key_len * 8, k); 717 AES_set_encrypt_key(key, ctx->key_len * 8, k);
724 else 718 else
@@ -728,12 +722,6 @@ xcrypt_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
728 for (i = 0; i < 4 * (AES_MAXNR + 1); i++) 722 for (i = 0; i < 4 * (AES_MAXNR + 1); i++)
729 k->rd_key[i] = htonl(k->rd_key[i]); 723 k->rd_key[i] = htonl(k->rd_key[i]);
730 724
731#ifdef notdef
732 for (i = 0; i < 4 * (AES_MAXNR + 1); i++)
733 printf("%08x ", k->rd_key[i]);
734 printf("\n");
735#endif
736
737 return (1); 725 return (1);
738} 726}
739 727
@@ -770,7 +758,7 @@ check_viac3aes(void)
770 cryptodev_aes_256_cbc.do_cipher = xcrypt_cipher; 758 cryptodev_aes_256_cbc.do_cipher = xcrypt_cipher;
771 cryptodev_aes_256_cbc.cleanup = xcrypt_cleanup; 759 cryptodev_aes_256_cbc.cleanup = xcrypt_cleanup;
772 cryptodev_aes_256_cbc.ctx_size = sizeof(AES_KEY); 760 cryptodev_aes_256_cbc.ctx_size = sizeof(AES_KEY);
773 return (1); 761 return (value);
774} 762}
775#endif /* __i386__ */ 763#endif /* __i386__ */
776 764