diff options
Diffstat (limited to 'src/lib/libcrypto/engine/hw_cryptodev.c')
-rw-r--r-- | src/lib/libcrypto/engine/hw_cryptodev.c | 16 |
1 files changed, 9 insertions, 7 deletions
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); |