Compare commits

...

6 Commits

Author SHA1 Message Date
Dr. Stephen Henson
0e508c12e0 prepare for rc4 2011-11-19 17:04:28 +00:00
Dr. Stephen Henson
f6385248f6 Add flag to support cofactor ECDH 2011-11-19 17:03:44 +00:00
Dr. Stephen Henson
52876c3100 bump version to rc4-dev 2011-11-18 21:59:36 +00:00
Dr. Stephen Henson
c08128acc2 prepare for RC3 2011-11-18 18:50:57 +00:00
Dr. Stephen Henson
901b9b5c36 In EC_KEY_set_public_key_affine_coordinates include explicit check to see passed components do not exceed field order 2011-11-16 13:28:11 +00:00
Dr. Stephen Henson
9eca2399f1 portability fix for some perl versions 2011-11-11 19:01:11 +00:00
8 changed files with 40 additions and 18 deletions

View File

@@ -4,6 +4,9 @@
Changes between 1.0.1 and 1.1.0 [xx XXX xxxx]
*) Add flag to EC_KEY to use cofactor ECDH if set.
[Steve Henson]
*) Update fips_test_suite to support multiple command line options. New
test to induce all self test errors in sequence and check expected
failures.

View File

@@ -511,10 +511,12 @@ int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, BIGNUM *y)
tx, ty, ctx))
goto err;
}
/* Check if retrieved coordinates match originals: if not values
* are out of range.
/* Check if retrieved coordinates match originals and are less than
* field order: if not values are out of range.
*/
if (BN_cmp(x, tx) || BN_cmp(y, ty))
if (BN_cmp(x, tx) || BN_cmp(y, ty)
|| (BN_cmp(x, &key->group->field) >= 0)
|| (BN_cmp(y, &key->group->field) >= 0))
{
ECerr(EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES,
EC_R_COORDINATES_OUT_OF_RANGE);

View File

@@ -85,6 +85,8 @@
extern "C" {
#endif
#define EC_FLAG_COFACTOR_ECDH 0x1000
const ECDH_METHOD *ECDH_OpenSSL(void);
void ECDH_set_default_method(const ECDH_METHOD *);

View File

@@ -146,6 +146,18 @@ static int ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
}
group = EC_KEY_get0_group(ecdh);
if (EC_KEY_get_flags(ecdh) & EC_FLAG_COFACTOR_ECDH)
{
if (!EC_GROUP_get_cofactor(group, x, ctx) ||
!BN_mul(x, x, priv_key, ctx))
{
ECDHerr(ECDH_F_ECDH_COMPUTE_KEY, ERR_R_MALLOC_FAILURE);
goto err;
}
priv_key = x;
}
if ((tmp=EC_POINT_new(group)) == NULL)
{
ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_MALLOC_FAILURE);

View File

@@ -166,6 +166,7 @@ int FIPS_selftest_ecdh(void)
rv = -1;
goto err;
}
EC_KEY_set_flags(ec1, EC_FLAG_COFACTOR_ECDH);
if (!EC_KEY_set_public_key_affine_coordinates(ec1, x, y))
{
@@ -194,6 +195,7 @@ int FIPS_selftest_ecdh(void)
rv = -1;
goto err;
}
EC_KEY_set_flags(ec1, EC_FLAG_COFACTOR_ECDH);
if (!EC_KEY_set_public_key_affine_coordinates(ec2, x, y))
{

View File

@@ -261,6 +261,7 @@ static void ec_output_Zhash(FILE *out, int exout, EC_GROUP *group,
unsigned char chash[EVP_MAX_MD_SIZE];
int Zlen;
ec = EC_KEY_new();
EC_KEY_set_flags(ec, EC_FLAG_COFACTOR_ECDH);
EC_KEY_set_group(ec, group);
peerkey = make_peer(group, cx, cy);
if (rhash == NULL)

View File

@@ -67,8 +67,8 @@ int fips_post_failed(int id, int subid, void *ex);
int fips_post_corrupt(int id, int subid, void *ex);
int fips_post_status(void);
#define FIPS_MODULE_VERSION_NUMBER 0x20000003L
#define FIPS_MODULE_VERSION_TEXT "FIPS 2.0-rc3-dev unvalidated test module xx XXX xxxx"
#define FIPS_MODULE_VERSION_NUMBER 0x20000004L
#define FIPS_MODULE_VERSION_TEXT "FIPS 2.0-rc4 unvalidated test module xx XXX xxxx"
#ifdef __cplusplus
}

View File

@@ -513,29 +513,29 @@ my $mkcmd = "mkdir";
my $cmpall = 0;
my %fips_enabled = (
dsa => 1,
dsa2 => 2,
"dsa" => 1,
"dsa2" => 2,
"dsa-pqgver" => 2,
ecdsa => 2,
rsa => 1,
"ecdsa" => 2,
"rsa" => 1,
"rsa-pss0" => 2,
"rsa-pss62" => 1,
sha => 1,
hmac => 1,
cmac => 2,
"sha" => 1,
"hmac" => 1,
"cmac" => 2,
"rand-aes" => 1,
"rand-des2" => 0,
aes => 1,
"aes" => 1,
"aes-cfb1" => 2,
des3 => 1,
"des3" => 1,
"des3-cfb1" => 2,
drbg => 2,
"drbg" => 2,
"aes-ccm" => 2,
"aes-xts" => 2,
"aes-gcm" => 2,
dh => 0,
ecdh => 2,
v2 => 1,
"dh" => 0,
"ecdh" => 2,
"v2" => 1,
);
foreach (@ARGV) {