libgcrypt-1.7 fails self-test for all 'basic' with 'Checksum error' (log attached)

Werner Koch wk at
Fri Apr 29 08:30:05 CEST 2016

On Thu, 28 Apr 2016 17:09, jussi.kivilinna at said:

> Looks as this is caused by some compiler error. I reproduced this with
> gcc-5.3 on Ubuntu 16.04.
> With -O3 optimization level, gcc inlines _gcry_cipher_ocb_get_l, 
> double_block_cpy and double_block to _gcry_cipher_ocb_authenticate.

Thanks for your analysis.

> Simple workaround that avoid this is to add __attribute__((noinline))
> for _gcry_cipher_ocb_get_l to prevent inlining inside cipher-ocb.c.

I do not think this is a good idea because this only works around the
gcc bug at in at this place.  Fortunately we detected this but we can't
know whether this problem is lurking at other places at well.   Instead
we should 

  - check whether this bug has been fixed in a later gcc version
  - report the bug to gcc if it is not yet known
  - add a hint to Libgcrypt's README telling that some gcc versions
    create wrong code when using -O3.



Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

More information about the Gcrypt-devel mailing list