Lines Matching defs:ctx
133 BIO_OK_CTX *ctx;
135 if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL) {
140 ctx->cont = 1;
141 ctx->sigio = 1;
142 ctx->md = EVP_MD_CTX_new();
143 if (ctx->md == NULL) {
144 OPENSSL_free(ctx);
148 BIO_set_data(bi, ctx);
155 BIO_OK_CTX *ctx;
160 ctx = BIO_get_data(a);
162 EVP_MD_CTX_free(ctx->md);
163 OPENSSL_clear_free(ctx, sizeof(BIO_OK_CTX));
173 BIO_OK_CTX *ctx;
179 ctx = BIO_get_data(b);
182 if ((ctx == NULL) || (next == NULL) || (BIO_get_init(b) == 0))
188 if (ctx->blockout) {
189 i = ctx->buf_len - ctx->buf_off;
192 memcpy(out, &(ctx->buf[ctx->buf_off]), i);
196 ctx->buf_off += i;
199 if (ctx->buf_len == ctx->buf_off) {
200 ctx->buf_off = 0;
205 if (ctx->buf_len_save > ctx->buf_off_save) {
206 ctx->buf_len = ctx->buf_len_save - ctx->buf_off_save;
207 memmove(ctx->buf, &(ctx->buf[ctx->buf_off_save]),
208 ctx->buf_len);
210 ctx->buf_len = 0;
212 ctx->blockout = 0;
221 n = IOBS - ctx->buf_len;
222 i = BIO_read(next, &(ctx->buf[ctx->buf_len]), n);
227 ctx->buf_len += i;
230 if (ctx->sigio == 1) {
238 if (ctx->sigio == 0) {
246 if (ctx->cont <= 0)
259 BIO_OK_CTX *ctx;
265 ctx = BIO_get_data(b);
269 if ((ctx == NULL) || (next == NULL) || (BIO_get_init(b) == 0))
272 if (ctx->sigio && !sig_out(b))
277 n = ctx->buf_len - ctx->buf_off;
278 while (ctx->blockout && n > 0) {
279 i = BIO_write(next, &(ctx->buf[ctx->buf_off]), n);
283 ctx->cont = 0;
286 ctx->buf_off += i;
291 ctx->blockout = 0;
292 if (ctx->buf_len == ctx->buf_off) {
293 ctx->buf_len = OK_BLOCK_BLOCK;
294 ctx->buf_off = 0;
300 n = (inl + ctx->buf_len > OK_BLOCK_SIZE + OK_BLOCK_BLOCK) ?
301 (int)(OK_BLOCK_SIZE + OK_BLOCK_BLOCK - ctx->buf_len) : inl;
303 memcpy(&ctx->buf[ctx->buf_len], in, n);
304 ctx->buf_len += n;
308 if (ctx->buf_len >= OK_BLOCK_SIZE + OK_BLOCK_BLOCK) {
323 BIO_OK_CTX *ctx;
330 ctx = BIO_get_data(b);
335 ctx->buf_len = 0;
336 ctx->buf_off = 0;
337 ctx->buf_len_save = 0;
338 ctx->buf_off_save = 0;
339 ctx->cont = 1;
340 ctx->finished = 0;
341 ctx->blockout = 0;
342 ctx->sigio = 1;
346 if (ctx->cont <= 0)
353 ret = ctx->blockout ? ctx->buf_len - ctx->buf_off : 0;
359 if (ctx->blockout == 0)
363 while (ctx->blockout) {
371 ctx->finished = 1;
372 ctx->buf_off = ctx->buf_len = 0;
373 ctx->cont = (int)ret;
384 ret = (long)ctx->cont;
388 if (!EVP_DigestInit_ex(ctx->md, md, NULL))
395 *ppmd = EVP_MD_CTX_get0_md(ctx->md);
435 BIO_OK_CTX *ctx;
441 ctx = BIO_get_data(b);
442 md = ctx->md;
447 if (ctx->buf_len + 2 * md_size > OK_BLOCK_SIZE)
458 memcpy(&(ctx->buf[ctx->buf_len]), md_data, md_size);
459 longswap(&(ctx->buf[ctx->buf_len]), md_size);
460 ctx->buf_len += md_size;
464 if (!EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL))
466 ctx->buf_len += md_size;
467 ctx->blockout = 1;
468 ctx->sigio = 0;
477 BIO_OK_CTX *ctx;
485 ctx = BIO_get_data(b);
486 if ((md = ctx->md) == NULL)
493 if ((int)(ctx->buf_len - ctx->buf_off) < 2 * md_size)
498 memcpy(md_data, &(ctx->buf[ctx->buf_off]), md_size);
500 ctx->buf_off += md_size;
506 ret = memcmp(&(ctx->buf[ctx->buf_off]), tmp, md_size) == 0;
507 ctx->buf_off += md_size;
509 ctx->sigio = 0;
510 if (ctx->buf_len != ctx->buf_off) {
511 memmove(ctx->buf, &(ctx->buf[ctx->buf_off]),
512 ctx->buf_len - ctx->buf_off);
514 ctx->buf_len -= ctx->buf_off;
515 ctx->buf_off = 0;
517 ctx->cont = 0;
527 BIO_OK_CTX *ctx;
533 ctx = BIO_get_data(b);
534 md = ctx->md;
538 tl = ctx->buf_len - OK_BLOCK_BLOCK;
539 ctx->buf[0] = (unsigned char)(tl >> 24);
540 ctx->buf[1] = (unsigned char)(tl >> 16);
541 ctx->buf[2] = (unsigned char)(tl >> 8);
542 ctx->buf[3] = (unsigned char)(tl);
544 (unsigned char *)&(ctx->buf[OK_BLOCK_BLOCK]), tl))
546 if (!EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL))
548 ctx->buf_len += md_size;
549 ctx->blockout = 1;
558 BIO_OK_CTX *ctx;
564 ctx = BIO_get_data(b);
565 md = ctx->md;
571 tl = ctx->buf[0];
573 tl |= ctx->buf[1];
575 tl |= ctx->buf[2];
577 tl |= ctx->buf[3];
579 if (ctx->buf_len < tl + OK_BLOCK_BLOCK + md_size)
583 (unsigned char *)&(ctx->buf[OK_BLOCK_BLOCK]), tl))
587 if (memcmp(&(ctx->buf[tl + OK_BLOCK_BLOCK]), tmp, md_size) == 0) {
589 ctx->buf_off_save = tl + OK_BLOCK_BLOCK + md_size;
590 ctx->buf_len_save = ctx->buf_len;
591 ctx->buf_off = OK_BLOCK_BLOCK;
592 ctx->buf_len = tl + OK_BLOCK_BLOCK;
593 ctx->blockout = 1;
595 ctx->cont = 0;