bign96.h(3)

📦
version 2.2.0 · 2 versions
, in fedora 44

okay bestie, you opened bign96.h(3) from the Library Functions Manual 💖

✨ NAME ✨

bign96.h — Подпись Bign уровня 96 / Bign signature at level 96 💅

🦋 SYNOPSIS 🦋

#include 'bee2/crypto/bign.h'

🎀 Функции 🎀

       err_t bign96ParamsStd (bign_params *params, const char *name)
       err_t bign96ParamsVal (const bign_params *params)
       err_t bign96KeypairGen (octet privkey[24], octet pubkey[48], const
           bign_params *params, gen_i rng, void *rng_state)
       err_t bign96KeypairVal (const bign_params *params, const octet
           privkey[24], const octet pubkey[48])
       err_t bign96PubkeyVal (const bign_params *params, const octet
           pubkey[48])
       err_t bign96PubkeyCalc (octet pubkey[48], const bign_params *params,
           const octet privkey[24])
       err_t bign96Sign (octet sig[34], const bign_params *params, const octet
           oid_der[], size_t oid_len, const octet hash[24], const octet
           privkey[24], gen_i rng, void *rng_state)
       err_t bign96Sign2 (octet sig[34], const bign_params *params, const octet
           oid_der[], size_t oid_len, const octet hash[24], const octet
           privkey[24], const void *t, size_t t_len)
       err_t bign96Verify (const bign_params *params, const octet oid_der[],
           size_t oid_len, const octet hash[24], const octet sig[34], const
           octet pubkey[48])
  • bign96ParamsStd — loads the standard long-term parameters ✨
  • bign96ParamsVal — validates the long-term parameters 💖
  • bign96KeypairGen — generates a key pair 🔥
  • bign96KeypairVal — validates a key pair 💅
  • bign96PubkeyVal — validates a public key 🦋
  • bign96PubkeyCalc — builds the public key from the private key 🌸
  • bign96Sign — produces a digital signature (ЭЦП) 👑
  • bign96Sign2 — deterministic digital signature generation 💀
  • bign96Verify — verifies a digital signature ⭐

💅 ПОДРОБНОЕ ОПИСАНИЕ 💅

okay so Bign96 is literally the Bign signature when the security level is lowered to l = 96, and it comes with these corrections, bestie:

  1. the length of s0, the first part of the signature, is reduced from 96 bits to 80 bits — shorter signature energy, periodt.
  2. in the deterministic signature generation mode (the bign96Sign2 function, iykyk), for constructing the one-time private key, instead of the belt-wblock algorithm, the belt-32block algorithm is used (encryption of one and a half blocks). The latter algorithm is defined in СТБ 34.101.31-2020 as auxiliary for the belt-fmt algorithm.

The conventions and interfaces of the bee2/crypto/bign module are repeated.

Expected [ERR_BAD_INPUT] — all input pointers are correct.

✨ Функции ✨

okay bestie, this is the part where we meet the actual functions 💖 eight of them, all returning err_t, all doing their lil cryptographic thing. let's go 🦋


err_t bign96KeypairGen (octet privkey[24], octet pubkey[48], const bign_params * params, gen_i rng, void * rng_state)

so like, given the long-term params params, we generate a private key privkey and a public key pubkey. and for the generation we use the RNG rng and its state rng_state ✨

Ожидается (aka what you gotta make sure is true, or it's a whole thing):

  • [ERR_BAD_PARAMS] — the params params are valid 💅
  • [ERR_BAD_RNG] — the RNG rng (with its state rng_state) is valid
  • (no code, just vibes) — the RNG rng you're passing is a cryptographically strong one 🔥 like actually, don't skimp here

Возвращает: ERR_OK if the keys generated successfully, otherwise the error code 😭

Аргументы:

  • privkey — the private key
  • pubkey — the public key
  • params — the long-term params
  • rng — the random number generator
  • rng_state — [in/out] the state of the generator

err_t bign96KeypairVal (const bign_params * params, const octet privkey[24], const octet pubkey[48])

vibe check time 🎀 given the long-term params params, this checks that the private key privkey is valid and that the public key pubkey actually matches it. like, are they a matching set or is one of them lying 😭

Ожидается:

  • [ERR_BAD_PARAMS] — the params params are valid

Возвращает: ERR_OK if the pair is valid, otherwise the error code 💜

Аргументы:

  • params — the long-term params
  • privkey — the private key
  • pubkey — the public key

err_t bign96ParamsStd (bign_params * params, const char * name)

loads the standard long-term params with the name name into params. and bestie, there's literally only ONE name supported: "1.2.112.0.2.0.34.101.45.3.0" 👑 no cap, that's the only one, don't come at me with other strings.

Возвращает: ERR_OK if the params loaded successfully, otherwise the error code ✨

Аргументы:

  • params — the standard params
  • name — the name of the params

err_t bign96ParamsVal (const bign_params * params)

checks whether the long-term params params are valid. that's it, that's the whole job 🧚

Возвращает: ERR_OK if the params are valid, otherwise the error code 🌸

Аргументы:

  • params — the long-term params

err_t bign96PubkeyCalc (octet pubkey[48], const bign_params * params, const octet privkey[24])

okay so given the long-term params params, this builds the public key pubkey from the private key privkey. like a little key glow-up ✨ private key in, public key out 💅

Ожидается:

  • [ERR_BAD_PARAMS] — the params params are valid
  • [ERR_BAD_PRIVKEY] — the private key privkey is valid

Возвращает: ERR_OK if the public key was built successfully, otherwise the error code 💖

Аргументы:

  • pubkey — the public key
  • params — the long-term params
  • privkey — the private key

err_t bign96PubkeyVal (const bign_params * params, const octet pubkey[48])

given the long-term params params, checks whether the public key pubkey is valid. is this key giving what it's supposed to give or nah 🔍

Ожидается:

  • [ERR_BAD_PARAMS] — the params params are valid

Возвращает: ERR_OK if the key is valid, otherwise the error code 🌈

Аргументы:

  • params — the long-term params
  • pubkey — the key being checked

err_t bign96Sign (octet sig[34], const bign_params * params, const octet oid_der[], size_t oid_len, const octet hash[24], const octet privkey[24], gen_i rng, void * rng_state)

bestie this one produces the signature sig for a message whose hash value is hash, where that hash was made using the algorithm with identifier [oid_len]oid_der, given as a DER encoding. the signature is produced on the private key privkey. and to produce this digital signature (ЭЦП) we use the long-term params params plus the RNG rng with its state rng_state 🔥

Ожидается:

  • [ERR_BAD_PARAMS] — the params params are valid
  • [ERR_BAD_OID] — the identifier oid_der is valid
  • [ERR_BAD_INPUT] — the buffers sig and hash don't overlap 🚨 (like they must NOT intersect, fr fr)
  • [ERR_BAD_PRIVKEY] — the private key privkey is valid
  • [ERR_BAD_RNG] — the RNG rng (with its state rng_state) is valid
  • (no code) — the RNG rng is cryptographically strong

Возвращает: ERR_OK if the signature was produced, otherwise the error code 😭

Аргументы:

  • sig — the signature
  • params — the long-term params
  • oid_der — the hash algorithm identifier
  • oid_len — the length of oid_der in octets
  • hash — the hash value
  • privkey — the private key
  • rng — the random number generator
  • rng_state — [in/out] the state of the generator

err_t bign96Sign2 (octet sig[34], const bign_params * params, const octet oid_der[], size_t oid_len, const octet hash[24], const octet privkey[24], const void * t, size_t t_len)

the sequel 🎬 same deal as above: produces the signature sig for a message with hash value hash, made with the algorithm whose identifier is [oid_len]oid_der as a DER encoding, on the private key privkey, using the long-term params params. BUT — and here's the plot twist — the one-time private key is generated using the extra data [t_len]t. and if t == 0, then no extra data is used at all 🫶

Ожидается:

  • [ERR_BAD_PARAMS] — the params params are valid
  • [ERR_BAD_OID] — the identifier oid_der is valid
  • [ERR_BAD_INPUT] — the buffers sig and hash don't overlap
  • [ERR_BAD_PRIVKEY] — the private key privkey is valid

Возвращает: ERR_OK if the signature was produced, otherwise the error code ✨

Аргументы:

  • sig — the signature
  • params — the long-term params
  • oid_der — the hash algorithm identifier
  • oid_len — the length of oid_der in octets
  • hash — the hash value
  • privkey — the private key
  • t — the extra data
  • t_len — the size of the extra data

err_t bign96Verify (const bign_params * params, const octet oid_der[], size_t oid_len, const octet hash[24], const octet sig[34], const octet pubkey[48])

the moment of truth 💅 this verifies the digital signature (ЭЦП) sig for a message with hash value hash. the verification uses the long-term params params and the public key pubkey. and it's assumed that the hash value hash was made using the algorithm with identifier [oid_len]oid_der, given as a DER encoding 🔍

Ожидается:

  • [ERR_BAD_PARAMS] — the params params are valid
  • [ERR_BAD_OID] — the identifier oid_der is valid
  • [ERR_BAD_PUBKEY] — the public key pubkey is valid

Возвращает: ERR_OK if the signature is valid, otherwise the error code 🎀

Прим. (note bestie 📌) — if the restrictions on the digital signature (ЭЦП) are violated, the code ERR_BAD_SIG is returned.

Аргументы:

  • params — the long-term params
  • oid_der — the hash algorithm identifier
  • oid_len — the length of oid_der in octets
  • hash — the hash value
  • sig — the signature
  • pubkey — the public key

✨ Автор ✨

automatically generated by Doxygen for the Bee2 library, straight from the source text 🦋 (not me being a bot-generated manpage, it's giving iconic honestly 👑)


and that's a wrap on bign96.h(3) bestie 💖 this lil page lives in the Bee2 library, dated Вс 25 Янв 2026 00:00:00 (that's Sunday, January 25, 2026, midnight — very main character of it). go forth and sign responsibly, no cap 🌸🫶

📦 where this page comes from