floodyberry/curve25519-donna — pull request #1 by nmathewson (2013-09-07 03:01:34+00:00)
Title: Fix strict compiler warnings

Hi! I work on Tor. We're currently using Adam's curve25519-donna for our default curve25519 implementation, and we're planning to move to yours.

Tor currently builds with lots of compiler warnings turned on. For example, with gcc 4.7 we say:
``` -D_FORTIFY_SOURCE=2 -fstack-protector-all -Wstack-protector -fwrapv --param ssp-buffer-size=1
-fPIE -Wall -fno-strict-aliasing -Wno-deprecated-declarations -W -Wfloat-equal -Wundef -Wpointer-arith
-Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment
-Wformat=2 -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wbad-function-cast
-Wswitch-enum -Werror -Winit-self -Wmissing-field-initializers -Wdeclaration-after-statement
-Wold-style-definition -Waddress -Wmissing-noreturn -Wstrict-overflow=1 -Wnormalized=id -Woverride-init
-Wextra -Warray-bounds```

With all that, it's pretty impressive that your donna branch (which we're tentatively calling donna-fb when we need to distinguish it from Adam's) only got three warnings when I tried merging it.

(I note that the "implicit narrowing" one won't come up on 32-bit systems, where curve25519-donna.c is meant to build. Nevertheless, I'd like to be able to use the curve25519-donna.c implementation as a fallback of last resort in case we ever need to build somewhere where the uint128_t stuff in donna-c64.c simply won't work.)

I'm happy to maintain these on our own if need be, but I hate to diverge from upstream code, especially when crypto is involved.

What do you think?