Lines Matching defs:block

233 static apr_status_t crypto_block_cleanup(apr_crypto_block_t *block)
236 if (block->ctx) {
237 PK11_DestroyContext(block->ctx, PR_TRUE);
238 block->ctx = NULL;
247 apr_crypto_block_t *block = (apr_crypto_block_t *) data;
248 return crypto_block_cleanup(block);
516 * @param ctx The block context returned, see note.
522 * @param blockSize The block size of the cipher.
536 apr_crypto_block_t *block = *ctx;
537 if (!block) {
538 *ctx = block = apr_pcalloc(p, sizeof(apr_crypto_block_t));
540 if (!block) {
543 block->f = key->f;
544 block->pool = p;
545 block->provider = key->provider;
547 apr_pool_cleanup_register(p, block, crypto_block_cleanup_helper,
577 block->blockSize = PK11_GetBlockSize(key->cipherMech, secParam);
578 block->ctx = PK11_CreateContextBySymKey(key->cipherMech, CKA_ENCRYPT,
583 if (perr || !block->ctx) {
611 * @param ctx The block context to use.
617 apr_crypto_block_t *block)
624 *outlen = inlen + block->blockSize;
628 buffer = apr_palloc(block->pool, inlen + block->blockSize);
632 apr_crypto_clear(block->pool, buffer, inlen + block->blockSize);
636 s = PK11_CipherOp(block->ctx, *out, &outl, inlen, (unsigned char*) in,
641 block->f->result->rc = perr;
642 block->f->result->msg = PR_ErrorToName(perr);
653 * @brief Encrypt final data block, write it to out.
654 * @note If necessary the final block will be written out after being
655 * padded. Typically the final block will be written to the
664 * @param ctx The block context to use.
666 * @return APR_EPADDING if padding was enabled and the block was incorrectly
671 apr_size_t *outlen, apr_crypto_block_t *block)
677 SECStatus s = PK11_DigestFinal(block->ctx, out, &outl, block->blockSize);
683 block->f->result->rc = perr;
684 block->f->result->msg = PR_ErrorToName(perr);
688 crypto_block_cleanup(block);
698 * @param ctx The block context returned, see note.
699 * @param blockSize The block size of the cipher.
715 apr_crypto_block_t *block = *ctx;
716 if (!block) {
717 *ctx = block = apr_pcalloc(p, sizeof(apr_crypto_block_t));
719 if (!block) {
722 block->f = key->f;
723 block->pool = p;
724 block->provider = key->provider;
726 apr_pool_cleanup_register(p, block, crypto_block_cleanup_helper,
741 block->blockSize = PK11_GetBlockSize(key->cipherMech, secParam);
742 block->ctx = PK11_CreateContextBySymKey(key->cipherMech, CKA_DECRYPT,
747 if (perr || !block->ctx) {
775 * @param ctx The block context to use.
781 apr_crypto_block_t *block)
788 *outlen = inlen + block->blockSize;
792 buffer = apr_palloc(block->pool, inlen + block->blockSize);
796 apr_crypto_clear(block->pool, buffer, inlen + block->blockSize);
800 s = PK11_CipherOp(block->ctx, *out, &outl, inlen, (unsigned char*) in,
805 block->f->result->rc = perr;
806 block->f->result->msg = PR_ErrorToName(perr);
817 * @brief Decrypt final data block, write it to out.
818 * @note If necessary the final block will be written out after being
819 * padded. Typically the final block will be written to the
828 * @param ctx The block context to use.
830 * @return APR_EPADDING if padding was enabled and the block was incorrectly
835 apr_size_t *outlen, apr_crypto_block_t *block)
841 SECStatus s = PK11_DigestFinal(block->ctx, out, &outl, block->blockSize);
847 block->f->result->rc = perr;
848 block->f->result->msg = PR_ErrorToName(perr);
852 crypto_block_cleanup(block);