Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp603642yba; Thu, 18 Apr 2019 06:41:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzWwHitela/yFwjWm3JnLCAmXM6l3+xs0+Ln8q2yuroybHbT2yVk+bE5FHSvYoE1At7mXW1 X-Received: by 2002:a62:524e:: with SMTP id g75mr94368020pfb.106.1555594901450; Thu, 18 Apr 2019 06:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555594901; cv=none; d=google.com; s=arc-20160816; b=LwanCP5JWUdVXzR9KDh+Ftm9M5dzdcKBq62+7Z12XcNTlZ7jYjTmlRoGJT96K2oOht vmGqYdns5N2Aflri1geqva4l0RhqrS2XBEqH+YnpiUFuzzK5Nye80Yktw9cxSsbTX77b gTZ5IwzmxD1VmuLnESvThgNsXa79gHrMba31ePgg9ILCuXEqdOPic90RL2CqVUGfLh2K oiKwHgeP9QEfPcHeSg7+29i+qPRp/Wm2PRTfkcdEfFDfOosT/s3Q7WKVx5Pzd6LhLvc1 /1JUHx8buBvI1mbsWacU77bTrm66QgN+aAz4wkXrJxo0P/b7sKgyCQfqKMXAeza/w3A3 4J9A== 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 f2si1901928pgv.441.2019.04.18.06.41.26; Thu, 18 Apr 2019 06:41:41 -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 S2389253AbfDRNkD (ORCPT + 99 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 Content-Transfer-Encoding: 8bit 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(+) 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, -- 2.21.0