mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-06 13:17:44 +03:00
tpm2: rename struct tpm2_context to Tpm2Context
This aligns with systemd coding guidelines for struct naming
This commit is contained in:
parent
7bfe0a48d9
commit
bd860983a6
@ -726,7 +726,7 @@ static int verb_sign(int argc, char *argv[], void *userdata) {
|
||||
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
|
||||
_cleanup_(pcr_state_free_all) PcrState *pcr_states = NULL;
|
||||
_cleanup_(EVP_PKEY_freep) EVP_PKEY *privkey = NULL, *pubkey = NULL;
|
||||
_cleanup_(tpm2_context_destroy) struct tpm2_context c = {};
|
||||
_cleanup_(tpm2_context_destroy) Tpm2Context c = {};
|
||||
_cleanup_fclose_ FILE *privkeyf = NULL;
|
||||
ESYS_TR session_handle = ESYS_TR_NONE;
|
||||
TSS2_RC rc;
|
||||
|
@ -155,7 +155,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int determine_banks(struct tpm2_context *c, unsigned target_pcr_nr) {
|
||||
static int determine_banks(Tpm2Context *c, unsigned target_pcr_nr) {
|
||||
_cleanup_strv_free_ char **l = NULL;
|
||||
int r;
|
||||
|
||||
@ -240,7 +240,7 @@ static int get_file_system_word(
|
||||
}
|
||||
|
||||
static int run(int argc, char *argv[]) {
|
||||
_cleanup_(tpm2_context_destroy) struct tpm2_context c = {};
|
||||
_cleanup_(tpm2_context_destroy) Tpm2Context c = {};
|
||||
_cleanup_free_ char *joined = NULL, *word = NULL;
|
||||
unsigned target_pcr_nr;
|
||||
size_t length;
|
||||
|
@ -841,7 +841,7 @@ static int measure_volume_key(
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to load TPM2 libraries: %m");
|
||||
|
||||
_cleanup_(tpm2_context_destroy) struct tpm2_context c = {};
|
||||
_cleanup_(tpm2_context_destroy) Tpm2Context c = {};
|
||||
r = tpm2_context_init(arg_tpm2_device, &c);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
@ -104,7 +104,7 @@ int dlopen_tpm2(void) {
|
||||
DLSYM_ARG(Tss2_MU_TPM2B_PUBLIC_Unmarshal));
|
||||
}
|
||||
|
||||
void tpm2_context_destroy(struct tpm2_context *c) {
|
||||
void tpm2_context_destroy(Tpm2Context *c) {
|
||||
assert(c);
|
||||
|
||||
if (c->esys_context)
|
||||
@ -138,7 +138,7 @@ ESYS_TR tpm2_flush_context_verbose(ESYS_CONTEXT *c, ESYS_TR handle) {
|
||||
return ESYS_TR_NONE;
|
||||
}
|
||||
|
||||
int tpm2_context_init(const char *device, struct tpm2_context *ret) {
|
||||
int tpm2_context_init(const char *device, Tpm2Context *ret) {
|
||||
_cleanup_(Esys_Finalize_wrapper) ESYS_CONTEXT *c = NULL;
|
||||
_cleanup_free_ TSS2_TCTI_CONTEXT *tcti = NULL;
|
||||
_cleanup_(dlclosep) void *dl = NULL;
|
||||
@ -238,7 +238,7 @@ int tpm2_context_init(const char *device, struct tpm2_context *ret) {
|
||||
return log_error_errno(SYNTHETIC_ERRNO(ENOTRECOVERABLE),
|
||||
"Failed to start up TPM: %s", sym_Tss2_RC_Decode(rc));
|
||||
|
||||
*ret = (struct tpm2_context) {
|
||||
*ret = (Tpm2Context) {
|
||||
.esys_context = TAKE_PTR(c),
|
||||
.tcti_context = TAKE_PTR(tcti),
|
||||
.tcti_dl = TAKE_PTR(dl),
|
||||
@ -1403,7 +1403,7 @@ int tpm2_seal(const char *device,
|
||||
uint16_t *ret_pcr_bank,
|
||||
uint16_t *ret_primary_alg) {
|
||||
|
||||
_cleanup_(tpm2_context_destroy) struct tpm2_context c = {};
|
||||
_cleanup_(tpm2_context_destroy) Tpm2Context c = {};
|
||||
_cleanup_(Esys_Freep) TPM2B_DIGEST *policy_digest = NULL;
|
||||
_cleanup_(Esys_Freep) TPM2B_PRIVATE *private = NULL;
|
||||
_cleanup_(Esys_Freep) TPM2B_PUBLIC *public = NULL;
|
||||
@ -1624,7 +1624,7 @@ int tpm2_unseal(const char *device,
|
||||
void **ret_secret,
|
||||
size_t *ret_secret_size) {
|
||||
|
||||
_cleanup_(tpm2_context_destroy) struct tpm2_context c = {};
|
||||
_cleanup_(tpm2_context_destroy) Tpm2Context c = {};
|
||||
ESYS_TR primary = ESYS_TR_NONE, session = ESYS_TR_NONE, hmac_session = ESYS_TR_NONE,
|
||||
hmac_key = ESYS_TR_NONE;
|
||||
_cleanup_(Esys_Freep) TPM2B_SENSITIVE_DATA* unsealed = NULL;
|
||||
|
@ -53,11 +53,11 @@ int dlopen_tpm2(void);
|
||||
int tpm2_seal(const char *device, uint32_t hash_pcr_mask, const void *pubkey, size_t pubkey_size, uint32_t pubkey_pcr_mask, const char *pin, void **ret_secret, size_t *ret_secret_size, void **ret_blob, size_t *ret_blob_size, void **ret_pcr_hash, size_t *ret_pcr_hash_size, uint16_t *ret_pcr_bank, uint16_t *ret_primary_alg);
|
||||
int tpm2_unseal(const char *device, uint32_t hash_pcr_mask, uint16_t pcr_bank, const void *pubkey, size_t pubkey_size, uint32_t pubkey_pcr_mask, JsonVariant *signature, const char *pin, uint16_t primary_alg, const void *blob, size_t blob_size, const void *policy_hash, size_t policy_hash_size, void **ret_secret, size_t *ret_secret_size);
|
||||
|
||||
struct tpm2_context {
|
||||
typedef struct {
|
||||
void *tcti_dl;
|
||||
TSS2_TCTI_CONTEXT *tcti_context;
|
||||
ESYS_CONTEXT *esys_context;
|
||||
};
|
||||
} Tpm2Context;
|
||||
|
||||
ESYS_TR tpm2_flush_context_verbose(ESYS_CONTEXT *c, ESYS_TR handle);
|
||||
|
||||
@ -73,12 +73,12 @@ int tpm2_get_good_pcr_banks_strv(ESYS_CONTEXT *c, uint32_t pcr_mask, char ***ret
|
||||
|
||||
int tpm2_extend_bytes(ESYS_CONTEXT *c, char **banks, unsigned pcr_index, const void *data, size_t data_size, const void *secret, size_t secret_size);
|
||||
|
||||
#else
|
||||
struct tpm2_context;
|
||||
#endif
|
||||
#else /* HAVE_TPM2 */
|
||||
typedef struct {} Tpm2Context;
|
||||
#endif /* HAVE_TPM2 */
|
||||
|
||||
int tpm2_context_init(const char *device, struct tpm2_context *ret);
|
||||
void tpm2_context_destroy(struct tpm2_context *c);
|
||||
int tpm2_context_init(const char *device, Tpm2Context *ret);
|
||||
void tpm2_context_destroy(Tpm2Context *c);
|
||||
|
||||
int tpm2_list_devices(void);
|
||||
int tpm2_find_device_auto(int log_level, char **ret);
|
||||
|
Loading…
Reference in New Issue
Block a user