当前位置: 首页>>代码示例>>C++>>正文


C++ crypto_tfm_ctx函数代码示例

本文整理汇总了C++中crypto_tfm_ctx函数的典型用法代码示例。如果您正苦于以下问题:C++ crypto_tfm_ctx函数的具体用法?C++ crypto_tfm_ctx怎么用?C++ crypto_tfm_ctx使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了crypto_tfm_ctx函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pcrypt_aead_exit_tfm

static void pcrypt_aead_exit_tfm(struct crypto_tfm *tfm)
{
	struct pcrypt_aead_ctx *ctx = crypto_tfm_ctx(tfm);

	crypto_free_aead(ctx->child);
}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:6,代码来源:pcrypt.c

示例2: chksum_final

static void chksum_final(struct crypto_tfm *tfm, u8 *out)
{
	struct chksum_ctx *mctx = crypto_tfm_ctx(tfm);
	
	*(__le32 *)out = ~cpu_to_le32(mctx->crc);
}
开发者ID:janrinze,项目名称:loox7xxport,代码行数:6,代码来源:crc32c.c

示例3: crypto_pcbc_exit_tfm

static void crypto_pcbc_exit_tfm(struct crypto_tfm *tfm)
{
	struct crypto_pcbc_ctx *ctx = crypto_tfm_ctx(tfm);
	crypto_free_cipher(ctx->child);
}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:5,代码来源:pcbc.c

示例4: ecb_process

static void ecb_process(struct crypto_tfm *tfm, u8 *dst, u8 *src,
			cryptfn_t fn, int enc, void *info, int in_place)
{
	fn(crypto_tfm_ctx(tfm), dst, src);
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:5,代码来源:cipher.c

示例5: des_decrypt

static void des_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
{
	struct s390_des_ctx *ctx = crypto_tfm_ctx(tfm);

	crypt_s390_km(KM_DEA_DECRYPT, ctx->key, out, in, DES_BLOCK_SIZE);
}
开发者ID:1800alex,项目名称:linux,代码行数:6,代码来源:des_s390.c

示例6: cprng_exit

static void cprng_exit(struct crypto_tfm *tfm)
{
	free_prng_context(crypto_tfm_ctx(tfm));
}
开发者ID:KAsp3rd,项目名称:android_kernel_lge_msm8992,代码行数:4,代码来源:ansi_cprng.c

示例7: lrw_encrypt

static int lrw_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
		       struct scatterlist *src, unsigned int nbytes)
{
	struct aesni_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
	be128 buf[8];
	struct lrw_crypt_req req = {
		.tbuf = buf,
		.tbuflen = sizeof(buf),

		.table_ctx = &ctx->lrw_table,
		.crypt_ctx = aes_ctx(ctx->raw_aes_ctx),
		.crypt_fn = lrw_xts_encrypt_callback,
	};
	int ret;

	desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;

	kernel_fpu_begin();
	ret = lrw_crypt(desc, dst, src, nbytes, &req);
	kernel_fpu_end();

	return ret;
}

static int lrw_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
		       struct scatterlist *src, unsigned int nbytes)
{
	struct aesni_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
	be128 buf[8];
	struct lrw_crypt_req req = {
		.tbuf = buf,
		.tbuflen = sizeof(buf),

		.table_ctx = &ctx->lrw_table,
		.crypt_ctx = aes_ctx(ctx->raw_aes_ctx),
		.crypt_fn = lrw_xts_decrypt_callback,
	};
	int ret;

	desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;

	kernel_fpu_begin();
	ret = lrw_crypt(desc, dst, src, nbytes, &req);
	kernel_fpu_end();

	return ret;
}

static int xts_aesni_setkey(struct crypto_tfm *tfm, const u8 *key,
			    unsigned int keylen)
{
	struct aesni_xts_ctx *ctx = crypto_tfm_ctx(tfm);
	u32 *flags = &tfm->crt_flags;
	int err;

	/* key consists of keys of equal size concatenated, therefore
	 * the length must be even
	 */
	if (keylen % 2) {
		*flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
		return -EINVAL;
	}

	/* first half of xts-key is for crypt */
	err = aes_set_key_common(tfm, ctx->raw_crypt_ctx, key, keylen / 2);
	if (err)
		return err;

	/* second half of xts-key is for tweak */
	return aes_set_key_common(tfm, ctx->raw_tweak_ctx, key + keylen / 2,
				  keylen / 2);
}


static void aesni_xts_tweak(void *ctx, u8 *out, const u8 *in)
{
	aesni_enc(ctx, out, in);
}

#ifdef CONFIG_X86_64

static void aesni_xts_enc(void *ctx, u128 *dst, const u128 *src, le128 *iv)
{
	glue_xts_crypt_128bit_one(ctx, dst, src, iv, GLUE_FUNC_CAST(aesni_enc));
}
开发者ID:a1d3s,项目名称:linux-bpi,代码行数:85,代码来源:aesni-intel_glue.c

示例8: crypto_rfc3686_exit_tfm

static void crypto_rfc3686_exit_tfm(struct crypto_tfm *tfm)
{
	struct crypto_rfc3686_ctx *ctx = crypto_tfm_ctx(tfm);

	crypto_free_ablkcipher(ctx->child);
}
开发者ID:0-T-0,项目名称:ps4-linux,代码行数:6,代码来源:ctr.c

示例9: lrw_aesni_exit_tfm

static void lrw_aesni_exit_tfm(struct crypto_tfm *tfm)
{
	struct aesni_lrw_ctx *ctx = crypto_tfm_ctx(tfm);

	lrw_free_table(&ctx->lrw_table);
}
开发者ID:a1d3s,项目名称:linux-bpi,代码行数:6,代码来源:aesni-intel_glue.c

示例10: crypto_rsa_set_key

/* public key, exponent, private key */
static int crypto_rsa_set_key(struct crypto_tfm *tfm, const u8 *in_key,
		              unsigned int key_len)
{
	struct crypto_rsa_ctx *ctx = crypto_tfm_ctx(tfm);
	int l;
	int part = 0;
	BIGNUM *x;
	RSA *rsa = &ctx->crr_rsa;

	cleanup_rsa(ctx);

	while (key_len >= 4) {
		l = ntohl(*((uint32_t*) in_key));

		l += 4;

		if (l > key_len)
			return -1;

		x = BN_mpi2bn(in_key, l, NULL);
		if (!x)
			return -1;

//		printk(KERN_INFO "PART %d\n", part);
		switch (part++) {
		case 0:
			rsa->n = x;
			break;

		case 1:
			rsa->e = x;
			break;

		case 2:
			rsa->d = x;
			break;

		case 3:
			rsa->p = x;
			break;

		case 4:
			rsa->q = x;
			break;

		case 5:
			rsa->dmp1 = x;
			break;

		case 6:
			rsa->dmq1 = x;
			break;

		case 7:
			rsa->iqmp = x;
			break;

		default:
			return -1;
		}

		key_len -= l;
		in_key  += l;
	}

	return 0;
}
开发者ID:Acidburn0zzz,项目名称:tcpcrypt,代码行数:68,代码来源:main.c

示例11: camellia_setkey

static int camellia_setkey(struct crypto_tfm *tfm, const u8 *in_key,
                           unsigned int key_len)
{
    return __camellia_setkey(crypto_tfm_ctx(tfm), in_key, key_len,
                             &tfm->crt_flags);
}
开发者ID:quadcores,项目名称:cbs_4.2.4,代码行数:6,代码来源:camellia_aesni_avx_glue.c

示例12: lzo_exit

static void lzo_exit(struct crypto_tfm *tfm)
{
    struct lzo_ctx *ctx = crypto_tfm_ctx(tfm);

    vfree(ctx->lzo_comp_mem);
}
开发者ID:274914765,项目名称:C,代码行数:6,代码来源:lzo.c

示例13: init

static void init(struct crypto_tfm *tfm)
{
	tfm->__crt_alg->cra_digest.dia_init(crypto_tfm_ctx(tfm));
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:4,代码来源:digest.c

示例14: des3_decrypt

static void des3_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
{
	struct s390_des_ctx *ctx = crypto_tfm_ctx(tfm);

	crypt_s390_km(KM_TDEA_192_DECRYPT, ctx->key, dst, src, DES_BLOCK_SIZE);
}
开发者ID:1800alex,项目名称:linux,代码行数:6,代码来源:des_s390.c

示例15: lz4_exit

static void lz4_exit(struct crypto_tfm *tfm)
{
	struct lz4_ctx *ctx = crypto_tfm_ctx(tfm);

	lz4_free_ctx(NULL, ctx->lz4_comp_mem);
}
开发者ID:BWhitten,项目名称:linux-stable,代码行数:6,代码来源:lz4.c


注:本文中的crypto_tfm_ctx函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。