libgcrypt-1.9.2: cipher/poly1305.c does not compile on i686/32 with gcc-4.7.3 ( --disable-asm does not work)

horst.wente at posteo.de horst.wente at posteo.de
Tue Mar 2 00:02:14 CET 2021


Hello!

The "#define ADD_1305_32" ( for "defined (__i386__) && __GNUC__ >= 4" ) 
leads to

> poly1305.c: In function 'poly1305_blocks':
> poly1305.c:424:7: error: can't find a register in class 'GENERAL_REGS' 
> while
     reloading 'asm'
> poly1305.c:424:7: error: 'asm' operand has impossible constraints

I suppose the template uses too many registers, so I redefined it and it 
seems to
work for me ( all tests successful ).

hth
horst wente


--- cipher/poly1305.c.orig      2021-01-28 13:53:52.000000000 +0100
+++ cipher/poly1305.c   2021-03-01 20:25:26.000000000 +0100
@@ -314,14 +314,19 @@

  /* A += B (i386) */
  #define ADD_1305_32(A4, A3, A2, A1, A0, B4, B3, B2, B1, B0) \
-      __asm__ ("addl %5, %0\n" \
-              "adcl %6, %1\n" \
-              "adcl %7, %2\n" \
-              "adcl %8, %3\n" \
-              "adcl %9, %4\n" \
-              : "+r" (A0), "+r" (A1), "+r" (A2), "+r" (A3), "+r" (A4) \
-              : "g" (B0), "g" (B1), "g" (B2), "g" (B3), "g" (B4) \
-              : "cc" )
+      __asm__ ("clc\n"         \
+               "addl %5, %0\n" \
+               "movl %6, %5\n" \
+               "adcl %5, %1\n" \
+               "movl %7, %5\n" \
+               "adcl %5, %2\n" \
+               "movl %8, %5\n" \
+               "adcl %5, %3\n" \
+               "movl %9, %5\n" \
+               "adcl %5, %4\n" \
+               : "+m" (A0), "+m" (A1), "+m" (A2), "+m" (A3), "+m" (A4)  
\
+               : "r" (B0), "g" (B1), "g" (B2), "g" (B3), "g" (B4)       
\
+               : "cc" )

  #endif /* __i386__ */




More information about the Gcrypt-devel mailing list