diff options
author | djm <> | 2010-10-06 22:57:46 +0000 |
---|---|---|
committer | djm <> | 2010-10-06 22:57:46 +0000 |
commit | 9b33e0a4893772bd3689c8403a7754593410469a (patch) | |
tree | 9b04e95e5f06db0c684af0ddf591d406d701cbf2 /src | |
parent | d98f5be34ed52ab16dd147ef017c75cafb7bfd35 (diff) | |
download | openbsd-9b33e0a4893772bd3689c8403a7754593410469a.tar.gz openbsd-9b33e0a4893772bd3689c8403a7754593410469a.tar.bz2 openbsd-9b33e0a4893772bd3689c8403a7754593410469a.zip |
More OpenSSL fixes:
- Update local engines for the EVP API change (len u_int => size_t)
- Use hw_cryptodev.c instead of eng_cryptodev.c
- Make x86_64-xlate.pl always write to the output file and not stdout,
fixing "make -j" builds (spotted by naddy@)
ok naddy@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/engine/eng_aesni.c | 8 | ||||
-rw-r--r-- | src/lib/libcrypto/engine/hw_cryptodev.c | 16 | ||||
-rwxr-xr-x | src/lib/libcrypto/perlasm/x86_64-xlate.pl | 2 | ||||
-rw-r--r-- | src/lib/libssl/crypto/Makefile | 4 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/engine/eng_aesni.c | 8 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/engine/hw_cryptodev.c | 16 | ||||
-rwxr-xr-x | src/lib/libssl/src/crypto/perlasm/x86_64-xlate.pl | 2 |
7 files changed, 30 insertions, 26 deletions
diff --git a/src/lib/libcrypto/engine/eng_aesni.c b/src/lib/libcrypto/engine/eng_aesni.c index eeded1eefa..5fdb33bfde 100644 --- a/src/lib/libcrypto/engine/eng_aesni.c +++ b/src/lib/libcrypto/engine/eng_aesni.c | |||
@@ -438,20 +438,20 @@ aesni_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *user_key, | |||
438 | } | 438 | } |
439 | 439 | ||
440 | static int aesni_cipher_ecb(EVP_CIPHER_CTX *ctx, unsigned char *out, | 440 | static int aesni_cipher_ecb(EVP_CIPHER_CTX *ctx, unsigned char *out, |
441 | const unsigned char *in, unsigned int inl) | 441 | const unsigned char *in, size_t inl) |
442 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); | 442 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); |
443 | aesni_ecb_encrypt(in, out, inl, key, ctx->encrypt); | 443 | aesni_ecb_encrypt(in, out, inl, key, ctx->encrypt); |
444 | return 1; | 444 | return 1; |
445 | } | 445 | } |
446 | static int aesni_cipher_cbc(EVP_CIPHER_CTX *ctx, unsigned char *out, | 446 | static int aesni_cipher_cbc(EVP_CIPHER_CTX *ctx, unsigned char *out, |
447 | const unsigned char *in, unsigned int inl) | 447 | const unsigned char *in, size_t inl) |
448 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); | 448 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); |
449 | aesni_cbc_encrypt(in, out, inl, key, | 449 | aesni_cbc_encrypt(in, out, inl, key, |
450 | ctx->iv, ctx->encrypt); | 450 | ctx->iv, ctx->encrypt); |
451 | return 1; | 451 | return 1; |
452 | } | 452 | } |
453 | static int aesni_cipher_cfb(EVP_CIPHER_CTX *ctx, unsigned char *out, | 453 | static int aesni_cipher_cfb(EVP_CIPHER_CTX *ctx, unsigned char *out, |
454 | const unsigned char *in, unsigned int inl) | 454 | const unsigned char *in, size_t inl) |
455 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); | 455 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); |
456 | 456 | ||
457 | aesni_cfb128_encrypt(in, out, inl, key, ctx->iv, | 457 | aesni_cfb128_encrypt(in, out, inl, key, ctx->iv, |
@@ -459,7 +459,7 @@ static int aesni_cipher_cfb(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
459 | return 1; | 459 | return 1; |
460 | } | 460 | } |
461 | static int aesni_cipher_ofb(EVP_CIPHER_CTX *ctx, unsigned char *out, | 461 | static int aesni_cipher_ofb(EVP_CIPHER_CTX *ctx, unsigned char *out, |
462 | const unsigned char *in, unsigned int inl) | 462 | const unsigned char *in, size_t inl) |
463 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); | 463 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); |
464 | aesni_ofb128_encrypt(in, out, inl, key, ctx->iv, &ctx->num); | 464 | aesni_ofb128_encrypt(in, out, inl, key, ctx->iv, &ctx->num); |
465 | return 1; | 465 | return 1; |
diff --git a/src/lib/libcrypto/engine/hw_cryptodev.c b/src/lib/libcrypto/engine/hw_cryptodev.c index 03022f2fd3..6ac2f9be30 100644 --- a/src/lib/libcrypto/engine/hw_cryptodev.c +++ b/src/lib/libcrypto/engine/hw_cryptodev.c | |||
@@ -56,13 +56,13 @@ ENGINE_load_cryptodev(void) | |||
56 | #include <sys/ioctl.h> | 56 | #include <sys/ioctl.h> |
57 | 57 | ||
58 | #include <errno.h> | 58 | #include <errno.h> |
59 | #include <stdio.h> | ||
60 | #include <unistd.h> | ||
61 | #include <fcntl.h> | 59 | #include <fcntl.h> |
60 | #include <limits.h> | ||
62 | #include <stdarg.h> | 61 | #include <stdarg.h> |
63 | #include <syslog.h> | 62 | #include <stdio.h> |
64 | #include <errno.h> | ||
65 | #include <string.h> | 63 | #include <string.h> |
64 | #include <syslog.h> | ||
65 | #include <unistd.h> | ||
66 | 66 | ||
67 | #if defined(__i386__) || defined(__amd64__) | 67 | #if defined(__i386__) || defined(__amd64__) |
68 | #include <sys/sysctl.h> | 68 | #include <sys/sysctl.h> |
@@ -97,7 +97,7 @@ static int get_cryptodev_ciphers(const int **cnids); | |||
97 | static int cryptodev_usable_ciphers(const int **nids); | 97 | static int cryptodev_usable_ciphers(const int **nids); |
98 | static int cryptodev_usable_digests(const int **nids); | 98 | static int cryptodev_usable_digests(const int **nids); |
99 | static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 99 | static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
100 | const unsigned char *in, unsigned int inl); | 100 | const unsigned char *in, size_t inl); |
101 | static int cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 101 | static int cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
102 | const unsigned char *iv, int enc); | 102 | const unsigned char *iv, int enc); |
103 | static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx); | 103 | static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx); |
@@ -381,7 +381,7 @@ cryptodev_usable_digests(const int **nids) | |||
381 | 381 | ||
382 | static int | 382 | static int |
383 | cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 383 | cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
384 | const unsigned char *in, unsigned int inl) | 384 | const unsigned char *in, size_t inl) |
385 | { | 385 | { |
386 | struct crypt_op cryp; | 386 | struct crypt_op cryp; |
387 | struct dev_crypto_state *state = ctx->cipher_data; | 387 | struct dev_crypto_state *state = ctx->cipher_data; |
@@ -644,7 +644,7 @@ viac3_xcrypt_cbc(int *cw, const void *src, void *dst, void *key, int rep, | |||
644 | 644 | ||
645 | static int | 645 | static int |
646 | xcrypt_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 646 | xcrypt_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
647 | const unsigned char *in, unsigned int inl) | 647 | const unsigned char *in, size_t inl) |
648 | { | 648 | { |
649 | unsigned char *save_iv_store[EVP_MAX_IV_LENGTH + 15]; | 649 | unsigned char *save_iv_store[EVP_MAX_IV_LENGTH + 15]; |
650 | unsigned char *save_iv = DOALIGN(save_iv_store); | 650 | unsigned char *save_iv = DOALIGN(save_iv_store); |
@@ -659,6 +659,8 @@ xcrypt_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
659 | return (1); | 659 | return (1); |
660 | if ((inl % ctx->cipher->block_size) != 0) | 660 | if ((inl % ctx->cipher->block_size) != 0) |
661 | return (0); | 661 | return (0); |
662 | if (inl > UINT_MAX) | ||
663 | return (0); | ||
662 | 664 | ||
663 | if (ISUNALIGNED(in) || ISUNALIGNED(out)) { | 665 | if (ISUNALIGNED(in) || ISUNALIGNED(out)) { |
664 | spare = malloc(inl); | 666 | spare = malloc(inl); |
diff --git a/src/lib/libcrypto/perlasm/x86_64-xlate.pl b/src/lib/libcrypto/perlasm/x86_64-xlate.pl index 8153a92a7b..d66ad24095 100755 --- a/src/lib/libcrypto/perlasm/x86_64-xlate.pl +++ b/src/lib/libcrypto/perlasm/x86_64-xlate.pl | |||
@@ -66,7 +66,7 @@ if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } | |||
66 | my ($outdev,$outino,@junk)=stat($output); | 66 | my ($outdev,$outino,@junk)=stat($output); |
67 | 67 | ||
68 | open STDOUT,">$output" || die "can't open $output: $!" | 68 | open STDOUT,">$output" || die "can't open $output: $!" |
69 | if ($stddev!=$outdev || $stdino!=$outino); | 69 | if (1 || $stddev!=$outdev || $stdino!=$outino); |
70 | } | 70 | } |
71 | 71 | ||
72 | my $gas=1; $gas=0 if ($output =~ /\.asm$/); | 72 | my $gas=1; $gas=0 if ($output =~ /\.asm$/); |
diff --git a/src/lib/libssl/crypto/Makefile b/src/lib/libssl/crypto/Makefile index 93657a0bb8..dfcfffe193 100644 --- a/src/lib/libssl/crypto/Makefile +++ b/src/lib/libssl/crypto/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.56 2010/10/04 19:15:40 naddy Exp $ | 1 | # $OpenBSD: Makefile,v 1.57 2010/10/06 22:57:46 djm Exp $ |
2 | 2 | ||
3 | LIB= crypto | 3 | LIB= crypto |
4 | WANTLINT= | 4 | WANTLINT= |
@@ -150,7 +150,7 @@ SRCS+= eng_err.c eng_lib.c eng_list.c eng_init.c eng_ctrl.c | |||
150 | SRCS+= eng_table.c eng_pkey.c eng_fat.c eng_all.c | 150 | SRCS+= eng_table.c eng_pkey.c eng_fat.c eng_all.c |
151 | SRCS+= tb_rsa.c tb_dsa.c tb_ecdsa.c tb_dh.c tb_ecdh.c tb_rand.c tb_store.c | 151 | SRCS+= tb_rsa.c tb_dsa.c tb_ecdsa.c tb_dh.c tb_ecdh.c tb_rand.c tb_store.c |
152 | SRCS+= tb_cipher.c tb_digest.c tb_pkmeth.c tb_asnmth.c | 152 | SRCS+= tb_cipher.c tb_digest.c tb_pkmeth.c tb_asnmth.c |
153 | SRCS+= eng_openssl.c eng_cnf.c eng_dyn.c eng_cryptodev.c | 153 | SRCS+= eng_openssl.c eng_cnf.c eng_dyn.c hw_cryptodev.c |
154 | SRCS+= eng_aesni.c # local addition | 154 | SRCS+= eng_aesni.c # local addition |
155 | 155 | ||
156 | # err/ | 156 | # err/ |
diff --git a/src/lib/libssl/src/crypto/engine/eng_aesni.c b/src/lib/libssl/src/crypto/engine/eng_aesni.c index eeded1eefa..5fdb33bfde 100644 --- a/src/lib/libssl/src/crypto/engine/eng_aesni.c +++ b/src/lib/libssl/src/crypto/engine/eng_aesni.c | |||
@@ -438,20 +438,20 @@ aesni_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *user_key, | |||
438 | } | 438 | } |
439 | 439 | ||
440 | static int aesni_cipher_ecb(EVP_CIPHER_CTX *ctx, unsigned char *out, | 440 | static int aesni_cipher_ecb(EVP_CIPHER_CTX *ctx, unsigned char *out, |
441 | const unsigned char *in, unsigned int inl) | 441 | const unsigned char *in, size_t inl) |
442 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); | 442 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); |
443 | aesni_ecb_encrypt(in, out, inl, key, ctx->encrypt); | 443 | aesni_ecb_encrypt(in, out, inl, key, ctx->encrypt); |
444 | return 1; | 444 | return 1; |
445 | } | 445 | } |
446 | static int aesni_cipher_cbc(EVP_CIPHER_CTX *ctx, unsigned char *out, | 446 | static int aesni_cipher_cbc(EVP_CIPHER_CTX *ctx, unsigned char *out, |
447 | const unsigned char *in, unsigned int inl) | 447 | const unsigned char *in, size_t inl) |
448 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); | 448 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); |
449 | aesni_cbc_encrypt(in, out, inl, key, | 449 | aesni_cbc_encrypt(in, out, inl, key, |
450 | ctx->iv, ctx->encrypt); | 450 | ctx->iv, ctx->encrypt); |
451 | return 1; | 451 | return 1; |
452 | } | 452 | } |
453 | static int aesni_cipher_cfb(EVP_CIPHER_CTX *ctx, unsigned char *out, | 453 | static int aesni_cipher_cfb(EVP_CIPHER_CTX *ctx, unsigned char *out, |
454 | const unsigned char *in, unsigned int inl) | 454 | const unsigned char *in, size_t inl) |
455 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); | 455 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); |
456 | 456 | ||
457 | aesni_cfb128_encrypt(in, out, inl, key, ctx->iv, | 457 | aesni_cfb128_encrypt(in, out, inl, key, ctx->iv, |
@@ -459,7 +459,7 @@ static int aesni_cipher_cfb(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
459 | return 1; | 459 | return 1; |
460 | } | 460 | } |
461 | static int aesni_cipher_ofb(EVP_CIPHER_CTX *ctx, unsigned char *out, | 461 | static int aesni_cipher_ofb(EVP_CIPHER_CTX *ctx, unsigned char *out, |
462 | const unsigned char *in, unsigned int inl) | 462 | const unsigned char *in, size_t inl) |
463 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); | 463 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); |
464 | aesni_ofb128_encrypt(in, out, inl, key, ctx->iv, &ctx->num); | 464 | aesni_ofb128_encrypt(in, out, inl, key, ctx->iv, &ctx->num); |
465 | return 1; | 465 | return 1; |
diff --git a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c index 03022f2fd3..6ac2f9be30 100644 --- a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c +++ b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c | |||
@@ -56,13 +56,13 @@ ENGINE_load_cryptodev(void) | |||
56 | #include <sys/ioctl.h> | 56 | #include <sys/ioctl.h> |
57 | 57 | ||
58 | #include <errno.h> | 58 | #include <errno.h> |
59 | #include <stdio.h> | ||
60 | #include <unistd.h> | ||
61 | #include <fcntl.h> | 59 | #include <fcntl.h> |
60 | #include <limits.h> | ||
62 | #include <stdarg.h> | 61 | #include <stdarg.h> |
63 | #include <syslog.h> | 62 | #include <stdio.h> |
64 | #include <errno.h> | ||
65 | #include <string.h> | 63 | #include <string.h> |
64 | #include <syslog.h> | ||
65 | #include <unistd.h> | ||
66 | 66 | ||
67 | #if defined(__i386__) || defined(__amd64__) | 67 | #if defined(__i386__) || defined(__amd64__) |
68 | #include <sys/sysctl.h> | 68 | #include <sys/sysctl.h> |
@@ -97,7 +97,7 @@ static int get_cryptodev_ciphers(const int **cnids); | |||
97 | static int cryptodev_usable_ciphers(const int **nids); | 97 | static int cryptodev_usable_ciphers(const int **nids); |
98 | static int cryptodev_usable_digests(const int **nids); | 98 | static int cryptodev_usable_digests(const int **nids); |
99 | static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 99 | static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
100 | const unsigned char *in, unsigned int inl); | 100 | const unsigned char *in, size_t inl); |
101 | static int cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 101 | static int cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
102 | const unsigned char *iv, int enc); | 102 | const unsigned char *iv, int enc); |
103 | static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx); | 103 | static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx); |
@@ -381,7 +381,7 @@ cryptodev_usable_digests(const int **nids) | |||
381 | 381 | ||
382 | static int | 382 | static int |
383 | cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 383 | cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
384 | const unsigned char *in, unsigned int inl) | 384 | const unsigned char *in, size_t inl) |
385 | { | 385 | { |
386 | struct crypt_op cryp; | 386 | struct crypt_op cryp; |
387 | struct dev_crypto_state *state = ctx->cipher_data; | 387 | struct dev_crypto_state *state = ctx->cipher_data; |
@@ -644,7 +644,7 @@ viac3_xcrypt_cbc(int *cw, const void *src, void *dst, void *key, int rep, | |||
644 | 644 | ||
645 | static int | 645 | static int |
646 | xcrypt_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 646 | xcrypt_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
647 | const unsigned char *in, unsigned int inl) | 647 | const unsigned char *in, size_t inl) |
648 | { | 648 | { |
649 | unsigned char *save_iv_store[EVP_MAX_IV_LENGTH + 15]; | 649 | unsigned char *save_iv_store[EVP_MAX_IV_LENGTH + 15]; |
650 | unsigned char *save_iv = DOALIGN(save_iv_store); | 650 | unsigned char *save_iv = DOALIGN(save_iv_store); |
@@ -659,6 +659,8 @@ xcrypt_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
659 | return (1); | 659 | return (1); |
660 | if ((inl % ctx->cipher->block_size) != 0) | 660 | if ((inl % ctx->cipher->block_size) != 0) |
661 | return (0); | 661 | return (0); |
662 | if (inl > UINT_MAX) | ||
663 | return (0); | ||
662 | 664 | ||
663 | if (ISUNALIGNED(in) || ISUNALIGNED(out)) { | 665 | if (ISUNALIGNED(in) || ISUNALIGNED(out)) { |
664 | spare = malloc(inl); | 666 | spare = malloc(inl); |
diff --git a/src/lib/libssl/src/crypto/perlasm/x86_64-xlate.pl b/src/lib/libssl/src/crypto/perlasm/x86_64-xlate.pl index 8153a92a7b..d66ad24095 100755 --- a/src/lib/libssl/src/crypto/perlasm/x86_64-xlate.pl +++ b/src/lib/libssl/src/crypto/perlasm/x86_64-xlate.pl | |||
@@ -66,7 +66,7 @@ if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } | |||
66 | my ($outdev,$outino,@junk)=stat($output); | 66 | my ($outdev,$outino,@junk)=stat($output); |
67 | 67 | ||
68 | open STDOUT,">$output" || die "can't open $output: $!" | 68 | open STDOUT,">$output" || die "can't open $output: $!" |
69 | if ($stddev!=$outdev || $stdino!=$outino); | 69 | if (1 || $stddev!=$outdev || $stdino!=$outino); |
70 | } | 70 | } |
71 | 71 | ||
72 | my $gas=1; $gas=0 if ($output =~ /\.asm$/); | 72 | my $gas=1; $gas=0 if ($output =~ /\.asm$/); |