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

# libressl-des\_read\_pw(3)

compatibility user interface functions

## NAME

**EVP\_read\_pw\_string**, **EVP\_read\_pw\_string\_min**, **EVP\_set\_pw\_prompt**, **EVP\_get\_pw\_prompt** – compatibility user interface functions

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

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

*int*\

**EVP\_read\_pw\_string**(*char \*buf*, *int length*, *const char \*prompt*, *int verify*);

*int*\

**EVP\_read\_pw\_string\_min**(*char \*buf*, *int min\_length*, *int length*, *const char \*prompt*, *int verify*);

*void*\

**EVP\_set\_pw\_prompt**(*const char \*default\_prompt*);

*char* *\**\

**EVP\_get\_pw\_prompt**(*void*);

## DESCRIPTION

**EVP\_read\_pw\_string**() writes the *prompt* to */dev/tty*, or, if that could not be opened, to standard output, turns echo off, and reads an input string from */dev/tty*, or, if that could not be opened, from standard input. The string is returned in *buf*, which must have space for at least *length* bytes. If the *length* argument exceeds BUFSIZ, BUFSIZ is used instead. If *verify* is set, the user is asked for the password twice and unless the two copies match, an error is returned.

**EVP\_read\_pw\_string\_min**() additionally checks that the password is at least *min\_length* bytes long.

**EVP\_set\_pw\_prompt**() sets a default prompt to a copy of *default\_prompt*, or clears the default prompt if the *default\_prompt* argument is NULL or an empty string. If the *default\_prompt* argument is longer than 79 bytes, the copy is silently truncated to a string length of 79 bytes.

As long as a default prompt is set, **EVP\_read\_pw\_string**() and **EVP\_read\_pw\_string\_min**() can be called with a *prompt* argument of NULL, in which case the default prompt is used instead.

## RETURN VALUES

**EVP\_read\_pw\_string**() and **EVP\_read\_pw\_string\_min**() return 0 on success or a negative value on failure.

They return -1 if *length* is less than or equal to zero or on memory allocation failure. They return -1 or -2 if the internal call to UI\_process(3) fails.

In addition, *EVP\_read\_pw\_string\_min* returns -1 if *min\_length* is negative, if *length* is less than or equal to *min\_length*, or if the user entered a password shorter than *min\_length*.

**EVP\_get\_pw\_prompt**() returns an internal pointer to static memory containing the default prompt, or NULL if no default prompt is set.

## SEE ALSO

UI\_new(3)

## HISTORY

**EVP\_read\_pw\_string**() first appeared in SSLeay 0.5.1 and **EVP\_set\_pw\_prompt**() and **EVP\_get\_pw\_prompt**() in SSLeay 0.6.0. These functions have been available since OpenBSD 2.4.

**EVP\_read\_pw\_string\_min**() first appeared in OpenSSL 1.0.0 and has been available since OpenBSD 4.9.
