---
name: "libressl-DSA_do_sign"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-DSA_do_sign"
---

# libressl-DSA\_do\_sign(3)

raw DSA signature operations

## NAME

**DSA\_do\_sign**, **DSA\_do\_verify** – raw DSA signature operations

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#include \<openssl/dsa.h\>**

*DSA\_SIG* *\**\

**DSA\_do\_sign**(*const unsigned char \*dgst*, *int dlen*, *DSA \*dsa*);

*int*\

**DSA\_do\_verify**(*const unsigned char \*dgst*, *int dgst\_len*, *DSA\_SIG \*sig*, *DSA \*dsa*);

## DESCRIPTION

**DSA\_do\_sign**() computes a digital signature on the *dlen* byte message digest *dgst* using the private key *dsa* and returns it in a newly allocated *DSA\_SIG* structure.

DSA\_sign\_setup(3) may be used to precompute part of the signing operation in case signature generation is time-critical.

**DSA\_do\_verify**() verifies that the signature *sig* matches a given message digest *dgst* of size *dgst\_len*. *dsa* is the signer's public key.

## RETURN VALUES

**DSA\_do\_sign**() returns the signature or NULL on error. **DSA\_do\_verify**() returns 1 for a valid signature, 0 for an incorrect signature, and -1 on error. The error codes can be obtained by ERR\_get\_error(3).

## SEE ALSO

DSA\_get0\_key(3), DSA\_meth\_set\_sign(3), DSA\_new(3), DSA\_SIG\_new(3), DSA\_sign(3)

## HISTORY

**DSA\_do\_sign**() and **DSA\_do\_verify**() first appeared in OpenSSL 0.9.3 and have been available since OpenBSD 2.6.
