|
|
5a6fa5 |
From 6faa13d83e5166e4bbe97d85935aca779fde9089 Mon Sep 17 00:00:00 2001
|
|
|
5a6fa5 |
From: Ingo Franzki <ifranzki@linux.ibm.com>
|
|
|
5a6fa5 |
Date: Thu, 2 Jul 2020 14:46:29 +0200
|
|
|
5a6fa5 |
Subject: [PATCH 2/2] pkcstok_migrate: Fix private token object conversion on
|
|
|
5a6fa5 |
little endian platforms
|
|
|
5a6fa5 |
|
|
|
5a6fa5 |
The new format stores numeric fields in the object header in big endian, while
|
|
|
5a6fa5 |
the old format uses the platform endianness. So convert the fields to big endian
|
|
|
5a6fa5 |
during conversion.
|
|
|
5a6fa5 |
|
|
|
5a6fa5 |
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
|
|
|
5a6fa5 |
---
|
|
|
5a6fa5 |
usr/sbin/pkcstok_migrate/pkcstok_migrate.c | 4 ++--
|
|
|
5a6fa5 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
5a6fa5 |
|
|
|
5a6fa5 |
diff --git a/usr/sbin/pkcstok_migrate/pkcstok_migrate.c b/usr/sbin/pkcstok_migrate/pkcstok_migrate.c
|
|
|
5a6fa5 |
index e0c19125..0148102c 100644
|
|
|
5a6fa5 |
--- a/usr/sbin/pkcstok_migrate/pkcstok_migrate.c
|
|
|
5a6fa5 |
+++ b/usr/sbin/pkcstok_migrate/pkcstok_migrate.c
|
|
|
5a6fa5 |
@@ -239,7 +239,7 @@ static CK_RV make_OBJECT_PRIV_312(unsigned char **obj_new, unsigned int *obj_new
|
|
|
5a6fa5 |
|
|
|
5a6fa5 |
/* Setup header */
|
|
|
5a6fa5 |
memset(&header, 0, sizeof(header));
|
|
|
5a6fa5 |
- header.tokversion = 0x0003000C;
|
|
|
5a6fa5 |
+ header.tokversion = htobe32(0x0003000C);
|
|
|
5a6fa5 |
header.private_flag = 0x01;
|
|
|
5a6fa5 |
ret = aes_256_wrap(header.key_wrapped, obj_key, masterkey);
|
|
|
5a6fa5 |
if (ret != CKR_OK) {
|
|
|
5a6fa5 |
@@ -252,7 +252,7 @@ static CK_RV make_OBJECT_PRIV_312(unsigned char **obj_new, unsigned int *obj_new
|
|
|
5a6fa5 |
header.iv[9] = 0;
|
|
|
5a6fa5 |
header.iv[10] = 0;
|
|
|
5a6fa5 |
header.iv[11] = 1;
|
|
|
5a6fa5 |
- header.object_len = clear_len;
|
|
|
5a6fa5 |
+ header.object_len = htobe32(clear_len);
|
|
|
5a6fa5 |
memcpy(object, &header, HEADER_LEN);
|
|
|
5a6fa5 |
|
|
|
5a6fa5 |
/* Encrypt body */
|
|
|
5a6fa5 |
--
|
|
|
5a6fa5 |
2.16.2.windows.1
|
|
|
5a6fa5 |
|