|
|
cae166 |
# HG changeset patch
|
|
|
cae166 |
# User Tomas Mraz <tmraz@fedoraproject.org>
|
|
|
cae166 |
# Date 1560861770 -7200
|
|
|
cae166 |
# Tue Jun 18 14:42:50 2019 +0200
|
|
|
cae166 |
# Node ID 6ef49fe67d6227a1d290da5537ec0dade379a15a
|
|
|
cae166 |
# Parent ebc93d6daeaa9001d31fd18b5199779da99ae9aa
|
|
|
cae166 |
Bug 1559906, fipstest: use CKM_TLS12_MASTER_KEY_DERIVE in TLS test, r=rrelyea
|
|
|
cae166 |
|
|
|
cae166 |
This also lets us CAVS tests more than just SHA256.
|
|
|
cae166 |
|
|
|
cae166 |
diff --git a/cmd/fipstest/fipstest.c b/cmd/fipstest/fipstest.c
|
|
|
cae166 |
--- a/cmd/fipstest/fipstest.c
|
|
|
cae166 |
+++ b/cmd/fipstest/fipstest.c
|
|
|
cae166 |
@@ -6669,12 +6669,13 @@ tls(char *reqfn)
|
|
|
cae166 |
|
|
|
cae166 |
CK_MECHANISM master_mech = { CKM_TLS_MASTER_KEY_DERIVE, NULL, 0 };
|
|
|
cae166 |
CK_MECHANISM key_block_mech = { CKM_TLS_KEY_AND_MAC_DERIVE, NULL, 0 };
|
|
|
cae166 |
- CK_SSL3_MASTER_KEY_DERIVE_PARAMS master_params;
|
|
|
cae166 |
- CK_SSL3_KEY_MAT_PARAMS key_block_params;
|
|
|
cae166 |
+ CK_TLS12_MASTER_KEY_DERIVE_PARAMS master_params;
|
|
|
cae166 |
+ CK_TLS12_KEY_MAT_PARAMS key_block_params;
|
|
|
cae166 |
CK_SSL3_KEY_MAT_OUT key_material;
|
|
|
cae166 |
CK_RV crv;
|
|
|
cae166 |
|
|
|
cae166 |
/* set up PKCS #11 parameters */
|
|
|
cae166 |
+ master_params.prfHashMechanism = CKM_SHA256;
|
|
|
cae166 |
master_params.pVersion = NULL;
|
|
|
cae166 |
master_params.RandomInfo.pClientRandom = clientHello_random;
|
|
|
cae166 |
master_params.RandomInfo.ulClientRandomLen = sizeof(clientHello_random);
|
|
|
cae166 |
@@ -6682,6 +6683,7 @@ tls(char *reqfn)
|
|
|
cae166 |
master_params.RandomInfo.ulServerRandomLen = sizeof(serverHello_random);
|
|
|
cae166 |
master_mech.pParameter = (void *)&master_params;
|
|
|
cae166 |
master_mech.ulParameterLen = sizeof(master_params);
|
|
|
cae166 |
+ key_block_params.prfHashMechanism = CKM_SHA256;
|
|
|
cae166 |
key_block_params.ulMacSizeInBits = 0;
|
|
|
cae166 |
key_block_params.ulKeySizeInBits = 0;
|
|
|
cae166 |
key_block_params.ulIVSizeInBits = 0;
|
|
|
cae166 |
@@ -6724,13 +6726,39 @@ tls(char *reqfn)
|
|
|
cae166 |
if (buf[0] == '[') {
|
|
|
cae166 |
if (strncmp(buf, "[TLS", 4) == 0) {
|
|
|
cae166 |
if (buf[7] == '0') {
|
|
|
cae166 |
+ /* CK_SSL3_MASTER_KEY_DERIVE_PARAMS is a subset of
|
|
|
cae166 |
+ * CK_TLS12_MASTER_KEY_DERIVE_PARAMS and
|
|
|
cae166 |
+ * CK_SSL3_KEY_MAT_PARAMS is a subset of
|
|
|
cae166 |
+ * CK_TLS12_KEY_MAT_PARAMS. The latter params have
|
|
|
cae166 |
+ * an extra prfHashMechanism field at the end. */
|
|
|
cae166 |
master_mech.mechanism = CKM_TLS_MASTER_KEY_DERIVE;
|
|
|
cae166 |
key_block_mech.mechanism = CKM_TLS_KEY_AND_MAC_DERIVE;
|
|
|
cae166 |
+ master_mech.ulParameterLen = sizeof(CK_SSL3_MASTER_KEY_DERIVE_PARAMS);
|
|
|
cae166 |
+ key_block_mech.ulParameterLen = sizeof(CK_SSL3_KEY_MAT_PARAMS);
|
|
|
cae166 |
} else if (buf[7] == '2') {
|
|
|
cae166 |
- master_mech.mechanism =
|
|
|
cae166 |
- CKM_NSS_TLS_MASTER_KEY_DERIVE_SHA256;
|
|
|
cae166 |
- key_block_mech.mechanism =
|
|
|
cae166 |
- CKM_NSS_TLS_KEY_AND_MAC_DERIVE_SHA256;
|
|
|
cae166 |
+ if (strncmp(&buf[10], "SHA-1", 5) == 0) {
|
|
|
cae166 |
+ master_params.prfHashMechanism = CKM_SHA_1;
|
|
|
cae166 |
+ key_block_params.prfHashMechanism = CKM_SHA_1;
|
|
|
cae166 |
+ } else if (strncmp(&buf[10], "SHA-224", 7) == 0) {
|
|
|
cae166 |
+ master_params.prfHashMechanism = CKM_SHA224;
|
|
|
cae166 |
+ key_block_params.prfHashMechanism = CKM_SHA224;
|
|
|
cae166 |
+ } else if (strncmp(&buf[10], "SHA-256", 7) == 0) {
|
|
|
cae166 |
+ master_params.prfHashMechanism = CKM_SHA256;
|
|
|
cae166 |
+ key_block_params.prfHashMechanism = CKM_SHA256;
|
|
|
cae166 |
+ } else if (strncmp(&buf[10], "SHA-384", 7) == 0) {
|
|
|
cae166 |
+ master_params.prfHashMechanism = CKM_SHA384;
|
|
|
cae166 |
+ key_block_params.prfHashMechanism = CKM_SHA384;
|
|
|
cae166 |
+ } else if (strncmp(&buf[10], "SHA-512", 7) == 0) {
|
|
|
cae166 |
+ master_params.prfHashMechanism = CKM_SHA512;
|
|
|
cae166 |
+ key_block_params.prfHashMechanism = CKM_SHA512;
|
|
|
cae166 |
+ } else {
|
|
|
cae166 |
+ fprintf(tlsresp, "ERROR: Unable to find prf Hash type");
|
|
|
cae166 |
+ goto loser;
|
|
|
cae166 |
+ }
|
|
|
cae166 |
+ master_mech.mechanism = CKM_TLS12_MASTER_KEY_DERIVE;
|
|
|
cae166 |
+ key_block_mech.mechanism = CKM_TLS12_KEY_AND_MAC_DERIVE;
|
|
|
cae166 |
+ master_mech.ulParameterLen = sizeof(master_params);
|
|
|
cae166 |
+ key_block_mech.ulParameterLen = sizeof(key_block_params);
|
|
|
cae166 |
} else {
|
|
|
cae166 |
fprintf(stderr, "Unknown TLS type %x\n",
|
|
|
cae166 |
(unsigned int)buf[0]);
|