DSA_SIG_NEW(3SSL)
π DSA_SIG_NEW π
okay bestie, gather round, because we're doing the DSA_SIG_NEW(3SSL) page from the OpenSSL manual and it's genuinely so much less scary than it sounds β¨
this is the whole little family of functions that allocate and free DSA signature objects β your r and s, packaged up cute. let's get into it π
π SYNOPSIS π
first, the ritual. you gotta include the header or nothing works, 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);
like... look at that. four little functions. one struct. main character energy fr fr π
πΈ DESCRIPTION πΈ
β¨ DSA_SIG_new() β birth of a struct
it allocates an empty DSA_SIG structure. that's it. that's the job. a fresh, blank, hopeful little signature object π¦
π DSA_SIG_free() β the farewell tour
this one frees the DSA_SIG structure and its components.
and here's the part that lowkey matters: the values are erased before the memory is returned to the system. so it's not just "eh, whatever, hand it back" β it scrubs first. icons only π₯
also if the argument is NULL, nothing happens. it just... doesn't. no drama, no crash, nothing is done π
π DSA_SIG_get0() β the peek
it returns internal pointers to the r and s values contained in sig. you're not getting copies, bestie β you're getting pointers into the thing. iykyk π«Ά
π DSA_SIG_set0() β the handoff
you set the r and s values by calling DSA_SIG_set0() and passing in the new values for r and s as parameters.
β οΈ okay this is the one you have to actually read. calling this function transfers the memory management of the values to the DSA_SIG object. which means the values you passed in should NOT be freed directly after this function has been called. the struct owns them now. hands off. periodt π
π RETURN VALUES π
DSA_SIG_new()β if the allocation fails it returnsNULLand sets an error code that you can snag withERR_get_error(3). otherwise it returns a pointer to the newly allocated structure. so:NULL= sad, pointer = slay πDSA_SIG_free()β returns no value. it's avoid. it gives you nothing back and that's fine, it's not that kind of function πDSA_SIG_set0()β returns1on success or0on failure. classic. binary. decisive. we love a clear answer β¨
π§ SEE ALSO π§
go read these next, bestie, they're all connected:
π COPYRIGHT π
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>.
k that's the whole page, you ate it, i'm so proud π₯Ήπ
version 4.0.3 Β· dated 2026-09-29 Β· DSA_SIG_NEW(3SSL) β mwah, go write some secure code bestie π
β¨
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms