]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tpm2-util: more structure initialization simplifications
authorLennart Poettering <lennart@poettering.net>
Wed, 17 Aug 2022 07:49:41 +0000 (09:49 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 17 Aug 2022 12:59:47 +0000 (21:59 +0900)
src/shared/tpm2-util.c

index 1f099bcf17a19c9d78525bd0398802b7957785d7..f88272db7b052c9eea89f1cd4825f78a32ee962c 100644 (file)
@@ -415,11 +415,13 @@ static void tpm2_pcr_mask_to_selection(uint32_t mask, uint16_t bank, TPML_PCR_SE
 
         *ret = (TPML_PCR_SELECTION) {
                 .count = 1,
-                .pcrSelections[0].hash = bank,
-                .pcrSelections[0].sizeofSelect = 3,
-                .pcrSelections[0].pcrSelect[0] = mask & 0xFF,
-                .pcrSelections[0].pcrSelect[1] = (mask >> 8) & 0xFF,
-                .pcrSelections[0].pcrSelect[2] = (mask >> 16) & 0xFF,
+                .pcrSelections[0] = {
+                        .hash = bank,
+                        .sizeofSelect = 3,
+                        .pcrSelect[0] = mask & 0xFF,
+                        .pcrSelect[1] = (mask >> 8) & 0xFF,
+                        .pcrSelect[2] = (mask >> 16) & 0xFF,
+                }
         };
 }
 
@@ -621,12 +623,8 @@ static int tpm2_make_encryption_session(
 
         static const TPMT_SYM_DEF symmetric = {
                 .algorithm = TPM2_ALG_AES,
-                .keyBits = {
-                        .aes = 128,
-                },
-                .mode = {
-                        .aes = TPM2_ALG_CFB,
-                },
+                .keyBits.aes = 128,
+                .mode.aes = TPM2_ALG_CFB,
         };
         const TPMA_SESSION sessionAttributes = TPMA_SESSION_DECRYPT | TPMA_SESSION_ENCRYPT |
                         TPMA_SESSION_CONTINUESESSION;