summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/evp_enc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/evp/evp_enc.c')
-rw-r--r--src/lib/libcrypto/evp/evp_enc.c71
1 files changed, 19 insertions, 52 deletions
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c
index 93cc3a9464..5299a65b6a 100644
--- a/src/lib/libcrypto/evp/evp_enc.c
+++ b/src/lib/libcrypto/evp/evp_enc.c
@@ -58,23 +58,18 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "evp.h" 61#include <openssl/evp.h>
62 62
63char *EVP_version="EVP part of SSLeay 0.9.0b 29-Jun-1998"; 63const char *EVP_version="EVP" OPENSSL_VERSION_PTEXT;
64 64
65void EVP_CIPHER_CTX_init(ctx) 65void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx)
66EVP_CIPHER_CTX *ctx;
67 { 66 {
68 memset(ctx,0,sizeof(EVP_CIPHER_CTX)); 67 memset(ctx,0,sizeof(EVP_CIPHER_CTX));
69 /* ctx->cipher=NULL; */ 68 /* ctx->cipher=NULL; */
70 } 69 }
71 70
72void EVP_CipherInit(ctx,data,key,iv,enc) 71void EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *data,
73EVP_CIPHER_CTX *ctx; 72 unsigned char *key, unsigned char *iv, int enc)
74EVP_CIPHER *data;
75unsigned char *key;
76unsigned char *iv;
77int enc;
78 { 73 {
79 if (enc) 74 if (enc)
80 EVP_EncryptInit(ctx,data,key,iv); 75 EVP_EncryptInit(ctx,data,key,iv);
@@ -82,22 +77,15 @@ int enc;
82 EVP_DecryptInit(ctx,data,key,iv); 77 EVP_DecryptInit(ctx,data,key,iv);
83 } 78 }
84 79
85void EVP_CipherUpdate(ctx,out,outl,in,inl) 80void EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
86EVP_CIPHER_CTX *ctx; 81 unsigned char *in, int inl)
87unsigned char *out;
88int *outl;
89unsigned char *in;
90int inl;
91 { 82 {
92 if (ctx->encrypt) 83 if (ctx->encrypt)
93 EVP_EncryptUpdate(ctx,out,outl,in,inl); 84 EVP_EncryptUpdate(ctx,out,outl,in,inl);
94 else EVP_DecryptUpdate(ctx,out,outl,in,inl); 85 else EVP_DecryptUpdate(ctx,out,outl,in,inl);
95 } 86 }
96 87
97int EVP_CipherFinal(ctx,out,outl) 88int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
98EVP_CIPHER_CTX *ctx;
99unsigned char *out;
100int *outl;
101 { 89 {
102 if (ctx->encrypt) 90 if (ctx->encrypt)
103 { 91 {
@@ -107,11 +95,8 @@ int *outl;
107 else return(EVP_DecryptFinal(ctx,out,outl)); 95 else return(EVP_DecryptFinal(ctx,out,outl));
108 } 96 }
109 97
110void EVP_EncryptInit(ctx,cipher,key,iv) 98void EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
111EVP_CIPHER_CTX *ctx; 99 unsigned char *key, unsigned char *iv)
112EVP_CIPHER *cipher;
113unsigned char *key;
114unsigned char *iv;
115 { 100 {
116 if (cipher != NULL) 101 if (cipher != NULL)
117 ctx->cipher=cipher; 102 ctx->cipher=cipher;
@@ -120,11 +105,8 @@ unsigned char *iv;
120 ctx->buf_len=0; 105 ctx->buf_len=0;
121 } 106 }
122 107
123void EVP_DecryptInit(ctx,cipher,key,iv) 108void EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
124EVP_CIPHER_CTX *ctx; 109 unsigned char *key, unsigned char *iv)
125EVP_CIPHER *cipher;
126unsigned char *key;
127unsigned char *iv;
128 { 110 {
129 if (cipher != NULL) 111 if (cipher != NULL)
130 ctx->cipher=cipher; 112 ctx->cipher=cipher;
@@ -134,12 +116,8 @@ unsigned char *iv;
134 } 116 }
135 117
136 118
137void EVP_EncryptUpdate(ctx,out,outl,in,inl) 119void EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
138EVP_CIPHER_CTX *ctx; 120 unsigned char *in, int inl)
139unsigned char *out;
140int *outl;
141unsigned char *in;
142int inl;
143 { 121 {
144 int i,j,bl; 122 int i,j,bl;
145 123
@@ -179,10 +157,7 @@ int inl;
179 ctx->buf_len=i; 157 ctx->buf_len=i;
180 } 158 }
181 159
182void EVP_EncryptFinal(ctx,out,outl) 160void EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
183EVP_CIPHER_CTX *ctx;
184unsigned char *out;
185int *outl;
186 { 161 {
187 int i,n,b,bl; 162 int i,n,b,bl;
188 163
@@ -200,12 +175,8 @@ int *outl;
200 *outl=b; 175 *outl=b;
201 } 176 }
202 177
203void EVP_DecryptUpdate(ctx,out,outl,in,inl) 178void EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
204EVP_CIPHER_CTX *ctx; 179 unsigned char *in, int inl)
205unsigned char *out;
206int *outl;
207unsigned char *in;
208int inl;
209 { 180 {
210 int b,bl,n; 181 int b,bl,n;
211 int keep_last=0; 182 int keep_last=0;
@@ -249,10 +220,7 @@ int inl;
249 } 220 }
250 } 221 }
251 222
252int EVP_DecryptFinal(ctx,out,outl) 223int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
253EVP_CIPHER_CTX *ctx;
254unsigned char *out;
255int *outl;
256 { 224 {
257 int i,b; 225 int i,b;
258 int n; 226 int n;
@@ -293,8 +261,7 @@ int *outl;
293 return(1); 261 return(1);
294 } 262 }
295 263
296void EVP_CIPHER_CTX_cleanup(c) 264void EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c)
297EVP_CIPHER_CTX *c;
298 { 265 {
299 if ((c->cipher != NULL) && (c->cipher->cleanup != NULL)) 266 if ((c->cipher != NULL) && (c->cipher->cleanup != NULL))
300 c->cipher->cleanup(c); 267 c->cipher->cleanup(c);