Changeset 94082 in vbox for trunk/src/libs/openssl-3.0.1/crypto/ec/ecp_nist.c
- Timestamp:
- Mar 3, 2022 7:17:34 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 150325
- Location:
- trunk/src/libs/openssl-3.0.1
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/openssl-3.0.1
- Property svn:mergeinfo
-
old new 12 12 /vendor/openssl/1.1.1c:131722-131725 13 13 /vendor/openssl/1.1.1k:145841-145843 14 /vendor/openssl/3.0.1:150323-150324 15 /vendor/openssl/current:147554-150322
-
- Property svn:mergeinfo
-
trunk/src/libs/openssl-3.0.1/crypto/ec/ecp_nist.c
r91772 r94082 1 1 /* 2 * Copyright 2001-20 19The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved. 3 3 * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved 4 4 * 5 * Licensed under the OpenSSL license(the "License"). You may not use5 * Licensed under the Apache License 2.0 (the "License"). You may not use 6 6 * this file except in compliance with the License. You can obtain a copy 7 7 * in the file LICENSE in the source distribution or at 8 8 * https://www.openssl.org/source/license.html 9 9 */ 10 11 /* 12 * ECDSA low level APIs are deprecated for public use, but still ok for 13 * internal use. 14 */ 15 #include "internal/deprecated.h" 10 16 11 17 #include <limits.h> … … 20 26 EC_FLAGS_DEFAULT_OCT, 21 27 NID_X9_62_prime_field, 22 ec_GFp_simple_group_init, 23 ec_GFp_simple_group_finish, 24 ec_GFp_simple_group_clear_finish, 25 ec_GFp_nist_group_copy, 26 ec_GFp_nist_group_set_curve, 27 ec_GFp_simple_group_get_curve, 28 ec_GFp_simple_group_get_degree, 29 ec_group_simple_order_bits, 30 ec_GFp_simple_group_check_discriminant, 31 ec_GFp_simple_point_init, 32 ec_GFp_simple_point_finish, 33 ec_GFp_simple_point_clear_finish, 34 ec_GFp_simple_point_copy, 35 ec_GFp_simple_point_set_to_infinity, 36 ec_GFp_simple_set_Jprojective_coordinates_GFp, 37 ec_GFp_simple_get_Jprojective_coordinates_GFp, 38 ec_GFp_simple_point_set_affine_coordinates, 39 ec_GFp_simple_point_get_affine_coordinates, 28 ossl_ec_GFp_simple_group_init, 29 ossl_ec_GFp_simple_group_finish, 30 ossl_ec_GFp_simple_group_clear_finish, 31 ossl_ec_GFp_nist_group_copy, 32 ossl_ec_GFp_nist_group_set_curve, 33 ossl_ec_GFp_simple_group_get_curve, 34 ossl_ec_GFp_simple_group_get_degree, 35 ossl_ec_group_simple_order_bits, 36 ossl_ec_GFp_simple_group_check_discriminant, 37 ossl_ec_GFp_simple_point_init, 38 ossl_ec_GFp_simple_point_finish, 39 ossl_ec_GFp_simple_point_clear_finish, 40 ossl_ec_GFp_simple_point_copy, 41 ossl_ec_GFp_simple_point_set_to_infinity, 42 ossl_ec_GFp_simple_point_set_affine_coordinates, 43 ossl_ec_GFp_simple_point_get_affine_coordinates, 40 44 0, 0, 0, 41 ec_GFp_simple_add,42 ec_GFp_simple_dbl,43 ec_GFp_simple_invert,44 ec_GFp_simple_is_at_infinity,45 ec_GFp_simple_is_on_curve,46 ec_GFp_simple_cmp,47 ec_GFp_simple_make_affine,48 ec_GFp_simple_points_make_affine,45 ossl_ec_GFp_simple_add, 46 ossl_ec_GFp_simple_dbl, 47 ossl_ec_GFp_simple_invert, 48 ossl_ec_GFp_simple_is_at_infinity, 49 ossl_ec_GFp_simple_is_on_curve, 50 ossl_ec_GFp_simple_cmp, 51 ossl_ec_GFp_simple_make_affine, 52 ossl_ec_GFp_simple_points_make_affine, 49 53 0 /* mul */ , 50 54 0 /* precompute_mult */ , 51 55 0 /* have_precompute_mult */ , 52 ec_GFp_nist_field_mul,53 ec_GFp_nist_field_sqr,56 ossl_ec_GFp_nist_field_mul, 57 ossl_ec_GFp_nist_field_sqr, 54 58 0 /* field_div */ , 55 ec_GFp_simple_field_inv,59 ossl_ec_GFp_simple_field_inv, 56 60 0 /* field_encode */ , 57 61 0 /* field_decode */ , 58 62 0, /* field_set_to_one */ 59 ec_key_simple_priv2oct,60 ec_key_simple_oct2priv,63 ossl_ec_key_simple_priv2oct, 64 ossl_ec_key_simple_oct2priv, 61 65 0, /* set private */ 62 ec_key_simple_generate_key,63 ec_key_simple_check_key,64 ec_key_simple_generate_public_key,66 ossl_ec_key_simple_generate_key, 67 ossl_ec_key_simple_check_key, 68 ossl_ec_key_simple_generate_public_key, 65 69 0, /* keycopy */ 66 70 0, /* keyfinish */ 67 ecdh_simple_compute_key, 71 ossl_ecdh_simple_compute_key, 72 ossl_ecdsa_simple_sign_setup, 73 ossl_ecdsa_simple_sign_sig, 74 ossl_ecdsa_simple_verify_sig, 68 75 0, /* field_inverse_mod_ord */ 69 ec_GFp_simple_blind_coordinates,70 ec_GFp_simple_ladder_pre,71 ec_GFp_simple_ladder_step,72 ec_GFp_simple_ladder_post76 ossl_ec_GFp_simple_blind_coordinates, 77 ossl_ec_GFp_simple_ladder_pre, 78 ossl_ec_GFp_simple_ladder_step, 79 ossl_ec_GFp_simple_ladder_post 73 80 }; 74 81 … … 76 83 } 77 84 78 int ec_GFp_nist_group_copy(EC_GROUP *dest, const EC_GROUP *src)85 int ossl_ec_GFp_nist_group_copy(EC_GROUP *dest, const EC_GROUP *src) 79 86 { 80 87 dest->field_mod_func = src->field_mod_func; 81 88 82 return ec_GFp_simple_group_copy(dest, src);89 return ossl_ec_GFp_simple_group_copy(dest, src); 83 90 } 84 91 85 int ec_GFp_nist_group_set_curve(EC_GROUP *group, const BIGNUM *p, 86 const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 92 int ossl_ec_GFp_nist_group_set_curve(EC_GROUP *group, const BIGNUM *p, 93 const BIGNUM *a, const BIGNUM *b, 94 BN_CTX *ctx) 87 95 { 88 96 int ret = 0; … … 90 98 91 99 if (ctx == NULL) 92 if ((ctx = new_ctx = BN_CTX_new ()) == NULL)100 if ((ctx = new_ctx = BN_CTX_new_ex(group->libctx)) == NULL) 93 101 return 0; 94 102 … … 106 114 group->field_mod_func = BN_nist_mod_521; 107 115 else { 108 E Cerr(EC_F_EC_GFP_NIST_GROUP_SET_CURVE, EC_R_NOT_A_NIST_PRIME);116 ERR_raise(ERR_LIB_EC, EC_R_NOT_A_NIST_PRIME); 109 117 goto err; 110 118 } 111 119 112 ret = ec_GFp_simple_group_set_curve(group, p, a, b, ctx);120 ret = ossl_ec_GFp_simple_group_set_curve(group, p, a, b, ctx); 113 121 114 122 err: … … 118 126 } 119 127 120 int ec_GFp_nist_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a,121 const BIGNUM *b, BN_CTX *ctx)128 int ossl_ec_GFp_nist_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, 129 const BIGNUM *b, BN_CTX *ctx) 122 130 { 123 131 int ret = 0; … … 125 133 126 134 if (!group || !r || !a || !b) { 127 E Cerr(EC_F_EC_GFP_NIST_FIELD_MUL, ERR_R_PASSED_NULL_PARAMETER);135 ERR_raise(ERR_LIB_EC, ERR_R_PASSED_NULL_PARAMETER); 128 136 goto err; 129 137 } 130 138 if (!ctx) 131 if ((ctx_new = ctx = BN_CTX_new ()) == NULL)139 if ((ctx_new = ctx = BN_CTX_new_ex(group->libctx)) == NULL) 132 140 goto err; 133 141 … … 143 151 } 144 152 145 int ec_GFp_nist_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a,146 BN_CTX *ctx)153 int ossl_ec_GFp_nist_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, 154 BN_CTX *ctx) 147 155 { 148 156 int ret = 0; … … 150 158 151 159 if (!group || !r || !a) { 152 E Cerr(EC_F_EC_GFP_NIST_FIELD_SQR, EC_R_PASSED_NULL_PARAMETER);160 ERR_raise(ERR_LIB_EC, EC_R_PASSED_NULL_PARAMETER); 153 161 goto err; 154 162 } 155 163 if (!ctx) 156 if ((ctx_new = ctx = BN_CTX_new ()) == NULL)164 if ((ctx_new = ctx = BN_CTX_new_ex(group->libctx)) == NULL) 157 165 goto err; 158 166
Note:
See TracChangeset
for help on using the changeset viewer.