From patchwork Thu Oct 3 21:59:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 20821 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f199.google.com (mail-qc0-f199.google.com [209.85.216.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 04259266F8 for ; Thu, 3 Oct 2013 22:00:55 +0000 (UTC) Received: by mail-qc0-f199.google.com with SMTP id u18sf5849996qcx.2 for ; Thu, 03 Oct 2013 15:00:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=uUIPw+j1/gm5mbpYWKA0BP/EunO3rOBGomy+G2FnwUQ=; b=OnhUxG4EoytHiRqBNaom9V8Deth+MADxcaaJpUf9WRWkX1yBQdqA3P+YwpuKPaKw3i 4/PVUv6ZRzwOvx6uAXSDo9V7TqHkQMw6lKLZqE1sjwsCjbHg/fky53ma8c7DgM1ozj1C Ygy7945hJifZ1eS7ESZp6UpGhV7AbPkUoWvg9C8wSIni+cHxTW/Bk6nqYsjBVG+8aIzD 7A0gVHV8geNkoqjQtm0vszJOfHtgzIaVAdnLXfQBfdswJMOe9POdAa5/xTK/xmOz5vBI +ISalxRYD/oKOYjj92kO4AogREq4YXMYSgbtqdq80/nu7MQw380UnfBQXe1VL6qt6YF6 qPJg== X-Received: by 10.236.20.114 with SMTP id o78mr9127722yho.8.1380837654821; Thu, 03 Oct 2013 15:00:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.50.225 with SMTP id f1ls1049028qeo.66.gmail; Thu, 03 Oct 2013 15:00:54 -0700 (PDT) X-Received: by 10.52.230.102 with SMTP id sx6mr7783141vdc.15.1380837654731; Thu, 03 Oct 2013 15:00:54 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id gq10si2210429vdc.147.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Oct 2013 15:00:54 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ld13so1319857vcb.39 for ; Thu, 03 Oct 2013 15:00:54 -0700 (PDT) X-Gm-Message-State: ALoCoQmYaP05SrjNmpqrupF0uTU7N9yJCrGT2541DKjr9KesHjCErgon1dGjMdQ9BoCrj50zcPK4 X-Received: by 10.52.98.66 with SMTP id eg2mr7843271vdb.24.1380837654645; Thu, 03 Oct 2013 15:00:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp212426vcz; Thu, 3 Oct 2013 15:00:54 -0700 (PDT) X-Received: by 10.180.183.51 with SMTP id ej19mr4602585wic.60.1380837652995; Thu, 03 Oct 2013 15:00:52 -0700 (PDT) Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by mx.google.com with ESMTPS id s3si3887897wjx.160.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Oct 2013 15:00:52 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.170 is neither permitted nor denied by best guess record for domain of ard.biesheuvel@linaro.org) client-ip=209.85.212.170; Received: by mail-wi0-f170.google.com with SMTP id cb5so1482656wib.3 for ; Thu, 03 Oct 2013 15:00:52 -0700 (PDT) X-Received: by 10.180.83.228 with SMTP id t4mr4525689wiy.12.1380837652490; Thu, 03 Oct 2013 15:00:52 -0700 (PDT) Received: from ards-mac-mini.local (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id jf2sm3792057wic.2.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Oct 2013 15:00:52 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org Cc: nico@linaro.org, patches@linaro.org, linux@arm.linux.org.uk, Ard Biesheuvel Subject: [PATCH v2 2/3] ARM: move AES typedefs and function prototypes to separate header Date: Thu, 3 Oct 2013 23:59:25 +0200 Message-Id: <1380837566-18242-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1380837566-18242-1-git-send-email-ard.biesheuvel@linaro.org> References: <1380837566-18242-1-git-send-email-ard.biesheuvel@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Put the struct definitions for AES keys and the asm function prototypes in a separate header and export the asm functions from the module. This allows other drivers to use them directly. Signed-off-by: Ard Biesheuvel --- arch/arm/crypto/aes_glue.c | 22 ++++++---------------- arch/arm/crypto/aes_glue.h | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 16 deletions(-) create mode 100644 arch/arm/crypto/aes_glue.h diff --git a/arch/arm/crypto/aes_glue.c b/arch/arm/crypto/aes_glue.c index 59f7877..3003fa1 100644 --- a/arch/arm/crypto/aes_glue.c +++ b/arch/arm/crypto/aes_glue.c @@ -6,22 +6,12 @@ #include #include -#define AES_MAXNR 14 +#include "aes_glue.h" -typedef struct { - unsigned int rd_key[4 *(AES_MAXNR + 1)]; - int rounds; -} AES_KEY; - -struct AES_CTX { - AES_KEY enc_key; - AES_KEY dec_key; -}; - -asmlinkage void AES_encrypt(const u8 *in, u8 *out, AES_KEY *ctx); -asmlinkage void AES_decrypt(const u8 *in, u8 *out, AES_KEY *ctx); -asmlinkage int private_AES_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key); -asmlinkage int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key); +EXPORT_SYMBOL(AES_encrypt); +EXPORT_SYMBOL(AES_decrypt); +EXPORT_SYMBOL(private_AES_set_encrypt_key); +EXPORT_SYMBOL(private_AES_set_decrypt_key); static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) { @@ -81,7 +71,7 @@ static struct crypto_alg aes_alg = { .cipher = { .cia_min_keysize = AES_MIN_KEY_SIZE, .cia_max_keysize = AES_MAX_KEY_SIZE, - .cia_setkey = aes_set_key, + .cia_setkey = aes_set_key, .cia_encrypt = aes_encrypt, .cia_decrypt = aes_decrypt } diff --git a/arch/arm/crypto/aes_glue.h b/arch/arm/crypto/aes_glue.h new file mode 100644 index 0000000..cca3e51 --- /dev/null +++ b/arch/arm/crypto/aes_glue.h @@ -0,0 +1,19 @@ + +#define AES_MAXNR 14 + +struct AES_KEY { + unsigned int rd_key[4 * (AES_MAXNR + 1)]; + int rounds; +}; + +struct AES_CTX { + struct AES_KEY enc_key; + struct AES_KEY dec_key; +}; + +asmlinkage void AES_encrypt(const u8 *in, u8 *out, struct AES_KEY *ctx); +asmlinkage void AES_decrypt(const u8 *in, u8 *out, struct AES_KEY *ctx); +asmlinkage int private_AES_set_decrypt_key(const unsigned char *userKey, + const int bits, struct AES_KEY *key); +asmlinkage int private_AES_set_encrypt_key(const unsigned char *userKey, + const int bits, struct AES_KEY *key);