From patchwork Thu Oct 10 08:21:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhou Wang X-Patchwork-Id: 175709 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1961469ill; Thu, 10 Oct 2019 01:24:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQ4c18fXZ7+XEYTCpMnj+vdc8UNhCiGt7o0PRlCZ+5rZ994/rMHn9+R3fHo54Io9muiczX X-Received: by 2002:a17:906:a459:: with SMTP id cb25mr6785080ejb.63.1570695898488; Thu, 10 Oct 2019 01:24:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570695898; cv=none; d=google.com; s=arc-20160816; b=KJ9Yrg/Rym/VzphvsyIRk4sR5DfkEOhs7223e96dHJwYCiai4oAgPbKgvwSwxCVuvB wGiKXhpovRAJhFRQu2MU874KeiEaP4GbueCrZsvDkhuhWTVoVodyDxg/grczlIXET2JX YN/nlCV+yhmPLEk8mUdjQapP+qzFNbXcbFY9FWF9guJW0uF3R6JtjcosB874JRLBOwWo apVVbsRokvT2ZuXsKZlPU2yFAJJN4jq3dFYlgtaE+miPualEJ3YntCY2l0h2I1a5kOaX iMwSGVv7lykR5pioFxj+PYGFRqag1hgIs7aWXHf292gym9yiYQi8tNTJg2ZtN09zSOZd tlTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=Dy0F7ms7DPtbw3AisZ3swXdFKhGaIuZybxH2r+OOCGk=; b=ZYeNnUVjpd4xoPvLRRwNUZJFXyrDrhJpiqDp6XOhjOf+6O6BP3YiYnXkas08zdrRA3 Gwri/CmglVqBFJKIaxnMiP2YHQhIVoZzZjgbDhJXlhsqHGACc7jSg/FI2SFfsrs7T/SU TWsVCnmFhOixniWebbxnH7f29c4NCxfV83/fbyCuFgcNyPYIOP/yIoNzL8nXl86d6NDk JLlq7hqHlQwtwOzB7lkKYloADkPXv0SSMqre+M+tqxRjl3GdjwKIK9MeEuq0Y5pxDHJR NBs8YSNY9J1F0duQYNlVYKGgNWDW1NEU0/L4ARxWpRyGakZ7RFMygKWTUFuuQUwQs6xi v4ag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g90si3289925edd.329.2019.10.10.01.24.58; Thu, 10 Oct 2019 01:24:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732980AbfJJIY5 (ORCPT + 3 others); Thu, 10 Oct 2019 04:24:57 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3727 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727389AbfJJIY5 (ORCPT ); Thu, 10 Oct 2019 04:24:57 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 32491B0E3858D330F2E5; Thu, 10 Oct 2019 16:24:55 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.439.0; Thu, 10 Oct 2019 16:24:46 +0800 From: Zhou Wang To: Herbert Xu , "David S. Miller" CC: , , Zhou Wang Subject: [PATCH] crypto: zlib-deflate - add zlib-deflate test case in tcrypt Date: Thu, 10 Oct 2019 16:21:47 +0800 Message-ID: <1570695707-46528-1-git-send-email-wangzhou1@hisilicon.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org As a type CRYPTO_ALG_TYPE_ACOMPRESS is needed to trigger crypto acomp test, we introduce a new help function tcrypto_test_extend to pass type and mask to alg_test. Then tcrypto module can be used to do basic acomp test by: insmod tcrypto.ko alg="zlib-deflate" mode=55 type=10 Signed-off-by: Zhou Wang --- crypto/tcrypt.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) -- 2.8.1 diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 83ad0b1..6ad821c 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -72,7 +72,7 @@ static char *check[] = { "khazad", "wp512", "wp384", "wp256", "tnepres", "xeta", "fcrypt", "camellia", "seed", "salsa20", "rmd128", "rmd160", "rmd256", "rmd320", "lzo", "lzo-rle", "cts", "sha3-224", "sha3-256", "sha3-384", - "sha3-512", "streebog256", "streebog512", + "sha3-512", "streebog256", "streebog512", "zlib-deflate", NULL }; @@ -1657,6 +1657,19 @@ static inline int tcrypt_test(const char *alg) return ret; } +static inline int tcrypt_test_extend(const char *alg, u32 type, u32 mask) +{ + int ret; + + pr_debug("testing %s\n", alg); + + ret = alg_test(alg, alg, type, mask); + /* non-fips algs return -EINVAL in fips mode */ + if (fips_enabled && ret == -EINVAL) + ret = 0; + return ret; +} + static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb) { int i; @@ -1919,6 +1932,10 @@ static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb) ret += tcrypt_test("streebog512"); break; + case 55: + ret += tcrypt_test_extend("zlib-deflate", type, mask); + break; + case 100: ret += tcrypt_test("hmac(md5)"); break;