1.\" $OpenBSD: des_read_pw.3,v 1.10 2020/06/19 17:17:13 schwarze Exp $ 2.\" OpenSSL doc/crypto/ui_compat.pod May 14 11:28:00 2006 +0000 3.\" OpenSSL doc/crypto/des.pod 2a9aca32 Oct 25 08:44:10 2001 +0000 4.\" 5.\" This file was written by Ulf Moeller <ulf@openssl.org> and 6.\" Richard Levitte <levitte@openssl.org>. 7.\" Copyright (c) 2000, 2001 The OpenSSL Project. All rights reserved. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 16.\" 2. Redistributions in binary form must reproduce the above copyright 17.\" notice, this list of conditions and the following disclaimer in 18.\" the documentation and/or other materials provided with the 19.\" distribution. 20.\" 21.\" 3. All advertising materials mentioning features or use of this 22.\" software must display the following acknowledgment: 23.\" "This product includes software developed by the OpenSSL Project 24.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 25.\" 26.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27.\" endorse or promote products derived from this software without 28.\" prior written permission. For written permission, please contact 29.\" openssl-core@openssl.org. 30.\" 31.\" 5. Products derived from this software may not be called "OpenSSL" 32.\" nor may "OpenSSL" appear in their names without prior written 33.\" permission of the OpenSSL Project. 34.\" 35.\" 6. Redistributions of any form whatsoever must retain the following 36.\" acknowledgment: 37.\" "This product includes software developed by the OpenSSL Project 38.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" 39.\" 40.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51.\" OF THE POSSIBILITY OF SUCH DAMAGE. 52.\" 53.Dd $Mdocdate: June 19 2020 $ 54.Dt DES_READ_PW 3 55.Os 56.Sh NAME 57.Nm des_read_pw , 58.Nm des_read_pw_string , 59.Nm EVP_read_pw_string , 60.Nm EVP_read_pw_string_min 61.Nd compatibility user interface functions 62.Sh SYNOPSIS 63.In openssl/ui_compat.h 64.Ft int 65.Fo des_read_pw 66.Fa "char *buf" 67.Fa "char *buff" 68.Fa "int length" 69.Fa "const char *prompt" 70.Fa "int verify" 71.Fc 72.Ft int 73.Fo des_read_pw_string 74.Fa "char *buf" 75.Fa "int length" 76.Fa "const char *prompt" 77.Fa "int verify" 78.Fc 79.In openssl/evp.h 80.Ft int 81.Fo EVP_read_pw_string 82.Fa "char *buf" 83.Fa "int length" 84.Fa "const char *prompt" 85.Fa "int verify" 86.Fc 87.Ft int 88.Fo EVP_read_pw_string_min 89.Fa "char *buf" 90.Fa "int min_length" 91.Fa "int length" 92.Fa "const char *prompt" 93.Fa "int verify" 94.Fc 95.Sh DESCRIPTION 96These functions are deprecated. 97Use 98.Xr UI_UTIL_read_pw 3 99instead. 100.Pp 101The DES library contained a few routines to prompt for passwords. 102These aren't necessarily dependent on DES, and have therefore become 103part of the UI compatibility library. 104.Pp 105.Fn des_read_pw 106writes the string specified by 107.Fa prompt 108to standard output, turns echo off, and reads an input string from the 109terminal. 110The string is returned in 111.Fa buf , 112which must have space for at least 113.Fa length 114bytes. 115If 116.Fa verify 117is set, the user is asked for the password twice and unless the two 118copies match, an error is returned. 119The second password is stored in 120.Fa buff , 121which must therefore also be at least 122.Fa length 123bytes. 124.Pp 125.Fn des_read_pw_string 126is a variant of 127.Fn des_read_pw 128that provides a buffer if 129.Fa verify 130is set. 131It is available in the MIT Kerberos library as well. 132If 133.Fa length 134exceeds 135.Dv BUFSIZ , 136.Fn des_read_pw_string 137uses 138.Dv BUFSIZ . 139.Pp 140.Fn EVP_read_pw_string 141and 142.Fn EVP_read_pw_string_min 143are functionally similar to 144.Fn des_read_pw_string . 145.Fn EVP_read_pw_string_min 146additionally checks that the password is at least 147.Fa min_length 148bytes long. 149.Sh RETURN VALUES 150These functions return 0 on success and a negative value on failure. 151.Pp 152They return -1 if 153.Fa length 154is less than or equal to zero or on memory allocation failure. 155They return -1 or -2 if the internal call to 156.Xr UI_process 3 157fails. 158.Pp 159In addition, 160.Fa EVP_read_pw_string_min 161returns -1 if 162.Fa min_length 163is negative, if 164.Fa length 165is less than or equal to 166.Fa min_length , 167or if the user entered a password shorter than 168.Fa min_length . 169.Sh SEE ALSO 170.Xr UI_new 3 , 171.Xr UI_UTIL_read_pw 3 172.Sh HISTORY 173.Fn des_read_pw_string 174appeared in SSLeay 0.4 or earlier. 175.Fn EVP_read_pw_string 176first appeared in SSLeay 0.5.1. 177.Fn des_read_pw 178first appeared in SSLeay 0.8.0. 179These functions have been available since 180.Ox 2.4 . 181.Pp 182.Fn EVP_read_pw_string_min 183first appeared in OpenSSL 1.0.0 184and has been available since 185.Ox 4.9 . 186.Sh AUTHORS 187.An Richard Levitte Aq Mt richard@levitte.org 188for the OpenSSL project. 189