![]() |
Dash Core
0.12.2.1
P2P Digital Currency
|
#include "num.h"
Go to the source code of this file.
|
static |
Add two scalars together (modulo the group order). Returns whether it overflowed.
Referenced by bench_ecmult_wnaf(), bench_scalar_add(), bench_scalar_inverse(), bench_scalar_inverse_var(), bench_wnaf_const(), run_ecmult_chain(), run_scalar_tests(), scalar_test(), secp256k1_ecdsa_sig_sign(), secp256k1_eckey_privkey_tweak_add(), secp256k1_ecmult_gen(), secp256k1_schnorr_sig_combine(), secp256k1_schnorr_sig_sign(), test_constant_wnaf(), test_ec_combine(), test_ecdsa_sign_verify(), and test_wnaf().
|
static |
Conditionally add a power of two to a scalar. The result is not allowed to overflow.
Referenced by scalar_test(), secp256k1_wnaf_const(), and test_constant_wnaf().
|
static |
Clear a scalar to prevent the leak of sensitive data.
Referenced by secp256k1_ec_privkey_tweak_add(), secp256k1_ec_privkey_tweak_mul(), secp256k1_ec_pubkey_create(), secp256k1_ec_seckey_verify(), secp256k1_ecdh(), secp256k1_ecdsa_sig_sign(), secp256k1_ecdsa_sign(), secp256k1_ecdsa_sign_recoverable(), secp256k1_ecmult_gen(), secp256k1_ecmult_gen_blind(), secp256k1_ecmult_gen_context_clear(), secp256k1_schnorr_generate_nonce_pair(), secp256k1_schnorr_sig_combine(), secp256k1_schnorr_sig_sign(), and secp256k1_schnorr_sign().
|
static |
Conditionally negate a number, in constant time. Returns -1 if the number was negated, 1 otherwise
Referenced by run_wnaf(), secp256k1_wnaf_const(), and test_constant_wnaf_negate().
|
static |
Compare two scalars.
Referenced by run_scalar_tests(), scalar_test(), test_constant_wnaf(), test_constant_wnaf_negate(), test_ecdsa_edge_cases(), test_ecmult_gen_blind(), test_ecmult_gen_blind_reset(), and test_wnaf().
|
static |
Convert a scalar to a byte array.
Referenced by scalar_test(), secp256k1_ec_privkey_tweak_add(), secp256k1_ec_privkey_tweak_mul(), secp256k1_ecdsa_recoverable_signature_save(), secp256k1_ecdsa_recoverable_signature_serialize_compact(), secp256k1_ecdsa_sig_recover(), secp256k1_ecdsa_sig_serialize(), secp256k1_ecdsa_sig_verify(), secp256k1_ecdsa_signature_save(), secp256k1_ecdsa_signature_serialize_compact(), secp256k1_ecmult_gen_blind(), secp256k1_scalar_get_num(), secp256k1_scalar_inverse_var(), secp256k1_schnorr_sig_combine(), secp256k1_schnorr_sig_sign(), test_bad_scalar(), test_ecdh_generator_basepoint(), test_ecdsa_end_to_end(), test_ecdsa_recovery_end_to_end(), and test_schnorr_end_to_end().
|
static |
Access bits from a scalar. All requested bits must belong to the same 32-bit limb.
Referenced by scalar_test(), secp256k1_ecmult_gen(), secp256k1_ecmult_wnaf(), and test_constant_wnaf_negate().
|
static |
Access bits from a scalar. Not constant time.
Referenced by scalar_test(), and secp256k1_ecmult_wnaf().
|
static |
Convert a scalar to a number.
Referenced by random_num_order(), random_num_order_test(), and scalar_test().
|
static |
Compute the inverse of a scalar (modulo the group order).
Referenced by bench_scalar_inverse(), run_scalar_tests(), scalar_test(), secp256k1_ecdsa_sig_sign(), and test_ecdsa_edge_cases().
|
static |
Compute the inverse of a scalar (modulo the group order), without constant-time guarantee.
Referenced by bench_scalar_inverse_var(), run_scalar_tests(), secp256k1_ecdsa_sig_recover(), secp256k1_ecdsa_sig_verify(), secp256k1_schnorr_sig_recover(), and test_ecdsa_edge_cases().
|
static |
Check whether a scalar, considered as an nonnegative integer, is even.
Referenced by secp256k1_wnaf_const(), and test_constant_wnaf_negate().
|
static |
Check whether a scalar is higher than the group order divided by 2.
Referenced by scalar_test(), secp256k1_ecdsa_sig_sign(), secp256k1_ecdsa_signature_normalize(), secp256k1_ecdsa_verify(), and secp256k1_wnaf_const().
|
static |
Check whether a scalar equals one.
Referenced by run_scalar_tests(), scalar_test(), secp256k1_scalar_inverse_var(), and secp256k1_wnaf_const().
|
static |
Check whether a scalar equals zero.
Referenced by random_scalar_order(), random_scalar_order_test(), run_scalar_tests(), run_wnaf(), scalar_test(), secp256k1_ec_pubkey_create(), secp256k1_ec_seckey_verify(), secp256k1_ecdh(), secp256k1_ecdsa_sig_recover(), secp256k1_ecdsa_sig_sign(), secp256k1_ecdsa_sig_verify(), secp256k1_ecdsa_sign(), secp256k1_ecdsa_sign_recoverable(), secp256k1_eckey_privkey_tweak_add(), secp256k1_eckey_privkey_tweak_mul(), secp256k1_eckey_pubkey_tweak_mul(), secp256k1_ecmult_const(), secp256k1_ecmult_gen_blind(), secp256k1_schnorr_generate_nonce_pair(), secp256k1_schnorr_partial_sign(), secp256k1_schnorr_sig_combine(), secp256k1_schnorr_sig_recover(), secp256k1_schnorr_sig_sign(), secp256k1_schnorr_sig_verify(), secp256k1_schnorr_sign(), and secp256k1_wnaf_const().
|
static |
Multiply two scalars (modulo the group order).
Referenced by bench_scalar_mul(), run_ecmult_chain(), run_scalar_tests(), scalar_test(), secp256k1_ecdsa_sig_recover(), secp256k1_ecdsa_sig_sign(), secp256k1_ecdsa_sig_verify(), secp256k1_eckey_privkey_tweak_mul(), secp256k1_scalar_inverse(), secp256k1_scalar_inverse_var(), secp256k1_schnorr_sig_recover(), secp256k1_schnorr_sig_sign(), test_constant_wnaf(), and test_wnaf().
|
static |
Multiply a and b (without taking the modulus!), divide by 2**shift, and round to the nearest integer. Shift must be at least 256.
Referenced by scalar_test().
|
static |
Compute the complement of a scalar (modulo the group order).
Referenced by bench_scalar_negate(), ecmult_const_mult_zero_one(), run_scalar_tests(), scalar_test(), secp256k1_ecdsa_sig_recover(), secp256k1_ecdsa_sig_sign(), secp256k1_ecdsa_signature_normalize(), secp256k1_ecmult_gen_blind(), secp256k1_ecmult_wnaf(), secp256k1_schnorr_sig_recover(), secp256k1_schnorr_sig_sign(), secp256k1_wnaf_const(), test_constant_wnaf(), test_constant_wnaf_negate(), test_ecdsa_edge_cases(), test_ecdsa_end_to_end(), test_ecmult_constants(), test_point_times_order(), and test_wnaf().
|
static |
Get the order of the group as a number.
Referenced by run_scalar_tests(), and scalar_test().
|
static |
Set a scalar from a big endian byte array.
Referenced by bench_setup(), random_scalar_order(), random_scalar_order_test(), run_scalar_tests(), secp256k1_der_parse_integer(), secp256k1_ec_privkey_tweak_add(), secp256k1_ec_privkey_tweak_mul(), secp256k1_ec_pubkey_create(), secp256k1_ec_pubkey_tweak_add(), secp256k1_ec_pubkey_tweak_mul(), secp256k1_ec_seckey_verify(), secp256k1_ecdh(), secp256k1_ecdsa_recover(), secp256k1_ecdsa_recoverable_signature_load(), secp256k1_ecdsa_recoverable_signature_parse_compact(), secp256k1_ecdsa_sig_sign(), secp256k1_ecdsa_sign(), secp256k1_ecdsa_sign_recoverable(), secp256k1_ecdsa_signature_load(), secp256k1_ecdsa_signature_parse_compact(), secp256k1_ecdsa_verify(), secp256k1_ecmult_gen_blind(), secp256k1_scalar_inverse_var(), secp256k1_schnorr_generate_nonce_pair(), secp256k1_schnorr_partial_sign(), secp256k1_schnorr_sig_combine(), secp256k1_schnorr_sig_recover(), secp256k1_schnorr_sig_sign(), secp256k1_schnorr_sig_verify(), secp256k1_schnorr_sign(), and test_ecdsa_edge_cases().
|
static |
Set a scalar to an unsigned integer.
Referenced by run_scalar_tests(), run_wnaf(), scalar_test(), secp256k1_der_parse_integer(), secp256k1_eckey_pubkey_tweak_add(), secp256k1_eckey_pubkey_tweak_mul(), secp256k1_ecmult_gen_blind(), test_constant_wnaf(), test_ecdsa_edge_cases(), test_ecdsa_sign_verify(), test_ecmult_constants(), and test_wnaf().
|
static |
Shift a scalar right by some amount strictly between 0 and 16, returning the low bits that were shifted off
Referenced by scalar_test(), secp256k1_wnaf_const(), and test_constant_wnaf().
|
static |
Compute the square of a scalar (modulo the group order).
Referenced by bench_scalar_sqr(), run_scalar_tests(), scalar_test(), and secp256k1_scalar_inverse().