예제 #1
0
static int
ixp_init(void)
{
	IxCryptoAccStatus status;

	ixp_ctx.cipherCtx.cipherAlgo = IX_CRYPTO_ACC_CIPHER_3DES;
	ixp_ctx.cipherCtx.cipherMode = IX_CRYPTO_ACC_MODE_CBC;
	ixp_ctx.cipherCtx.cipherKeyLen = 24;
	ixp_ctx.cipherCtx.cipherBlockLen = IX_CRYPTO_ACC_DES_BLOCK_64;
	ixp_ctx.cipherCtx.cipherInitialVectorLen = IX_CRYPTO_ACC_DES_IV_64;
	memcpy(ixp_ctx.cipherCtx.key.cipherKey, "0123456789abcdefghijklmn", 24);

	ixp_ctx.authCtx.authAlgo = IX_CRYPTO_ACC_AUTH_SHA1;
	ixp_ctx.authCtx.authDigestLen = 12;
	ixp_ctx.authCtx.aadLen = 0;
	ixp_ctx.authCtx.authKeyLen = 20;
	memcpy(ixp_ctx.authCtx.key.authKey, "0123456789abcdefghij", 20);

	ixp_ctx.useDifferentSrcAndDestMbufs = 0;
	ixp_ctx.operation = IX_CRYPTO_ACC_OP_ENCRYPT_AUTH ;

	IX_MBUF_MLEN(&ixp_pri)  = IX_MBUF_PKT_LEN(&ixp_pri) = 128;
	IX_MBUF_MDATA(&ixp_pri) = (unsigned char *) kmalloc(128, SLAB_ATOMIC);
	IX_MBUF_MLEN(&ixp_sec)  = IX_MBUF_PKT_LEN(&ixp_sec) = 128;
	IX_MBUF_MDATA(&ixp_sec) = (unsigned char *) kmalloc(128, SLAB_ATOMIC);

	status = ixCryptoAccCtxRegister(&ixp_ctx, &ixp_pri, &ixp_sec,
			ixp_register_cb, ixp_perform_cb, &ixp_ctx_id);

	if (IX_CRYPTO_ACC_STATUS_SUCCESS == status) {
		while (!ixp_registered)
			schedule();
		return ixp_registered < 0 ? -1 : 0;
	}

	printk("ixp: ixCryptoAccCtxRegister failed %d\n", status);
	return -1;
}
예제 #2
0
static void
ixp_register_cb(UINT32 ctx_id, IX_MBUF *bufp, IxCryptoAccStatus status)
{
	if (bufp) {
		IX_MBUF_MLEN(bufp) = IX_MBUF_PKT_LEN(bufp) = 0;
		kfree(IX_MBUF_MDATA(bufp));
		IX_MBUF_MDATA(bufp) = NULL;
	}

	if (IX_CRYPTO_ACC_STATUS_WAIT == status)
		return;
	if (IX_CRYPTO_ACC_STATUS_SUCCESS == status)
		ixp_registered = 1;
	else
		ixp_registered = -1;
}
예제 #3
0
static void
ixp_request(void *arg)
{
	request_t *r = arg;
	IxCryptoAccStatus status;

	memset(&r->mbuf, 0, sizeof(r->mbuf));
	IX_MBUF_MLEN(&r->mbuf) = IX_MBUF_PKT_LEN(&r->mbuf) = request_size + 64;
	IX_MBUF_MDATA(&r->mbuf) = r->buffer;
	IX_MBUF_PRIV(&r->mbuf) = r;
	status = ixCryptoAccAuthCryptPerform(ixp_ctx_id, &r->mbuf, NULL,
			0, request_size, 0, request_size, request_size, r->buffer);
	if (IX_CRYPTO_ACC_STATUS_SUCCESS != status) {
		printk("status1 = %d\n", status);
		outstanding--;
		return;
	}
	return;
}
예제 #4
0
static void
ixp_request(void *arg)
{
	request_t *r = arg;
	IxCryptoAccStatus status;
	unsigned long flags;

	memset(&r->mbuf, 0, sizeof(r->mbuf));
	IX_MBUF_MLEN(&r->mbuf) = IX_MBUF_PKT_LEN(&r->mbuf) = request_size + 64;
	IX_MBUF_MDATA(&r->mbuf) = r->buffer;
	IX_MBUF_PRIV(&r->mbuf) = r;
	status = ixCryptoAccAuthCryptPerform(ixp_ctx_id, &r->mbuf, NULL,
			0, request_size, 0, request_size, request_size, r->buffer);
	if (IX_CRYPTO_ACC_STATUS_SUCCESS != status) {
		printk("status1 = %d\n", status);
		spin_lock_irqsave(&ocfbench_counter_lock, flags);
		outstanding--;
		spin_unlock_irqrestore(&ocfbench_counter_lock, flags);
		return;
	}
	return;
}