summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto/engine/hw_cryptodev.c
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2010-10-06 22:57:46 +0000
committerdjm <djm@openbsd.org>2010-10-06 22:57:46 +0000
commit3e8f98598f0cd4f2742253e449c699b509ce02f9 (patch)
tree743134cc6a39c5f71a76ffafa2e1467e2e9a41bd /lib/libcrypto/engine/hw_cryptodev.c
parentRetire Skipjack (diff)
downloadwireguard-openbsd-3e8f98598f0cd4f2742253e449c699b509ce02f9.tar.xz
wireguard-openbsd-3e8f98598f0cd4f2742253e449c699b509ce02f9.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 'lib/libcrypto/engine/hw_cryptodev.c')
-rw-r--r--lib/libcrypto/engine/hw_cryptodev.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/libcrypto/engine/hw_cryptodev.c b/lib/libcrypto/engine/hw_cryptodev.c
index 03022f2fd39..6ac2f9be300 100644
--- a/lib/libcrypto/engine/hw_cryptodev.c
+++ b/lib/libcrypto/engine/hw_cryptodev.c
@@ -56,13 +56,13 @@ ENGINE_load_cryptodev(void)
#include <sys/ioctl.h>
#include <errno.h>
-#include <stdio.h>
-#include <unistd.h>
#include <fcntl.h>
+#include <limits.h>
#include <stdarg.h>
-#include <syslog.h>
-#include <errno.h>
+#include <stdio.h>
#include <string.h>
+#include <syslog.h>
+#include <unistd.h>
#if defined(__i386__) || defined(__amd64__)
#include <sys/sysctl.h>
@@ -97,7 +97,7 @@ static int get_cryptodev_ciphers(const int **cnids);
static int cryptodev_usable_ciphers(const int **nids);
static int cryptodev_usable_digests(const int **nids);
static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl);
+ const unsigned char *in, size_t inl);
static int cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
const unsigned char *iv, int enc);
static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx);
@@ -381,7 +381,7 @@ cryptodev_usable_digests(const int **nids)
static int
cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
struct crypt_op cryp;
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,
static int
xcrypt_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
- const unsigned char *in, unsigned int inl)
+ const unsigned char *in, size_t inl)
{
unsigned char *save_iv_store[EVP_MAX_IV_LENGTH + 15];
unsigned char *save_iv = DOALIGN(save_iv_store);
@@ -659,6 +659,8 @@ xcrypt_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
return (1);
if ((inl % ctx->cipher->block_size) != 0)
return (0);
+ if (inl > UINT_MAX)
+ return (0);
if (ISUNALIGNED(in) || ISUNALIGNED(out)) {
spare = malloc(inl);