DSA_SIGN(3ossl)

πŸ’– DSA_SIGN β€” bestie's guide to DSA signatures πŸ’–

okay so this is the DSA_SIGN(3ossl) page from the OpenSSL manual (yes, that OpenSSL, the big one), and it's lowkey a deprecation notice wrapped in a hug. sit down, grab a strawberry πŸ“, we're getting into it.


✨ NAME ✨

DSA_sign, DSA_sign_setup, DSA_verify β€” DSA signatures. that's it, that's the trio. the girlies of the DSA world πŸ’…


🌸 SYNOPSIS 🌸

first things first, you gotta include the header:

#include <openssl/dsa.h>

now listen up because this is important β€” 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. see openssl_user_macros(7) for the tea on that. β˜•

int DSA_sign(int type, const unsigned char *dgst, int len,
             unsigned char *sigret, unsigned int *siglen, DSA *dsa);

int DSA_sign_setup(DSA *dsa, BN_CTX *ctx, BIGNUM **kinvp, BIGNUM **rp);

int DSA_verify(int type, const unsigned char *dgst, int len,
               unsigned char *sigbuf, int siglen, DSA *dsa);

πŸ¦‹ DESCRIPTION πŸ¦‹

THE WHOLE FUNCTION FAMILY ON THIS PAGE IS DEPRECATED. like, all of them. every single one. bestie, applications should instead be using EVP_PKEY_sign_init(3), EVP_PKEY_sign(3), EVP_PKEY_verify_init(3) and EVP_PKEY_verify(3). that's the glow-up. that's the move. ✨

okay but for the history girlies, here's what each one does:

  • DSA_sign() β€” computes a digital signature over the len byte message digest dgst, using the private key dsa, and drops its ASN.1 DER encoding at sigret. the length of that signature lands in *siglen. and this part is non-negotiable: sigret must point to DSA_size(dsa) bytes of memory. no more, no less, she needs her space. πŸ‘‘
  • DSA_sign_setup() β€” okay so this one is defined only for backward binary compatibility and you genuinely should not use it. since OpenSSL 1.1.0 the DSA type is opaque, and the output of DSA_sign_setup() can't be used anyway. calling it will only cause overhead, and it does not affect the actual signature (pre-)computation. it's giving "shows up to the party, contributes nothing" πŸ’€
  • DSA_verify() β€” verifies that the signature sigbuf of size siglen matches a given message digest dgst of size len. dsa here is the signer's public key. vibe check, but cryptographic. πŸ”

and one more lil detail that applies across the board: the type parameter is ignored. that's right, she's just there for the aesthetic. πŸ™ˆ

also, real talk β€” the random generator must be seeded when DSA_sign() (or DSA_sign_setup()) is called. and if the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail. no luck, no signature, periodt. 😭


πŸ’œ RETURN VALUES πŸ’œ

  • DSA_sign() and DSA_sign_setup() β€” return 1 on success, 0 on error.
  • DSA_verify() β€” returns 1 for a valid signature, 0 for an incorrect signature, and -1 on error.

and the error codes? you can grab those with ERR_get_error(3). receipts always available, bestie 🧾


🌈 CONFORMING TO 🌈

  • US Federal Information Processing Standard FIPS186-4 (Digital Signature Standard, DSS)
  • ANSI X9.30

look at her, certified and standards-compliant, we love a queen who follows the rules πŸ‘‘


πŸŽ€ SEE ALSO πŸŽ€

DSA_new(3), ERR_get_error(3), RAND_bytes(3), DSA_do_sign(3), RAND(7)

iykyk β€” go read those next, they're the supporting cast 🫢


⭐ HISTORY ⭐

all of these functions were deprecated in OpenSSL 3.0. that's the whole story. that's the arc. she had her era and now she's retired πŸ’…


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>.


and that's the page, babe πŸŽ€ this was OpenSSL 3.5.9, dated 2026-09-29, signing off from the DSA_SIGN(3ossl) era. deprecated but never forgotten, fr fr. stay seeded, stay secure, and go use EVP_PKEY_sign_init(3) like a main character. βœ¨πŸ’œ

πŸ“¦ where this page comes from