/* Originally written by Bodo Moeller for the OpenSSL project. * ==================================================================== * Copyright (c) 1998-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 * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * [email protected]. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * ([email protected]). This product includes software written by Tim * Hudson ([email protected]). * */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * * Portions of the attached software ("Contribution") are developed by * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. * * The Contribution is licensed pursuant to the OpenSSL open source * license provided above. * * The elliptic curve binary polynomial software is originally written by * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems * Laboratories. */ #include <openssl/ec_key.h> #include <string.h> #include <openssl/ec.h> #include <openssl/ecdsa.h> #include <openssl/engine.h> #include <openssl/err.h> #include <openssl/ex_data.h> #include <openssl/mem.h> #include <openssl/sha.h> #include <openssl/thread.h> #include "internal.h" #include "../delocate.h" #include "../ecdsa/internal.h" #include "../service_indicator/internal.h" #include "../../internal.h" DEFINE_STATIC_EX_DATA_CLASS(…) … static EC_WRAPPED_SCALAR *ec_wrapped_scalar_new(const EC_GROUP *group) { … } static void ec_wrapped_scalar_free(EC_WRAPPED_SCALAR *scalar) { … } EC_KEY *EC_KEY_new(void) { … } EC_KEY *EC_KEY_new_method(const ENGINE *engine) { … } EC_KEY *EC_KEY_new_by_curve_name(int nid) { … } void EC_KEY_free(EC_KEY *r) { … } EC_KEY *EC_KEY_dup(const EC_KEY *src) { … } int EC_KEY_up_ref(EC_KEY *r) { … } int EC_KEY_is_opaque(const EC_KEY *key) { … } const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key) { … } int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group) { … } const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key) { … } int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *priv_key) { … } const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key) { … } int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub_key) { … } unsigned int EC_KEY_get_enc_flags(const EC_KEY *key) { … } void EC_KEY_set_enc_flags(EC_KEY *key, unsigned int flags) { … } point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key) { … } void EC_KEY_set_conv_form(EC_KEY *key, point_conversion_form_t cform) { … } int EC_KEY_check_key(const EC_KEY *eckey) { … } int EC_KEY_check_fips(const EC_KEY *key) { … } int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, const BIGNUM *x, const BIGNUM *y) { … } int EC_KEY_oct2key(EC_KEY *key, const uint8_t *in, size_t len, BN_CTX *ctx) { … } size_t EC_KEY_key2buf(const EC_KEY *key, point_conversion_form_t form, uint8_t **out_buf, BN_CTX *ctx) { … } int EC_KEY_oct2priv(EC_KEY *key, const uint8_t *in, size_t len) { … } size_t EC_KEY_priv2oct(const EC_KEY *key, uint8_t *out, size_t max_out) { … } size_t EC_KEY_priv2buf(const EC_KEY *key, uint8_t **out_buf) { … } int EC_KEY_generate_key(EC_KEY *key) { … } int EC_KEY_generate_key_fips(EC_KEY *eckey) { … } int EC_KEY_get_ex_new_index(long argl, void *argp, CRYPTO_EX_unused *unused, CRYPTO_EX_dup *dup_unused, CRYPTO_EX_free *free_func) { … } int EC_KEY_set_ex_data(EC_KEY *d, int idx, void *arg) { … } void *EC_KEY_get_ex_data(const EC_KEY *d, int idx) { … } void EC_KEY_set_asn1_flag(EC_KEY *key, int flag) { … }