diff --git a/ChangeLog b/ChangeLog index 950a19645501bd74941e64dc3e6c5230d6d68458..2208874c876662477986e84591aa9ef22ea00b55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2016-03-15 Niels Möller <nisse@lysator.liu.se> + * blowfish.c (blowfish_encrypt, blowfish_decrypt): Use READ_UINT32 + macro. Fixes an undefined shift, reported by Nikos + Mavrogiannopoulos. + From Nikos Mavrogiannopoulos. * configure.ac (HOGWEED_EXTRA_SYMBOLS): Add "mp_*", when building with mini-gmp. diff --git a/blowfish.c b/blowfish.c index ba921e71bce0dea2e9831813c2153d70e5da983d..52040f13f2b01a67875ad61a905bfb4908f83fda 100644 --- a/blowfish.c +++ b/blowfish.c @@ -337,8 +337,8 @@ blowfish_encrypt (const struct blowfish_ctx *ctx, { uint32_t d1, d2; - d1 = src[0] << 24 | src[1] << 16 | src[2] << 8 | src[3]; - d2 = src[4] << 24 | src[5] << 16 | src[6] << 8 | src[7]; + d1 = READ_UINT32(src); + d2 = READ_UINT32(src+4); encrypt (ctx, &d1, &d2); dst[0] = (d1 >> 24) & 0xff; dst[1] = (d1 >> 16) & 0xff; @@ -359,8 +359,8 @@ blowfish_decrypt (const struct blowfish_ctx *ctx, { uint32_t d1, d2; - d1 = src[0] << 24 | src[1] << 16 | src[2] << 8 | src[3]; - d2 = src[4] << 24 | src[5] << 16 | src[6] << 8 | src[7]; + d1 = READ_UINT32(src); + d2 = READ_UINT32(src+4); decrypt (ctx, &d1, &d2); dst[0] = (d1 >> 24) & 0xff; dst[1] = (d1 >> 16) & 0xff;