I've just realized that chil.patch I sent in my first e-mail can cause troubles
when hwcrhk library passes null as stated in nCipher headers.
I am attaching modified version "chil2.patch" that supports both null and an
empty string.
Sorry for inconvenience.
--
Jaroslav Imrich
Disig, a.s.
Zahradnicka 151, 821 08 Bratislava 2
[email protected]
www.disig.sk
diff -ur openssl-0.9.8m/engines/e_chil.c openssl-0.9.8m-modified/engines/e_chil.c
--- openssl-0.9.8m/engines/e_chil.c 2008-11-28 23:04:25.000000000 +0100
+++ openssl-0.9.8m-modified/engines/e_chil.c 2010-03-10 20:38:04.000000000 +0100
@@ -1205,6 +1205,13 @@
void *callback_data = NULL;
UI_METHOD *ui_method = NULL;
+ const char *prompt_info_checked = NULL;
+ if (prompt_info)
+ {
+ if (0 != *prompt_info)
+ prompt_info_checked = prompt_info;
+ }
+
if (cactx)
{
if (cactx->ui_method)
@@ -1237,7 +1244,7 @@
{
int ok;
char *prompt = UI_construct_prompt(ui,
- "pass phrase", prompt_info);
+ "pass phrase", prompt_info_checked);
ok = UI_add_input_string(ui,prompt,
UI_INPUT_FLAG_DEFAULT_PWD,
@@ -1305,10 +1312,14 @@
{
char answer;
char buf[BUFSIZ];
+ memset(buf, 0, BUFSIZ);
if (wrong_info)
- BIO_snprintf(buf, sizeof(buf)-1,
- "Current card: \"%s\"\n", wrong_info);
+ {
+ if (0 != *wrong_info)
+ BIO_snprintf(buf, sizeof(buf)-1,
+ "Current card: \"%s\"\n", wrong_info);
+ }
ok = UI_dup_info_string(ui, buf);
if (ok >= 0 && prompt_info)
{