DSA_SIG_NEW(3ossl)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’– NAME πŸ’–

okay so this page is the whole squad for DSA signature objects, bestie: DSA_SIG_get0, DSA_SIG_set0, DSA_SIG_new, and DSA_SIG_free β€” all about allocating and freeing those little guys. this is page DSA_SIG_NEW(3ossl) from the OpenSSL manuals, and yes we're getting into the math-flavored part, but I got you 🫢


✨ SYNOPSIS ✨

like, the whole vibe in code form, no cap:

#include <openssl/dsa.h>

DSA_SIG *DSA_SIG_new(void);
void DSA_SIG_free(DSA_SIG *a);
void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps);
int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s);

πŸ¦‹ DESCRIPTION πŸ¦‹

DSA_SIG_new() allocates an empty DSA_SIG structure. it's giving blank canvas, main character energy β€” nothing in it yet, just potential πŸ’…

DSA_SIG_free() frees the DSA_SIG structure and its components. and listen β€” the values get erased before the memory is handed back to the system, so nothing juicy is left lying around. also super chill about NULL: if the argument is NULL, nothing is done. no drama, no crash, we love that πŸ™ˆ

DSA_SIG_get0() returns internal pointers to the r and s values contained in sig. internal, bestie β€” like it's handing you a peek at the real thing, not a copy.

and the r and s values can be set by calling DSA_SIG_set0(), passing the new values for r and s as parameters to the function.

⚠️ okay this part is important so read it twice: calling DSA_SIG_set0() transfers the memory management of the values to the DSA_SIG object. so the values you passed in should not be freed directly after this function has been called. that's literally double-free territory and it will not slay πŸ’€

πŸŽ€ RETURN VALUES πŸŽ€

  • if the allocation fails, DSA_SIG_new() returns NULL and sets an error code that you can grab with ERR_get_error(3). otherwise it returns a pointer to the newly allocated structure. lowkey a glow-up on success, error code on failure 😭
  • DSA_SIG_free() returns no value. it just does its thing and dips.
  • DSA_SIG_set0() returns 1 on success or 0 on failure. classic.

🌈 SEE ALSO 🌈

the friend group, fr fr:


Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.


⭐ and that's the whole page, bestie β€” written from OpenSSL version 3.5.6, dated 2026-04-07, page DSA_SIG_NEW(3ossl). go forth and manage your memory correctly, periodt πŸ§šπŸ’œ

πŸ“¦ where this page comes from