--- secure.c.orig	2002-12-31 11:58:07.000000000 +0100
+++ secure.c	2002-12-31 11:59:03.000000000 +0100
@@ -20,10 +20,10 @@
 
 #include "rdesktop.h"
 
-#include <rc4.h>
-#include <md5.h>
-#include <sha.h>
-#include <bn.h>
+#include "openssl/rc4.h"
+#include "openssl/md5.h"
+#include "openssl/sha.h"
+#include "openssl/bn.h"
 
 extern char *hostname;
 extern int width;
@@ -280,7 +280,7 @@
 sec_rsa_encrypt(uint8 *out, uint8 *in, int len,
 		uint8 *modulus, uint8 *exponent)
 {
-	BN_CTX ctx;
+	BN_CTX *ctx;
 	BIGNUM mod, exp, x, y;
 	uint8 inr[SEC_MODULUS_SIZE];
 	int outlen;
@@ -290,7 +290,8 @@
 	memcpy(inr, in, len);
 	reverse(inr, len);
 
-	BN_CTX_init(&ctx);
+	ctx = BN_CTX_new();
+	BN_CTX_init(ctx);
 	BN_init(&mod);
 	BN_init(&exp);
 	BN_init(&x);
@@ -299,7 +300,7 @@
 	BN_bin2bn(modulus, SEC_MODULUS_SIZE, &mod);
 	BN_bin2bn(exponent, SEC_EXPONENT_SIZE, &exp);
 	BN_bin2bn(inr, len, &x);
-	BN_mod_exp(&y, &x, &exp, &mod, &ctx);
+	BN_mod_exp(&y, &x, &exp, &mod, ctx);
 	outlen = BN_bn2bin(&y, out);
 	reverse(out, outlen);
 	if (outlen < SEC_MODULUS_SIZE)
@@ -309,7 +310,7 @@
 	BN_clear_free(&x);
 	BN_free(&exp);
 	BN_free(&mod);
-	BN_CTX_free(&ctx);
+	BN_CTX_free(ctx);
 }
 
 
