Skip to content

Commit 6fb8a3c

Browse files
author
Hon Ching (Vicky) Lo
committed
Support OpenSSL 1.1.0
1 parent cf053b9 commit 6fb8a3c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

‎lib/tpm_unseal.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,8 @@ int tpmUnsealFile( char* fname, unsigned char** tss_data, int* tss_size,
408408
}
409409

410410
/* Decode and decrypt the encrypted data */
411-
EVP_CIPHER_CTX ctx;
412-
EVP_DecryptInit(&ctx, EVP_aes_256_cbc(), symKey, (unsigned char *)TPMSEAL_IV);
411+
EVP_CIPHER_CTX *ctx = NULL;
412+
EVP_DecryptInit(ctx, EVP_aes_256_cbc(), symKey, (unsigned char *)TPMSEAL_IV);
413413

414414
/* Create a base64 BIO to decode the encrypted data */
415415
if ((b64 = BIO_new(BIO_f_base64())) == NULL) {
@@ -420,11 +420,11 @@ int tpmUnsealFile( char* fname, unsigned char** tss_data, int* tss_size,
420420

421421
bmem = BIO_push( b64, bmem );
422422
while ((rcLen = BIO_read(bmem, data, sizeof(data))) > 0) {
423-
EVP_DecryptUpdate(&ctx, res_data+res_size,
423+
EVP_DecryptUpdate(ctx, res_data+res_size,
424424
&rcLen, (unsigned char *)data, rcLen);
425425
res_size += rcLen;
426426
}
427-
EVP_DecryptFinal(&ctx, res_data+res_size, &rcLen);
427+
EVP_DecryptFinal(ctx, res_data+res_size, &rcLen);
428428
res_size += rcLen;
429429
bmem = BIO_pop(b64);
430430
BIO_free(b64);

‎src/cmds/tpm_sealdata.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,16 +343,16 @@ int main(int argc, char **argv)
343343
BIO_puts(bdata, TPMSEAL_ENC_STRING);
344344
bdata = BIO_push(b64, bdata);
345345

346-
EVP_CIPHER_CTX ctx;
347-
EVP_EncryptInit(&ctx, EVP_aes_256_cbc(), randKey, (unsigned char *)TPMSEAL_IV);
346+
EVP_CIPHER_CTX *ctx = NULL;
347+
EVP_EncryptInit(ctx, EVP_aes_256_cbc(), randKey, (unsigned char *)TPMSEAL_IV);
348348

349349
while ((lineLen = BIO_read(bin, line, sizeof(line))) > 0) {
350-
EVP_EncryptUpdate(&ctx, encData, &encDataLen,
350+
EVP_EncryptUpdate(ctx, encData, &encDataLen,
351351
line, lineLen);
352352
BIO_write(bdata, encData, encDataLen);
353353
}
354354

355-
EVP_EncryptFinal(&ctx, encData, &encDataLen);
355+
EVP_EncryptFinal(ctx, encData, &encDataLen);
356356
BIO_write(bdata, encData, encDataLen);
357357
if (BIO_flush(bdata) != 1) {
358358
logError(_("Unable to flush output\n"));

0 commit comments

Comments
 (0)