From ec672b4e37990104eed20106a4513acfabdfd819 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Fri, 11 May 2018 16:05:28 -0400 Subject: [PATCH] Expose the two new API calls TPMLIB_Get/SetState Expose the two new API calls TPMLIB_GetState() and TPMLIB_SetState(). Fix one parameter in the TPMLIB_GetState() call. Signed-off-by: Stefan Berger --- include/libtpms/tpm_library.h | 2 +- include/libtpms/tpm_library.h.in | 2 +- man/man3/TPMLIB_SetState.3 | 26 +++++++++++--------------- man/man3/TPMLIB_SetState.pod | 2 +- src/tpm_library.c | 12 ++++++++++++ 5 files changed, 26 insertions(+), 18 deletions(-) diff --git a/include/libtpms/tpm_library.h b/include/libtpms/tpm_library.h index fdef1a5d..f353c457 100644 --- a/include/libtpms/tpm_library.h +++ b/include/libtpms/tpm_library.h @@ -154,7 +154,7 @@ TPM_RESULT TPMLIB_ValidateState(enum TPMLIB_StateType st, TPM_RESULT TPMLIB_SetState(enum TPMLIB_StateType st, const unsigned char *buffer, uint32_t buflen); TPM_RESULT TPMLIB_GetState(enum TPMLIB_StateType st, - const unsigned char **buffer, uint32_t *buflen); + unsigned char **buffer, uint32_t *buflen); #ifdef __cplusplus } diff --git a/include/libtpms/tpm_library.h.in b/include/libtpms/tpm_library.h.in index 1e071336..fa2ec6d0 100644 --- a/include/libtpms/tpm_library.h.in +++ b/include/libtpms/tpm_library.h.in @@ -154,7 +154,7 @@ TPM_RESULT TPMLIB_ValidateState(enum TPMLIB_StateType st, TPM_RESULT TPMLIB_SetState(enum TPMLIB_StateType st, const unsigned char *buffer, uint32_t buflen); TPM_RESULT TPMLIB_GetState(enum TPMLIB_StateType st, - const unsigned char **buffer, uint32_t *buflen); + unsigned char **buffer, uint32_t *buflen); #ifdef __cplusplus } diff --git a/man/man3/TPMLIB_SetState.3 b/man/man3/TPMLIB_SetState.3 index af324583..f09431da 100644 --- a/man/man3/TPMLIB_SetState.3 +++ b/man/man3/TPMLIB_SetState.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.31) +.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== @@ -46,7 +46,7 @@ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" -.\" If the F register is turned on, we'll generate index entries on stderr for +.\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. @@ -54,20 +54,16 @@ .\" Avoid warning from groff about undefined register 'F'. .de IX .. -.nr rF 0 -.if \n(.g .if rF .nr rF 1 -.if (\n(rF:(\n(.g==0)) \{ -. if \nF \{ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" +.if !\nF .nr F 0 +.if \nF>0 \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" .. -. if !\nF==2 \{ -. nr % 0 -. nr F 2 -. \} +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 . \} .\} -.rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -133,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "TPMLIB_SetState 3" -.TH TPMLIB_SetState 3 "2018-05-10" "libtpms" "" +.TH TPMLIB_SetState 3 "2018-05-11" "libtpms" "" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -153,7 +149,7 @@ TPMLIB_GetState \- Get the TPM's volatile, permanent, or save state const unsigned char *buffer, uint32_t buflen);\fR .PP \&\fB\s-1TPM_RESULT\s0 TPMLIB_GetState(enum TPMLIB_StateType st, - const unsigned char **buffer, uint32_t *buflen);\fR + unsigned char **buffer, uint32_t *buflen);\fR .SH "DESCRIPTION" .IX Header "DESCRIPTION" The \fB\f(BITPMLIB_SetState()\fB\fR function allows to set either one of the state blobs of diff --git a/man/man3/TPMLIB_SetState.pod b/man/man3/TPMLIB_SetState.pod index 104a2ab4..81b5ae59 100644 --- a/man/man3/TPMLIB_SetState.pod +++ b/man/man3/TPMLIB_SetState.pod @@ -16,7 +16,7 @@ B B + unsigned char **buffer, uint32_t *buflen);> =head1 DESCRIPTION diff --git a/src/tpm_library.c b/src/tpm_library.c index 3b64184d..ebc706cb 100644 --- a/src/tpm_library.c +++ b/src/tpm_library.c @@ -154,6 +154,18 @@ char *TPMLIB_GetInfo(enum TPMLIB_InfoFlags flags) return tpm_iface[0]->GetInfo(flags); } +TPM_RESULT TPMLIB_SetState(enum TPMLIB_StateType st, + const unsigned char *buffer, uint32_t buflen) +{ + return tpm_iface[0]->SetState(st, buffer, buflen); +} + +TPM_RESULT TPMLIB_GetState(enum TPMLIB_StateType st, + unsigned char **buffer, uint32_t *buflen) +{ + return tpm_iface[0]->GetState(st, buffer, buflen); +} + TPM_RESULT TPM_IO_Hash_Start(void) { return tpm_iface[0]->HashStart();