Lines Matching defs:ctx

66     BIO_ENC_CTX *ctx;
68 if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL) {
73 ctx->cipher = EVP_CIPHER_CTX_new();
74 if (ctx->cipher == NULL) {
75 OPENSSL_free(ctx);
78 ctx->cont = 1;
79 ctx->ok = 1;
80 ctx->read_end = ctx->read_start = &(ctx->buf[BUF_OFFSET]);
81 BIO_set_data(bi, ctx);
109 BIO_ENC_CTX *ctx;
114 ctx = BIO_get_data(b);
117 if ((ctx == NULL) || (next == NULL))
121 if (ctx->buf_len > 0) {
122 i = ctx->buf_len - ctx->buf_off;
125 memcpy(out, &(ctx->buf[ctx->buf_off]), i);
129 ctx->buf_off += i;
130 if (ctx->buf_len == ctx->buf_off) {
131 ctx->buf_len = 0;
132 ctx->buf_off = 0;
136 blocksize = EVP_CIPHER_CTX_get_block_size(ctx->cipher);
146 if (ctx->cont <= 0)
149 if (ctx->read_start == ctx->read_end) { /* time to read more data */
150 ctx->read_end = ctx->read_start = &(ctx->buf[BUF_OFFSET]);
151 i = BIO_read(next, ctx->read_start, ENC_BLOCK_SIZE);
153 ctx->read_end += i;
155 i = ctx->read_end - ctx->read_start;
161 ctx->cont = i;
162 i = EVP_CipherFinal_ex(ctx->cipher,
163 ctx->buf, &(ctx->buf_len));
164 ctx->ok = i;
165 ctx->buf_off = 0;
179 if (!EVP_CipherUpdate(ctx->cipher,
181 ctx->read_start, i > j ? j : i)) {
190 ctx->read_start = ctx->read_end;
193 ctx->read_start += j;
197 if (!EVP_CipherUpdate(ctx->cipher,
198 ctx->buf, &ctx->buf_len,
199 ctx->read_start, i)) {
201 ctx->ok = 0;
204 ctx->read_start += i;
205 ctx->cont = 1;
212 if (ctx->buf_len == 0)
216 if (ctx->buf_len <= outl)
217 i = ctx->buf_len;
222 memcpy(out, ctx->buf, i);
224 ctx->buf_off = i;
231 return ((ret == 0) ? ctx->cont : ret);
237 BIO_ENC_CTX *ctx;
240 ctx = BIO_get_data(b);
242 if ((ctx == NULL) || (next == NULL))
248 n = ctx->buf_len - ctx->buf_off;
250 i = BIO_write(next, &(ctx->buf[ctx->buf_off]), n);
255 ctx->buf_off += i;
263 ctx->buf_off = 0;
266 if (!EVP_CipherUpdate(ctx->cipher,
267 ctx->buf, &ctx->buf_len,
270 ctx->ok = 0;
276 ctx->buf_off = 0;
277 n = ctx->buf_len;
279 i = BIO_write(next, &(ctx->buf[ctx->buf_off]), n);
285 ctx->buf_off += i;
287 ctx->buf_len = 0;
288 ctx->buf_off = 0;
297 BIO_ENC_CTX *ctx, *dctx;
304 ctx = BIO_get_data(b);
306 if (ctx == NULL)
311 ctx->ok = 1;
312 ctx->finished = 0;
313 if (!EVP_CipherInit_ex(ctx->cipher, NULL, NULL, NULL, NULL,
314 EVP_CIPHER_CTX_is_encrypting(ctx->cipher)))
319 if (ctx->cont <= 0)
325 ret = ctx->buf_len - ctx->buf_off;
330 ret = ctx->buf_len - ctx->buf_off;
337 while (ctx->buf_len != ctx->buf_off) {
338 pend = ctx->buf_len - ctx->buf_off;
345 if (i < 0 || (ctx->buf_len - ctx->buf_off) == pend)
349 if (!ctx->finished) {
350 ctx->finished = 1;
351 ctx->buf_off = 0;
352 ret = EVP_CipherFinal_ex(ctx->cipher,
353 (unsigned char *)ctx->buf,
354 &(ctx->buf_len));
355 ctx->ok = (int)ret;
367 ret = (long)ctx->ok;
376 *c_ctx = ctx->cipher;
385 ret = EVP_CIPHER_CTX_copy(dctx->cipher, ctx->cipher);
409 BIO_ENC_CTX *ctx;
415 ctx = BIO_get_data(b);
416 if (ctx == NULL)
437 if (!EVP_CipherInit_ex(ctx->cipher, c, NULL, k, i, e))