patch-Src_pgpcreat_c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. $OpenBSD: patch-Src_pgpcreat_c,v 1.1 2014/04/14 20:53:58 naddy Exp $
  2. --- Src/pgpcreat.c.orig Sun Nov 9 12:09:44 2003
  3. +++ Src/pgpcreat.c Mon Apr 14 21:37:16 2014
  4. @@ -159,11 +159,11 @@ static int pgp_ideaencrypt(BUFFER *in, BUFFER *out, BU
  5. static int pgp_3desencrypt(BUFFER *in, BUFFER *out, BUFFER *key, int mdc)
  6. {
  7. - des_cblock iv;
  8. + DES_cblock iv;
  9. int i, n = 0;
  10. - des_key_schedule ks1;
  11. - des_key_schedule ks2;
  12. - des_key_schedule ks3;
  13. + DES_key_schedule ks1;
  14. + DES_key_schedule ks2;
  15. + DES_key_schedule ks3;
  16. SHA_CTX c;
  17. assert(key->length == 25);
  18. @@ -171,9 +171,9 @@ static int pgp_3desencrypt(BUFFER *in, BUFFER *out, BU
  19. for (i = 0; i < 8; i++)
  20. iv[i] = 0;
  21. - des_set_key((const_des_cblock *) (key->data + 1), ks1);
  22. - des_set_key((const_des_cblock *) (key->data + 9), ks2);
  23. - des_set_key((const_des_cblock *) (key->data+ 17), ks3);
  24. + DES_set_key((const_DES_cblock *) (key->data + 1), &ks1);
  25. + DES_set_key((const_DES_cblock *) (key->data + 9), &ks2);
  26. + DES_set_key((const_DES_cblock *) (key->data+ 17), &ks3);
  27. if (mdc) {
  28. mdc = 1;
  29. @@ -187,21 +187,21 @@ static int pgp_3desencrypt(BUFFER *in, BUFFER *out, BU
  30. SHA1_Update(&c, in->data, in->length);
  31. }
  32. n = 0;
  33. - des_ede3_cfb64_encrypt(out->data + mdc, out->data + mdc, 10, ks1, ks2, ks3, &iv, &n,
  34. + DES_ede3_cfb64_encrypt(out->data + mdc, out->data + mdc, 10, &ks1, &ks2, &ks3, &iv, &n,
  35. ENCRYPT);
  36. if (!mdc) {
  37. iv[6] = iv[0], iv[7] = iv[1];
  38. memcpy(iv, out->data + 2, 6);
  39. n = 0;
  40. }
  41. - des_ede3_cfb64_encrypt(in->data, out->data + 10 + mdc, in->length, ks1, ks2, ks3,
  42. + DES_ede3_cfb64_encrypt(in->data, out->data + 10 + mdc, in->length, &ks1, &ks2, &ks3,
  43. &iv, &n, ENCRYPT);
  44. if (mdc) {
  45. SHA1_Update(&c, "\xD3\x14", 2); /* 0xD3 = 0xC0 | PGP_MDC */
  46. - des_ede3_cfb64_encrypt("\xD3\x14", out->data + 11 + in->length, 2, ks1, ks2, ks3,
  47. + DES_ede3_cfb64_encrypt("\xD3\x14", out->data + 11 + in->length, 2, &ks1, &ks2, &ks3,
  48. &iv, &n, ENCRYPT);
  49. SHA1_Final(out->data + 13 + in->length, &c);
  50. - des_ede3_cfb64_encrypt(out->data + 13 + in->length, out->data + 13 + in->length, 20, ks1, ks2, ks3,
  51. + DES_ede3_cfb64_encrypt(out->data + 13 + in->length, out->data + 13 + in->length, 20, &ks1, &ks2, &ks3,
  52. &iv, &n, ENCRYPT);
  53. }
  54. return (0);