Commit e08c6d3b authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Jarkko Sakkinen

tpm: use %*ph to print small buffer

Use %*ph format to print small buffer as hex string.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarPetr Vorel <pvorel@suse.cz>
Reviewed-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
parent a4c30497
...@@ -56,31 +56,20 @@ static ssize_t pubek_show(struct device *dev, struct device_attribute *attr, ...@@ -56,31 +56,20 @@ static ssize_t pubek_show(struct device *dev, struct device_attribute *attr,
out = (struct tpm_readpubek_out *)&tpm_buf.data[10]; out = (struct tpm_readpubek_out *)&tpm_buf.data[10];
str += str +=
sprintf(str, sprintf(str,
"Algorithm: %02X %02X %02X %02X\n" "Algorithm: %4ph\n"
"Encscheme: %02X %02X\n" "Encscheme: %2ph\n"
"Sigscheme: %02X %02X\n" "Sigscheme: %2ph\n"
"Parameters: %02X %02X %02X %02X " "Parameters: %12ph\n"
"%02X %02X %02X %02X "
"%02X %02X %02X %02X\n"
"Modulus length: %d\n" "Modulus length: %d\n"
"Modulus:\n", "Modulus:\n",
out->algorithm[0], out->algorithm[1], out->algorithm[2], out->algorithm,
out->algorithm[3], out->encscheme,
out->encscheme[0], out->encscheme[1], out->sigscheme,
out->sigscheme[0], out->sigscheme[1], out->parameters,
out->parameters[0], out->parameters[1],
out->parameters[2], out->parameters[3],
out->parameters[4], out->parameters[5],
out->parameters[6], out->parameters[7],
out->parameters[8], out->parameters[9],
out->parameters[10], out->parameters[11],
be32_to_cpu(out->keysize)); be32_to_cpu(out->keysize));
for (i = 0; i < 256; i++) { for (i = 0; i < 256; i += 16)
str += sprintf(str, "%02X ", out->modulus[i]); str += sprintf(str, "%16ph\n", &out->modulus[i]);
if ((i + 1) % 16 == 0)
str += sprintf(str, "\n");
}
out_buf: out_buf:
tpm_buf_destroy(&tpm_buf); tpm_buf_destroy(&tpm_buf);
......
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