summaryrefslogtreecommitdiffstats
path: root/include/tpm-common.h
Commit message (Collapse)AuthorAgeFilesLines
* tpm: Add TPM2 support for read/write valuesSimon Glass2021-03-021-0/+3
| | | | | | | Implement this API function for TPM2. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
* common: Drop asm/global_data.h from common headerSimon Glass2021-02-021-0/+2
| | | | | | | | | | | | Move this out of the common header and include it only where needed. In a number of cases this requires adding "struct udevice;" to avoid adding another large header or in other cases replacing / adding missing header files that had been pulled in, very indirectly. Finally, we have a few cases where we did not need to include <asm/global_data.h> at all, so remove that include. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
* command: Remove the cmd_tbl_t typedefSimon Glass2020-05-181-7/+9
| | | | | | | | | | | | | We should not use typedefs in U-Boot. They cannot be used as forward declarations which means that header files must include the full header to access them. Drop the typedef and rename the struct to remove the _s suffix which is now not useful. This requires quite a few header-file additions. Signed-off-by: Simon Glass <sjg@chromium.org>
* tpm: add a helper to iterate on all tpm devicesPhilippe Reynes2020-02-051-0/+3
| | | | | | | | This add a helper for_each_tpm_device that run through all the tpm (1.x and 2.0) devices. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
* tpm: Export tpm_clear_and_reenable()Simon Glass2018-12-051-0/+8
| | | | | | | This function is intended to be exported but is not. Add it to the header file. Signed-off-by: Simon Glass <sjg@chromium.org>
* tpm: Remove use of build-time TPM versionsSimon Glass2018-12-051-0/+11
| | | | | | | | | | | | There is only one place in the code which assumes at build-time that we are using either a v1 or a v2 TPM. Fix this up and add a new function to return the version of a TPM. Supported TPM versions (v1 and v2) can be enabled independently and it is possible to use both versions at once. This is useful for sandbox when running tests. Signed-off-by: Simon Glass <sjg@chromium.org>
* tpm: Convert to use a device parameterSimon Glass2018-11-291-2/+14
| | | | | | | | | At present many TPM calls assume there is only one TPM in the system and look up this TPM themselves. This is inconsistent with driver model, which expects all driver methods to have a device parameter. Update the code to correct this. Signed-off-by: Simon Glass <sjg@chromium.org>
* tpm: Export the open/close functionsSimon Glass2018-11-291-0/+18
| | | | | | | | | | | At present these functions are not accessible outside the TPM library, but in some cases we need to call them. Export them in the header file and add a define for the SHA1 digest size. Also adjust tpm_open() to call tpm_close() first so that the TPM is in a known state before opening (e.g. by a previous phase of U-Boot). Signed-off-by: Simon Glass <sjg@chromium.org>
* tpm: Add a constant for the minimum supported digest sizeSimon Glass2018-11-291-0/+2
| | | | | | | When SHA1 is used we need 20 bytes for the digest size. Add a constant so that clients can make use of this, e.g. to allocate local buffers. Signed-off-by: Simon Glass <sjg@chromium.org>
* tpm: allow TPM v1 and v2 to be compiled at the same timeMiquel Raynal2018-07-281-6/+34
| | | | | | | | | | | | | | | | | | | | | | | While there is probably no reason to do so in a real life situation, it will allow to compile test both stacks with the same sandbox defconfig. As we cannot define two 'tpm' commands at the same time, the command for TPM v1 is still called 'tpm' and the one for TPM v2 'tpm2'. While this is the exact command name that must be written into eg. test files, any user already using the TPM v2 stack can continue to do so by just writing 'tpm' because as long as TPM v1 support is not compiled, U-Boot prompt will search for the closest command named after 'tpm'. The command set can also be changed at runtime (not supported yet, but ready to be), but as one can compile only either one stack or the other, there is still one spot in the code where conditionals are used: to retrieve the v1 or v2 command set. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Simon Glass <sjg@chromium.org> [trini: In sandbox_tpm2_fill_buf() use NULL not \0 to ensure NULL terminated string due to LLVM warning] Signed-off-by: Tom Rini <trini@konsulko.com>
* tpm: fix typo in kernel docMiquel Raynal2018-07-281-1/+1
| | | | | | | | The udevice given to the open() function of course must be opened, not closed. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* tpm: prepare support for TPMv2.x commandsMiquel Raynal2018-05-251-0/+6
| | | | | | | | | | | | Choice between v1 and v2 compliant functions is done with the configuration. Create the various files that will receive TPMv2-only code on the same scheme as for the TPMv1 code. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* tpm: add missing parameter in private data structure descriptionMiquel Raynal2018-05-251-0/+1
| | | | | | | | | | Both parameters 'duration_ms' and 'retry_time_ms' of the tpm_chip_priv structure are documented is the comment above the declaration but 'buf' was forgotten. Add the missing description. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* tpm: disociate TPMv1.x specific and generic codeMiquel Raynal2018-05-251-0/+210
There are no changes in this commit but a new organization of the code as follow. * cmd/ directory: > move existing code from cmd/tpm.c in cmd/tpm-common.c > move specific code in cmd/tpm-v1.c > create a specific header file with generic definitions for commands only called cmd/tpm-user-utils.h * lib/ directory: > move existing code from lib/tpm.c in lib/tpm-common.c > move specific code in lib/tpm-v1.c > create a specific header file with generic definitions for the library itself called lib/tpm-utils.h * include/ directory: > move existing code from include/tpm.h in include/tpm-common.h > move specific code in include/tpm-v1.h Code designated as 'common' is compiled if TPM are used. Code designated as 'specific' is compiled only if the right specification has been selected. All files include tpm-common.h. Files in cmd/ include tpm-user-utils.h. Files in lib/ include tpm-utils.h. Depending on the specification, files may include either (not both) tpm-v1.h or tpm-v2.h. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Tom Rini <trini@konsulko.com> [trini: Fix a few more cases of tpm.h -> tpm-v1.h, some Kconfig logic] Signed-off-by: Tom Rini <trini@konsulko.com>