apps/pkcs8.c:232: error: BUFFER_OVERRUN_L2
  Offset added: [50, 8192] Size: 400 by call to `EVP_read_pw_string`.
Showing all 11 steps of the trace


apps/pkcs8.c:71:1: Array declaration
69.   int MAIN(int, char **);
70.   
71. > int MAIN(int argc, char **argv)
72.   {
73.   	char **args, *infile = NULL, *outfile = NULL;

apps/pkcs8.c:232:5: Call
230.   			else {
231.   				p8pass = pass;
232.   				EVP_read_pw_string(pass, 50, "Enter Encryption Password:", 1);
           ^
233.   			}
234.   			app_RAND_load_file(NULL, bio_err, 0);

crypto/evp/evp_key.c:87:1: Parameter `len`
  85.    * in the DES library -- if someone ever wants to disable DES,
  86.    * this function will fail */
  87. > int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify)
  88.   	{
  89.   #ifndef NO_DES

crypto/evp/evp_key.c:92:9: Call
  90.   	if ((prompt == NULL) && (prompt_string[0] != '\0'))
  91.   		prompt=prompt_string;
  92.   	return(des_read_pw_string(buf,len,prompt,verify));
                ^
  93.   #else
  94.   	return -1;

crypto/des/read_pwd.c:208:1: Parameter `*buf`
    206.   static jmp_buf save;
    207.   
    208. > int des_read_pw_string(char *buf, int length, const char *prompt,
    209.   	     int verify)
    210.   	{

crypto/des/read_pwd.c:214:6: Call
    212.   	int ret;
    213.   
    214.   	ret=des_read_pw(buf,buff,(length>BUFSIZ)?BUFSIZ:length,prompt,verify);
                ^
    215.   	memset(buff,0,BUFSIZ);
    216.   	return(ret);

crypto/des/read_pwd.c:233:1: <Offset trace>
231.   
232.   /* return 0 if ok, 1 (or -1) otherwise */
233. > int des_read_pw(char *buf, char *buff, int size, const char *prompt,
234.   	     int verify)
235.   	{

crypto/des/read_pwd.c:233:1: Parameter `size`
      231.   
      232.   /* return 0 if ok, 1 (or -1) otherwise */
      233. > int des_read_pw(char *buf, char *buff, int size, const char *prompt,
      234.   	     int verify)
      235.   	{

crypto/des/read_pwd.c:233:1: <Length trace>
231.   
232.   /* return 0 if ok, 1 (or -1) otherwise */
233. > int des_read_pw(char *buf, char *buff, int size, const char *prompt,
234.   	     int verify)
235.   	{

crypto/des/read_pwd.c:233:1: Parameter `*buf`
      231.   
      232.   /* return 0 if ok, 1 (or -1) otherwise */
      233. > int des_read_pw(char *buf, char *buff, int size, const char *prompt,
      234.   	     int verify)
      235.   	{

crypto/des/read_pwd.c:331:3: Array access: Offset added: [50, 8192] Size: 400 by call to `EVP_read_pw_string` 
      329.   
      330.   		buf[0]='\0';
      331.   		fgets(buf,size,tty);
               ^
      332.   		if (feof(tty)) goto error;
      333.   		if (ferror(tty)) goto error;

int des_read_pw(char *buf, char *buff, int size, const char *prompt,
	     int verify)
	{
#ifdef VMS
	struct IOSB iosb;
	$DESCRIPTOR(terminal,"TT");
	long tty_orig[3], tty_new[3];
	long status;
	unsigned short channel = 0;
#else
#ifndef MSDOS
	TTY_STRUCT tty_orig,tty_new;
#endif
#endif
	int number;
	int ok;
	static int ps;
	int is_a_tty;
	static FILE *tty;
	char *p;
	if (setjmp(save))
		{
		ok=0;
		goto error;
		}
	number=5;
	ok=0;
	ps=0;
	is_a_tty=1;
	tty=NULL;
#ifndef MSDOS
	if ((tty=fopen("/dev/tty","r")) == NULL)
		tty=stdin;
#else
	if ((tty=fopen("con","r")) == NULL)
		tty=stdin;
#endif
#if defined(TTY_get) && !defined(VMS)
	if (TTY_get(fileno(tty),&tty_orig) == -1)
		{
#ifdef ENOTTY
		if (errno == ENOTTY)
			is_a_tty=0;
		else
#endif
#ifdef EINVAL
		if (errno == EINVAL)
			is_a_tty=0;
		else
#endif
			return(-1);
		}
	memcpy(&(tty_new),&(tty_orig),sizeof(tty_orig));
#endif
#ifdef VMS
	status = sys$assign(&terminal,&channel,0,0);
	if (status != SS$_NORMAL)
		return(-1);
	status=sys$qiow(0,channel,IO$_SENSEMODE,&iosb,0,0,tty_orig,12,0,0,0,0);
	if ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL))
		return(-1);
#endif
	pushsig();
	ps=1;
#ifdef TTY_FLAGS
	tty_new.TTY_FLAGS &= ~ECHO;
#endif
#if defined(TTY_set) && !defined(VMS)
	if (is_a_tty && (TTY_set(fileno(tty),&tty_new) == -1))
		return(-1);
#endif
#ifdef VMS
	tty_new[0] = tty_orig[0];
	tty_new[1] = tty_orig[1] | TT$M_NOECHO;
	tty_new[2] = tty_orig[2];
	status = sys$qiow(0,channel,IO$_SETMODE,&iosb,0,0,tty_new,12,0,0,0,0);
	if ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL))
		return(-1);
#endif
	ps=2;
	while ((!ok) && (number--))
		{
		fputs(prompt,stderr);
		fflush(stderr);
		buf[0]='\0';
		fgets(buf,size,tty);
		if (feof(tty)) goto error;
		if (ferror(tty)) goto error;
		if ((p=(char *)strchr(buf,'\n')) != NULL)
			*p='\0';
		else	read_till_nl(tty);
		if (verify)
			{
			fprintf(stderr,"\nVerifying password - %s",prompt);
			fflush(stderr);
			buff[0]='\0';
			fgets(buff,size,tty);
			if (feof(tty)) goto error;
			if ((p=(char *)strchr(buff,'\n')) != NULL)
				*p='\0';
			else	read_till_nl(tty);
			if (strcmp(buf,buff) != 0)
				{
				fprintf(stderr,"\nVerify failure");
				fflush(stderr);
				break;
				}
			}
		ok=1;
		}
error:
	fprintf(stderr,"\n");
#ifdef DEBUG
	perror("fgets(tty)");
#endif
#if defined(TTY_set) && !defined(VMS)
	if (ps >= 2) TTY_set(fileno(tty),&tty_orig);
#endif
#ifdef VMS
	if (ps >= 2)
		status = sys$qiow(0,channel,IO$_SETMODE,&iosb,0,0
			,tty_orig,12,0,0,0,0);
#endif
	if (ps >= 1) popsig();
	if (stdin != tty) fclose(tty);
#ifdef VMS
	status = sys$dassgn(channel);
#endif
	return(!ok);
	}
['int MAIN(int argc, char **argv)\n{\n\tchar **args, *infile = NULL, *outfile = NULL;\n\tchar *passargin = NULL, *passargout = NULL;\n\tBIO *in = NULL, *out = NULL;\n\tint topk8 = 0;\n\tint pbe_nid = -1;\n\tconst EVP_CIPHER *cipher = NULL;\n\tint iter = PKCS12_DEFAULT_ITER;\n\tint informat, outformat;\n\tint p8_broken = PKCS8_OK;\n\tint nocrypt = 0;\n\tX509_SIG *p8;\n\tPKCS8_PRIV_KEY_INFO *p8inf;\n\tEVP_PKEY *pkey;\n\tchar pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL;\n\tint badarg = 0;\n\tif (bio_err == NULL) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);\n\tinformat=FORMAT_PEM;\n\toutformat=FORMAT_PEM;\n\tERR_load_crypto_strings();\n\tOpenSSL_add_all_algorithms();\n\targs = argv + 1;\n\twhile (!badarg && *args && *args[0] == \'-\') {\n\t\tif (!strcmp(*args,"-v2")) {\n\t\t\tif (args[1]) {\n\t\t\t\targs++;\n\t\t\t\tcipher=EVP_get_cipherbyname(*args);\n\t\t\t\tif(!cipher) {\n\t\t\t\t\tBIO_printf(bio_err,\n\t\t\t\t\t\t "Unknown cipher %s\\n", *args);\n\t\t\t\t\tbadarg = 1;\n\t\t\t\t}\n\t\t\t} else badarg = 1;\n\t\t} else if (!strcmp(*args,"-v1")) {\n\t\t\tif (args[1]) {\n\t\t\t\targs++;\n\t\t\t\tpbe_nid=OBJ_txt2nid(*args);\n\t\t\t\tif(pbe_nid == NID_undef) {\n\t\t\t\t\tBIO_printf(bio_err,\n\t\t\t\t\t\t "Unknown PBE algorithm %s\\n", *args);\n\t\t\t\t\tbadarg = 1;\n\t\t\t\t}\n\t\t\t} else badarg = 1;\n\t\t} else if (!strcmp(*args,"-inform")) {\n\t\t\tif (args[1]) {\n\t\t\t\targs++;\n\t\t\t\tinformat=str2fmt(*args);\n\t\t\t} else badarg = 1;\n\t\t} else if (!strcmp(*args,"-outform")) {\n\t\t\tif (args[1]) {\n\t\t\t\targs++;\n\t\t\t\toutformat=str2fmt(*args);\n\t\t\t} else badarg = 1;\n\t\t} else if (!strcmp (*args, "-topk8")) topk8 = 1;\n\t\telse if (!strcmp (*args, "-noiter")) iter = 1;\n\t\telse if (!strcmp (*args, "-nocrypt")) nocrypt = 1;\n\t\telse if (!strcmp (*args, "-nooct")) p8_broken = PKCS8_NO_OCTET;\n\t\telse if (!strcmp (*args, "-nsdb")) p8_broken = PKCS8_NS_DB;\n\t\telse if (!strcmp (*args, "-embed")) p8_broken = PKCS8_EMBEDDED_PARAM;\n\t\telse if (!strcmp(*args,"-passin"))\n\t\t\t{\n\t\t\tif (!args[1]) goto bad;\n\t\t\tpassargin= *(++args);\n\t\t\t}\n\t\telse if (!strcmp(*args,"-passout"))\n\t\t\t{\n\t\t\tif (!args[1]) goto bad;\n\t\t\tpassargout= *(++args);\n\t\t\t}\n\t\telse if (!strcmp (*args, "-in")) {\n\t\t\tif (args[1]) {\n\t\t\t\targs++;\n\t\t\t\tinfile = *args;\n\t\t\t} else badarg = 1;\n\t\t} else if (!strcmp (*args, "-out")) {\n\t\t\tif (args[1]) {\n\t\t\t\targs++;\n\t\t\t\toutfile = *args;\n\t\t\t} else badarg = 1;\n\t\t} else badarg = 1;\n\t\targs++;\n\t}\n\tif (badarg) {\n\t\tbad:\n\t\tBIO_printf(bio_err, "Usage pkcs8 [options]\\n");\n\t\tBIO_printf(bio_err, "where options are\\n");\n\t\tBIO_printf(bio_err, "-in file        input file\\n");\n\t\tBIO_printf(bio_err, "-inform X       input format (DER or PEM)\\n");\n\t\tBIO_printf(bio_err, "-passin arg     input file pass phrase source\\n");\n\t\tBIO_printf(bio_err, "-outform X      output format (DER or PEM)\\n");\n\t\tBIO_printf(bio_err, "-out file       output file\\n");\n\t\tBIO_printf(bio_err, "-passout arg    output file pass phrase source\\n");\n\t\tBIO_printf(bio_err, "-topk8          output PKCS8 file\\n");\n\t\tBIO_printf(bio_err, "-nooct          use (nonstandard) no octet format\\n");\n\t\tBIO_printf(bio_err, "-embed          use (nonstandard) embedded DSA parameters format\\n");\n\t\tBIO_printf(bio_err, "-nsdb           use (nonstandard) DSA Netscape DB format\\n");\n\t\tBIO_printf(bio_err, "-noiter         use 1 as iteration count\\n");\n\t\tBIO_printf(bio_err, "-nocrypt        use or expect unencrypted private key\\n");\n\t\tBIO_printf(bio_err, "-v2 alg         use PKCS#5 v2.0 and cipher \\"alg\\"\\n");\n\t\tBIO_printf(bio_err, "-v1 obj         use PKCS#5 v1.5 and cipher \\"alg\\"\\n");\n\t\treturn (1);\n\t}\n\tif(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {\n\t\tBIO_printf(bio_err, "Error getting passwords\\n");\n\t\treturn (1);\n\t}\n\tif ((pbe_nid == -1) && !cipher) pbe_nid = NID_pbeWithMD5AndDES_CBC;\n\tif (infile) {\n\t\tif (!(in = BIO_new_file(infile, "rb"))) {\n\t\t\tBIO_printf(bio_err,\n\t\t\t\t "Can\'t open input file %s\\n", infile);\n\t\t\treturn (1);\n\t\t}\n\t} else in = BIO_new_fp (stdin, BIO_NOCLOSE);\n\tif (outfile) {\n\t\tif (!(out = BIO_new_file (outfile, "wb"))) {\n\t\t\tBIO_printf(bio_err,\n\t\t\t\t "Can\'t open output file %s\\n", outfile);\n\t\t\treturn (1);\n\t\t}\n\t} else out = BIO_new_fp (stdout, BIO_NOCLOSE);\n\tif (topk8) {\n\t\tif(informat == FORMAT_PEM)\n\t\t\tpkey = PEM_read_bio_PrivateKey(in, NULL, NULL, passin);\n\t\telse if(informat == FORMAT_ASN1)\n\t\t\tpkey = d2i_PrivateKey_bio(in, NULL);\n\t\telse {\n\t\t\tBIO_printf(bio_err, "Bad format specified for key\\n");\n\t\t\treturn (1);\n\t\t}\n\t\tif (!pkey) {\n\t\t\tBIO_printf(bio_err, "Error reading key\\n", outfile);\n\t\t\tERR_print_errors(bio_err);\n\t\t\treturn (1);\n\t\t}\n\t\tBIO_free(in);\n\t\tif (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken))) {\n\t\t\tBIO_printf(bio_err, "Error converting key\\n", outfile);\n\t\t\tERR_print_errors(bio_err);\n\t\t\treturn (1);\n\t\t}\n\t\tif(nocrypt) {\n\t\t\tif(outformat == FORMAT_PEM)\n\t\t\t\tPEM_write_bio_PKCS8_PRIV_KEY_INFO(out, p8inf);\n\t\t\telse if(outformat == FORMAT_ASN1)\n\t\t\t\ti2d_PKCS8_PRIV_KEY_INFO_bio(out, p8inf);\n\t\t\telse {\n\t\t\t\tBIO_printf(bio_err, "Bad format specified for key\\n");\n\t\t\t\treturn (1);\n\t\t\t}\n\t\t} else {\n\t\t\tif(passout) p8pass = passout;\n\t\t\telse {\n\t\t\t\tp8pass = pass;\n\t\t\t\tEVP_read_pw_string(pass, 50, "Enter Encryption Password:", 1);\n\t\t\t}\n\t\t\tapp_RAND_load_file(NULL, bio_err, 0);\n\t\t\tif (!(p8 = PKCS8_encrypt(pbe_nid, cipher,\n\t\t\t\t\tp8pass, strlen(p8pass),\n\t\t\t\t\tNULL, 0, iter, p8inf))) {\n\t\t\t\tBIO_printf(bio_err, "Error encrypting key\\n",\n\t\t\t\t\t\t\t\t outfile);\n\t\t\t\tERR_print_errors(bio_err);\n\t\t\t\treturn (1);\n\t\t\t}\n\t\t\tapp_RAND_write_file(NULL, bio_err);\n\t\t\tif(outformat == FORMAT_PEM)\n\t\t\t\tPEM_write_bio_PKCS8(out, p8);\n\t\t\telse if(outformat == FORMAT_ASN1)\n\t\t\t\ti2d_PKCS8_bio(out, p8);\n\t\t\telse {\n\t\t\t\tBIO_printf(bio_err, "Bad format specified for key\\n");\n\t\t\t\treturn (1);\n\t\t\t}\n\t\t\tX509_SIG_free(p8);\n\t\t}\n\t\tPKCS8_PRIV_KEY_INFO_free (p8inf);\n\t\tEVP_PKEY_free(pkey);\n\t\tBIO_free(out);\n\t\tif(passin) Free(passin);\n\t\tif(passout) Free(passout);\n\t\treturn (0);\n\t}\n\tif(nocrypt) {\n\t\tif(informat == FORMAT_PEM)\n\t\t\tp8inf = PEM_read_bio_PKCS8_PRIV_KEY_INFO(in,NULL,NULL, NULL);\n\t\telse if(informat == FORMAT_ASN1)\n\t\t\tp8inf = d2i_PKCS8_PRIV_KEY_INFO_bio(in, NULL);\n\t\telse {\n\t\t\tBIO_printf(bio_err, "Bad format specified for key\\n");\n\t\t\treturn (1);\n\t\t}\n\t} else {\n\t\tif(informat == FORMAT_PEM)\n\t\t\tp8 = PEM_read_bio_PKCS8(in, NULL, NULL, NULL);\n\t\telse if(informat == FORMAT_ASN1)\n\t\t\tp8 = d2i_PKCS8_bio(in, NULL);\n\t\telse {\n\t\t\tBIO_printf(bio_err, "Bad format specified for key\\n");\n\t\t\treturn (1);\n\t\t}\n\t\tif (!p8) {\n\t\t\tBIO_printf (bio_err, "Error reading key\\n", outfile);\n\t\t\tERR_print_errors(bio_err);\n\t\t\treturn (1);\n\t\t}\n\t\tif(passin) p8pass = passin;\n\t\telse {\n\t\t\tp8pass = pass;\n\t\t\tEVP_read_pw_string(pass, 50, "Enter Password:", 0);\n\t\t}\n\t\tp8inf = M_PKCS8_decrypt(p8, p8pass, strlen(p8pass));\n\t\tX509_SIG_free(p8);\n\t}\n\tif (!p8inf) {\n\t\tBIO_printf(bio_err, "Error decrypting key\\n", outfile);\n\t\tERR_print_errors(bio_err);\n\t\treturn (1);\n\t}\n\tif (!(pkey = EVP_PKCS82PKEY(p8inf))) {\n\t\tBIO_printf(bio_err, "Error converting key\\n", outfile);\n\t\tERR_print_errors(bio_err);\n\t\treturn (1);\n\t}\n\tif (p8inf->broken) {\n\t\tBIO_printf(bio_err, "Warning: broken key encoding: ");\n\t\tswitch (p8inf->broken) {\n\t\t\tcase PKCS8_NO_OCTET:\n\t\t\tBIO_printf(bio_err, "No Octet String in PrivateKey\\n");\n\t\t\tbreak;\n\t\t\tcase PKCS8_EMBEDDED_PARAM:\n\t\t\tBIO_printf(bio_err, "DSA parameters included in PrivateKey\\n");\n\t\t\tbreak;\n\t\t\tcase PKCS8_NS_DB:\n\t\t\tBIO_printf(bio_err, "DSA public key include in PrivateKey\\n");\n\t\t\tbreak;\n\t\t\tdefault:\n\t\t\tBIO_printf(bio_err, "Unknown broken type\\n");\n\t\t\tbreak;\n\t\t}\n\t}\n\tPKCS8_PRIV_KEY_INFO_free(p8inf);\n\tif(outformat == FORMAT_PEM)\n\t\tPEM_write_bio_PrivateKey(out, pkey, NULL, NULL, 0, NULL, passout);\n\telse if(outformat == FORMAT_ASN1)\n\t\ti2d_PrivateKey_bio(out, pkey);\n\telse {\n\t\tBIO_printf(bio_err, "Bad format specified for key\\n");\n\t\t\treturn (1);\n\t}\n\tEVP_PKEY_free(pkey);\n\tBIO_free(out);\n\tBIO_free(in);\n\tif(passin) Free(passin);\n\tif(passout) Free(passout);\n\treturn (0);\n}', "int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify)\n\t{\n#ifndef NO_DES\n\tif ((prompt == NULL) && (prompt_string[0] != '\\0'))\n\t\tprompt=prompt_string;\n\treturn(des_read_pw_string(buf,len,prompt,verify));\n#else\n\treturn -1;\n#endif\n\t}", 'int des_read_pw_string(char *buf, int length, const char *prompt,\n\t     int verify)\n\t{\n\tchar buff[BUFSIZ];\n\tint ret;\n\tret=des_read_pw(buf,buff,(length>BUFSIZ)?BUFSIZ:length,prompt,verify);\n\tmemset(buff,0,BUFSIZ);\n\treturn(ret);\n\t}', 'int des_read_pw(char *buf, char *buff, int size, const char *prompt,\n\t     int verify)\n\t{\n#ifdef VMS\n\tstruct IOSB iosb;\n\t$DESCRIPTOR(terminal,"TT");\n\tlong tty_orig[3], tty_new[3];\n\tlong status;\n\tunsigned short channel = 0;\n#else\n#ifndef MSDOS\n\tTTY_STRUCT tty_orig,tty_new;\n#endif\n#endif\n\tint number;\n\tint ok;\n\tstatic int ps;\n\tint is_a_tty;\n\tstatic FILE *tty;\n\tchar *p;\n\tif (setjmp(save))\n\t\t{\n\t\tok=0;\n\t\tgoto error;\n\t\t}\n\tnumber=5;\n\tok=0;\n\tps=0;\n\tis_a_tty=1;\n\ttty=NULL;\n#ifndef MSDOS\n\tif ((tty=fopen("/dev/tty","r")) == NULL)\n\t\ttty=stdin;\n#else\n\tif ((tty=fopen("con","r")) == NULL)\n\t\ttty=stdin;\n#endif\n#if defined(TTY_get) && !defined(VMS)\n\tif (TTY_get(fileno(tty),&tty_orig) == -1)\n\t\t{\n#ifdef ENOTTY\n\t\tif (errno == ENOTTY)\n\t\t\tis_a_tty=0;\n\t\telse\n#endif\n#ifdef EINVAL\n\t\tif (errno == EINVAL)\n\t\t\tis_a_tty=0;\n\t\telse\n#endif\n\t\t\treturn(-1);\n\t\t}\n\tmemcpy(&(tty_new),&(tty_orig),sizeof(tty_orig));\n#endif\n#ifdef VMS\n\tstatus = sys$assign(&terminal,&channel,0,0);\n\tif (status != SS$_NORMAL)\n\t\treturn(-1);\n\tstatus=sys$qiow(0,channel,IO$_SENSEMODE,&iosb,0,0,tty_orig,12,0,0,0,0);\n\tif ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL))\n\t\treturn(-1);\n#endif\n\tpushsig();\n\tps=1;\n#ifdef TTY_FLAGS\n\ttty_new.TTY_FLAGS &= ~ECHO;\n#endif\n#if defined(TTY_set) && !defined(VMS)\n\tif (is_a_tty && (TTY_set(fileno(tty),&tty_new) == -1))\n\t\treturn(-1);\n#endif\n#ifdef VMS\n\ttty_new[0] = tty_orig[0];\n\ttty_new[1] = tty_orig[1] | TT$M_NOECHO;\n\ttty_new[2] = tty_orig[2];\n\tstatus = sys$qiow(0,channel,IO$_SETMODE,&iosb,0,0,tty_new,12,0,0,0,0);\n\tif ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL))\n\t\treturn(-1);\n#endif\n\tps=2;\n\twhile ((!ok) && (number--))\n\t\t{\n\t\tfputs(prompt,stderr);\n\t\tfflush(stderr);\n\t\tbuf[0]=\'\\0\';\n\t\tfgets(buf,size,tty);\n\t\tif (feof(tty)) goto error;\n\t\tif (ferror(tty)) goto error;\n\t\tif ((p=(char *)strchr(buf,\'\\n\')) != NULL)\n\t\t\t*p=\'\\0\';\n\t\telse\tread_till_nl(tty);\n\t\tif (verify)\n\t\t\t{\n\t\t\tfprintf(stderr,"\\nVerifying password - %s",prompt);\n\t\t\tfflush(stderr);\n\t\t\tbuff[0]=\'\\0\';\n\t\t\tfgets(buff,size,tty);\n\t\t\tif (feof(tty)) goto error;\n\t\t\tif ((p=(char *)strchr(buff,\'\\n\')) != NULL)\n\t\t\t\t*p=\'\\0\';\n\t\t\telse\tread_till_nl(tty);\n\t\t\tif (strcmp(buf,buff) != 0)\n\t\t\t\t{\n\t\t\t\tfprintf(stderr,"\\nVerify failure");\n\t\t\t\tfflush(stderr);\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\tok=1;\n\t\t}\nerror:\n\tfprintf(stderr,"\\n");\n#ifdef DEBUG\n\tperror("fgets(tty)");\n#endif\n#if defined(TTY_set) && !defined(VMS)\n\tif (ps >= 2) TTY_set(fileno(tty),&tty_orig);\n#endif\n#ifdef VMS\n\tif (ps >= 2)\n\t\tstatus = sys$qiow(0,channel,IO$_SETMODE,&iosb,0,0\n\t\t\t,tty_orig,12,0,0,0,0);\n#endif\n\tif (ps >= 1) popsig();\n\tif (stdin != tty) fclose(tty);\n#ifdef VMS\n\tstatus = sys$dassgn(channel);\n#endif\n\treturn(!ok);\n\t}']