Index: sys/crypto/aesni/aesni_ghash.c =================================================================== --- sys/crypto/aesni/aesni_ghash.c +++ sys/crypto/aesni/aesni_ghash.c @@ -534,7 +534,7 @@ const unsigned char *tag, uint32_t nbytes, uint32_t abytes, int ibytes, const unsigned char *key, int nr) { - int i, j ,k; + int i, j, k, resid; __m128i tmp1, tmp2, tmp3, tmp4; __m128i tmp5, tmp6, tmp7, tmp8; __m128i H, H2, H3, H4, Y, T; @@ -790,7 +790,8 @@ _mm_storeu_si128(&((__m128i*)out)[k], tmp1); } //If remains one incomplete block - if (nbytes%16) { + resid = nbytes % 16; + if (resid != 0) { tmp1 = _mm_shuffle_epi8(ctr1, BSWAP_EPI64); tmp1 = _mm_xor_si128(tmp1, KEY[0]); for (j=1; j