Commit ce9b008a authored by Michal Ludvig's avatar Michal Ludvig Committed by David S. Miller

[CRYPTO]: Standalone VIA PadLock driver.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e56b8fa8
...@@ -274,5 +274,6 @@ config CRYPTO_TEST ...@@ -274,5 +274,6 @@ config CRYPTO_TEST
help help
Quick & dirty crypto test module. Quick & dirty crypto test module.
source "drivers/crypto/Kconfig"
endmenu endmenu
...@@ -60,3 +60,4 @@ obj-$(CONFIG_EISA) += eisa/ ...@@ -60,3 +60,4 @@ obj-$(CONFIG_EISA) += eisa/
obj-$(CONFIG_CPU_FREQ) += cpufreq/ obj-$(CONFIG_CPU_FREQ) += cpufreq/
obj-$(CONFIG_MMC) += mmc/ obj-$(CONFIG_MMC) += mmc/
obj-y += firmware/ obj-y += firmware/
obj-$(CONFIG_CRYPTO) += crypto/
menu "Hardware crypto devices"
config CRYPTO_DEV_PADLOCK
tristate "Support for VIA PadLock ACE"
depends on CRYPTO && X86 && !X86_64
help
Some VIA processors come with an integrated crypto engine
(so called VIA PadLock ACE, Advanced Cryptography Engine)
that provides instructions for very fast {en,de}cryption
with some algorithms.
The instructions are used only when the CPU supports them.
Otherwise software encryption is used. If you are unsure,
say Y.
config CRYPTO_DEV_PADLOCK_AES
bool "Support for AES in VIA PadLock"
depends on CRYPTO_DEV_PADLOCK
default y
help
Use VIA PadLock for AES algorithm.
endmenu
obj-$(CONFIG_CRYPTO_DEV_PADLOCK) += padlock.o
padlock-objs-$(CONFIG_CRYPTO_DEV_PADLOCK_AES) += padlock-aes.o
padlock-objs := padlock-generic.o $(padlock-objs-y)
This diff is collapsed.
/*
* Cryptographic API.
*
* Support for VIA PadLock hardware crypto engine.
*
* Copyright (c) 2004 Michal Ludvig <michal@logix.cz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/crypto.h>
#include <asm/byteorder.h>
#include "padlock.h"
static int __init
padlock_init(void)
{
int ret = -ENOSYS;
if (!cpu_has_xcrypt) {
printk(KERN_ERR PFX "VIA PadLock not detected.\n");
return -ENODEV;
}
if (!cpu_has_xcrypt_enabled) {
printk(KERN_ERR PFX "VIA PadLock detected, but not enabled. Hmm, strange...\n");
return -ENODEV;
}
#ifdef CONFIG_CRYPTO_DEV_PADLOCK_AES
if ((ret = padlock_init_aes())) {
printk(KERN_ERR PFX "VIA PadLock AES initialization failed.\n");
return ret;
}
#endif
if (ret == -ENOSYS)
printk(KERN_ERR PFX "Hmm, VIA PadLock was compiled without any algorithm.\n");
return ret;
}
static void __exit
padlock_fini(void)
{
#ifdef CONFIG_CRYPTO_DEV_PADLOCK_AES
padlock_fini_aes();
#endif
}
module_init(padlock_init);
module_exit(padlock_fini);
MODULE_DESCRIPTION("VIA PadLock crypto engine support.");
MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("Michal Ludvig");
/*
* Driver for VIA PadLock
*
* Copyright (c) 2004 Michal Ludvig <michal@logix.cz>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
*/
#ifndef _CRYPTO_PADLOCK_H
#define _CRYPTO_PADLOCK_H
/* Control word. */
union cword {
uint32_t cword[4];
struct {
int rounds:4;
int algo:3;
int keygen:1;
int interm:1;
int encdec:1;
int ksize:2;
} b;
};
#define PFX "padlock: "
#ifdef CONFIG_CRYPTO_DEV_PADLOCK_AES
int padlock_init_aes(void);
void padlock_fini_aes(void);
#endif
#endif /* _CRYPTO_PADLOCK_H */
...@@ -56,6 +56,9 @@ ...@@ -56,6 +56,9 @@
#define CRYPTO_UNSPEC 0 #define CRYPTO_UNSPEC 0
#define CRYPTO_MAX_ALG_NAME 64 #define CRYPTO_MAX_ALG_NAME 64
#define CRYPTO_DIR_ENCRYPT 1
#define CRYPTO_DIR_DECRYPT 0
struct scatterlist; struct scatterlist;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment