Home | History | Annotate | Download | only in evp

Lines Matching refs:ctx

110 	BIO_ENC_CTX *ctx;
112 ctx=(BIO_ENC_CTX *)OPENSSL_malloc(sizeof(BIO_ENC_CTX));
113 if (ctx == NULL) return(0);
114 EVP_CIPHER_CTX_init(&ctx->cipher);
116 ctx->buf_len=0;
117 ctx->buf_off=0;
118 ctx->cont=1;
119 ctx->finished=0;
120 ctx->ok=1;
123 bi->ptr=(char *)ctx;
146 BIO_ENC_CTX *ctx;
149 ctx=(BIO_ENC_CTX *)b->ptr;
151 if ((ctx == NULL) || (b->next_bio == NULL)) return(0);
154 if (ctx->buf_len > 0)
156 i=ctx->buf_len-ctx->buf_off;
158 memcpy(out,&(ctx->buf[ctx->buf_off]),i);
162 ctx->buf_off+=i;
163 if (ctx->buf_len == ctx->buf_off)
165 ctx->buf_len=0;
166 ctx->buf_off=0;
175 if (ctx->cont <= 0) break;
179 i=BIO_read(b->next_bio,&(ctx->buf[BUF_OFFSET]),ENC_BLOCK_SIZE);
186 ctx->cont=i;
187 i=EVP_CipherFinal_ex(&(ctx->cipher),
188 (unsigned char *)ctx->buf,
189 &(ctx->buf_len));
190 ctx->ok=i;
191 ctx->buf_off=0;
201 EVP_CipherUpdate(&(ctx->cipher),
202 (unsigned char *)ctx->buf,&ctx->buf_len,
203 (unsigned char *)&(ctx->buf[BUF_OFFSET]),i);
204 ctx->cont=1;
211 if(ctx->buf_len == 0) continue;
214 if (ctx->buf_len <= outl)
215 i=ctx->buf_len;
219 memcpy(out,ctx->buf,i);
221 ctx->buf_off=i;
228 return((ret == 0)?ctx->cont:ret);
234 BIO_ENC_CTX *ctx;
236 ctx=(BIO_ENC_CTX *)b->ptr;
240 n=ctx->buf_len-ctx->buf_off;
243 i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n);
249 ctx->buf_off+=i;
256 ctx->buf_off=0;
260 EVP_CipherUpdate(&(ctx->cipher),
261 (unsigned char *)ctx->buf,&ctx->buf_len,
266 ctx->buf_off=0;
267 n=ctx->buf_len;
270 i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n);
277 ctx->buf_off+=i;
279 ctx->buf_len=0;
280 ctx->buf_off=0;
289 BIO_ENC_CTX *ctx,*dctx;
294 ctx=(BIO_ENC_CTX *)b->ptr;
299 ctx->ok=1;
300 ctx->finished=0;
301 EVP_CipherInit_ex(&(ctx->cipher),NULL,NULL,NULL,NULL,
302 ctx->cipher.encrypt);
306 if (ctx->cont <= 0)
312 ret=ctx->buf_len-ctx->buf_off;
317 ret=ctx->buf_len-ctx->buf_off;
324 while (ctx->buf_len != ctx->buf_off)
331 if (!ctx->finished)
333 ctx->finished=1;
334 ctx->buf_off=0;
335 ret=EVP_CipherFinal_ex(&(ctx->cipher),
336 (unsigned char *)ctx->buf,
337 &(ctx->buf_len));
338 ctx->ok=(int)ret;
349 ret=(long)ctx->ok;
358 (*c_ctx)= &(ctx->cipher);
365 ret = EVP_CIPHER_CTX_copy(&dctx->cipher,&ctx->cipher);
402 ctx=(BIO_ENC_CTX *)b->ptr;
403 memcpy(ctx->cipher,c,sizeof(EVP_CIPHER_CTX));
413 BIO_ENC_CTX *ctx;
422 ctx=(BIO_ENC_CTX *)b->ptr;
423 EVP_CipherInit_ex(&(ctx->cipher),c,NULL, k,i,e);