forked from pool/openCryptoki
f41ca9bf97
- Added patch for compile errors * ocki-3.19.0-0035-Fix-compile-error-error-initializer-element-is-not-c.patch - Changed spec file to use %autosetup instead of %setup. - Updated the package openCryptoki 3.19.0 (jsc#PED-616, bsc#1207760), added the following patches: * ocki-3.19.0-0001-EP11-Unify-key-pair-generation-functions.patch * ocki-3.19.0-0002-EP11-Do-not-report-DSA-DH-parameter-generation-as-be.patch * ocki-3.19.0-0003-EP11-Do-not-pass-empty-CKA_PUBLIC_KEY_INFO-to-EP11-h.patch * ocki-3.19.0-0004-Mechtable-CKM_IBM_DILITHIUM-can-also-be-used-for-key.patch * ocki-3.19.0-0005-EP11-Remove-DSA-DH-parameter-generation-mechanisms-f.patch * ocki-3.19.0-0006-EP11-Pass-back-chain-code-for-CKM_IBM_BTC_DERIVE.patch * ocki-3.19.0-0007-EP11-Supply-CKA_PUBLIC_KEY_INFO-with-CKM_IBM_BTC_DER.patch * ocki-3.19.0-0008-EP11-Supply-CKA_PUBLIC_KEY_INFO-when-importing-priva.patch * ocki-3.19.0-0009-EP11-Fix-memory-leak-introduced-with-recent-commit.patch * ocki-3.19.0-0010-p11sak-Fix-segfault-when-dilithium-version-is-not-sp.patch * ocki-3.19.0-0011-EP11-remove-dead-code-and-unused-variables.patch * ocki-3.19.0-0012-EP11-Update-EP11-host-library-header-files.patch * ocki-3.19.0-0013-EP11-Support-EP11-host-library-version-4.patch * ocki-3.19.0-0014-EP11-Add-new-control-points.patch * ocki-3.19.0-0015-EP11-Default-unknown-CPs-to-ON.patch * ocki-3.19.0-0016-COMMON-Add-defines-for-Dilithium-round-2-and-3-varia.patch * ocki-3.19.0-0017-COMMON-Add-defines-for-Kyber.patch * ocki-3.19.0-0018-COMMON-Add-post-quantum-algorithm-OIDs.patch * ocki-3.19.0-0019-COMMON-Dilithium-key-BER-encoding-decoding-allow-dif.patch * ocki-3.19.0-0020-COMMON-EP11-Add-CKA_VALUE-holding-SPKI-PKCS-8-of-key.patch * ocki-3.19.0-0021-COMMON-EP11-Allow-to-select-Dilithium-variant-via-mo.patch * ocki-3.19.0-0022-EP11-Query-supported-PQC-variants-and-restrict-usage.patch * ocki-3.19.0-0023-POLICY-Dilithium-strength-and-signature-size-depends.patch * ocki-3.19.0-0024-TESTCASES-Test-Dilithium-variants.patch * ocki-3.19.0-0025-COMMON-EP11-Add-Kyber-key-type-and-mechanism.patch * ocki-3.19.0-0026-EP11-Add-support-for-generating-and-importing-Kyber-.patch * ocki-3.19.0-0027-EP11-Add-support-for-encrypt-decrypt-and-KEM-operati.patch * ocki-3.19.0-0028-POLICY-STATISTICS-Check-for-Kyber-KEM-KDFs-and-count.patch * ocki-3.19.0-0029-TESTCASES-Add-tests-for-CKM_IBM_KYBER.patch * ocki-3.19.0-0030-p11sak-Support-additional-Dilithium-variants.patch * ocki-3.19.0-0031-p11sak-Add-support-for-IBM-Kyber-key-type.patch * ocki-3.19.0-0032-testcase-Enhance-p11sak-testcase-to-generate-IBM-Kyb.patch * ocki-3.19.0-0033-EP11-Supply-CKA_PUBLIC_KEY_INFO-with-CKM_IBM_BTC_DER.patch * ocki-3.19.0-0034-EP11-Fix-setting-unknown-CPs-to-ON.patch OBS-URL: https://build.opensuse.org/request/show/1063652 OBS-URL: https://build.opensuse.org/package/show/security/openCryptoki?expand=0&rev=128
77 lines
2.9 KiB
Diff
77 lines
2.9 KiB
Diff
From 95f64e0c9f30ea8e0712e554418230659dabe1ec Mon Sep 17 00:00:00 2001
|
|
From: Ingo Franzki <ifranzki@linux.ibm.com>
|
|
Date: Wed, 16 Feb 2022 13:44:10 +0100
|
|
Subject: [PATCH 16/34] COMMON: Add defines for Dilithium round 2 and 3
|
|
variants
|
|
|
|
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
|
|
---
|
|
usr/include/pkcs11types.h | 12 ++++++++++--
|
|
usr/lib/common/p11util.c | 6 ++++++
|
|
2 files changed, 16 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/usr/include/pkcs11types.h b/usr/include/pkcs11types.h
|
|
index bc53e672..6bf9c1fa 100644
|
|
--- a/usr/include/pkcs11types.h
|
|
+++ b/usr/include/pkcs11types.h
|
|
@@ -437,6 +437,7 @@ typedef CK_ULONG CK_KEY_TYPE;
|
|
#ifndef OCK_NO_EP11_DEFINES
|
|
#define CKK_IBM_PQC_DILITHIUM CKK_VENDOR_DEFINED + 0x10023
|
|
#endif
|
|
+#define CKK_IBM_DILITHIUM CKK_IBM_PQC_DILITHIUM
|
|
|
|
/* CK_CERTIFICATE_TYPE is a value that identifies a certificate
|
|
* type */
|
|
@@ -594,8 +595,15 @@ typedef CK_ULONG CK_ATTRIBUTE_TYPE;
|
|
#define CKA_IBM_PROTKEY_NEVER_EXTRACTABLE (CKA_VENDOR_DEFINED +0x1000d)
|
|
#define CKA_IBM_OPAQUE_PKEY (CKA_VENDOR_DEFINED + 0xd0100)
|
|
|
|
-/* For Dilithium, oid = 1.3.6.1.4.1.2.267.1.6.5 */
|
|
-#define IBM_DILITHIUM_KEYFORM_ROUND2 1
|
|
+#define CK_IBM_DILITHIUM_KEYFORM_ROUND2_65 1
|
|
+#define CK_IBM_DILITHIUM_KEYFORM_ROUND2_87 2
|
|
+#define CK_IBM_DILITHIUM_KEYFORM_ROUND3_44 3
|
|
+#define CK_IBM_DILITHIUM_KEYFORM_ROUND3_65 4
|
|
+#define CK_IBM_DILITHIUM_KEYFORM_ROUND3_87 5
|
|
+
|
|
+#define IBM_DILITHIUM_KEYFORM_ROUND2 CK_IBM_DILITHIUM_KEYFORM_ROUND2_65
|
|
+
|
|
+#define CKA_IBM_DILITHIUM_MODE (CKA_VENDOR_DEFINED + 0x00010)
|
|
|
|
#define CKA_IBM_DILITHIUM_KEYFORM (CKA_VENDOR_DEFINED + 0xd0001)
|
|
#define CKA_IBM_DILITHIUM_RHO (CKA_VENDOR_DEFINED + 0xd0002)
|
|
diff --git a/usr/lib/common/p11util.c b/usr/lib/common/p11util.c
|
|
index 4ef33306..f3a031e3 100644
|
|
--- a/usr/lib/common/p11util.c
|
|
+++ b/usr/lib/common/p11util.c
|
|
@@ -123,6 +123,10 @@ const char *p11_get_ckr(CK_RV rc)
|
|
}
|
|
}
|
|
|
|
+#ifndef CKA_IBM_PQC_PARAMS
|
|
+#define CKA_IBM_PQC_PARAMS (CKA_VENDOR_DEFINED +0x1000e)
|
|
+#endif
|
|
+
|
|
//
|
|
// p11_get_cka - return textual interpretation of an attribute type
|
|
// only simple types - no arrays. For unknown a ptr to a static
|
|
@@ -221,6 +225,7 @@ const char *p11_get_cka(CK_ATTRIBUTE_TYPE atype)
|
|
_sym2str(CKA_IBM_PROTKEY_NEVER_EXTRACTABLE);
|
|
_sym2str(CKA_IBM_OPAQUE_PKEY);
|
|
_sym2str(CKA_IBM_DILITHIUM_KEYFORM);
|
|
+ _sym2str(CKA_IBM_DILITHIUM_MODE);
|
|
_sym2str(CKA_IBM_DILITHIUM_RHO);
|
|
_sym2str(CKA_IBM_DILITHIUM_SEED);
|
|
_sym2str(CKA_IBM_DILITHIUM_TR);
|
|
@@ -228,6 +233,7 @@ const char *p11_get_cka(CK_ATTRIBUTE_TYPE atype)
|
|
_sym2str(CKA_IBM_DILITHIUM_S2);
|
|
_sym2str(CKA_IBM_DILITHIUM_T0);
|
|
_sym2str(CKA_IBM_DILITHIUM_T1);
|
|
+ _sym2str(CKA_IBM_PQC_PARAMS);
|
|
default:
|
|
sprintf(buf, "unknown attribute type 0x%08lx", atype);
|
|
return buf;
|
|
--
|
|
2.16.2.windows.1
|
|
|