|
|
@ -115,7 +115,7 @@ index dfa7786bde..f01e40ff5a 100644
|
|
|
|
size_t info_len;
|
|
|
|
size_t info_len;
|
|
|
|
+ int is_tls13;
|
|
|
|
+ int is_tls13;
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+ int output_keylen_indicator;
|
|
|
|
+ int fips_indicator;
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
} KDF_HKDF;
|
|
|
|
} KDF_HKDF;
|
|
|
|
|
|
|
|
|
|
|
@ -126,7 +126,7 @@ index dfa7786bde..f01e40ff5a 100644
|
|
|
|
|
|
|
|
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+ if (keylen < EVP_KDF_FIPS_MIN_KEY_LEN)
|
|
|
|
+ if (keylen < EVP_KDF_FIPS_MIN_KEY_LEN)
|
|
|
|
+ ctx->output_keylen_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+ ctx->fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
switch (ctx->mode) {
|
|
|
|
switch (ctx->mode) {
|
|
|
@ -172,7 +172,7 @@ index dfa7786bde..f01e40ff5a 100644
|
|
|
|
+ * be longer than that. If a derived key has ever been shorter than
|
|
|
|
+ * be longer than that. If a derived key has ever been shorter than
|
|
|
|
+ * that, ctx->output_keyelen_indicator will be NOT_APPROVED, and we
|
|
|
|
+ * that, ctx->output_keyelen_indicator will be NOT_APPROVED, and we
|
|
|
|
+ * should also set the returned FIPS indicator to unapproved. */
|
|
|
|
+ * should also set the returned FIPS indicator to unapproved. */
|
|
|
|
+ if (ctx->output_keylen_indicator == EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED)
|
|
|
|
+ if (ctx->fips_indicator == EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED)
|
|
|
|
+ fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+ fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (ctx->is_tls13) {
|
|
|
|
+ if (ctx->is_tls13) {
|
|
|
@ -248,7 +248,7 @@ index dfa7786bde..f01e40ff5a 100644
|
|
|
|
|
|
|
|
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+ if (keylen < EVP_KDF_FIPS_MIN_KEY_LEN)
|
|
|
|
+ if (keylen < EVP_KDF_FIPS_MIN_KEY_LEN)
|
|
|
|
+ ctx->output_keylen_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+ ctx->fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
switch (ctx->mode) {
|
|
|
|
switch (ctx->mode) {
|
|
|
@ -282,7 +282,7 @@ index a542f84dfa..6b6dfb94ac 100644
|
|
|
|
int use_l;
|
|
|
|
int use_l;
|
|
|
|
int use_separator;
|
|
|
|
int use_separator;
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+ int output_keylen_indicator;
|
|
|
|
+ int fips_indicator;
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
} KBKDF;
|
|
|
|
} KBKDF;
|
|
|
|
|
|
|
|
|
|
|
@ -301,7 +301,7 @@ index a542f84dfa..6b6dfb94ac 100644
|
|
|
|
|
|
|
|
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+ if (keylen < EVP_KDF_FIPS_MIN_KEY_LEN)
|
|
|
|
+ if (keylen < EVP_KDF_FIPS_MIN_KEY_LEN)
|
|
|
|
+ ctx->output_keylen_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+ ctx->fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
h = EVP_MAC_CTX_get_mac_size(ctx->ctx_init);
|
|
|
|
h = EVP_MAC_CTX_get_mac_size(ctx->ctx_init);
|
|
|
@ -355,7 +355,7 @@ index a542f84dfa..6b6dfb94ac 100644
|
|
|
|
+ * be longer than that. If a derived key has ever been shorter than
|
|
|
|
+ * be longer than that. If a derived key has ever been shorter than
|
|
|
|
+ * that, ctx->output_keyelen_indicator will be NOT_APPROVED, and we
|
|
|
|
+ * that, ctx->output_keyelen_indicator will be NOT_APPROVED, and we
|
|
|
|
+ * should also set the returned FIPS indicator to unapproved. */
|
|
|
|
+ * should also set the returned FIPS indicator to unapproved. */
|
|
|
|
+ if (ctx->output_keylen_indicator == EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED)
|
|
|
|
+ if (ctx->fips_indicator == EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED)
|
|
|
|
+ fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+ fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /* Implementation Guidance for FIPS 140-3 and the Cryptographic Module
|
|
|
|
+ /* Implementation Guidance for FIPS 140-3 and the Cryptographic Module
|
|
|
@ -409,7 +409,7 @@ index c592ba72f1..4a52b38266 100644
|
|
|
|
unsigned char *session_id;
|
|
|
|
unsigned char *session_id;
|
|
|
|
size_t session_id_len;
|
|
|
|
size_t session_id_len;
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+ int output_keylen_indicator;
|
|
|
|
+ int fips_indicator;
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
} KDF_SSHKDF;
|
|
|
|
} KDF_SSHKDF;
|
|
|
|
|
|
|
|
|
|
|
@ -421,7 +421,7 @@ index c592ba72f1..4a52b38266 100644
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+ if (keylen < EVP_KDF_FIPS_MIN_KEY_LEN)
|
|
|
|
+ if (keylen < EVP_KDF_FIPS_MIN_KEY_LEN)
|
|
|
|
+ ctx->output_keylen_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+ ctx->fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
return SSHKDF(md, ctx->key, ctx->key_len,
|
|
|
|
return SSHKDF(md, ctx->key, ctx->key_len,
|
|
|
@ -465,7 +465,7 @@ index c592ba72f1..4a52b38266 100644
|
|
|
|
+ * be longer than that. If a derived key has ever been shorter than
|
|
|
|
+ * be longer than that. If a derived key has ever been shorter than
|
|
|
|
+ * that, ctx->output_keyelen_indicator will be NOT_APPROVED, and we
|
|
|
|
+ * that, ctx->output_keyelen_indicator will be NOT_APPROVED, and we
|
|
|
|
+ * should also set the returned FIPS indicator to unapproved. */
|
|
|
|
+ * should also set the returned FIPS indicator to unapproved. */
|
|
|
|
+ if (ctx->output_keylen_indicator == EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED)
|
|
|
|
+ if (ctx->fips_indicator == EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED)
|
|
|
|
+ fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+ fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /* Implementation Guidance for FIPS 140-3 and the Cryptographic Module
|
|
|
|
+ /* Implementation Guidance for FIPS 140-3 and the Cryptographic Module
|
|
|
@ -518,7 +518,7 @@ index eb54972e1c..23865cd70f 100644
|
|
|
|
size_t out_len; /* optional KMAC parameter */
|
|
|
|
size_t out_len; /* optional KMAC parameter */
|
|
|
|
+ int is_x963kdf;
|
|
|
|
+ int is_x963kdf;
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+ int output_keylen_indicator;
|
|
|
|
+ int fips_indicator;
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
} KDF_SSKDF;
|
|
|
|
} KDF_SSKDF;
|
|
|
|
|
|
|
|
|
|
|
@ -554,7 +554,7 @@ index eb54972e1c..23865cd70f 100644
|
|
|
|
|
|
|
|
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+ if (keylen < EVP_KDF_FIPS_MIN_KEY_LEN)
|
|
|
|
+ if (keylen < EVP_KDF_FIPS_MIN_KEY_LEN)
|
|
|
|
+ ctx->output_keylen_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+ ctx->fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
if (ctx->macctx != NULL) {
|
|
|
|
if (ctx->macctx != NULL) {
|
|
|
@ -566,7 +566,7 @@ index eb54972e1c..23865cd70f 100644
|
|
|
|
|
|
|
|
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+ if (keylen < EVP_KDF_FIPS_MIN_KEY_LEN)
|
|
|
|
+ if (keylen < EVP_KDF_FIPS_MIN_KEY_LEN)
|
|
|
|
+ ctx->output_keylen_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+ ctx->fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
return SSKDF_hash_kdm(md, ctx->secret, ctx->secret_len,
|
|
|
|
return SSKDF_hash_kdm(md, ctx->secret, ctx->secret_len,
|
|
|
@ -609,7 +609,7 @@ index eb54972e1c..23865cd70f 100644
|
|
|
|
+ * be longer than that. If a derived key has ever been shorter than
|
|
|
|
+ * be longer than that. If a derived key has ever been shorter than
|
|
|
|
+ * that, ctx->output_keyelen_indicator will be NOT_APPROVED, and we
|
|
|
|
+ * that, ctx->output_keyelen_indicator will be NOT_APPROVED, and we
|
|
|
|
+ * should also set the returned FIPS indicator to unapproved. */
|
|
|
|
+ * should also set the returned FIPS indicator to unapproved. */
|
|
|
|
+ if (ctx->output_keylen_indicator == EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED)
|
|
|
|
+ if (ctx->fips_indicator == EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED)
|
|
|
|
+ fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+ fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /* Implementation Guidance for FIPS 140-3 and the Cryptographic Module
|
|
|
|
+ /* Implementation Guidance for FIPS 140-3 and the Cryptographic Module
|
|
|
@ -682,7 +682,7 @@ index a4d64b9352..f6782a6ca2 100644
|
|
|
|
+ PROV_DIGEST digest;
|
|
|
|
+ PROV_DIGEST digest;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+ int output_keylen_indicator;
|
|
|
|
+ int fips_indicator;
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
} TLS1_PRF;
|
|
|
|
} TLS1_PRF;
|
|
|
|
|
|
|
|
|
|
|
@ -701,7 +701,7 @@ index a4d64b9352..f6782a6ca2 100644
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+ if (keylen < EVP_KDF_FIPS_MIN_KEY_LEN)
|
|
|
|
+ if (keylen < EVP_KDF_FIPS_MIN_KEY_LEN)
|
|
|
|
+ ctx->output_keylen_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+ ctx->fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
|
|
|
|
|
|
|
|
return tls1_prf_alg(ctx->P_hash, ctx->P_sha1,
|
|
|
|
return tls1_prf_alg(ctx->P_hash, ctx->P_sha1,
|
|
|
@ -753,7 +753,7 @@ index a4d64b9352..f6782a6ca2 100644
|
|
|
|
+ * be longer than that. If a derived key has ever been shorter than
|
|
|
|
+ * be longer than that. If a derived key has ever been shorter than
|
|
|
|
+ * that, ctx->output_keyelen_indicator will be NOT_APPROVED, and we
|
|
|
|
+ * that, ctx->output_keyelen_indicator will be NOT_APPROVED, and we
|
|
|
|
+ * should also set the returned FIPS indicator to unapproved. */
|
|
|
|
+ * should also set the returned FIPS indicator to unapproved. */
|
|
|
|
+ if (ctx->output_keylen_indicator == EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED)
|
|
|
|
+ if (ctx->fips_indicator == EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED)
|
|
|
|
+ fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+ fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /* SP 800-135r1 section 4.2.2 says TLS 1.2 KDF is approved when "(3)
|
|
|
|
+ /* SP 800-135r1 section 4.2.2 says TLS 1.2 KDF is approved when "(3)
|
|
|
@ -813,7 +813,7 @@ index b1bc6f7e1b..8173fc2cc7 100644
|
|
|
|
size_t cek_oid_len;
|
|
|
|
size_t cek_oid_len;
|
|
|
|
int use_keybits;
|
|
|
|
int use_keybits;
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+ int output_keylen_indicator;
|
|
|
|
+ int fips_indicator;
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
} KDF_X942;
|
|
|
|
} KDF_X942;
|
|
|
|
|
|
|
|
|
|
|
@ -824,7 +824,7 @@ index b1bc6f7e1b..8173fc2cc7 100644
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+#ifdef FIPS_MODULE
|
|
|
|
+ if (keylen < EVP_KDF_FIPS_MIN_KEY_LEN)
|
|
|
|
+ if (keylen < EVP_KDF_FIPS_MIN_KEY_LEN)
|
|
|
|
+ ctx->output_keylen_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+ ctx->fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
+#endif /* defined(FIPS_MODULE) */
|
|
|
|
ret = x942kdf_hash_kdm(md, ctx->secret, ctx->secret_len,
|
|
|
|
ret = x942kdf_hash_kdm(md, ctx->secret, ctx->secret_len,
|
|
|
|
der, der_len, ctr, key, keylen);
|
|
|
|
der, der_len, ctr, key, keylen);
|
|
|
@ -866,7 +866,7 @@ index b1bc6f7e1b..8173fc2cc7 100644
|
|
|
|
+ * be longer than that. If a derived key has ever been shorter than
|
|
|
|
+ * be longer than that. If a derived key has ever been shorter than
|
|
|
|
+ * that, ctx->output_keyelen_indicator will be NOT_APPROVED, and we
|
|
|
|
+ * that, ctx->output_keyelen_indicator will be NOT_APPROVED, and we
|
|
|
|
+ * should also set the returned FIPS indicator to unapproved. */
|
|
|
|
+ * should also set the returned FIPS indicator to unapproved. */
|
|
|
|
+ if (ctx->output_keylen_indicator == EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED)
|
|
|
|
+ if (ctx->fips_indicator == EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED)
|
|
|
|
+ fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+ fips_indicator = EVP_KDF_REDHAT_FIPS_INDICATOR_NOT_APPROVED;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /* Implementation Guidance for FIPS 140-3 and the Cryptographic Module
|
|
|
|
+ /* Implementation Guidance for FIPS 140-3 and the Cryptographic Module
|
|
|
|