diff options
author | Bodo Möller <bodo@openssl.org> | 2002-08-09 08:43:04 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2002-08-09 08:43:04 +0000 |
commit | e172d60ddbba3dd37748c8c468064c99213b9e60 (patch) | |
tree | 1ededc75b7669b610533758ac42f0ad91f59330b /crypto/ec/ec_key.c | |
parent | f8fe7fa4913d34f33fac12181a0fc722ef367238 (diff) | |
download | openssl-e172d60ddbba3dd37748c8c468064c99213b9e60.tar.gz |
Add ECDH support.
Additional changes:
- use EC_GROUP_get_degree() in apps/req.c
- add ECDSA and ECDH to apps/speed.c
- adds support for EC curves over binary fields to ECDSA
- new function EC_KEY_up_ref() in crypto/ec/ec_key.c
- reorganize crypto/ecdsa/ecdsatest.c
- add engine support for ECDH
- fix a few bugs in ECDSA engine support
Submitted by: Douglas Stebila <douglas.stebila@sun.com>
Diffstat (limited to 'crypto/ec/ec_key.c')
-rw-r--r-- | crypto/ec/ec_key.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/crypto/ec/ec_key.c b/crypto/ec/ec_key.c index 790d930225..f9f98cfd9d 100644 --- a/crypto/ec/ec_key.c +++ b/crypto/ec/ec_key.c @@ -55,9 +55,15 @@ * Hudson (tjh@cryptsoft.com). * */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * Portions originally developed by SUN MICROSYSTEMS, INC., and + * contributed to the OpenSSL project. + */ #include "ec_lcl.h" #include <openssl/err.h> +#include <string.h> EC_KEY *EC_KEY_new(void) { @@ -210,6 +216,22 @@ EC_KEY *EC_KEY_dup(const EC_KEY *eckey) return ret; } +int EC_KEY_up_ref(EC_KEY *r) + { + int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_EC); +#ifdef REF_PRINT + REF_PRINT("EC_KEY",r); +#endif +#ifdef REF_CHECK + if (i < 2) + { + fprintf(stderr, "EC_KEY_up, bad reference count\n"); + abort(); + } +#endif + return ((i > 1) ? 1 : 0); + } + int EC_KEY_generate_key(EC_KEY *eckey) { int ok = 0; |