mpi_write_to_sgl(9)
π
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 leastmpi_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'tNULL, it gets set to the sign ofa. if it isNULL, 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 β
0on 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 π₯
- Kernel file
./lib/crypto/mpi/mpicoder.c mpi_read_raw_data(9)mpi_read_buffer(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms