Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1235801ybz; Wed, 29 Apr 2020 17:49:03 -0700 (PDT) X-Google-Smtp-Source: APiQypLUNqBYuAVrBVQGUIF5uozt0cxccaBsmhPV/E7jBeNjfQAcPfHEeY0B6bD3Ii0keT1DukX8 X-Received: by 2002:a50:f61b:: with SMTP id c27mr524640edn.256.1588207743743; Wed, 29 Apr 2020 17:49:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588207743; cv=none; d=google.com; s=arc-20160816; b=P/KQbuetqT0Q/pROCNk4R8CUyCR4J/g+jq7pmiVeiqmQzIv7PEVviTXojJ8S+j+Nkx iMXxsz/hhNRzAZylPv0RNwxVQULYBE80Wa3jaVpMTwo/YwqIRFIL5xpLGYAF0bxZ2sI6 prFU5DmrnCR4pV9SsOmqezyvXY0Rgb9v9ClVBuV9H2sF60ymWSAqZY1rU8bRmDt35ghb jScVhpdKBlaILyEE8HdNMhqwRpSPBFFBWTAlHxa4HXtr8TQJQlA0MZFsS2uY3XmjnqAj EZvfFbQrGUwQRZgZlsbyFhvlQEUZGppD7ShRvXqOi0toCK6YFgqzPDzd+I9XgRG/oUei O9Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=wsdK5SjT8ryjefhmGWRSY0yfIOXI7p/LdLv+CqWIo0k=; b=MjE3Pg0ayq5ZxOSiZ9sfwGzngNeEtVSCjb1YZQPXgK7fweVI7+xXL2/NbQRuCazmm9 ZRlbfml14r9WZx45J+h3DsjS9fHPl45yAoioGpxRDGCVTcUg/WxVcc029/ceEb/WXL28 w60ds4TdozeNqdnUPPtXRJu/AoqhRm9BlItbGdDJmu7lFadWyE2NDlmlR8IgHPiUgvb2 mpzAgRksggKC72FGtqCrC3qv7Zs9ZtAlv5DMinSvGIuoFRQhEDvbhAxNqhQNaTFcmnCh pi9dVsogu1DypXBhzxWk1kxM0EK98xfQBNBtN9CTmug9WtPqsnO5f6EbiTD/AtywCsh9 udIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j5si5238193ejj.183.2020.04.29.17.48.29; Wed, 29 Apr 2020 17:49:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726486AbgD3AsO (ORCPT + 99 others); Wed, 29 Apr 2020 20:48:14 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3386 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726309AbgD3AsO (ORCPT ); Wed, 29 Apr 2020 20:48:14 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 4B90C99083E5249DB887; Thu, 30 Apr 2020 08:48:12 +0800 (CST) Received: from SWX921481.china.huawei.com (10.126.201.159) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.487.0; Thu, 30 Apr 2020 08:48:03 +0800 From: Barry Song To: , CC: , , Barry Song Subject: [PATCH] crypto: acomp - search acomp with scomp backend in crypto_has_acomp Date: Thu, 30 Apr 2020 12:47:32 +1200 Message-ID: <20200430004732.24092-1-song.bao.hua@hisilicon.com> X-Mailer: git-send-email 2.21.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.126.201.159] X-CFilter-Loop: Reflected Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org users may call crypto_has_acomp to confirm the existence of acomp before using crypto_acomp APIs. Right now, many of acomp have scomp backend, for example, lz4, lzo, deflate etc. crypto_has_acomp will return false for them even though they support acomp APIs. One possible way to make has_acomp true for them is calling this APIs like crypto_has_acomp("xxx", CRYPTO_ALG_TYPE_SCOMPRESS, 0); But it looks quite weird. Signed-off-by: Barry Song --- include/crypto/acompress.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/crypto/acompress.h b/include/crypto/acompress.h index d873f999b334..a7170848e6c2 100644 --- a/include/crypto/acompress.h +++ b/include/crypto/acompress.h @@ -156,7 +156,7 @@ static inline void crypto_free_acomp(struct crypto_acomp *tfm) static inline int crypto_has_acomp(const char *alg_name, u32 type, u32 mask) { type &= ~CRYPTO_ALG_TYPE_MASK; - type |= CRYPTO_ALG_TYPE_ACOMPRESS; + type |= CRYPTO_ALG_TYPE_ACOMPRESS | CRYPTO_ALG_TYPE_SCOMPRESS; mask |= CRYPTO_ALG_TYPE_MASK; return crypto_has_alg(alg_name, type, mask); -- 2.23.0