#include <openssl/pkcs12.h>
#include <openssl/ui.h>
#include <openssl/safestack.h>
+#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
+#endif
#ifdef OPENSSL_SYS_WINDOWS
#define strcasecmp _stricmp
#include "apps.h"
#undef NON_MAIN
-#ifdef OPENSSL_SYS_WINDOWS
-# include "bss_file.c"
-#endif
-
typedef struct {
char *name;
unsigned long flag;
#ifdef OPENSSL_SYS_WIN32
int WIN32_rename(char *from, char *to)
{
+#ifndef OPENSSL_SYS_WINCE
/* Windows rename gives an error if 'to' exists, so delete it
* first and ignore file not found errror
*/
return -1;
#undef rename
return rename(from, to);
+#else
+ /* convert strings to UNICODE */
+ {
+ BOOL result = FALSE;
+ WCHAR* wfrom;
+ WCHAR* wto;
+ int i;
+ wfrom = malloc((strlen(from)+1)*2);
+ wto = malloc((strlen(to)+1)*2);
+ if (wfrom != NULL && wto != NULL)
+ {
+ for (i=0; i<(int)strlen(from)+1; i++)
+ wfrom[i] = (short)from[i];
+ for (i=0; i<(int)strlen(to)+1; i++)
+ wto[i] = (short)to[i];
+ result = MoveFile(wfrom, wto);
+ }
+ if (wfrom != NULL)
+ free(wfrom);
+ if (wto != NULL)
+ free(wto);
+ return result;
+ }
+#endif
}
#endif
if (buff)
{
- memset(buff,0,(unsigned int)bufsiz);
+ OPENSSL_cleanse(buff,(unsigned int)bufsiz);
OPENSSL_free(buff);
}
{
BIO_printf(bio_err, "User interface error\n");
ERR_print_errors(bio_err);
- memset(buf,0,(unsigned int)bufsiz);
+ OPENSSL_cleanse(buf,(unsigned int)bufsiz);
res = 0;
}
if (ok == -2)
{
BIO_printf(bio_err,"aborted!\n");
- memset(buf,0,(unsigned int)bufsiz);
+ OPENSSL_cleanse(buf,(unsigned int)bufsiz);
res = 0;
}
UI_free(ui);
BIO_printf(err,"no keyfile specified\n");
goto end;
}
+#ifndef OPENSSL_NO_ENGINE
if (format == FORMAT_ENGINE)
{
if (!e)
ui_method, &cb_data);
goto end;
}
+#endif
key=BIO_new(BIO_s_file());
if (key == NULL)
{
BIO_printf(err,"no keyfile specified\n");
goto end;
}
+#ifndef OPENSSL_NO_ENGINE
if (format == FORMAT_ENGINE)
{
if (!e)
ui_method, &cb_data);
goto end;
}
+#endif
key=BIO_new(BIO_s_file());
if (key == NULL)
{
return NULL;
}
+#ifndef OPENSSL_NO_ENGINE
/* Try to load an engine in a shareable library */
static ENGINE *try_load_engine(BIO *err, const char *engine, int debug)
{
}
return e;
}
+#endif
int load_config(BIO *err, CONF *cnf)
{