Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Merge crypto tree to pick up hisilicon patch.
This commit is contained in:
commit
e3419426f2
|
@ -38,6 +38,13 @@ void curve25519_arch(u8 out[CURVE25519_KEY_SIZE],
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(curve25519_arch);
|
EXPORT_SYMBOL(curve25519_arch);
|
||||||
|
|
||||||
|
void curve25519_base_arch(u8 pub[CURVE25519_KEY_SIZE],
|
||||||
|
const u8 secret[CURVE25519_KEY_SIZE])
|
||||||
|
{
|
||||||
|
return curve25519_arch(pub, secret, curve25519_base_point);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(curve25519_base_arch);
|
||||||
|
|
||||||
static int curve25519_set_secret(struct crypto_kpp *tfm, const void *buf,
|
static int curve25519_set_secret(struct crypto_kpp *tfm, const void *buf,
|
||||||
unsigned int len)
|
unsigned int len)
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,7 +40,7 @@ struct sec_req {
|
||||||
int req_id;
|
int req_id;
|
||||||
|
|
||||||
/* Status of the SEC request */
|
/* Status of the SEC request */
|
||||||
int fake_busy;
|
atomic_t fake_busy;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -132,8 +132,8 @@ struct sec_debug_file {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sec_dfx {
|
struct sec_dfx {
|
||||||
u64 send_cnt;
|
atomic64_t send_cnt;
|
||||||
u64 recv_cnt;
|
atomic64_t recv_cnt;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sec_debug {
|
struct sec_debug {
|
||||||
|
|
|
@ -120,7 +120,7 @@ static void sec_req_cb(struct hisi_qp *qp, void *resp)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
__sync_add_and_fetch(&req->ctx->sec->debug.dfx.recv_cnt, 1);
|
atomic64_inc(&req->ctx->sec->debug.dfx.recv_cnt);
|
||||||
|
|
||||||
req->ctx->req_op->buf_unmap(req->ctx, req);
|
req->ctx->req_op->buf_unmap(req->ctx, req);
|
||||||
|
|
||||||
|
@ -135,13 +135,13 @@ static int sec_bd_send(struct sec_ctx *ctx, struct sec_req *req)
|
||||||
mutex_lock(&qp_ctx->req_lock);
|
mutex_lock(&qp_ctx->req_lock);
|
||||||
ret = hisi_qp_send(qp_ctx->qp, &req->sec_sqe);
|
ret = hisi_qp_send(qp_ctx->qp, &req->sec_sqe);
|
||||||
mutex_unlock(&qp_ctx->req_lock);
|
mutex_unlock(&qp_ctx->req_lock);
|
||||||
__sync_add_and_fetch(&ctx->sec->debug.dfx.send_cnt, 1);
|
atomic64_inc(&ctx->sec->debug.dfx.send_cnt);
|
||||||
|
|
||||||
if (ret == -EBUSY)
|
if (ret == -EBUSY)
|
||||||
return -ENOBUFS;
|
return -ENOBUFS;
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
if (req->fake_busy)
|
if (atomic_read(&req->fake_busy))
|
||||||
ret = -EBUSY;
|
ret = -EBUSY;
|
||||||
else
|
else
|
||||||
ret = -EINPROGRESS;
|
ret = -EINPROGRESS;
|
||||||
|
@ -641,7 +641,7 @@ static void sec_skcipher_callback(struct sec_ctx *ctx, struct sec_req *req)
|
||||||
if (ctx->c_ctx.c_mode == SEC_CMODE_CBC && req->c_req.encrypt)
|
if (ctx->c_ctx.c_mode == SEC_CMODE_CBC && req->c_req.encrypt)
|
||||||
sec_update_iv(req);
|
sec_update_iv(req);
|
||||||
|
|
||||||
if (__sync_bool_compare_and_swap(&req->fake_busy, 1, 0))
|
if (atomic_cmpxchg(&req->fake_busy, 1, 0) != 1)
|
||||||
sk_req->base.complete(&sk_req->base, -EINPROGRESS);
|
sk_req->base.complete(&sk_req->base, -EINPROGRESS);
|
||||||
|
|
||||||
sk_req->base.complete(&sk_req->base, req->err_type);
|
sk_req->base.complete(&sk_req->base, req->err_type);
|
||||||
|
@ -672,9 +672,9 @@ static int sec_request_init(struct sec_ctx *ctx, struct sec_req *req)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->fake_req_limit <= atomic_inc_return(&qp_ctx->pending_reqs))
|
if (ctx->fake_req_limit <= atomic_inc_return(&qp_ctx->pending_reqs))
|
||||||
req->fake_busy = 1;
|
atomic_set(&req->fake_busy, 1);
|
||||||
else
|
else
|
||||||
req->fake_busy = 0;
|
atomic_set(&req->fake_busy, 0);
|
||||||
|
|
||||||
ret = ctx->req_op->get_res(ctx, req);
|
ret = ctx->req_op->get_res(ctx, req);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
|
@ -608,6 +608,14 @@ static const struct file_operations sec_dbg_fops = {
|
||||||
.write = sec_debug_write,
|
.write = sec_debug_write,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int debugfs_atomic64_t_get(void *data, u64 *val)
|
||||||
|
{
|
||||||
|
*val = atomic64_read((atomic64_t *)data);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
DEFINE_DEBUGFS_ATTRIBUTE(fops_atomic64_t_ro, debugfs_atomic64_t_get, NULL,
|
||||||
|
"%lld\n");
|
||||||
|
|
||||||
static int sec_core_debug_init(struct sec_dev *sec)
|
static int sec_core_debug_init(struct sec_dev *sec)
|
||||||
{
|
{
|
||||||
struct hisi_qm *qm = &sec->qm;
|
struct hisi_qm *qm = &sec->qm;
|
||||||
|
@ -628,9 +636,11 @@ static int sec_core_debug_init(struct sec_dev *sec)
|
||||||
|
|
||||||
debugfs_create_regset32("regs", 0444, tmp_d, regset);
|
debugfs_create_regset32("regs", 0444, tmp_d, regset);
|
||||||
|
|
||||||
debugfs_create_u64("send_cnt", 0444, tmp_d, &dfx->send_cnt);
|
debugfs_create_file("send_cnt", 0444, tmp_d, &dfx->send_cnt,
|
||||||
|
&fops_atomic64_t_ro);
|
||||||
|
|
||||||
debugfs_create_u64("recv_cnt", 0444, tmp_d, &dfx->recv_cnt);
|
debugfs_create_file("recv_cnt", 0444, tmp_d, &dfx->recv_cnt,
|
||||||
|
&fops_atomic64_t_ro);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue