diff options
Diffstat (limited to 'src/lib/libcrypto/evp')
-rw-r--r-- | src/lib/libcrypto/evp/e_aes.c | 9 | ||||
-rw-r--r-- | src/lib/libcrypto/evp/evp_enc.c | 7 | ||||
-rw-r--r-- | src/lib/libcrypto/evp/p_seal.c | 6 |
3 files changed, 10 insertions, 12 deletions
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c index f96a15f19c..bb3b420a3b 100644 --- a/src/lib/libcrypto/evp/e_aes.c +++ b/src/lib/libcrypto/evp/e_aes.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: e_aes.c,v 1.25 2014/07/12 19:31:03 miod Exp $ */ | 1 | /* $OpenBSD: e_aes.c,v 1.26 2014/10/22 13:02:04 jsing Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -50,6 +50,7 @@ | |||
50 | */ | 50 | */ |
51 | 51 | ||
52 | #include <assert.h> | 52 | #include <assert.h> |
53 | #include <stdlib.h> | ||
53 | #include <string.h> | 54 | #include <string.h> |
54 | 55 | ||
55 | #include <openssl/opensslconf.h> | 56 | #include <openssl/opensslconf.h> |
@@ -58,7 +59,6 @@ | |||
58 | #include <openssl/aes.h> | 59 | #include <openssl/aes.h> |
59 | #include <openssl/err.h> | 60 | #include <openssl/err.h> |
60 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
61 | #include <openssl/rand.h> | ||
62 | 62 | ||
63 | #include "evp_locl.h" | 63 | #include "evp_locl.h" |
64 | #include "modes_lcl.h" | 64 | #include "modes_lcl.h" |
@@ -769,9 +769,8 @@ aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) | |||
769 | return 0; | 769 | return 0; |
770 | if (arg) | 770 | if (arg) |
771 | memcpy(gctx->iv, ptr, arg); | 771 | memcpy(gctx->iv, ptr, arg); |
772 | if (c->encrypt && | 772 | if (c->encrypt) |
773 | RAND_bytes(gctx->iv + arg, gctx->ivlen - arg) <= 0) | 773 | arc4random_buf(gctx->iv + arg, gctx->ivlen - arg); |
774 | return 0; | ||
775 | gctx->iv_gen = 1; | 774 | gctx->iv_gen = 1; |
776 | return 1; | 775 | return 1; |
777 | 776 | ||
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c index 4333e4dff8..49ceacefad 100644 --- a/src/lib/libcrypto/evp/evp_enc.c +++ b/src/lib/libcrypto/evp/evp_enc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: evp_enc.c,v 1.24 2014/07/11 08:44:48 jsing Exp $ */ | 1 | /* $OpenBSD: evp_enc.c,v 1.25 2014/10/22 13:02:04 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -57,13 +57,13 @@ | |||
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include <stdlib.h> | ||
60 | #include <string.h> | 61 | #include <string.h> |
61 | 62 | ||
62 | #include <openssl/opensslconf.h> | 63 | #include <openssl/opensslconf.h> |
63 | 64 | ||
64 | #include <openssl/err.h> | 65 | #include <openssl/err.h> |
65 | #include <openssl/evp.h> | 66 | #include <openssl/evp.h> |
66 | #include <openssl/rand.h> | ||
67 | 67 | ||
68 | #ifndef OPENSSL_NO_ENGINE | 68 | #ifndef OPENSSL_NO_ENGINE |
69 | #include <openssl/engine.h> | 69 | #include <openssl/engine.h> |
@@ -613,8 +613,7 @@ EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key) | |||
613 | { | 613 | { |
614 | if (ctx->cipher->flags & EVP_CIPH_RAND_KEY) | 614 | if (ctx->cipher->flags & EVP_CIPH_RAND_KEY) |
615 | return EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_RAND_KEY, 0, key); | 615 | return EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_RAND_KEY, 0, key); |
616 | if (RAND_bytes(key, ctx->key_len) <= 0) | 616 | arc4random_buf(key, ctx->key_len); |
617 | return 0; | ||
618 | return 1; | 617 | return 1; |
619 | } | 618 | } |
620 | 619 | ||
diff --git a/src/lib/libcrypto/evp/p_seal.c b/src/lib/libcrypto/evp/p_seal.c index 4f8417ae64..8b9740fbcd 100644 --- a/src/lib/libcrypto/evp/p_seal.c +++ b/src/lib/libcrypto/evp/p_seal.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: p_seal.c,v 1.13 2014/07/11 08:44:48 jsing Exp $ */ | 1 | /* $OpenBSD: p_seal.c,v 1.14 2014/10/22 13:02:04 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -57,12 +57,12 @@ | |||
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include <stdlib.h> | ||
60 | 61 | ||
61 | #include <openssl/opensslconf.h> | 62 | #include <openssl/opensslconf.h> |
62 | 63 | ||
63 | #include <openssl/evp.h> | 64 | #include <openssl/evp.h> |
64 | #include <openssl/objects.h> | 65 | #include <openssl/objects.h> |
65 | #include <openssl/rand.h> | ||
66 | #include <openssl/x509.h> | 66 | #include <openssl/x509.h> |
67 | 67 | ||
68 | #ifndef OPENSSL_NO_RSA | 68 | #ifndef OPENSSL_NO_RSA |
@@ -86,7 +86,7 @@ EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char **ek, | |||
86 | if (EVP_CIPHER_CTX_rand_key(ctx, key) <= 0) | 86 | if (EVP_CIPHER_CTX_rand_key(ctx, key) <= 0) |
87 | return 0; | 87 | return 0; |
88 | if (EVP_CIPHER_CTX_iv_length(ctx)) | 88 | if (EVP_CIPHER_CTX_iv_length(ctx)) |
89 | RAND_pseudo_bytes(iv, EVP_CIPHER_CTX_iv_length(ctx)); | 89 | arc4random_buf(iv, EVP_CIPHER_CTX_iv_length(ctx)); |
90 | 90 | ||
91 | if (!EVP_EncryptInit_ex(ctx, NULL, NULL, key, iv)) | 91 | if (!EVP_EncryptInit_ex(ctx, NULL, NULL, key, iv)) |
92 | return 0; | 92 | return 0; |