  EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x);
  int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x);
  
+diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c
+index a29821a..5525efd 100644
+--- a/crypto/pem/pem_lib.c
++++ b/crypto/pem/pem_lib.c
+@@ -84,7 +84,7 @@ int pem_check_suffix(const char *pem_str, const char *suffix);
+ 
+ int PEM_def_callback(char *buf, int num, int w, void *key)
+ {
+-#ifdef OPENSSL_NO_FP_API
++#if defined(OPENSSL_NO_FP_API) || defined(OPENSSL_NO_UI)
+     /*
+      * We should not ever call the default callback routine from windows.
+      */
 diff --git a/crypto/pem/pem_pk8.c b/crypto/pem/pem_pk8.c
 index 5747c73..fe465cc 100644
 --- a/crypto/pem/pem_pk8.c

 
 /*
  * Borland C seems too stupid to be able to shift and do longs in the
diff --git a/crypto/opensslconf.h.in b/crypto/opensslconf.h.in
index 7a1c85d..7162c0f 100644
--- a/crypto/opensslconf.h.in

 
 # define M_ASN1_New(arg,func) \
         if (((arg)=func()) == NULL) return(NULL)
diff --git a/crypto/asn1/n_pkey.c b/crypto/asn1/n_pkey.c
index d5a5514..bede55c 100644
--- a/crypto/asn1/n_pkey.c
+++ b/crypto/asn1/n_pkey.c
@@ -193,7 +193,12 @@ int i2d_RSA_NET(const RSA *a, unsigned char **pp,
     OPENSSL_cleanse(pkey->private_key->data, rsalen);
 
     if (cb == NULL)
+#ifndef OPENSSL_NO_UI
         cb = EVP_read_pw_string;
+#else
+        i = 1;
+    else
+#endif
     i = cb((char *)buf, 256, "Enter Private Key password:", 1);
     if (i != 0) {
         ASN1err(ASN1_F_I2D_RSA_NET, ASN1_R_BAD_PASSWORD_READ);
@@ -264,7 +269,11 @@ RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,
         goto err;
     }
     if (cb == NULL)
+#ifndef OPENSSL_NO_UI
         cb = EVP_read_pw_string;
+#else
+        goto err;
+#endif
     if ((ret = d2i_RSA_NET_2(a, enckey->enckey->digest, cb, sgckey)) == NULL)
         goto err;
 
diff --git a/crypto/bn/bn_prime.c b/crypto/bn/bn_prime.c
index 1d25687..e933ead 100644
--- a/crypto/bn/bn_prime.c
