Commit 1749a81d authored by Felix Beck's avatar Felix Beck Committed by Heiko Carstens

[S390] zcrypt: Comments and kernel-doc cleanup

Comments, which suggested to be kernel-doc but were not in the right
formatting, have been corrected. Additionally some minor cleanup in
the comments has been done.
Signed-off-by: default avatarFelix Beck <felix.beck@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
parent 3f12ebce
This diff is collapsed.
...@@ -50,6 +50,15 @@ typedef unsigned int ap_qid_t; ...@@ -50,6 +50,15 @@ typedef unsigned int ap_qid_t;
#define AP_QID_QUEUE(_qid) ((_qid) & 15) #define AP_QID_QUEUE(_qid) ((_qid) & 15)
/** /**
* structy ap_queue_status - Holds the AP queue status.
* @queue_empty: Shows if queue is empty
* @replies_waiting: Waiting replies
* @queue_full: Is 1 if the queue is full
* @pad: A 4 bit pad
* @int_enabled: Shows if interrupts are enabled for the AP
* @response_conde: Holds the 8 bit response code
* @pad2: A 16 bit pad
*
* The ap queue status word is returned by all three AP functions * The ap queue status word is returned by all three AP functions
* (PQAP, NQAP and DQAP). There's a set of flags in the first * (PQAP, NQAP and DQAP). There's a set of flags in the first
* byte, followed by a 1 byte response code. * byte, followed by a 1 byte response code.
...@@ -75,7 +84,7 @@ struct ap_queue_status { ...@@ -75,7 +84,7 @@ struct ap_queue_status {
#define AP_RESPONSE_NO_FIRST_PART 0x13 #define AP_RESPONSE_NO_FIRST_PART 0x13
#define AP_RESPONSE_MESSAGE_TOO_BIG 0x15 #define AP_RESPONSE_MESSAGE_TOO_BIG 0x15
/** /*
* Known device types * Known device types
*/ */
#define AP_DEVICE_TYPE_PCICC 3 #define AP_DEVICE_TYPE_PCICC 3
...@@ -84,7 +93,7 @@ struct ap_queue_status { ...@@ -84,7 +93,7 @@ struct ap_queue_status {
#define AP_DEVICE_TYPE_CEX2A 6 #define AP_DEVICE_TYPE_CEX2A 6
#define AP_DEVICE_TYPE_CEX2C 7 #define AP_DEVICE_TYPE_CEX2C 7
/** /*
* AP reset flag states * AP reset flag states
*/ */
#define AP_RESET_IGNORE 0 /* request timeout will be ignored */ #define AP_RESET_IGNORE 0 /* request timeout will be ignored */
...@@ -152,7 +161,7 @@ struct ap_message { ...@@ -152,7 +161,7 @@ struct ap_message {
.dev_type=(dt), \ .dev_type=(dt), \
.match_flags=AP_DEVICE_ID_MATCH_DEVICE_TYPE, .match_flags=AP_DEVICE_ID_MATCH_DEVICE_TYPE,
/** /*
* Note: don't use ap_send/ap_recv after using ap_queue_message * Note: don't use ap_send/ap_recv after using ap_queue_message
* for the first time. Otherwise the ap message queue will get * for the first time. Otherwise the ap message queue will get
* confused. * confused.
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include "zcrypt_api.h" #include "zcrypt_api.h"
/** /*
* Module description. * Module description.
*/ */
MODULE_AUTHOR("IBM Corporation"); MODULE_AUTHOR("IBM Corporation");
...@@ -56,7 +56,7 @@ static atomic_t zcrypt_open_count = ATOMIC_INIT(0); ...@@ -56,7 +56,7 @@ static atomic_t zcrypt_open_count = ATOMIC_INIT(0);
static int zcrypt_rng_device_add(void); static int zcrypt_rng_device_add(void);
static void zcrypt_rng_device_remove(void); static void zcrypt_rng_device_remove(void);
/** /*
* Device attributes common for all crypto devices. * Device attributes common for all crypto devices.
*/ */
static ssize_t zcrypt_type_show(struct device *dev, static ssize_t zcrypt_type_show(struct device *dev,
...@@ -103,6 +103,9 @@ static struct attribute_group zcrypt_device_attr_group = { ...@@ -103,6 +103,9 @@ static struct attribute_group zcrypt_device_attr_group = {
}; };
/** /**
* __zcrypt_increase_preference(): Increase preference of a crypto device.
* @zdev: Pointer the crypto device
*
* Move the device towards the head of the device list. * Move the device towards the head of the device list.
* Need to be called while holding the zcrypt device list lock. * Need to be called while holding the zcrypt device list lock.
* Note: cards with speed_rating of 0 are kept at the end of the list. * Note: cards with speed_rating of 0 are kept at the end of the list.
...@@ -129,6 +132,9 @@ static void __zcrypt_increase_preference(struct zcrypt_device *zdev) ...@@ -129,6 +132,9 @@ static void __zcrypt_increase_preference(struct zcrypt_device *zdev)
} }
/** /**
* __zcrypt_decrease_preference(): Decrease preference of a crypto device.
* @zdev: Pointer to a crypto device.
*
* Move the device towards the tail of the device list. * Move the device towards the tail of the device list.
* Need to be called while holding the zcrypt device list lock. * Need to be called while holding the zcrypt device list lock.
* Note: cards with speed_rating of 0 are kept at the end of the list. * Note: cards with speed_rating of 0 are kept at the end of the list.
...@@ -202,7 +208,10 @@ void zcrypt_device_free(struct zcrypt_device *zdev) ...@@ -202,7 +208,10 @@ void zcrypt_device_free(struct zcrypt_device *zdev)
EXPORT_SYMBOL(zcrypt_device_free); EXPORT_SYMBOL(zcrypt_device_free);
/** /**
* Register a crypto device. * zcrypt_device_register() - Register a crypto device.
* @zdev: Pointer to a crypto device
*
* Register a crypto device. Returns 0 if successful.
*/ */
int zcrypt_device_register(struct zcrypt_device *zdev) int zcrypt_device_register(struct zcrypt_device *zdev)
{ {
...@@ -242,6 +251,9 @@ int zcrypt_device_register(struct zcrypt_device *zdev) ...@@ -242,6 +251,9 @@ int zcrypt_device_register(struct zcrypt_device *zdev)
EXPORT_SYMBOL(zcrypt_device_register); EXPORT_SYMBOL(zcrypt_device_register);
/** /**
* zcrypt_device_unregister(): Unregister a crypto device.
* @zdev: Pointer to crypto device
*
* Unregister a crypto device. * Unregister a crypto device.
*/ */
void zcrypt_device_unregister(struct zcrypt_device *zdev) void zcrypt_device_unregister(struct zcrypt_device *zdev)
...@@ -260,7 +272,9 @@ void zcrypt_device_unregister(struct zcrypt_device *zdev) ...@@ -260,7 +272,9 @@ void zcrypt_device_unregister(struct zcrypt_device *zdev)
EXPORT_SYMBOL(zcrypt_device_unregister); EXPORT_SYMBOL(zcrypt_device_unregister);
/** /**
* zcrypt_read is not be supported beyond zcrypt 1.3.1 * zcrypt_read (): Not supported beyond zcrypt 1.3.1.
*
* This function is not supported beyond zcrypt 1.3.1.
*/ */
static ssize_t zcrypt_read(struct file *filp, char __user *buf, static ssize_t zcrypt_read(struct file *filp, char __user *buf,
size_t count, loff_t *f_pos) size_t count, loff_t *f_pos)
...@@ -269,6 +283,8 @@ static ssize_t zcrypt_read(struct file *filp, char __user *buf, ...@@ -269,6 +283,8 @@ static ssize_t zcrypt_read(struct file *filp, char __user *buf,
} }
/** /**
* zcrypt_write(): Not allowed.
*
* Write is is not allowed * Write is is not allowed
*/ */
static ssize_t zcrypt_write(struct file *filp, const char __user *buf, static ssize_t zcrypt_write(struct file *filp, const char __user *buf,
...@@ -278,7 +294,9 @@ static ssize_t zcrypt_write(struct file *filp, const char __user *buf, ...@@ -278,7 +294,9 @@ static ssize_t zcrypt_write(struct file *filp, const char __user *buf,
} }
/** /**
* Device open/close functions to count number of users. * zcrypt_open(): Count number of users.
*
* Device open function to count number of users.
*/ */
static int zcrypt_open(struct inode *inode, struct file *filp) static int zcrypt_open(struct inode *inode, struct file *filp)
{ {
...@@ -286,13 +304,18 @@ static int zcrypt_open(struct inode *inode, struct file *filp) ...@@ -286,13 +304,18 @@ static int zcrypt_open(struct inode *inode, struct file *filp)
return 0; return 0;
} }
/**
* zcrypt_release(): Count number of users.
*
* Device close function to count number of users.
*/
static int zcrypt_release(struct inode *inode, struct file *filp) static int zcrypt_release(struct inode *inode, struct file *filp)
{ {
atomic_dec(&zcrypt_open_count); atomic_dec(&zcrypt_open_count);
return 0; return 0;
} }
/** /*
* zcrypt ioctls. * zcrypt ioctls.
*/ */
static long zcrypt_rsa_modexpo(struct ica_rsa_modexpo *mex) static long zcrypt_rsa_modexpo(struct ica_rsa_modexpo *mex)
...@@ -302,7 +325,7 @@ static long zcrypt_rsa_modexpo(struct ica_rsa_modexpo *mex) ...@@ -302,7 +325,7 @@ static long zcrypt_rsa_modexpo(struct ica_rsa_modexpo *mex)
if (mex->outputdatalength < mex->inputdatalength) if (mex->outputdatalength < mex->inputdatalength)
return -EINVAL; return -EINVAL;
/** /*
* As long as outputdatalength is big enough, we can set the * As long as outputdatalength is big enough, we can set the
* outputdatalength equal to the inputdatalength, since that is the * outputdatalength equal to the inputdatalength, since that is the
* number of bytes we will copy in any case * number of bytes we will copy in any case
...@@ -348,7 +371,7 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt) ...@@ -348,7 +371,7 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt)
if (crt->outputdatalength < crt->inputdatalength || if (crt->outputdatalength < crt->inputdatalength ||
(crt->inputdatalength & 1)) (crt->inputdatalength & 1))
return -EINVAL; return -EINVAL;
/** /*
* As long as outputdatalength is big enough, we can set the * As long as outputdatalength is big enough, we can set the
* outputdatalength equal to the inputdatalength, since that is the * outputdatalength equal to the inputdatalength, since that is the
* number of bytes we will copy in any case * number of bytes we will copy in any case
...@@ -365,7 +388,7 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt) ...@@ -365,7 +388,7 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt)
zdev->max_mod_size < crt->inputdatalength) zdev->max_mod_size < crt->inputdatalength)
continue; continue;
if (zdev->short_crt && crt->inputdatalength > 240) { if (zdev->short_crt && crt->inputdatalength > 240) {
/** /*
* Check inputdata for leading zeros for cards * Check inputdata for leading zeros for cards
* that can't handle np_prime, bp_key, or * that can't handle np_prime, bp_key, or
* u_mult_inv > 128 bytes. * u_mult_inv > 128 bytes.
...@@ -381,7 +404,7 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt) ...@@ -381,7 +404,7 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt)
copy_from_user(&z3, crt->u_mult_inv, len)) copy_from_user(&z3, crt->u_mult_inv, len))
return -EFAULT; return -EFAULT;
copied = 1; copied = 1;
/** /*
* We have to restart device lookup - * We have to restart device lookup -
* the device list may have changed by now. * the device list may have changed by now.
*/ */
...@@ -567,6 +590,8 @@ static int zcrypt_count_type(int type) ...@@ -567,6 +590,8 @@ static int zcrypt_count_type(int type)
} }
/** /**
* zcrypt_ica_status(): Old, depracted combi status call.
*
* Old, deprecated combi status call. * Old, deprecated combi status call.
*/ */
static long zcrypt_ica_status(struct file *filp, unsigned long arg) static long zcrypt_ica_status(struct file *filp, unsigned long arg)
...@@ -668,7 +693,7 @@ static long zcrypt_unlocked_ioctl(struct file *filp, unsigned int cmd, ...@@ -668,7 +693,7 @@ static long zcrypt_unlocked_ioctl(struct file *filp, unsigned int cmd,
(int __user *) arg); (int __user *) arg);
case Z90STAT_DOMAIN_INDEX: case Z90STAT_DOMAIN_INDEX:
return put_user(ap_domain_index, (int __user *) arg); return put_user(ap_domain_index, (int __user *) arg);
/** /*
* Deprecated ioctls. Don't add another device count ioctl, * Deprecated ioctls. Don't add another device count ioctl,
* you can count them yourself in the user space with the * you can count them yourself in the user space with the
* output of the Z90STAT_STATUS_MASK ioctl. * output of the Z90STAT_STATUS_MASK ioctl.
...@@ -706,7 +731,7 @@ static long zcrypt_unlocked_ioctl(struct file *filp, unsigned int cmd, ...@@ -706,7 +731,7 @@ static long zcrypt_unlocked_ioctl(struct file *filp, unsigned int cmd,
} }
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
/** /*
* ioctl32 conversion routines * ioctl32 conversion routines
*/ */
struct compat_ica_rsa_modexpo { struct compat_ica_rsa_modexpo {
...@@ -857,7 +882,7 @@ static long zcrypt_compat_ioctl(struct file *filp, unsigned int cmd, ...@@ -857,7 +882,7 @@ static long zcrypt_compat_ioctl(struct file *filp, unsigned int cmd,
} }
#endif #endif
/** /*
* Misc device file operations. * Misc device file operations.
*/ */
static const struct file_operations zcrypt_fops = { static const struct file_operations zcrypt_fops = {
...@@ -872,7 +897,7 @@ static const struct file_operations zcrypt_fops = { ...@@ -872,7 +897,7 @@ static const struct file_operations zcrypt_fops = {
.release = zcrypt_release .release = zcrypt_release
}; };
/** /*
* Misc device. * Misc device.
*/ */
static struct miscdevice zcrypt_misc_device = { static struct miscdevice zcrypt_misc_device = {
...@@ -881,7 +906,7 @@ static struct miscdevice zcrypt_misc_device = { ...@@ -881,7 +906,7 @@ static struct miscdevice zcrypt_misc_device = {
.fops = &zcrypt_fops, .fops = &zcrypt_fops,
}; };
/** /*
* Deprecated /proc entry support. * Deprecated /proc entry support.
*/ */
static struct proc_dir_entry *zcrypt_entry; static struct proc_dir_entry *zcrypt_entry;
...@@ -1075,7 +1100,7 @@ static int zcrypt_status_write(struct file *file, const char __user *buffer, ...@@ -1075,7 +1100,7 @@ static int zcrypt_status_write(struct file *file, const char __user *buffer,
} }
for (j = 0; j < 64 && *ptr; ptr++) { for (j = 0; j < 64 && *ptr; ptr++) {
/** /*
* '0' for no device, '1' for PCICA, '2' for PCICC, * '0' for no device, '1' for PCICA, '2' for PCICC,
* '3' for PCIXCC_MCL2, '4' for PCIXCC_MCL3, * '3' for PCIXCC_MCL2, '4' for PCIXCC_MCL3,
* '5' for CEX2C and '6' for CEX2A' * '5' for CEX2C and '6' for CEX2A'
...@@ -1103,7 +1128,7 @@ static int zcrypt_rng_data_read(struct hwrng *rng, u32 *data) ...@@ -1103,7 +1128,7 @@ static int zcrypt_rng_data_read(struct hwrng *rng, u32 *data)
{ {
int rc; int rc;
/** /*
* We don't need locking here because the RNG API guarantees serialized * We don't need locking here because the RNG API guarantees serialized
* read method calls. * read method calls.
*/ */
...@@ -1162,6 +1187,8 @@ static void zcrypt_rng_device_remove(void) ...@@ -1162,6 +1187,8 @@ static void zcrypt_rng_device_remove(void)
} }
/** /**
* zcrypt_api_init(): Module initialization.
*
* The module initialization code. * The module initialization code.
*/ */
int __init zcrypt_api_init(void) int __init zcrypt_api_init(void)
...@@ -1196,6 +1223,8 @@ int __init zcrypt_api_init(void) ...@@ -1196,6 +1223,8 @@ int __init zcrypt_api_init(void)
} }
/** /**
* zcrypt_api_exit(): Module termination.
*
* The module termination code. * The module termination code.
*/ */
void zcrypt_api_exit(void) void zcrypt_api_exit(void)
......
...@@ -174,7 +174,7 @@ static inline int zcrypt_type6_mex_key_de(struct ica_rsa_modexpo *mex, ...@@ -174,7 +174,7 @@ static inline int zcrypt_type6_mex_key_de(struct ica_rsa_modexpo *mex,
key->pvtMeHdr = static_pvt_me_hdr; key->pvtMeHdr = static_pvt_me_hdr;
key->pvtMeSec = static_pvt_me_sec; key->pvtMeSec = static_pvt_me_sec;
key->pubMeSec = static_pub_me_sec; key->pubMeSec = static_pub_me_sec;
/** /*
* In a private key, the modulus doesn't appear in the public * In a private key, the modulus doesn't appear in the public
* section. So, an arbitrary public exponent of 0x010001 will be * section. So, an arbitrary public exponent of 0x010001 will be
* used. * used.
...@@ -338,7 +338,7 @@ static inline int zcrypt_type6_crt_key(struct ica_rsa_modexpo_crt *crt, ...@@ -338,7 +338,7 @@ static inline int zcrypt_type6_crt_key(struct ica_rsa_modexpo_crt *crt,
pub = (struct cca_public_sec *)(key->key_parts + key_len); pub = (struct cca_public_sec *)(key->key_parts + key_len);
*pub = static_cca_pub_sec; *pub = static_cca_pub_sec;
pub->modulus_bit_len = 8 * crt->inputdatalength; pub->modulus_bit_len = 8 * crt->inputdatalength;
/** /*
* In a private key, the modulus doesn't appear in the public * In a private key, the modulus doesn't appear in the public
* section. So, an arbitrary public exponent of 0x010001 will be * section. So, an arbitrary public exponent of 0x010001 will be
* used. * used.
......
...@@ -108,7 +108,7 @@ static inline int convert_error(struct zcrypt_device *zdev, ...@@ -108,7 +108,7 @@ static inline int convert_error(struct zcrypt_device *zdev,
return -EINVAL; return -EINVAL;
case REP82_ERROR_MESSAGE_TYPE: case REP82_ERROR_MESSAGE_TYPE:
// REP88_ERROR_MESSAGE_TYPE // '20' CEX2A // REP88_ERROR_MESSAGE_TYPE // '20' CEX2A
/** /*
* To sent a message of the wrong type is a bug in the * To sent a message of the wrong type is a bug in the
* device driver. Warn about it, disable the device * device driver. Warn about it, disable the device
* and then repeat the request. * and then repeat the request.
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#define PCICC_MAX_MOD_SIZE_OLD 128 /* 1024 bits */ #define PCICC_MAX_MOD_SIZE_OLD 128 /* 1024 bits */
#define PCICC_MAX_MOD_SIZE 256 /* 2048 bits */ #define PCICC_MAX_MOD_SIZE 256 /* 2048 bits */
/** /*
* PCICC cards need a speed rating of 0. This keeps them at the end of * PCICC cards need a speed rating of 0. This keeps them at the end of
* the zcrypt device list (see zcrypt_api.c). PCICC cards are only * the zcrypt device list (see zcrypt_api.c). PCICC cards are only
* used if no other cards are present because they are slow and can only * used if no other cards are present because they are slow and can only
...@@ -388,7 +388,7 @@ static int convert_type86(struct zcrypt_device *zdev, ...@@ -388,7 +388,7 @@ static int convert_type86(struct zcrypt_device *zdev,
reply_len = le16_to_cpu(msg->length) - 2; reply_len = le16_to_cpu(msg->length) - 2;
if (reply_len > outputdatalength) if (reply_len > outputdatalength)
return -EINVAL; return -EINVAL;
/** /*
* For all encipher requests, the length of the ciphertext (reply_len) * For all encipher requests, the length of the ciphertext (reply_len)
* will always equal the modulus length. For MEX decipher requests * will always equal the modulus length. For MEX decipher requests
* the output needs to get padded. Minimum pad size is 10. * the output needs to get padded. Minimum pad size is 10.
......
...@@ -501,7 +501,7 @@ static int convert_type86_ica(struct zcrypt_device *zdev, ...@@ -501,7 +501,7 @@ static int convert_type86_ica(struct zcrypt_device *zdev,
reply_len = msg->length - 2; reply_len = msg->length - 2;
if (reply_len > outputdatalength) if (reply_len > outputdatalength)
return -EINVAL; return -EINVAL;
/** /*
* For all encipher requests, the length of the ciphertext (reply_len) * For all encipher requests, the length of the ciphertext (reply_len)
* will always equal the modulus length. For MEX decipher requests * will always equal the modulus length. For MEX decipher requests
* the output needs to get padded. Minimum pad size is 10. * the output needs to get padded. Minimum pad size is 10.
......
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