mixmaster

mixmaster 3.0 patched for libressl
git clone git://parazyd.org/mixmaster.git
Log | Files | Refs | README

commit 006ae6687d33c6ec8fe79a437f7820fe29639be8
parent 50de79fe7f9e194b5a6bdd3a63fb3bdb455588a8
Author: parazyd <parazyd@dyne.org>
Date:   Mon, 19 Sep 2016 15:33:16 +0200

patch for libressl support

Diffstat:
MSrc/crypto.c | 34+++++++++++++++++-----------------
MSrc/pgpcreat.c | 22+++++++++++-----------
MSrc/pgpget.c | 20++++++++++----------
3 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/Src/crypto.c b/Src/crypto.c @@ -383,23 +383,23 @@ int pk_encrypt(BUFFER *in, BUFFER *keybuf) } int buf_crypt(BUFFER *buf, BUFFER *key, BUFFER *iv, int enc) { - des_key_schedule ks1; - des_key_schedule ks2; - des_key_schedule ks3; - des_cblock i; + DES_key_schedule ks1; + DES_key_schedule ks2; + DES_key_schedule ks3; + DES_cblock i; assert(enc == ENCRYPT || enc == DECRYPT); assert((key->length == 16 || key->length == 24) && iv->length == 8); assert(buf->length % 8 == 0); memcpy(i, iv->data, 8); /* leave iv buffer unchanged */ - des_set_key((const_des_cblock *) key->data, ks1); - des_set_key((const_des_cblock *) (key->data + 8), ks2); + DES_set_key((const_DES_cblock *) key->data, &ks1); + DES_set_key((const_DES_cblock *) (key->data + 8), &ks2); if (key->length == 16) - des_set_key((const_des_cblock *) key->data, ks3); + DES_set_key((const_DES_cblock *) key->data, &ks3); else - des_set_key((const_des_cblock *) (key->data + 16), ks3); - des_ede3_cbc_encrypt(buf->data, buf->data, buf->length, ks1, ks2, ks3, + DES_set_key((const_DES_cblock *) (key->data + 16), &ks3); + DES_ede3_cbc_encrypt(buf->data, buf->data, buf->length, &ks1, &ks2, &ks3, &i, enc); return (0); } @@ -407,18 +407,18 @@ int buf_crypt(BUFFER *buf, BUFFER *key, BUFFER *iv, int enc) int buf_3descrypt(BUFFER *buf, BUFFER *key, BUFFER *iv, int enc) { int n = 0; - des_key_schedule ks1; - des_key_schedule ks2; - des_key_schedule ks3; + DES_key_schedule ks1; + DES_key_schedule ks2; + DES_key_schedule ks3; assert(enc == ENCRYPT || enc == DECRYPT); assert(key->length == 24 && iv->length == 8); - des_set_key((const_des_cblock *) key->data, ks1); - des_set_key((const_des_cblock *) (key->data + 8), ks2); - des_set_key((const_des_cblock *) (key->data + 16), ks3); - des_ede3_cfb64_encrypt(buf->data, buf->data, buf->length, ks1, ks2, ks3, - (des_cblock *) iv->data, &n, enc); + DES_set_key((const_DES_cblock *) key->data, &ks1); + DES_set_key((const_DES_cblock *) (key->data + 8), &ks2); + DES_set_key((const_DES_cblock *) (key->data + 16), &ks3); + DES_ede3_cfb64_encrypt(buf->data, buf->data, buf->length, &ks1, &ks2, &ks3, + (DES_cblock *) iv->data, &n, enc); return (0); } diff --git a/Src/pgpcreat.c b/Src/pgpcreat.c @@ -158,11 +158,11 @@ static int pgp_ideaencrypt(BUFFER *in, BUFFER *out, BUFFER *key, int mdc) static int pgp_3desencrypt(BUFFER *in, BUFFER *out, BUFFER *key, int mdc) { - des_cblock iv; + DES_cblock iv; int i, n = 0; - des_key_schedule ks1; - des_key_schedule ks2; - des_key_schedule ks3; + DES_key_schedule ks1; + DES_key_schedule ks2; + DES_key_schedule ks3; SHA_CTX c; assert(key->length == 25); @@ -170,9 +170,9 @@ static int pgp_3desencrypt(BUFFER *in, BUFFER *out, BUFFER *key, int mdc) for (i = 0; i < 8; i++) iv[i] = 0; - des_set_key((const_des_cblock *) (key->data + 1), ks1); - des_set_key((const_des_cblock *) (key->data + 9), ks2); - des_set_key((const_des_cblock *) (key->data+ 17), ks3); + DES_set_key((const_DES_cblock *) (key->data + 1), &ks1); + DES_set_key((const_DES_cblock *) (key->data + 9), &ks2); + DES_set_key((const_DES_cblock *) (key->data+ 17), &ks3); if (mdc) { mdc = 1; @@ -186,21 +186,21 @@ static int pgp_3desencrypt(BUFFER *in, BUFFER *out, BUFFER *key, int mdc) SHA1_Update(&c, in->data, in->length); } n = 0; - des_ede3_cfb64_encrypt(out->data + mdc, out->data + mdc, 10, ks1, ks2, ks3, &iv, &n, + DES_ede3_cfb64_encrypt(out->data + mdc, out->data + mdc, 10, &ks1, &ks2, &ks3, &iv, &n, ENCRYPT); if (!mdc) { iv[6] = iv[0], iv[7] = iv[1]; memcpy(iv, out->data + 2, 6); n = 0; } - des_ede3_cfb64_encrypt(in->data, out->data + 10 + mdc, in->length, ks1, ks2, ks3, + DES_ede3_cfb64_encrypt(in->data, out->data + 10 + mdc, in->length, &ks1, &ks2, &ks3, &iv, &n, ENCRYPT); if (mdc) { SHA1_Update(&c, "\xD3\x14", 2); /* 0xD3 = 0xC0 | PGP_MDC */ - des_ede3_cfb64_encrypt("\xD3\x14", out->data + 11 + in->length, 2, ks1, ks2, ks3, + DES_ede3_cfb64_encrypt("\xD3\x14", out->data + 11 + in->length, 2, &ks1, &ks2, &ks3, &iv, &n, ENCRYPT); SHA1_Final(out->data + 13 + in->length, &c); - des_ede3_cfb64_encrypt(out->data + 13 + in->length, out->data + 13 + in->length, 20, ks1, ks2, ks3, + DES_ede3_cfb64_encrypt(out->data + 13 + in->length, out->data + 13 + in->length, 20, &ks1, &ks2, &ks3, &iv, &n, ENCRYPT); } return (0); diff --git a/Src/pgpget.c b/Src/pgpget.c @@ -400,12 +400,12 @@ end: static int pgp_3desdecrypt(BUFFER *in, BUFFER *out, BUFFER *key, int mdc) { int err = 0; - des_cblock iv; + DES_cblock iv; byte hdr[10]; int i, n; - des_key_schedule ks1; - des_key_schedule ks2; - des_key_schedule ks3; + DES_key_schedule ks1; + DES_key_schedule ks2; + DES_key_schedule ks3; SHA_CTX c; char md[20]; /* we could make hdr 20 bytes long and reuse it for md */ @@ -423,12 +423,12 @@ static int pgp_3desdecrypt(BUFFER *in, BUFFER *out, BUFFER *key, int mdc) for (i = 0; i < 8; i++) iv[i] = 0; - des_set_key((const_des_cblock *) key->data, ks1); - des_set_key((const_des_cblock *) (key->data + 8), ks2); - des_set_key((const_des_cblock *) (key->data+ 16), ks3); + DES_set_key((const_DES_cblock *) key->data, &ks1); + DES_set_key((const_DES_cblock *) (key->data + 8), &ks2); + DES_set_key((const_DES_cblock *) (key->data+ 16), &ks3); n = 0; - des_ede3_cfb64_encrypt(in->data + mdc, hdr, 10, ks1, ks2, ks3, &iv, &n, DECRYPT); + DES_ede3_cfb64_encrypt(in->data + mdc, hdr, 10, &ks1, &ks2, &ks3, &iv, &n, DECRYPT); if (n != 2 || hdr[8] != hdr[6] || hdr[9] != hdr[7]) { err = -1; goto end; @@ -441,8 +441,8 @@ static int pgp_3desdecrypt(BUFFER *in, BUFFER *out, BUFFER *key, int mdc) memcpy(iv, in->data + 2, 6); n = 0; } - des_ede3_cfb64_encrypt(in->data + 10 + mdc, out->data, in->length - 10 + mdc, ks1, - ks2, ks3, &iv, &n, DECRYPT); + DES_ede3_cfb64_encrypt(in->data + 10 + mdc, out->data, in->length - 10 + mdc, &ks1, + &ks2, &ks3, &iv, &n, DECRYPT); if (mdc) { if (out->length > 22) { out->length -= 22;