---
name: "libressl-DSA_meth_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_meth_new"
---

# libressl-DSA\_meth\_new(3)

build up DSA methods

## NAME

**DSA\_meth\_new**, **DSA\_meth\_free**, **DSA\_meth\_dup**, **DSA\_meth\_get0\_name**, **DSA\_meth\_set1\_name**, **DSA\_meth\_set\_sign**, **DSA\_meth\_set\_finish** – build up DSA methods

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

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

*DSA\_METHOD* *\**\

**DSA\_meth\_new**(*const char \*name*, *int flags*);

*void*\

**DSA\_meth\_free**(*DSA\_METHOD \*meth*);

*DSA\_METHOD* *\**\

**DSA\_meth\_dup**(*const DSA\_METHOD \*meth*);

*const* *char* *\**\

**DSA\_meth\_get0\_name**(*const DSA\_METHOD \*meth*);

*int*\

**DSA\_meth\_set1\_name**(*DSA\_METHOD \*meth*, *const char \*name*);

*int*\

**DSA\_meth\_set\_sign**(*DSA\_METHOD \*meth*, *DSA\_SIG \*(\*sign)(const unsigned char \*, int, DSA \*)*);

*int*\

**DSA\_meth\_set\_finish**(*DSA\_METHOD \*meth*, *int (\*finish)(DSA \*)*);

## DESCRIPTION

The *DSA\_METHOD* structure holds function pointers for custom DSA implementations.

**DSA\_meth\_new**() creates a new *DSA\_METHOD* structure. A copy of the NUL-terminated *name* is stored in the new *DSA\_METHOD* object. Any new *DSA* object constructed from this *DSA\_METHOD* will have the given *flags* set by default.

**DSA\_meth\_dup**() creates a deep copy of *meth*. This might be useful for creating a new *DSA\_METHOD* based on an existing one, but with some differences.

**DSA\_meth\_free**() destroys *meth* and frees any memory associated with it.

**DSA\_meth\_get0\_name**() returns an internal pointer to the name of *meth*. **DSA\_meth\_set1\_name**() stores a copy of the NUL-terminated *name* in *meth* after freeing the previously stored name. Method names are ignored by the default DSA implementation but can be used by alternative implementations and by the application program.

**DSA\_meth\_set\_sign**() sets the function used for creating a DSA signature. This function will be called from DSA\_do\_sign(3) and indirectly from DSA\_sign(3). The parameters of *sign* have the same meaning as for DSA\_do\_sign(3).

**DSA\_meth\_set\_finish**() sets an optional function for destroying a *DSA* object. Unless *finish* is NULL, it will be called from DSA\_free(3). It takes the same argument and is intended to do DSA implementation specific cleanup. The memory used by the *DSA* object itself should not be freed by the *finish* function.

## RETURN VALUES

**DSA\_meth\_new**() and **DSA\_meth\_dup**() return the newly allocated *DSA\_METHOD* object or NULL on failure.

**DSA\_meth\_get0\_name**() returns an internal pointer which must not be freed by the caller.

**DSA\_meth\_set1\_name**() and all **DSA\_meth\_set\_\***() functions return 1 on success or 0 on failure. In the current implementation, only **DSA\_meth\_set1\_name**() can actually fail.

## SEE ALSO

DSA\_do\_sign(3), DSA\_new(3), DSA\_set\_method(3), DSA\_SIG\_new(3), DSA\_sign(3)

## HISTORY

These functions first appeared in OpenSSL 1.1.0.

**DSA\_meth\_new**(), **DSA\_meth\_free**(), **DSA\_meth\_dup**(), **DSA\_meth\_set\_sign**(), and **DSA\_meth\_set\_finish**() have been available since OpenBSD 6.3.

**DSA\_meth\_get0\_name**() and **DSA\_meth\_set1\_name**() have been available since OpenBSD 7.2.
