21 #if defined(HAVE_DECL__GETWCH) && !HAVE_DECL__GETWCH
25 #define WEOF (wchar_t)(0xFFFF)
27 #if defined(HAVE_DECL_SECUREZEROMEMORY) && !HAVE_DECL_SECUREZEROMEMORY
29 SecureZeroMemory(PVOID ptr, SIZE_T cnt)
31 volatile char *vcptr = (
volatile char*)ptr;
36 #elif defined(HAVE_READPASSPHRASE_H)
37 #include <readpassphrase.h>
39 #include "ext/tor_readpassphrase.h"
54 #if defined(HAVE_READPASSPHRASE)
55 char *pwd = readpassphrase(prompt, output, buflen, RPP_ECHO_OFF);
66 wchar_t *buf = tor_calloc(buflen,
sizeof(
wchar_t));
68 wchar_t *ptr = buf, *lastch = buf + buflen - 1;
69 while (ptr < lastch) {
70 wint_t ch = _getwch();
94 #ifndef WC_ERR_INVALID_CHARS
95 #define WC_ERR_INVALID_CHARS 0x80
99 r = WideCharToMultiByte(CP_UTF8,
100 WC_NO_BEST_FIT_CHARS|WC_ERR_INVALID_CHARS,
102 output, (
int)(buflen-1),
114 SecureZeroMemory(buf,
sizeof(
wchar_t)*buflen);
118 #error "No implementation for tor_getpass found!"
ssize_t tor_getpass(const char *prompt, char *output, size_t buflen)
Headers for util_malloc.c.
Macros to manage assertions, fatal and non-fatal.