OLD | NEW |
1 /* crypto/evp/p_open.c */ | 1 /* crypto/evp/p_open.c */ |
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 * |
5 * This package is an SSL implementation written | 5 * This package is an SSL implementation written |
6 * by Eric Young (eay@cryptsoft.com). | 6 * by Eric Young (eay@cryptsoft.com). |
7 * The implementation was written so as to conform with Netscapes SSL. | 7 * The implementation was written so as to conform with Netscapes SSL. |
8 * | 8 * |
9 * This library is free for commercial and non-commercial use as long as | 9 * This library is free for commercial and non-commercial use as long as |
10 * the following conditions are aheared to. The following conditions | 10 * the following conditions are aheared to. The following conditions |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 size=RSA_size(priv->pkey.rsa); | 89 size=RSA_size(priv->pkey.rsa); |
90 key=(unsigned char *)OPENSSL_malloc(size+2); | 90 key=(unsigned char *)OPENSSL_malloc(size+2); |
91 if (key == NULL) | 91 if (key == NULL) |
92 { | 92 { |
93 /* ERROR */ | 93 /* ERROR */ |
94 EVPerr(EVP_F_EVP_OPENINIT,ERR_R_MALLOC_FAILURE); | 94 EVPerr(EVP_F_EVP_OPENINIT,ERR_R_MALLOC_FAILURE); |
95 goto err; | 95 goto err; |
96 } | 96 } |
97 | 97 |
98 » i=EVP_PKEY_decrypt(key,ek,ekl,priv); | 98 » i=EVP_PKEY_decrypt_old(key,ek,ekl,priv); |
99 if ((i <= 0) || !EVP_CIPHER_CTX_set_key_length(ctx, i)) | 99 if ((i <= 0) || !EVP_CIPHER_CTX_set_key_length(ctx, i)) |
100 { | 100 { |
101 /* ERROR */ | 101 /* ERROR */ |
102 goto err; | 102 goto err; |
103 } | 103 } |
104 if(!EVP_DecryptInit_ex(ctx,NULL,NULL,key,iv)) goto err; | 104 if(!EVP_DecryptInit_ex(ctx,NULL,NULL,key,iv)) goto err; |
105 | 105 |
106 ret=1; | 106 ret=1; |
107 err: | 107 err: |
108 if (key != NULL) OPENSSL_cleanse(key,size); | 108 if (key != NULL) OPENSSL_cleanse(key,size); |
109 OPENSSL_free(key); | 109 OPENSSL_free(key); |
110 return(ret); | 110 return(ret); |
111 } | 111 } |
112 | 112 |
113 int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | 113 int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) |
114 { | 114 { |
115 int i; | 115 int i; |
116 | 116 |
117 i=EVP_DecryptFinal_ex(ctx,out,outl); | 117 i=EVP_DecryptFinal_ex(ctx,out,outl); |
118 EVP_DecryptInit_ex(ctx,NULL,NULL,NULL,NULL); | 118 EVP_DecryptInit_ex(ctx,NULL,NULL,NULL,NULL); |
119 return(i); | 119 return(i); |
120 } | 120 } |
121 #else /* !OPENSSL_NO_RSA */ | 121 #else /* !OPENSSL_NO_RSA */ |
122 | 122 |
123 # ifdef PEDANTIC | 123 # ifdef PEDANTIC |
124 static void *dummy=&dummy; | 124 static void *dummy=&dummy; |
125 # endif | 125 # endif |
126 | 126 |
127 #endif | 127 #endif |
OLD | NEW |