|
Message-ID: <CAKGDhHVr+k9ihfMB7drQ7_hMWX1vCeGzrNzzT=_f-T6jWAigXQ@mail.gmail.com> Date: Thu, 11 Jun 2015 23:21:39 +0200 From: Agnieszka Bielec <bielecagnieszka8@...il.com> To: john-dev@...ts.openwall.com Subject: Re: PHC: Lyra2 on CPU I discovered a bug in Lyra2 (dowloaded from PHC site). in this code: #ifdef HAVE_SSSE3 #define _mm_roti_epi64(x, c) \ (-(c) == 32) ? _mm_shuffle_epi32((x), _MM_SHUFFLE(2,3,0,1)) \ : (-(c) == 24) ? _mm_shuffle_epi8((x), r24) \ : (-(c) == 16) ? _mm_shuffle_epi8((x), r16) \ : (-(c) == 63) ? _mm_xor_si128(_mm_srli_epi64((x), - (c)), _mm_add_epi64((x), (x))) \ : _mm_xor_si128(_mm_srli_epi64((x), -(c)), _mm_slli_epi64((x), 64-(-(c)))) #else #define _mm_roti_epi64(r, c) _mm_xor_si128(_mm_srli_epi64( (r), -(c) ),_mm_slli_epi64( (r), 64-(-c) )) compiler choose the line of code after #else although I have SSSE3. In this case code will compile. but there is blake2d with sse in john where checking SSSE3 works. but this code #define _mm_roti_epi64(x, c) \ (-(c) == 32) ? _mm_shuffle_epi32((x), _MM_SHUFFLE(2,3,0,1)) \ : (-(c) == 24) ? _mm_shuffle_epi8((x), r24) \ : (-(c) == 16) ? _mm_shuffle_epi8((x), r16) \ : (-(c) == 63) ? _mm_xor_si128(_mm_srli_epi64((x), - (c)), _mm_add_epi64((x), (x))) \ : _mm_xor_si128(_mm_srli_epi64((x), -(c)), _mm_slli_epi64((x), 64-(-(c)))) won't compile because r16 nor r24 aren't declared in this place. I modified static inline void spongeLyra(__m128i *v){ __m128i t0, t1; int i; #if (SPONGE == 0) for (i = 0; i < 12; i++){ ROUND_LYRAA(i); } #elif (SPONGE == 1) for (i = 0; i < 12; i++){ ROUND_LYRA_BLAMKA(i); } #elif (SPONGE == 2) for (i = 0; i < 24; i++){ HALF_ROUND_LYRA_BLAMKA(i); } #endif } to static inline void spongeLyra(__m128i *v){ __m128i t0, t1; int i; #if defined(__SSSE3__) && !defined(__XOP__) const __m128i r16 = _mm_setr_epi8( 2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9 ); const __m128i r24 = _mm_setr_epi8( 3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10 ); #endif #if (SPONGE == 0) for (i = 0; i < 12; i++){ ROUND_LYRAA(i); } #elif (SPONGE == 1) for (i = 0; i < 12; i++){ ROUND_LYRA_BLAMKA(i); } #elif (SPONGE == 2) for (i = 0; i < 24; i++){ HALF_ROUND_LYRA_BLAMKA(i); } #endif } and now I'm not getting errors during make that there is no r16 or r24. looking at the code also i see that r16 and r24 are not declared in this place. also when I modify Lyra2 downloaded from internet to choose the path where ssse3 is needed it doesn't compile
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.