Lines Matching refs:ctx
129 BIO_BER_CTX *ctx;
131 ctx=(BIO_BER_CTX *)OPENSSL_malloc(sizeof(BIO_BER_CTX));
132 if (ctx == NULL) return(0);
134 memset((char *)ctx,0,sizeof(BIO_BER_CTX));
137 bi->ptr=(char *)ctx;
156 int bio_ber_get_header(BIO *bio, BIO_BER_CTX *ctx)
170 if (ctx->buf_off != 0)
172 p=ctx->buf;
173 j=ctx->buf_off;
174 n=ctx->buf_len-j;
180 ctx->buf_len-j;
181 ctx->buf_off=0;
185 i=BER_BUF_SIZE-ctx->buf_len;
188 i=BIO_read(bio->next_bio,&(ctx->buf[ctx->buf_len]),i);
195 ctx->buf_len+=i;
198 max=ctx->buf_len;
199 p=ctx->buf;
204 if ((ctx->buf_len < BER_BUF_SIZE) &&
215 if ((ctx->tag >= 0) && (ctx->tag != tag))
218 sprintf(buf,"tag=%d, got %d",ctx->tag,tag);
229 BIO_BER_CTX *ctx;
234 ctx=(BIO_BER_CTX *)b->ptr;
236 if ((ctx == NULL) || (b->next_bio == NULL)) return(0);
238 if (ctx->finished) return(0);
242 if (ctx->num_left > 0)
244 if (ctx->num_left < outl)
245 n=ctx->num_left;
254 ctx->num_left-=i;
257 if (ctx->num_left <= 0)
259 ctx->depth--;
260 if (ctx->depth <= 0)
261 ctx->finished=1;
276 BIO_ENC_CTX *ctx;
278 ctx=(BIO_ENC_CTX *)b->ptr;
282 n=ctx->buf_len-ctx->buf_off;
285 i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n);
291 ctx->buf_off+=i;
298 ctx->buf_off=0;
302 EVP_CipherUpdate(&(ctx->cipher),
303 (unsigned char *)ctx->buf,&ctx->buf_len,
308 ctx->buf_off=0;
309 n=ctx->buf_len;
312 i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n);
319 ctx->buf_off+=i;
321 ctx->buf_len=0;
322 ctx->buf_off=0;
331 BIO_ENC_CTX *ctx,*dctx;
335 ctx=(BIO_ENC_CTX *)b->ptr;
340 ctx->ok=1;
341 ctx->finished=0;
342 EVP_CipherInit_ex(&(ctx->cipher),NULL,NULL,NULL,NULL,
343 ctx->cipher.berrypt);
347 if (ctx->cont <= 0)
353 ret=ctx->buf_len-ctx->buf_off;
358 ret=ctx->buf_len-ctx->buf_off;
365 while (ctx->buf_len != ctx->buf_off)
375 if (!ctx->finished)
377 ctx->finished=1;
378 ctx->buf_off=0;
379 ret=EVP_CipherFinal_ex(&(ctx->cipher),
380 (unsigned char *)ctx->buf,
381 &(ctx->buf_len));
382 ctx->ok=(int)ret;
393 ret=(long)ctx->ok;
404 memcpy(&(dctx->cipher),&(ctx->cipher),sizeof(ctx->cipher));
440 ctx=(BIO_ENC_CTX *)b->ptr;
441 memcpy(ctx->cipher,c,sizeof(EVP_CIPHER_CTX));
451 BIO_ENC_CTX *ctx;
460 ctx=(BIO_ENC_CTX *)b->ptr;
461 EVP_CipherInit_ex(&(ctx->cipher),c,NULL,k,i,e);