Commit 794c6e10 authored by Winkler, Tomas's avatar Winkler, Tomas Committed by Jarkko Sakkinen

tpm/tpm2-chip: fix kdoc errors

Use correct kdoc format, describe correct parameters and return values.
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Reviewed-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
parent f865c196
...@@ -258,11 +258,9 @@ static const struct tpm_input_header tpm2_pcrread_header = { ...@@ -258,11 +258,9 @@ static const struct tpm_input_header tpm2_pcrread_header = {
* tpm2_pcr_read() - read a PCR value * tpm2_pcr_read() - read a PCR value
* @chip: TPM chip to use. * @chip: TPM chip to use.
* @pcr_idx: index of the PCR to read. * @pcr_idx: index of the PCR to read.
* @ref_buf: buffer to store the resulting hash, * @res_buf: buffer to store the resulting hash.
* *
* 0 is returned when the operation is successful. If a negative number is * Return: Same as with tpm_transmit_cmd.
* returned it remarks a POSIX error code. If a positive number is returned
* it remarks a TPM error.
*/ */
int tpm2_pcr_read(struct tpm_chip *chip, int pcr_idx, u8 *res_buf) int tpm2_pcr_read(struct tpm_chip *chip, int pcr_idx, u8 *res_buf)
{ {
...@@ -304,13 +302,12 @@ static const struct tpm_input_header tpm2_pcrextend_header = { ...@@ -304,13 +302,12 @@ static const struct tpm_input_header tpm2_pcrextend_header = {
/** /**
* tpm2_pcr_extend() - extend a PCR value * tpm2_pcr_extend() - extend a PCR value
*
* @chip: TPM chip to use. * @chip: TPM chip to use.
* @pcr_idx: index of the PCR. * @pcr_idx: index of the PCR.
* @hash: hash value to use for the extend operation. * @hash: hash value to use for the extend operation.
* *
* 0 is returned when the operation is successful. If a negative number is * Return: Same as with tpm_transmit_cmd.
* returned it remarks a POSIX error code. If a positive number is returned
* it remarks a TPM error.
*/ */
int tpm2_pcr_extend(struct tpm_chip *chip, int pcr_idx, const u8 *hash) int tpm2_pcr_extend(struct tpm_chip *chip, int pcr_idx, const u8 *hash)
{ {
...@@ -348,13 +345,13 @@ static const struct tpm_input_header tpm2_getrandom_header = { ...@@ -348,13 +345,13 @@ static const struct tpm_input_header tpm2_getrandom_header = {
/** /**
* tpm2_get_random() - get random bytes from the TPM RNG * tpm2_get_random() - get random bytes from the TPM RNG
*
* @chip: TPM chip to use * @chip: TPM chip to use
* @out: destination buffer for the random bytes * @out: destination buffer for the random bytes
* @max: the max number of bytes to write to @out * @max: the max number of bytes to write to @out
* *
* 0 is returned when the operation is successful. If a negative number is * Return:
* returned it remarks a POSIX error code. If a positive number is returned * Size of the output buffer, or -EIO on error.
* it remarks a TPM error.
*/ */
int tpm2_get_random(struct tpm_chip *chip, u8 *out, size_t max) int tpm2_get_random(struct tpm_chip *chip, u8 *out, size_t max)
{ {
...@@ -404,15 +401,15 @@ static const struct tpm_input_header tpm2_get_tpm_pt_header = { ...@@ -404,15 +401,15 @@ static const struct tpm_input_header tpm2_get_tpm_pt_header = {
}; };
/** /**
* Append TPMS_AUTH_COMMAND to the buffer. The buffer must be allocated with * tpm_buf_append_auth() - append TPMS_AUTH_COMMAND to the buffer.
* tpm_buf_alloc(). *
* * @buf: an allocated tpm_buf instance
* @param buf: an allocated tpm_buf instance * @session_handle: session handle
* @param nonce: the session nonce, may be NULL if not used * @nonce: the session nonce, may be NULL if not used
* @param nonce_len: the session nonce length, may be 0 if not used * @nonce_len: the session nonce length, may be 0 if not used
* @param attributes: the session attributes * @attributes: the session attributes
* @param hmac: the session HMAC or password, may be NULL if not used * @hmac: the session HMAC or password, may be NULL if not used
* @param hmac_len: the session HMAC or password length, maybe 0 if not used * @hmac_len: the session HMAC or password length, maybe 0 if not used
*/ */
static void tpm2_buf_append_auth(struct tpm_buf *buf, u32 session_handle, static void tpm2_buf_append_auth(struct tpm_buf *buf, u32 session_handle,
const u8 *nonce, u16 nonce_len, const u8 *nonce, u16 nonce_len,
...@@ -435,7 +432,8 @@ static void tpm2_buf_append_auth(struct tpm_buf *buf, u32 session_handle, ...@@ -435,7 +432,8 @@ static void tpm2_buf_append_auth(struct tpm_buf *buf, u32 session_handle,
/** /**
* tpm2_seal_trusted() - seal the payload of a trusted key * tpm2_seal_trusted() - seal the payload of a trusted key
* @chip_num: TPM chip to use *
* @chip: TPM chip to use
* @payload: the key data in clear and encrypted form * @payload: the key data in clear and encrypted form
* @options: authentication values and other options * @options: authentication values and other options
* *
...@@ -540,11 +538,17 @@ int tpm2_seal_trusted(struct tpm_chip *chip, ...@@ -540,11 +538,17 @@ int tpm2_seal_trusted(struct tpm_chip *chip,
/** /**
* tpm2_load_cmd() - execute a TPM2_Load command * tpm2_load_cmd() - execute a TPM2_Load command
* @chip_num: TPM chip to use *
* @chip: TPM chip to use
* @payload: the key data in clear and encrypted form * @payload: the key data in clear and encrypted form
* @options: authentication values and other options * @options: authentication values and other options
* @blob_handle: returned blob handle
* @flags: tpm transmit flags
* *
* Return: same as with tpm_transmit_cmd * Return: 0 on success.
* -E2BIG on wrong payload size.
* -EPERM on tpm error status.
* < 0 error from tpm_transmit_cmd.
*/ */
static int tpm2_load_cmd(struct tpm_chip *chip, static int tpm2_load_cmd(struct tpm_chip *chip,
struct trusted_key_payload *payload, struct trusted_key_payload *payload,
...@@ -600,11 +604,12 @@ static int tpm2_load_cmd(struct tpm_chip *chip, ...@@ -600,11 +604,12 @@ static int tpm2_load_cmd(struct tpm_chip *chip,
/** /**
* tpm2_flush_context_cmd() - execute a TPM2_FlushContext command * tpm2_flush_context_cmd() - execute a TPM2_FlushContext command
* @chip_num: TPM chip to use
* @payload: the key data in clear and encrypted form
* @options: authentication values and other options
* *
* Return: same as with tpm_transmit_cmd * @chip: TPM chip to use
* @handle: the key data in clear and encrypted form
* @flags: tpm transmit flags
*
* Return: Same as with tpm_transmit_cmd.
*/ */
static void tpm2_flush_context_cmd(struct tpm_chip *chip, u32 handle, static void tpm2_flush_context_cmd(struct tpm_chip *chip, u32 handle,
unsigned int flags) unsigned int flags)
...@@ -632,11 +637,16 @@ static void tpm2_flush_context_cmd(struct tpm_chip *chip, u32 handle, ...@@ -632,11 +637,16 @@ static void tpm2_flush_context_cmd(struct tpm_chip *chip, u32 handle,
/** /**
* tpm2_unseal_cmd() - execute a TPM2_Unload command * tpm2_unseal_cmd() - execute a TPM2_Unload command
* @chip_num: TPM chip to use *
* @chip: TPM chip to use
* @payload: the key data in clear and encrypted form * @payload: the key data in clear and encrypted form
* @options: authentication values and other options * @options: authentication values and other options
* @blob_handle: blob handle
* @flags: tpm_transmit_cmd flags
* *
* Return: same as with tpm_transmit_cmd * Return: 0 on success
* -EPERM on tpm error status
* < 0 error from tpm_transmit_cmd
*/ */
static int tpm2_unseal_cmd(struct tpm_chip *chip, static int tpm2_unseal_cmd(struct tpm_chip *chip,
struct trusted_key_payload *payload, struct trusted_key_payload *payload,
...@@ -681,11 +691,12 @@ static int tpm2_unseal_cmd(struct tpm_chip *chip, ...@@ -681,11 +691,12 @@ static int tpm2_unseal_cmd(struct tpm_chip *chip,
/** /**
* tpm2_unseal_trusted() - unseal the payload of a trusted key * tpm2_unseal_trusted() - unseal the payload of a trusted key
* @chip_num: TPM chip to use *
* @chip: TPM chip to use
* @payload: the key data in clear and encrypted form * @payload: the key data in clear and encrypted form
* @options: authentication values and other options * @options: authentication values and other options
* *
* Return: < 0 on error and 0 on success. * Return: Same as with tpm_transmit_cmd.
*/ */
int tpm2_unseal_trusted(struct tpm_chip *chip, int tpm2_unseal_trusted(struct tpm_chip *chip,
struct trusted_key_payload *payload, struct trusted_key_payload *payload,
...@@ -715,9 +726,7 @@ int tpm2_unseal_trusted(struct tpm_chip *chip, ...@@ -715,9 +726,7 @@ int tpm2_unseal_trusted(struct tpm_chip *chip,
* @value: output variable. * @value: output variable.
* @desc: passed to tpm_transmit_cmd() * @desc: passed to tpm_transmit_cmd()
* *
* 0 is returned when the operation is successful. If a negative number is * Return: Same as with tpm_transmit_cmd.
* returned it remarks a POSIX error code. If a positive number is returned
* it remarks a TPM error.
*/ */
ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id, u32 *value, ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id, u32 *value,
const char *desc) const char *desc)
...@@ -750,13 +759,12 @@ static const struct tpm_input_header tpm2_startup_header = { ...@@ -750,13 +759,12 @@ static const struct tpm_input_header tpm2_startup_header = {
/** /**
* tpm2_startup() - send startup command to the TPM chip * tpm2_startup() - send startup command to the TPM chip
*
* @chip: TPM chip to use. * @chip: TPM chip to use.
* @startup_type startup type. The value is either * @startup_type: startup type. The value is either
* TPM_SU_CLEAR or TPM_SU_STATE. * TPM_SU_CLEAR or TPM_SU_STATE.
* *
* 0 is returned when the operation is successful. If a negative number is * Return: Same as with tpm_transmit_cmd.
* returned it remarks a POSIX error code. If a positive number is returned
* it remarks a TPM error.
*/ */
static int tpm2_startup(struct tpm_chip *chip, u16 startup_type) static int tpm2_startup(struct tpm_chip *chip, u16 startup_type)
{ {
...@@ -781,8 +789,9 @@ static const struct tpm_input_header tpm2_shutdown_header = { ...@@ -781,8 +789,9 @@ static const struct tpm_input_header tpm2_shutdown_header = {
/** /**
* tpm2_shutdown() - send shutdown command to the TPM chip * tpm2_shutdown() - send shutdown command to the TPM chip
*
* @chip: TPM chip to use. * @chip: TPM chip to use.
* @shutdown_type shutdown type. The value is either * @shutdown_type: shutdown type. The value is either
* TPM_SU_CLEAR or TPM_SU_STATE. * TPM_SU_CLEAR or TPM_SU_STATE.
*/ */
void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type) void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type)
...@@ -805,12 +814,11 @@ void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type) ...@@ -805,12 +814,11 @@ void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type)
/* /*
* tpm2_calc_ordinal_duration() - maximum duration for a command * tpm2_calc_ordinal_duration() - maximum duration for a command
*
* @chip: TPM chip to use. * @chip: TPM chip to use.
* @ordinal: command code number. * @ordinal: command code number.
* *
* 0 is returned when the operation is successful. If a negative number is * Return: maximum duration for a command
* returned it remarks a POSIX error code. If a positive number is returned
* it remarks a TPM error.
*/ */
unsigned long tpm2_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal) unsigned long tpm2_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal)
{ {
...@@ -842,13 +850,12 @@ static const struct tpm_input_header tpm2_selftest_header = { ...@@ -842,13 +850,12 @@ static const struct tpm_input_header tpm2_selftest_header = {
/** /**
* tpm2_continue_selftest() - start a self test * tpm2_continue_selftest() - start a self test
*
* @chip: TPM chip to use * @chip: TPM chip to use
* @full: test all commands instead of testing only those that were not * @full: test all commands instead of testing only those that were not
* previously tested. * previously tested.
* *
* 0 is returned when the operation is successful. If a negative number is * Return: Same as with tpm_transmit_cmd with exception of RC_TESTING.
* returned it remarks a POSIX error code. If a positive number is returned
* it remarks a TPM error.
*/ */
static int tpm2_start_selftest(struct tpm_chip *chip, bool full) static int tpm2_start_selftest(struct tpm_chip *chip, bool full)
{ {
...@@ -874,14 +881,13 @@ static int tpm2_start_selftest(struct tpm_chip *chip, bool full) ...@@ -874,14 +881,13 @@ static int tpm2_start_selftest(struct tpm_chip *chip, bool full)
/** /**
* tpm2_do_selftest() - run a full self test * tpm2_do_selftest() - run a full self test
*
* @chip: TPM chip to use * @chip: TPM chip to use
* *
* Return: Same as with tpm_transmit_cmd.
*
* During the self test TPM2 commands return with the error code RC_TESTING. * During the self test TPM2 commands return with the error code RC_TESTING.
* Waiting is done by issuing PCR read until it executes successfully. * Waiting is done by issuing PCR read until it executes successfully.
*
* 0 is returned when the operation is successful. If a negative number is
* returned it remarks a POSIX error code. If a positive number is returned
* it remarks a TPM error.
*/ */
static int tpm2_do_selftest(struct tpm_chip *chip) static int tpm2_do_selftest(struct tpm_chip *chip)
{ {
...@@ -928,6 +934,8 @@ static int tpm2_do_selftest(struct tpm_chip *chip) ...@@ -928,6 +934,8 @@ static int tpm2_do_selftest(struct tpm_chip *chip)
* tpm2_probe() - probe TPM 2.0 * tpm2_probe() - probe TPM 2.0
* @chip: TPM chip to use * @chip: TPM chip to use
* *
* Return: < 0 error and 0 on success.
*
* Send idempotent TPM 2.0 command and see whether TPM 2.0 chip replied based on * Send idempotent TPM 2.0 command and see whether TPM 2.0 chip replied based on
* the reply tag. * the reply tag.
*/ */
......
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