2005-04-16 18:20:36 -04:00
|
|
|
/*
|
|
|
|
* Cryptographic API.
|
|
|
|
*
|
2006-01-06 03:19:17 -05:00
|
|
|
* Support for s390 cryptographic instructions.
|
2005-04-16 18:20:36 -04:00
|
|
|
* Testing module for querying processor crypto capabilities.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation
|
|
|
|
* Author(s): Thomas Spatzier (tspat@de.ibm.com)
|
|
|
|
*
|
|
|
|
* 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/kernel.h>
|
|
|
|
#include <asm/errno.h>
|
2006-01-06 03:19:17 -05:00
|
|
|
#include "crypt_s390.h"
|
2005-04-16 18:20:36 -04:00
|
|
|
|
2006-01-06 03:19:17 -05:00
|
|
|
static void query_available_functions(void)
|
2005-04-16 18:20:36 -04:00
|
|
|
{
|
|
|
|
printk(KERN_INFO "#####################\n");
|
2006-01-06 03:19:17 -05:00
|
|
|
|
|
|
|
/* query available KM functions */
|
2005-04-16 18:20:36 -04:00
|
|
|
printk(KERN_INFO "KM_QUERY: %d\n",
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_func_available(KM_QUERY));
|
2005-04-16 18:20:36 -04:00
|
|
|
printk(KERN_INFO "KM_DEA: %d\n",
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_func_available(KM_DEA_ENCRYPT));
|
2005-04-16 18:20:36 -04:00
|
|
|
printk(KERN_INFO "KM_TDEA_128: %d\n",
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_func_available(KM_TDEA_128_ENCRYPT));
|
2005-04-16 18:20:36 -04:00
|
|
|
printk(KERN_INFO "KM_TDEA_192: %d\n",
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_func_available(KM_TDEA_192_ENCRYPT));
|
2006-01-06 03:19:18 -05:00
|
|
|
printk(KERN_INFO "KM_AES_128: %d\n",
|
|
|
|
crypt_s390_func_available(KM_AES_128_ENCRYPT));
|
|
|
|
printk(KERN_INFO "KM_AES_192: %d\n",
|
|
|
|
crypt_s390_func_available(KM_AES_192_ENCRYPT));
|
|
|
|
printk(KERN_INFO "KM_AES_256: %d\n",
|
|
|
|
crypt_s390_func_available(KM_AES_256_ENCRYPT));
|
2006-01-06 03:19:17 -05:00
|
|
|
|
|
|
|
/* query available KMC functions */
|
2005-04-16 18:20:36 -04:00
|
|
|
printk(KERN_INFO "KMC_QUERY: %d\n",
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_func_available(KMC_QUERY));
|
2005-04-16 18:20:36 -04:00
|
|
|
printk(KERN_INFO "KMC_DEA: %d\n",
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_func_available(KMC_DEA_ENCRYPT));
|
2005-04-16 18:20:36 -04:00
|
|
|
printk(KERN_INFO "KMC_TDEA_128: %d\n",
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_func_available(KMC_TDEA_128_ENCRYPT));
|
2005-04-16 18:20:36 -04:00
|
|
|
printk(KERN_INFO "KMC_TDEA_192: %d\n",
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_func_available(KMC_TDEA_192_ENCRYPT));
|
2006-01-06 03:19:18 -05:00
|
|
|
printk(KERN_INFO "KMC_AES_128: %d\n",
|
|
|
|
crypt_s390_func_available(KMC_AES_128_ENCRYPT));
|
|
|
|
printk(KERN_INFO "KMC_AES_192: %d\n",
|
|
|
|
crypt_s390_func_available(KMC_AES_192_ENCRYPT));
|
|
|
|
printk(KERN_INFO "KMC_AES_256: %d\n",
|
|
|
|
crypt_s390_func_available(KMC_AES_256_ENCRYPT));
|
2006-01-06 03:19:17 -05:00
|
|
|
|
2006-03-26 04:38:58 -05:00
|
|
|
/* query available KIMD functions */
|
2005-04-16 18:20:36 -04:00
|
|
|
printk(KERN_INFO "KIMD_QUERY: %d\n",
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_func_available(KIMD_QUERY));
|
2005-04-16 18:20:36 -04:00
|
|
|
printk(KERN_INFO "KIMD_SHA_1: %d\n",
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_func_available(KIMD_SHA_1));
|
2006-01-06 03:19:18 -05:00
|
|
|
printk(KERN_INFO "KIMD_SHA_256: %d\n",
|
|
|
|
crypt_s390_func_available(KIMD_SHA_256));
|
2006-01-06 03:19:17 -05:00
|
|
|
|
|
|
|
/* query available KLMD functions */
|
2005-04-16 18:20:36 -04:00
|
|
|
printk(KERN_INFO "KLMD_QUERY: %d\n",
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_func_available(KLMD_QUERY));
|
2005-04-16 18:20:36 -04:00
|
|
|
printk(KERN_INFO "KLMD_SHA_1: %d\n",
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_func_available(KLMD_SHA_1));
|
2006-01-06 03:19:18 -05:00
|
|
|
printk(KERN_INFO "KLMD_SHA_256: %d\n",
|
|
|
|
crypt_s390_func_available(KLMD_SHA_256));
|
2006-01-06 03:19:17 -05:00
|
|
|
|
|
|
|
/* query available KMAC functions */
|
2005-04-16 18:20:36 -04:00
|
|
|
printk(KERN_INFO "KMAC_QUERY: %d\n",
|
2006-01-06 03:19:18 -05:00
|
|
|
crypt_s390_func_available(KMAC_QUERY));
|
2005-04-16 18:20:36 -04:00
|
|
|
printk(KERN_INFO "KMAC_DEA: %d\n",
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_func_available(KMAC_DEA));
|
2005-04-16 18:20:36 -04:00
|
|
|
printk(KERN_INFO "KMAC_TDEA_128: %d\n",
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_func_available(KMAC_TDEA_128));
|
2005-04-16 18:20:36 -04:00
|
|
|
printk(KERN_INFO "KMAC_TDEA_192: %d\n",
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_func_available(KMAC_TDEA_192));
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
2006-01-06 03:19:17 -05:00
|
|
|
static int init(void)
|
2005-04-16 18:20:36 -04:00
|
|
|
{
|
2006-01-06 03:19:17 -05:00
|
|
|
struct crypt_s390_query_status status = {
|
2005-04-16 18:20:36 -04:00
|
|
|
.high = 0,
|
|
|
|
.low = 0
|
|
|
|
};
|
|
|
|
|
2006-01-06 03:19:17 -05:00
|
|
|
printk(KERN_INFO "crypt_s390: querying available crypto functions\n");
|
|
|
|
crypt_s390_km(KM_QUERY, &status, NULL, NULL, 0);
|
|
|
|
printk(KERN_INFO "KM:\t%016llx %016llx\n",
|
2005-04-16 18:20:36 -04:00
|
|
|
(unsigned long long) status.high,
|
|
|
|
(unsigned long long) status.low);
|
|
|
|
status.high = status.low = 0;
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_kmc(KMC_QUERY, &status, NULL, NULL, 0);
|
|
|
|
printk(KERN_INFO "KMC:\t%016llx %016llx\n",
|
2005-04-16 18:20:36 -04:00
|
|
|
(unsigned long long) status.high,
|
|
|
|
(unsigned long long) status.low);
|
|
|
|
status.high = status.low = 0;
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_kimd(KIMD_QUERY, &status, NULL, 0);
|
|
|
|
printk(KERN_INFO "KIMD:\t%016llx %016llx\n",
|
2005-04-16 18:20:36 -04:00
|
|
|
(unsigned long long) status.high,
|
|
|
|
(unsigned long long) status.low);
|
|
|
|
status.high = status.low = 0;
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_klmd(KLMD_QUERY, &status, NULL, 0);
|
|
|
|
printk(KERN_INFO "KLMD:\t%016llx %016llx\n",
|
2005-04-16 18:20:36 -04:00
|
|
|
(unsigned long long) status.high,
|
|
|
|
(unsigned long long) status.low);
|
|
|
|
status.high = status.low = 0;
|
2006-01-06 03:19:17 -05:00
|
|
|
crypt_s390_kmac(KMAC_QUERY, &status, NULL, 0);
|
|
|
|
printk(KERN_INFO "KMAC:\t%016llx %016llx\n",
|
2005-04-16 18:20:36 -04:00
|
|
|
(unsigned long long) status.high,
|
|
|
|
(unsigned long long) status.low);
|
|
|
|
|
|
|
|
query_available_functions();
|
2006-01-06 03:19:17 -05:00
|
|
|
return -ECANCELED;
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
2006-01-06 03:19:17 -05:00
|
|
|
static void __exit cleanup(void)
|
2005-04-16 18:20:36 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
module_init(init);
|
|
|
|
module_exit(cleanup);
|
|
|
|
|
|
|
|
MODULE_LICENSE("GPL");
|