DSA_SIZE(3SSL)

πŸ’… DSA_SIZE β€” bestie edition

okay so this is a page from the OpenSSL manual, third section of the SSL-ish library family, and no cap it's a short one. It's all about three lil deprecated DSA helper functions: DSA_size, DSA_bits, and DSA_security_bits. Let's get into it 🫢


✨ NAME ✨

DSA_size, DSA_bits, DSA_security_bits β€” get your DSA signature size, your key bits, or your security bits. three little queries, one page, one vibe 🌸


✨ SYNOPSIS ✨

First things first, bestie, you gotta include the header:

#include <openssl/dsa.h>
⚠️ okay so listen: the following functions have been deprecated since OpenSSL 3.0, and you can hide them entirely by defining OPENSSL_API_COMPAT with a suitable version value. Go read openssl_user_macros(7) for the deets, iykyk.
int DSA_bits(const DSA *dsa);

int DSA_size(const DSA *dsa);

int DSA_security_bits(const DSA *dsa);

✨ DESCRIPTION ✨

okay so lowkey the first thing you need to know: ALL of the functions described on this page are deprecated. Like, every single one 😭 If you're writing an application, pleaseee instead use EVP_PKEY_get_bits(3), EVP_PKEY_get_security_bits(3), and EVP_PKEY_get_size(3). That's the slay route. That's the main character move. πŸ‘‘

But for the record, here's what each one did:

  • DSA_bits() β€” returns the number of bits in key dsa. And like, specifically? it's the number of bits in the p parameter. that's it. that's the number. πŸ’…
  • DSA_size() β€” returns the maximum size of an ASN.1 encoded DSA signature for key dsa, in bytes. Real talk: this is your girl for figuring out how much memory you need to allocate for a DSA signature. Girl math but make it malloc. ✨
  • DSA_security_bits() β€” returns the number of security bits of the given dsa key. If you're curious where that comes from, go peek at BN_security_bits(3). πŸ¦‹

✨ RETURN VALUES ✨

here's the tea, three separate flavors of it:

  • DSA_security_bits() β€” returns the number of security bits in the key, or -1 if dsa doesn't hold any key parameters. πŸ’€
  • DSA_bits() β€” returns the number of bits in the key, or -1 if dsa doesn't hold any key parameters. πŸ’€
  • DSA_size() β€” returns the signature size in bytes, or -1 if dsa doesn't hold any key parameters. πŸ’€

so like... -1 three times. not me being the messenger of bad news every single time. anyway 🫢


✨ SEE ALSO ✨

go read these too bestie, they're the glow-up versions:


✨ HISTORY ✨

All of these functions were deprecated in OpenSSL 3.0. periodt. that's the whole history section. iconic of them honestly. 😌


Copyright 2000-2021 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>.


ok that's the whole page bestie!! πŸ’– remember: deprecated means deprec-ATED, so go use the EVP_PKEY girlies instead, and may your -1 never appear 🌈

this was OpenSSL 4.0.3, dated 2026-09-29, straight from the DSA_SIZE(3SSL) era. mwah, love u, bye πŸŽ€πŸ¦‹βœ¨

πŸ“¦ where this page comes from