/[rdesktop]/sourceforge.net/trunk/rdesktop/secure.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/secure.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 207 by matthewc, Thu Sep 26 14:26:46 2002 UTC revision 295 by matthewc, Tue Jan 28 11:36:02 2003 UTC
# Line 285  reverse(uint8 * p, int len) Line 285  reverse(uint8 * p, int len)
285  static void  static void
286  sec_rsa_encrypt(uint8 * out, uint8 * in, int len, uint8 * modulus, uint8 * exponent)  sec_rsa_encrypt(uint8 * out, uint8 * in, int len, uint8 * modulus, uint8 * exponent)
287  {  {
288          BN_CTX ctx;          BN_CTX *ctx;
289          BIGNUM mod, exp, x, y;          BIGNUM mod, exp, x, y;
290          uint8 inr[SEC_MODULUS_SIZE];          uint8 inr[SEC_MODULUS_SIZE];
291          int outlen;          int outlen;
# Line 295  sec_rsa_encrypt(uint8 * out, uint8 * in, Line 295  sec_rsa_encrypt(uint8 * out, uint8 * in,
295          memcpy(inr, in, len);          memcpy(inr, in, len);
296          reverse(inr, len);          reverse(inr, len);
297    
298          BN_CTX_init(&ctx);          ctx = BN_CTX_new();
299          BN_init(&mod);          BN_init(&mod);
300          BN_init(&exp);          BN_init(&exp);
301          BN_init(&x);          BN_init(&x);
# Line 304  sec_rsa_encrypt(uint8 * out, uint8 * in, Line 304  sec_rsa_encrypt(uint8 * out, uint8 * in,
304          BN_bin2bn(modulus, SEC_MODULUS_SIZE, &mod);          BN_bin2bn(modulus, SEC_MODULUS_SIZE, &mod);
305          BN_bin2bn(exponent, SEC_EXPONENT_SIZE, &exp);          BN_bin2bn(exponent, SEC_EXPONENT_SIZE, &exp);
306          BN_bin2bn(inr, len, &x);          BN_bin2bn(inr, len, &x);
307          BN_mod_exp(&y, &x, &exp, &mod, &ctx);          BN_mod_exp(&y, &x, &exp, &mod, ctx);
308          outlen = BN_bn2bin(&y, out);          outlen = BN_bn2bin(&y, out);
309          reverse(out, outlen);          reverse(out, outlen);
310          if (outlen < SEC_MODULUS_SIZE)          if (outlen < SEC_MODULUS_SIZE)
# Line 314  sec_rsa_encrypt(uint8 * out, uint8 * in, Line 314  sec_rsa_encrypt(uint8 * out, uint8 * in,
314          BN_clear_free(&x);          BN_clear_free(&x);
315          BN_free(&exp);          BN_free(&exp);
316          BN_free(&mod);          BN_free(&mod);
317          BN_CTX_free(&ctx);          BN_CTX_free(ctx);
318  }  }
319    
320  /* Initialise secure transport packet */  /* Initialise secure transport packet */
# Line 631  sec_connect(char *server) Line 631  sec_connect(char *server)
631          sec_process_mcs_data(&mcs_data);          sec_process_mcs_data(&mcs_data);
632          if (encryption)          if (encryption)
633                  sec_establish_key();                  sec_establish_key();
634            xfree(mcs_data.data);
635          return True;          return True;
636  }  }
637    

Legend:
Removed from v.207  
changed lines
  Added in v.295

  ViewVC Help
Powered by ViewVC 1.1.26