From patchwork Fri Oct 4 19:03:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 20836 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 63DB125E85 for ; Fri, 4 Oct 2013 19:05:11 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id db12sf9504189veb.10 for ; Fri, 04 Oct 2013 12:05:11 -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=cl5/aGn+DdUtjPil48NJ9DZVb+cqp1pPbF2QZD6FKiq7l4fZx5ELtM+dtE5fEGb3HF UBqfYR+whhJRDNPw2wRcgaY6IGbg0UV6ywzZK15njX+MxUhBVSy7PJVwD5BhnHu88W4b 7FFMjoyzX1kVkPDEvmTzWLC/FUFHeYocVpybMpi0XkmaO7JzY49gjXX36f5Fbkc549X5 OoHjNP/YzWkIxhvKXRC+Lo9o/IBtet/0BDTtqAaIVXYAh1wpAA38S2VtAzY1zDV/twOh n+5ETR0ZRCTXqTxJKOmAmhIHhzMhmGwGgI+Xaxbnu1u0ZJJpoYDB7EeOm/pn4e3nwZLn wWcw== X-Received: by 10.58.238.199 with SMTP id vm7mr2429841vec.17.1380913511265; Fri, 04 Oct 2013 12:05:11 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.82.49 with SMTP id f17ls1467743qey.33.gmail; Fri, 04 Oct 2013 12:05:11 -0700 (PDT) X-Received: by 10.220.244.132 with SMTP id lq4mr39694vcb.31.1380913511166; Fri, 04 Oct 2013 12:05:11 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id fx4si3697436vdc.104.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 04 Oct 2013 12:05:11 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.182 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.182; Received: by mail-vc0-f182.google.com with SMTP id hf12so2000294vcb.27 for ; Fri, 04 Oct 2013 12:05:11 -0700 (PDT) X-Gm-Message-State: ALoCoQl0daSn0EhGkUiTnw/laXmKESRZK0oWLCNz7dXS6xiHOaq8M4VUc1aFPoD6o8a1Q7Y29BII X-Received: by 10.52.74.100 with SMTP id s4mr50714vdv.35.1380913511049; Fri, 04 Oct 2013 12:05:11 -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 u4csp62495vcz; Fri, 4 Oct 2013 12:05:10 -0700 (PDT) X-Received: by 10.194.178.166 with SMTP id cz6mr3182898wjc.53.1380913509900; Fri, 04 Oct 2013 12:05:09 -0700 (PDT) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) by mx.google.com with ESMTPS id ey13si2963384wid.50.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 04 Oct 2013 12:05:09 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.181 is neither permitted nor denied by best guess record for domain of ard.biesheuvel@linaro.org) client-ip=209.85.212.181; Received: by mail-wi0-f181.google.com with SMTP id ex4so2173375wid.2 for ; Fri, 04 Oct 2013 12:05:09 -0700 (PDT) X-Received: by 10.180.73.65 with SMTP id j1mr8742449wiv.10.1380913509456; Fri, 04 Oct 2013 12:05:09 -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 b7sm12725065wiz.8.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 04 Oct 2013 12:05:09 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: nico@linaro.org, patches@linaro.org, linux@arm.linux.org.uk, will.deacon@arm.com, Ard Biesheuvel Subject: [PATCH v3 2/3] ARM: move AES typedefs and function prototypes to separate header Date: Fri, 4 Oct 2013 21:03:38 +0200 Message-Id: <1380913419-13296-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1380913419-13296-1-git-send-email-ard.biesheuvel@linaro.org> References: <1380913419-13296-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.182 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);