BN_generate_dsa_nonce

Generate a DSA/ECDSA per-signature nonce in [0, ]range).

Synopsis

Declared in <openssl/bn.h>

int
BN_generate_dsa_nonce(
    BIGNUM* out,
    BIGNUM const* range,
    BIGNUM const* priv,
    unsigned char const* message,
    size_t message_len,
    BN_CTX* ctx);

Description

Mixes priv and message with fresh entropy so an RNG failure alone cannot expose the private key the way a raw BN_rand_range() nonce would.

Return Value

1 on success, or 0 on failure.

Parameters

NameDescription
outDestination BIGNUM that receives the nonce k.
rangeExclusive upper bound (typically the group order).
privPrivate key value mixed into the nonce derivation.
messageMessage/digest octets mixed into the nonce derivation.
message_lenLength of message in bytes.
ctxBN_CTX for temporary BIGNUMs, or NULL.