---
name: "libressl-DSA_new"
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_new"
---

# libressl-DSA\_new(3)

allocate and free DSA objects

## NAME

**DSA\_new**, **DSA\_up\_ref**, **DSA\_free** – allocate and free DSA objects

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

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

*DSA\**\

**DSA\_new**(*void*);

*int*\

**DSA\_up\_ref**(*DSA \*dsa*);

*void*\

**DSA\_free**(*DSA \*dsa*);

## DESCRIPTION

The DSA functions implement the Digital Signature Algorithm.

**DSA\_new**() allocates and initializes a *DSA* structure, setting the reference count to 1. It is equivalent to calling DSA\_new\_method(3) with a NULL argument.

**DSA\_up\_ref**() increments the reference count by 1.

**DSA\_free**() decrements the reference count by 1. If it reaches 0, it frees the *DSA* structure and its components. The values are erased before the memory is returned to the system. If *dsa* is a NULL pointer, no action occurs.

## RETURN VALUES

If the allocation fails, **DSA\_new**() returns NULL and sets an error code that can be obtained by ERR\_get\_error(3). Otherwise it returns a pointer to the newly allocated structure.

**DSA\_up\_ref**() returns 1 for success or 0 for failure.

## SEE ALSO

BN\_new(3), [crypto(3)](/crypto/3.md), d2i\_DSAPublicKey(3), DH\_new(3), DSA\_do\_sign(3), DSA\_dup\_DH(3), DSA\_generate\_key(3), DSA\_generate\_parameters\_ex(3), DSA\_get0\_pqg(3), DSA\_get\_ex\_new\_index(3), DSA\_meth\_new(3), DSA\_print(3), DSA\_security\_bits(3), DSA\_set\_method(3), DSA\_SIG\_new(3), DSA\_sign(3), DSA\_size(3), EVP\_PKEY\_set1\_DSA(3), RSA\_new(3)

## STANDARDS

US Federal Information Processing Standard FIPS 186 (Digital Signature Standard, DSS), ANSI X9.30

## HISTORY

**DSA\_new**() and **DSA\_free**() first appeared in SSLeay 0.6.0 and have been available since OpenBSD 2.4.

**DSA\_up\_ref**() first appeared in OpenSSL 0.9.7 and has been available since OpenBSD 3.2.
