mpi_write_to_sgl(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… mpi_write_to_sgl (9) β€” from the Kernel API Manual, bestie πŸŽ€

okay so listen. we're in the Kernel API Manual today and the star of the show is mpi_write_to_sgl. yes that's the whole header, yes I folded it in, you're welcome πŸ’–


✨ NAME ✨

mpi_write_to_sgl β€” Funnction exports MPI to an sgl (msb first) 🌈

(and yes, "Funnction" with the triple-n is literally how it's written in the source. it's canon. it's iconic. we don't touch it πŸ’€)


🌸 SYNOPSIS 🌸

int mpi_write_to_sgl (MPI a , struct scatterlist *sgl , unsigned nbytes
, int *sign );

like, exactly that. spaces and all. copy-paste it, don't @ me 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • a β€” a multi precision integer. the big number. the main character of this whole operation πŸ‘‘
  • sgl β€” the scatterlist you're writing to. it needs to be at least mpi_get_size(a) long, no cap, that's a hard requirement. too short? that's a you problem πŸ™ˆ
  • nbytes β€” how many bytes you wanna write. leading bytes get filled with zero, so it's giving "padded for the gods" ✨
  • sign β€” if this isn't NULL, it gets set to the sign of a. if it is NULL, it just vibes and does nothing πŸ’€

🧚 DESCRIPTION 🧚

so this function works in the same way as mpi_read_buffer, bestie. literally the same energy, same behaviour. the one glow-up? it takes an sgl instead of a u8 * buf. that's it. that's the whole difference. slay πŸ’…


⭐ RETURN ⭐

  • 0 on success πŸŽ‰ (the good ending)
  • an error code in case of error 😭 (the bad ending)

that's it. no in-between. binary as hell.


πŸ”₯ SEE ALSO πŸ”₯

go read those next, iykyk πŸ“š


okay that's the whole page!! huge shoutout to ./lib/crypto/mpi for the source/version and to October 2026 for the date β€” the manpage queen herself, mpi_write_to_sgl(9), signing off πŸ’œπŸŽ€πŸ¦‹

πŸ“¦ where this page comes from