Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions scripts/utils-wolfssl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,10 @@ install_wolfssl() {
exit 1
fi
fi
# Change to test directory for FIPS builds
if [ -n "$WOLFSSL_FIPS_BUNDLE" ] || [ "$WOLFSSL_ISFIPS" = "1" ]; then
# Change to test directory for FIPS builds (only when cloning, not for bundles)
# XXX-fips-test is created by fips-check.sh when cloning from GitHub.
# Pre-packaged FIPS bundles don't have this directory - they ARE the source tree.
if [ -z "$WOLFSSL_FIPS_BUNDLE" ] && [ "$WOLFSSL_ISFIPS" = "1" ]; then
cd XXX-fips-test
fi
fi
Expand Down
8 changes: 7 additions & 1 deletion src/wp_dh_kmgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
/** Maximum size of the group name string. */
#define WP_MAX_DH_GROUP_NAME_SZ 10

/* Min accepted bitlen for keygen */
#ifdef HAVE_FIPS
#define WP_DH_MIN_BITS 2048
#else
#define WP_DH_MIN_BITS 1024
#endif

/**
* DH key.
Expand Down Expand Up @@ -1776,7 +1782,7 @@ static int wp_dh_params_validate(wp_Dh* dh)
if (ok) {
/* Ensure p is a minimum size. */
sz = mp_count_bits(&dh->key.p);
if (sz < 1024) {
if (sz < WP_DH_MIN_BITS) {
ok = 0;
}

Expand Down
56 changes: 38 additions & 18 deletions test/test_dh.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,26 +75,46 @@ static const unsigned char dh_der[] = {
0xDF, 0x31,
};

/* dh1024 p */
static const unsigned char dh_p[] =
{
0xE6, 0x96, 0x9D, 0x3D, 0x49, 0x5B, 0xE3, 0x2C, 0x7C, 0xF1, 0x80, 0xC3,
0xBD, 0xD4, 0x79, 0x8E, 0x91, 0xB7, 0x81, 0x82, 0x51, 0xBB, 0x05, 0x5E,
0x2A, 0x20, 0x64, 0x90, 0x4A, 0x79, 0xA7, 0x70, 0xFA, 0x15, 0xA2, 0x59,
0xCB, 0xD5, 0x23, 0xA6, 0xA6, 0xEF, 0x09, 0xC4, 0x30, 0x48, 0xD5, 0xA2,
0x2F, 0x97, 0x1F, 0x3C, 0x20, 0x12, 0x9B, 0x48, 0x00, 0x0E, 0x6E, 0xDD,
0x06, 0x1C, 0xBC, 0x05, 0x3E, 0x37, 0x1D, 0x79, 0x4E, 0x53, 0x27, 0xDF,
0x61, 0x1E, 0xBB, 0xBE, 0x1B, 0xAC, 0x9B, 0x5C, 0x60, 0x44, 0xCF, 0x02,
0x3D, 0x76, 0xE0, 0x5E, 0xEA, 0x9B, 0xAD, 0x99, 0x1B, 0x13, 0xA6, 0x3C,
0x97, 0x4E, 0x9E, 0xF1, 0x83, 0x9E, 0xB5, 0xDB, 0x12, 0x51, 0x36, 0xF7,
0x26, 0x2E, 0x56, 0xA8, 0x87, 0x15, 0x38, 0xDF, 0xD8, 0x23, 0xC6, 0x50,
0x50, 0x85, 0xE2, 0x1F, 0x0D, 0xD5, 0xC8, 0x6B,

/* Random 2048-bit DH prime (not a named group) */
static const unsigned char dh_p[] = {
0xc4, 0xa9, 0x96, 0x01, 0x1d, 0xe9, 0x31, 0xd3,
0x76, 0xdc, 0xae, 0xda, 0x11, 0x68, 0xee, 0xae,
0x5f, 0x3e, 0x8f, 0x78, 0x36, 0x13, 0xfc, 0x91,
0xba, 0x74, 0x7f, 0xdb, 0xd7, 0x04, 0x13, 0x50,
0xee, 0xba, 0xa8, 0xa3, 0xca, 0xe5, 0x26, 0xa4,
0x78, 0x60, 0xb9, 0xa3, 0xc0, 0xad, 0x14, 0x30,
0xd9, 0xe5, 0x6a, 0xa3, 0xe2, 0xf2, 0xe5, 0xc8,
0x08, 0xcd, 0x7b, 0x93, 0x8d, 0xbe, 0xe0, 0x6c,
0x0f, 0x34, 0x90, 0xd8, 0x30, 0x06, 0x22, 0xad,
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x67
};

/* dh1024 g */
static const unsigned char dh_g[] =
{
0x02,
/* dh2048 g */
static const unsigned char dh_g[] = {
0x02
};

/* Fixed param from krb5 DH generation, named "o2048" */
Expand Down
Loading