From patchwork Wed Jul 11 12:24:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Eremin-Solenikov X-Patchwork-Id: 141729 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp222992ljj; Wed, 11 Jul 2018 05:24:37 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeFKKp4y10emYQPiC8Q9AS42B6q7vtSC62LrB0D67312O20i8m3pfsWC+go/5g4ukWnYIAT X-Received: by 2002:a1c:9809:: with SMTP id a9-v6mr12360695wme.15.1531311877836; Wed, 11 Jul 2018 05:24:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531311877; cv=none; d=google.com; s=arc-20160816; b=OQK4QZcbAzPaEM39BSpOcMBGY2i/TkL6gYPAD49LfBjav553EtO1kfXcKm14ytku9z iT3Yp5Tyq7v8jFz2cFROJK/sGOCt/Drbu5R8/kq+ddMC6Rywj1P/ELkzZGqT9Jmq0Idp GKD+VGqb3c0k7V55b3TBu1k/yjjadzOF14LWE1vjiKcZhO4iSvIgXpuiGcQhJztSzj1I oOPCGJemHjsnH6kBjGAyWBMKazwePpJmMSaHT7Ja/iRLqnM+OrnFE5pKuNTIldHJWO+C 40aCXzD9z0e6rF+jTwSlPqT9khYhgzRcaTtrVizLeJMcR2laMts3igJLMAT/3I49R6sd s4Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=q8T+Cl0uSqVcMm/l5dAsPkp27z9EHYit/RXKytMpWPw=; b=qh4GQttFX38XcAtC/xjPTndA4bnOf5FJRFJ49/lTmrTzxB9ChCA1jm7l2r257O2l6Y +9V078OGDs862ELp7KP5GYPNAxtduCGkfZocVlUfbMWL3u8Hga9A+aLIiVkCAR1HmXrZ /WGakMcAEVMQovMZYKfqoe+8HWFMJmYFUGLdj9db9Cqou1ZiWAqaEbUzilpMXoyv9Iz+ rxFCNyfE3ePXTe0PfCCNor8lI7BmsS7UxBBMYAt9uUcpBSf969XAGDfBq/OkZHTOvpLv SQXsGrO6S+zxF8lHnWPOncjsDWnlNo8oNbbV59CG/RY26dKZOXvs3cPYuJP10lAsacSw R6og== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=J3dehLVw; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id p196-v6si1438476wme.58.2018.07.11.05.24.37; Wed, 11 Jul 2018 05:24:37 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=J3dehLVw; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 07D1A1B596; Wed, 11 Jul 2018 14:24:37 +0200 (CEST) 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-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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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(-) -- 2.18.0 Acked-by: Pablo de Lara 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,