components/openssl/openssl-1.0.1/patches/36_evp_leak.patch
author Ronald Jordan <ron.jordan@oracle.com>
Fri, 18 Jul 2014 06:53:27 -0700
branchs11-update
changeset 3215 f89394c89652
child 2156 47340bc31385
permissions -rw-r--r--
17283726 memory leak with EVP_CipherInit_ex
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3215
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
     1
Patch developed in-house.  Solaris-specific; not suitable for upstream.
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
     2
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
     3
--- openssl-1.0.1f/crypto/evp/evp_enc.c.orig	Mon Feb 11 07:26:04 2013
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
     4
+++ openssl-1.0.1f/crypto/evp/evp_enc.c	Mon Feb  3 16:40:48 2014
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
     5
@@ -393,10 +393,14 @@
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
     6
 		{
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
     7
 		ret = M_do_cipher(ctx, out, NULL, 0);
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
     8
 		if (ret < 0)
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
     9
-			return 0;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    10
+			{
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    11
+			ret = 0;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    12
+			goto cleanup;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    13
+			}
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    14
 		else 
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    15
 			*outl = ret;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    16
-		return 1;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    17
+		ret = 1;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    18
+		goto cleanup;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    19
 		}
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    20
 
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    21
 	b=ctx->cipher->block_size;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    22
@@ -404,7 +408,8 @@
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    23
 	if (b == 1)
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    24
 		{
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    25
 		*outl=0;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    26
-		return 1;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    27
+		ret = 1;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    28
+		goto cleanup;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    29
 		}
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    30
 	bl=ctx->buf_len;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    31
 	if (ctx->flags & EVP_CIPH_NO_PADDING)
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    32
@@ -412,10 +417,12 @@
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    33
 		if(bl)
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    34
 			{
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    35
 			EVPerr(EVP_F_EVP_ENCRYPTFINAL_EX,EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH);
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    36
-			return 0;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    37
+			ret = 0;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    38
+			goto cleanup;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    39
 			}
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    40
 		*outl = 0;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    41
-		return 1;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    42
+		ret = 1;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    43
+		goto cleanup;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    44
 		}
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    45
 
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    46
 	n=b-bl;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    47
@@ -427,6 +434,12 @@
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    48
 	if(ret)
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    49
 		*outl=b;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    50
 
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    51
+cleanup:
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    52
+	if (ctx->cipher->cleanup)
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    53
+		{
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    54
+		ctx->cipher->cleanup(ctx);
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    55
+		}
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    56
+
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    57
 	return ret;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    58
 	}
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    59
 
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    60
@@ -500,7 +513,7 @@
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    61
 
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    62
 int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    63
 	{
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    64
-	int i,n;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    65
+	int i,n,ret = 1;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    66
 	unsigned int b;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    67
 	*outl=0;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    68
 
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    69
@@ -508,10 +521,14 @@
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    70
 		{
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    71
 		i = M_do_cipher(ctx, out, NULL, 0);
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    72
 		if (i < 0)
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    73
-			return 0;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    74
+			{
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    75
+			ret = 0;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    76
+			goto cleanup;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    77
+			}
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    78
 		else
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    79
 			*outl = i;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    80
-		return 1;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    81
+		ret = 1;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    82
+		goto cleanup;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    83
 		}
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    84
 
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    85
 	b=ctx->cipher->block_size;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    86
@@ -520,10 +537,12 @@
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    87
 		if(ctx->buf_len)
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    88
 			{
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    89
 			EVPerr(EVP_F_EVP_DECRYPTFINAL_EX,EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH);
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    90
-			return 0;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    91
+			ret = 0;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    92
+			goto cleanup;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    93
 			}
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    94
 		*outl = 0;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    95
-		return 1;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    96
+		ret = 1;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    97
+		goto cleanup;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    98
 		}
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
    99
 	if (b > 1)
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   100
 		{
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   101
@@ -530,7 +549,8 @@
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   102
 		if (ctx->buf_len || !ctx->final_used)
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   103
 			{
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   104
 			EVPerr(EVP_F_EVP_DECRYPTFINAL_EX,EVP_R_WRONG_FINAL_BLOCK_LENGTH);
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   105
-			return(0);
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   106
+			ret = 0;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   107
+			goto cleanup;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   108
 			}
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   109
 		OPENSSL_assert(b <= sizeof ctx->final);
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   110
 		n=ctx->final[b-1];
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   111
@@ -537,7 +557,8 @@
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   112
 		if (n == 0 || n > (int)b)
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   113
 			{
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   114
 			EVPerr(EVP_F_EVP_DECRYPTFINAL_EX,EVP_R_BAD_DECRYPT);
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   115
-			return(0);
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   116
+			ret = 0;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   117
+			goto cleanup;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   118
 			}
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   119
 		for (i=0; i<n; i++)
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   120
 			{
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   121
@@ -544,7 +565,8 @@
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   122
 			if (ctx->final[--b] != n)
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   123
 				{
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   124
 				EVPerr(EVP_F_EVP_DECRYPTFINAL_EX,EVP_R_BAD_DECRYPT);
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   125
-				return(0);
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   126
+				ret = 0;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   127
+				goto cleanup;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   128
 				}
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   129
 			}
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   130
 		n=ctx->cipher->block_size-n;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   131
@@ -554,7 +576,14 @@
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   132
 		}
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   133
 	else
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   134
 		*outl=0;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   135
-	return(1);
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   136
+
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   137
+cleanup:
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   138
+	if (ctx->cipher->cleanup)
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   139
+		{
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   140
+		ctx->cipher->cleanup(ctx);
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   141
+		}
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   142
+
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   143
+	return ret;
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   144
 	}
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   145
 
f89394c89652 17283726 memory leak with EVP_CipherInit_ex
Ronald Jordan <ron.jordan@oracle.com>
parents:
diff changeset
   146
 void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)