DES_READ_PW(3)
Okay bestie, this is DES_READ_PW(3) from the Library Functions Manual, and itβs giving βcompatibility era but make it password-prompt realness.β π
πΈ NAME πΈ
EVP_read_pw_string, EVP_read_pw_string_min, EVP_set_pw_prompt, EVP_get_pw_prompt β the compatibility user interface functions. Theyβre the little crew that handles prompting for passwords and remembering a default prompt, periodt. π
β¨ SYNOPSIS β¨
Itβs libcrypto time, bestie, with #include <openssl/evp.h>:
library βlibcryptoβ #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 π
Okay so hereβs the tea, function by function:
EVP_read_pw_string()β writes the prompt to/dev/tty; if that could not be opened, it writes the prompt to standard output instead. It turns echo off. Then it reads an input string from/dev/tty; if that could not be opened, it reads from standard input instead. That string is returned inbuf, andbufmust have space for at leastlengthbytes. If thelengthargument exceedsBUFSIZ, thenBUFSIZis used instead. Ifverifyis set, the user is asked for the password twice, and unless the two copies match, an error is returned. π₯EVP_read_pw_string_min()β does all the above, and additionally checks that the password is at leastmin_lengthbytes long. Lowkey the extra-vigilant bestie of the group. π«ΆEVP_set_pw_prompt()β sets a default prompt to a copy ofdefault_prompt. If thedefault_promptargument isNULLor an empty string, it clears the default prompt. If thedefault_promptargument is longer than 79 bytes, that copy is silently truncated to a string length of 79 bytes. No drama, just truncation. π- default prompt behavior β as long as a default prompt is set,
EVP_read_pw_string()andEVP_read_pw_string_min()can be called with apromptargument ofNULL, and in that case the default prompt is used instead. Iconic convenience behavior. π
β RETURN VALUES β
EVP_read_pw_string()andEVP_read_pw_string_min()return0on success or a negative value on failure.- They return
-1iflengthis less than or equal to zero or on memory allocation failure. - They return
-1or-2if the internal call toUI_process(3)fails. π - In addition,
EVP_read_pw_string_minreturns-1ifmin_lengthis negative, iflengthis less than or equal tomin_length, or if the user entered a password shorter thanmin_length. EVP_get_pw_prompt()returns an internal pointer to static memory containing the default prompt, orNULLif no default prompt is set.
π¦ SEE ALSO π¦
π HISTORY π
EVP_read_pw_string() first appeared in SSLeay 0.5.1, and EVP_set_pw_prompt() and EVP_get_pw_prompt() first appeared 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. β¨
Thatβs the whole page, bestie β the footer says Debian, June 8, 2025, for DES_READ_PW(3). Mwah ππ
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org>
- Copyright (c) 2000 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms