diff options
author | Nils Larsch <nils@openssl.org> | 2005-05-16 10:11:04 +0000 |
---|---|---|
committer | Nils Larsch <nils@openssl.org> | 2005-05-16 10:11:04 +0000 |
commit | 9dd84053419aa220b5e66a5f9fcf809dbd6d9369 (patch) | |
tree | 7818c598a88a5b457333fd9f5951836fe96834b6 /crypto/ecdsa/ecdsatest.c | |
parent | 46a643763de6d8e39ecf6f76fa79b4d04885aa59 (diff) |
ecc api cleanup; summary:
- hide the EC_KEY structure definition in ec_lcl.c + add
some functions to use/access the EC_KEY fields
- change the way how method specific data (ecdsa/ecdh) is
attached to a EC_KEY
- add ECDSA_sign_ex and ECDSA_do_sign_ex functions with
additional parameters for pre-computed values
- rebuild libeay.num from 0.9.7
Diffstat (limited to 'crypto/ecdsa/ecdsatest.c')
-rw-r--r-- | crypto/ecdsa/ecdsatest.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/crypto/ecdsa/ecdsatest.c b/crypto/ecdsa/ecdsatest.c index 5315d90dd2..70f2cc4e8e 100644 --- a/crypto/ecdsa/ecdsatest.c +++ b/crypto/ecdsa/ecdsatest.c @@ -3,7 +3,7 @@ * Written by Nils Larsch for the OpenSSL project. */ /* ==================================================================== - * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved. + * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -201,9 +201,7 @@ int x9_62_test_internal(BIO *out, int nid, const char *r_in, const char *s_in) BIO_printf(out, "testing %s: ", OBJ_nid2sn(nid)); /* create the key */ - if ((key = EC_KEY_new()) == NULL) - goto x962_int_err; - if ((key->group = EC_GROUP_new_by_curve_name(nid)) == NULL) + if ((key = EC_KEY_new_by_curve_name(nid)) == NULL) goto x962_int_err; if (!EC_KEY_generate_key(key)) goto x962_int_err; @@ -291,6 +289,7 @@ int test_builtin(BIO *out) EC_builtin_curve *curves = NULL; size_t crv_len = 0, n = 0; EC_KEY *eckey = NULL, *wrong_eckey = NULL; + EC_GROUP *group; unsigned char digest[20], wrong_digest[20]; unsigned char *signature = NULL; unsigned int sig_len; @@ -337,9 +336,13 @@ int test_builtin(BIO *out) /* create new ecdsa key (== EC_KEY) */ if ((eckey = EC_KEY_new()) == NULL) goto builtin_err; - if ((eckey->group = EC_GROUP_new_by_curve_name(nid)) == NULL) + group = EC_GROUP_new_by_curve_name(nid); + if (group == NULL) + goto builtin_err; + if (EC_KEY_set_group(eckey, group) == 0) goto builtin_err; - if (EC_GROUP_get_degree(eckey->group) < 160) + EC_GROUP_free(group); + if (EC_GROUP_get_degree(EC_KEY_get0_group(eckey)) < 160) /* drop the curve */ { EC_KEY_free(eckey); @@ -356,8 +359,12 @@ int test_builtin(BIO *out) /* create second key */ if ((wrong_eckey = EC_KEY_new()) == NULL) goto builtin_err; - if ((wrong_eckey->group = EC_GROUP_new_by_curve_name(nid)) == NULL) + group = EC_GROUP_new_by_curve_name(nid); + if (group == NULL) + goto builtin_err; + if (EC_KEY_set_group(wrong_eckey, group) == 0) goto builtin_err; + EC_GROUP_free(group); if (!EC_KEY_generate_key(wrong_eckey)) { BIO_printf(out, " failed\n"); |