gnutls_decode_rs_value(3)
β¨ gnutls_decode_rs_value(3) β¨
okay bestie, sit down, hydrate, and let me tell you about a little function from the gnutls manual π this one's called gnutls_decode_rs_value, and it is lowkey doing the most important job in signature-land.
πΈ NAME πΈ
gnutls_decode_rs_value β API function. that's it. that's the name. iconic.
π¦ SYNOPSIS π¦
#include <gnutls/crypto.h>
int gnutls_decode_rs_value(const gnutls_datum_t * sig_value,
gnutls_datum_t * r, gnutls_datum_t * s);
like, look at her. three arguments, one int return. no cap.
π ARGUMENTS π
const gnutls_datum_t * sig_valueβ this one holds a Dss-Sig-Value structure that's DER or BER encoded. it's the thing you're decoding, the main character of the operation πgnutls_datum_t * rβ this is where thervalue is gonna live once we're done. it will contain it. manifesting β¨gnutls_datum_t * sβ and this one will contain thesvalue. the dynamic duo fr fr.
π DESCRIPTION π
so what does this function actually do? it takes the sig_value you handed it and decodes it into the r and s elements. that's the whole vibe.
and like, why do we care? because the Dss-Sig-Value structure is what gets used for DSA and ECDSA signatures. so if you're out here working with those, this is your girl π«Ά
now here's a lil detail that matters: the output values may be padded with a zero byte so nobody goes and interprets them as negative values. rude of math to do that, but okay. and listen β when you're done with these values, you gotta deallocate them using gnutls_free(). do not forget. do not ghost them. that's a memory leak and we don't do those π
β RETURNS β
if everything goes right, you get GNUTLS_E_SUCCESS (which is 0, the number of good vibes) back. if not? you get an error code. that's it. that's the deal.
π SINCE π
3.6.0 β she's been here since 3.6.0, so she's basically a veteran at this point. respect the elders π
π REPORTING BUGS π
found a bug? not the vibe, but please tell someone:
- report bugs to
<bugs@gnutls.org> - home page:
https://www.gnutls.org
π COPYRIGHT π
Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.
and the legal tea, which is actually quite sweet: copying and distribution of this file, with or without modification, are permitted in any medium without royalty, provided that the copyright notice and this notice are preserved. so like, go off, just keep the receipts π
π SEE ALSO π
the full documentation for gnutls is maintained as a Texinfo manual. if the /usr/share/doc/gnutls/ directory does not contain the HTML form, go visit:
https://www.gnutls.org/manual/
psa bestie:gnutls_free()yourrandswhen you're done. the zero-byte padding thing is real and it's there so your values don't get read as negative. you're welcome π
and that's the whole page, fr fr. this one's from the gnutls manual, version 3.8.13, page gnutls_decode_rs_value(3) β go decode some signatures and slay the day πβ¨π¦
π¦ where this page comes from
- alpine 3.22: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.23: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.24: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- arch rolling: gnutls 3.8.13-3 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- ubuntu stonking: gnutls-doc 3.8.13-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms