win32.c revision 6f9c93a8858a28b131dbd36b75b81e9250c6d11a
/*
* Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC")
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NETWORK ASSOCIATES DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE
* FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id */
/*! \file */
/* missing code for WIN32 */
#include <windows.h>
#include <string.h>
#define HAVE_GETPASSPHRASE
char *
getpassphrase(const char *prompt)
{
static char buf[128];
HANDLE h;
int cnt;
h = GetStdHandle(STD_INPUT_HANDLE);
GetConsoleMode(h, &mode);
{
break;
}
SetConsoleMode(h, mode);
return buf;
}
/* From ISC isc_commandline_parse() */
int optopt; /* character checked for validity */
char *optarg; /* argument associated with option */
static char endopt = '\0';
#define BADOPT (int)'?'
#define BADARG (int)':'
int
{
char *option; /* option letter list index */
/* index out of range or points to non-option */
return (-1);
}
/* "--" signals end of options */
++optind;
return (-1);
}
} else
/* See if option letter is one the caller wanted... */
if (*place == '\0')
++optind;
return (BADOPT);
}
if (*++option != ':') {
/* option doesn't take an argument */
if (*place == '\0')
++optind;
} else {
/* option needs an argument */
if (*place != '\0')
/* -D1 style */
/* -D 1 style */
else {
/* needed but absent */
if (*ostr == ':')
return (BADARG);
return (BADOPT);
}
++optind;
}
return (optopt);
}
/* load PKCS11 DLL */
#ifndef PK11_LIB_LOCATION
#error "PK11_LIB_LOCATION is not defined"
#endif
#define C_Initialize isc_C_Initialize
{
if (pk11_libname == NULL)
return 0xfe;
/* Visual Studio convertion issue... */
if (*pk11_libname == ' ')
pk11_libname++;
return 0xfe;
return 0xff;
}
#define C_Finalize isc_C_Finalize
{
return 0xfe;
return 0xff;
}
#define C_OpenSession isc_C_OpenSession
{
return 0xfe;
return 0xff;
}
#define C_CloseSession isc_C_CloseSession
{
return 0xfe;
return 0xff;
}
#define C_Login isc_C_Login
{
return 0xfe;
return 0xff;
}
#define C_CreateObject isc_C_CreateObject
{
return 0xfe;
return 0xff;
}
#define C_DestroyObject isc_C_DestroyObject
{
return 0xfe;
return 0xff;
}
{
return 0xfe;
"C_GetAttributeValue");
return 0xff;
}
{
return 0xfe;
"C_SetAttributeValue");
return 0xff;
}
{
return 0xfe;
"C_FindObjectsInit");
return 0xff;
}
#define C_FindObjects isc_C_FindObjects
{
return 0xfe;
return 0xff;
}
{
return 0xfe;
"C_FindObjectsFinal");
return 0xff;
}
{
return 0xfe;
"C_GenerateKeyPair");
return 0xff;
}