Lines Matching refs:encr
64 struct AppSecEncrHdr encr; in handleEncrypt() local
68 encr.keyID = keyId; in handleEncrypt()
78 fprintf(stderr, "Using Key ID: %016" PRIX64 "\n", encr.keyID); in handleEncrypt()
79 rand_bytes(encr.IV, sizeof(encr.IV)); in handleEncrypt()
80 printHash(stderr, "Using IV", encr.IV, AES_BLOCK_WORDS); in handleEncrypt()
87 encr.dataLen = bufUsed; in handleEncrypt()
122 fprintf(stderr, "orig len: %" PRIu32 " bytes\n", encr.dataLen); in handleEncrypt()
124 encr.dataLen -= sizeof(*image); in handleEncrypt()
125 fwrite(&encr, sizeof(encr), 1, out); in handleEncrypt()
129 aesCbcInitForEncr(&ctx, key, encr.IV); in handleEncrypt()
133 int32_t sz = encr.dataLen - (i * sizeof(uint32_t)); in handleEncrypt()
158 struct AppSecEncrHdr *encr; in handleDecrypt() local
168 if (bufUsed >= (sizeof(*image) + sizeof(*encr)) && in handleDecrypt()
178 encr = (struct AppSecEncrHdr *)data; in handleDecrypt()
179 data = (uint32_t *)(encr + 1); in handleDecrypt()
180 bufUsed -= sizeof(*image) + sizeof(*encr); in handleDecrypt()
186 if (encr->dataLen > bufUsed) { in handleDecrypt()
187 fprintf(stderr, "Claimed output size of %" PRIu32 "b invalid\n", encr->dataLen); in handleDecrypt()
191 encr->dataLen, bufUsed - encr->dataLen); in handleDecrypt()
192 if (!encr->keyID) { in handleDecrypt()
196 fprintf(stderr, "Using Key ID: %016" PRIX64 "\n", encr->keyID); in handleDecrypt()
197 printHash(stderr, "Using IV", encr->IV, AES_BLOCK_WORDS); in handleDecrypt()
201 aesCbcInitForDecr(&ctx, key, encr->IV); in handleDecrypt()
205 int32_t size = encr->dataLen - i * sizeof(uint32_t); in handleDecrypt()