* 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 <string.h>
#include "ec_lcl.h"
#include <openssl/err.h>
+#include <string.h>
EC_KEY *EC_KEY_new(void)
{
if (r->meth_data && r->meth_data->finish)
r->meth_data->finish(r);
- memset((void *)r, 0x0, sizeof(EC_KEY));
+ OPENSSL_cleanse((void *)r, sizeof(EC_KEY));
OPENSSL_free(r);
}
/* copy the private key */
if (eckey->priv_key)
{
- ret->priv_key = BN_dup(ret->priv_key);
+ ret->priv_key = BN_dup(eckey->priv_key);
if (ret->priv_key == NULL)
ok = 0;
}
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;