From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f66.google.com (mail-lf0-f66.google.com [209.85.215.66]) by dpdk.org (Postfix) with ESMTP id D98421B595 for ; Wed, 11 Jul 2018 14:24:35 +0200 (CEST) Received: by mail-lf0-f66.google.com with SMTP id m13-v6so21113187lfb.12 for ; Wed, 11 Jul 2018 05:24:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=q8T+Cl0uSqVcMm/l5dAsPkp27z9EHYit/RXKytMpWPw=; b=J3dehLVwBPruKRSrWYbvK2Bx9UrsaCAjyy8w3yipkEbuyATBGkjPrFaG3zKESUH4gb dIdWZE/eIEcOuhqo1wH5igKp08VsUp8WyjOl5FV4wK/qvWIptSrE/DL5xH2fT28vQsan X++5E0I+t4WQ4x0+CkQbN2ztG+04GBkUgd6bw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=q8T+Cl0uSqVcMm/l5dAsPkp27z9EHYit/RXKytMpWPw=; b=bysmme9Aq3ypLDinIi/K7Sf54RdUBl4kM4jodLkt49i17JEiYkMPHwACn/tITI/SYZ nXylP0408Vn7Au+WWVd7gjiVx6kNrdvN0RBtY02TPqj+Nc9dV53Li7iBW0BDoJ7YDhmK itwupfuxok2D4oLPozvvhnbH/dP8b1FYMtTUCFSlQ/RPCQ5cb3eofYN+J/XGhYbNL0te nd1OazRMPfIAyZzMzrVBPneFpptV0ThPiZ+kSdFCTVylpyznI0ZrBCbknfUE6u8eoEzG j6OfiufsvG065pZVy1yOOsD7ZsGRs/00DvYWmSvLNymix+QT5LB83OTxxGLdmlrgcziw 7VFw== X-Gm-Message-State: APt69E3v04ZL3GdiZ9IyRDzNpaeB/BqVbWRrjlbec2CL+PltsQ6zqmsC x4kTOS2i2VCXggnS7dYWHYaJqgwho2M= X-Google-Smtp-Source: AAOMgpeFMxw0OfhwiVjBRTP3vl9PTzMxTjoE9x9JQ4pl33HCYJtO/8Ok59aEnj6XvL8YdRgR9OYE2g== X-Received: by 2002:a19:5418:: with SMTP id i24-v6mr5509683lfb.34.1531311874204; Wed, 11 Jul 2018 05:24:34 -0700 (PDT) Received: from rhovanion.lumag.spb.ru ([94.25.229.8]) by smtp.gmail.com with ESMTPSA id g11-v6sm591201ljk.45.2018.07.11.05.24.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 05:24:33 -0700 (PDT) From: Dmitry Eremin-Solenikov To: dev@dpdk.org Date: Wed, 11 Jul 2018 15:24:32 +0300 Message-Id: <20180711122432.14658-1-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.18.0 Subject: [dpdk-dev] [PATCH] qat: fix checks for 3gpp algorithms vs bit mode X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 12:24:36 -0000 QAT driver checks byte alignment for KASUMI/SNOW 3G/ZUC algorithms using cipher/auth_param, which are not initialized at this moment yet. Use operation params instead. Signed-off-by: Dmitry Eremin-Solenikov --- drivers/crypto/qat/qat_sym.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c index 17d63eb1ee35..0ede2c23d54f 100644 --- a/drivers/crypto/qat/qat_sym.c +++ b/drivers/crypto/qat/qat_sym.c @@ -224,18 +224,16 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg, ctx->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_ZUC_3G_128_EEA3) { - if (unlikely( - (cipher_param->cipher_length % BYTE_LENGTH != 0) - || (cipher_param->cipher_offset - % BYTE_LENGTH != 0))) { + cipher_len = op->sym->cipher.data.length >> 3; + cipher_ofs = op->sym->cipher.data.offset >> 3; + + if (unlikely((cipher_len % BYTE_LENGTH != 0) + || (cipher_ofs % BYTE_LENGTH != 0))) { QAT_DP_LOG(ERR, "SNOW3G/KASUMI/ZUC in QAT PMD only supports byte aligned values"); op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS; return -EINVAL; } - cipher_len = op->sym->cipher.data.length >> 3; - cipher_ofs = op->sym->cipher.data.offset >> 3; - } else if (ctx->bpi_ctx) { /* DOCSIS - only send complete blocks to device * Process any partial block using CFB mode. @@ -260,15 +258,17 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg, ctx->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_KASUMI_F9 || ctx->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_ZUC_3G_128_EIA3) { - if (unlikely((auth_param->auth_off % BYTE_LENGTH != 0) - || (auth_param->auth_len % BYTE_LENGTH != 0))) { + + auth_ofs = op->sym->auth.data.offset >> 3; + auth_len = op->sym->auth.data.length >> 3; + + if (unlikely((auth_off % BYTE_LENGTH != 0) + || (auth_len % BYTE_LENGTH != 0))) { QAT_DP_LOG(ERR, "For SNOW3G/KASUMI/ZUC, QAT PMD only supports byte aligned values"); op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS; return -EINVAL; } - auth_ofs = op->sym->auth.data.offset >> 3; - auth_len = op->sym->auth.data.length >> 3; auth_param->u1.aad_adr = rte_crypto_op_ctophys_offset(op, -- 2.18.0