From patchwork Thu Apr 18 13:38:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 162473 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp760501jan; Thu, 18 Apr 2019 06:40:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzCK7MbWgYsryEuIbU1P8fF9rm/qk44/G9WLnMGn1KALiBPumqKUIkYZYSPaKDiKgYjShns X-Received: by 2002:a63:f547:: with SMTP id e7mr5649635pgk.417.1555594805435; Thu, 18 Apr 2019 06:40:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555594805; cv=none; d=google.com; s=arc-20160816; b=bcuy1bwTWEAeJWC0NFzEaePQnaW3LNmM2su1Qj/bGc5ZThS0IPnes5+J7Wy5UZn4tZ U6HKKI/ujUbhVGluvgbw4uvW6OtUehzSeTUSxzOj+x4VMLhXp550kCBSADZfUzmWfWse rYgX9YAdKFHSjIhdHgag4308AmjBZn70OE3zx2Xwrxk6n9FTVzEVOsIOJKZr9T19Sx0w rny4527Zo/o5oVNwjg4QmDP0YMwMV8ML52SvKMFdKrY8u4tyVsVCSYn/Hby6xh2keqxR uR2oiqcyNpv6WY0G47PfuEkAQnY39Wy1VxhGS2KPLIXfmxpBsehkbwg5qGP+fjOAlIkm nf+Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=TnmGWC4QvABEt3V005584iAfvHbVv/XiUmaLUDGGAhw=; b=s9YSQmzC52PACP/fKklfRU0/nAAPuIDCd4k+I6R4p6CHKbsyjQpJWBjVcjZEtCZste NqeKVp+VvMlLVuu4clZfCYfpIfyHNaJUuu4s3VJpTnK44QKJ53/GLYwQIVW9Zve1uRav 1jweEwQC2puVhPyHHsl40k0ZTC08nTkHsv7O56i0Yb4XaoSi6gk70XouMLmm9dZeQ1HZ 9f+ppGXWD+UAh7Wi4r6gsVmJLSNi1PM8cDyv+jdrl6rCe6OJGKk7eobbSGhMAQTdE/Lx nouDDaXlYlARvrb4G11xEVYOEn6UBt7iTJp4BV/MG+fInqG6xV2o7wMTNgLt7cYB3iNb 27Yw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 f6si2273383plf.90.2019.04.18.06.40.05; Thu, 18 Apr 2019 06:40:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389257AbfDRNkD (ORCPT + 30 others); Thu, 18 Apr 2019 09:40:03 -0400 Received: from foss.arm.com ([217.140.101.70]:33524 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389005AbfDRNkC (ORCPT ); Thu, 18 Apr 2019 09:40:02 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 15E0380D; Thu, 18 Apr 2019 06:40:02 -0700 (PDT) Received: from e110176-lin.kfn.arm.com (e110176-lin.kfn.arm.com [10.50.4.178]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9E8BC3F5AF; Thu, 18 Apr 2019 06:40:00 -0700 (PDT) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" Cc: Ofir Drang , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/35] crypto: ccree: add SM4 protected keys support Date: Thu, 18 Apr 2019 16:38:42 +0300 Message-Id: <20190418133913.9122-8-gilad@benyossef.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418133913.9122-1-gilad@benyossef.com> References: <20190418133913.9122-1-gilad@benyossef.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the registration for the SM4 based policy protected keys ciphers. Signed-off-by: Gilad Ben-Yossef --- drivers/crypto/ccree/cc_cipher.c | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) -- 2.21.0 diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c index d1754d1156ee..8acedbafbcb3 100644 --- a/drivers/crypto/ccree/cc_cipher.c +++ b/drivers/crypto/ccree/cc_cipher.c @@ -1578,6 +1578,42 @@ static const struct cc_alg_template skcipher_algs[] = { .min_hw_rev = CC_HW_REV_713, .std_body = CC_STD_OSCCA, }, + { + .name = "cbc(psm4)", + .driver_name = "cbc-psm4-ccree", + .blocksize = SM4_BLOCK_SIZE, + .template_skcipher = { + .setkey = cc_cipher_sethkey, + .encrypt = cc_cipher_encrypt, + .decrypt = cc_cipher_decrypt, + .min_keysize = CC_HW_KEY_SIZE, + .max_keysize = CC_HW_KEY_SIZE, + .ivsize = SM4_BLOCK_SIZE, + }, + .cipher_mode = DRV_CIPHER_CBC, + .flow_mode = S_DIN_to_SM4, + .min_hw_rev = CC_HW_REV_713, + .std_body = CC_STD_OSCCA, + .sec_func = true, + }, + { + .name = "ctr(psm4)", + .driver_name = "ctr-psm4-ccree", + .blocksize = SM4_BLOCK_SIZE, + .template_skcipher = { + .setkey = cc_cipher_sethkey, + .encrypt = cc_cipher_encrypt, + .decrypt = cc_cipher_decrypt, + .min_keysize = CC_HW_KEY_SIZE, + .max_keysize = CC_HW_KEY_SIZE, + .ivsize = SM4_BLOCK_SIZE, + }, + .cipher_mode = DRV_CIPHER_CTR, + .flow_mode = S_DIN_to_SM4, + .min_hw_rev = CC_HW_REV_713, + .std_body = CC_STD_OSCCA, + .sec_func = true, + }, }; static struct cc_crypto_alg *cc_create_alg(const struct cc_alg_template *tmpl,