Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@chromium.org>2015-02-23 10:15:50 +0300
committerAdam Langley <agl@google.com>2015-02-23 22:44:02 +0300
commit3f5917f3200df64bbbbb5081445c953122ad475f (patch)
treead93f01be7fda88eb42e72af8cda6158613650f1 /crypto
parent86058a256bea9af50adf12cb1b7cd35eccc40a52 (diff)
EVP_CIPHER_CTX_cleanup cannot fail.
There is exactly one implementation and it doesn't fail. Plus a cleanup function that can fail is very bad manners; the caller has no choice but to leak at that point. Change-Id: I5b524617ef37bc7d92273472fa742416ea7dfd43 Reviewed-on: https://boringssl-review.googlesource.com/3564 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/cipher/cipher.c4
-rw-r--r--crypto/cipher/e_aes.c3
-rw-r--r--crypto/cipher/internal.h2
3 files changed, 4 insertions, 5 deletions
diff --git a/crypto/cipher/cipher.c b/crypto/cipher/cipher.c
index 4bb41960..4dccd974 100644
--- a/crypto/cipher/cipher.c
+++ b/crypto/cipher/cipher.c
@@ -94,8 +94,8 @@ EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) {
}
int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) {
- if (c->cipher != NULL && c->cipher->cleanup && !c->cipher->cleanup(c)) {
- return 0;
+ if (c->cipher != NULL && c->cipher->cleanup) {
+ c->cipher->cleanup(c);
}
if (c->cipher_data) {
diff --git a/crypto/cipher/e_aes.c b/crypto/cipher/e_aes.c
index e012c3dc..01c2d7da 100644
--- a/crypto/cipher/e_aes.c
+++ b/crypto/cipher/e_aes.c
@@ -445,13 +445,12 @@ static int aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const uint8_t *key,
return 1;
}
-static int aes_gcm_cleanup(EVP_CIPHER_CTX *c) {
+static void aes_gcm_cleanup(EVP_CIPHER_CTX *c) {
EVP_AES_GCM_CTX *gctx = c->cipher_data;
OPENSSL_cleanse(&gctx->gcm, sizeof(gctx->gcm));
if (gctx->iv != c->iv) {
OPENSSL_free(gctx->iv);
}
- return 1;
}
/* increment counter (64-bit int) by 1 */
diff --git a/crypto/cipher/internal.h b/crypto/cipher/internal.h
index 2b8fb050..f28fd4c2 100644
--- a/crypto/cipher/internal.h
+++ b/crypto/cipher/internal.h
@@ -97,7 +97,7 @@ struct evp_cipher_st {
int (*cipher)(EVP_CIPHER_CTX *ctx, uint8_t *out, const uint8_t *in,
size_t inl);
- int (*cleanup)(EVP_CIPHER_CTX *);
+ void (*cleanup)(EVP_CIPHER_CTX *);
int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr);
};