Re: nistp224 80-bit accuracy hack

Bruce Guenter <[email protected]> Wed, 17 Aug 2005 14:26:50 -0600
Newsgroups gmane.org.djb.miscellaneous
Message-ID <[email protected]>
--AqsLC8rIMeq19msA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Aug 17, 2005 at 04:28:47PM +0200, Felix von Leitner wrote:
> I was just playing with nistp224.  nistp224 relies on the fact that
> floating point numbers have 80-bit accuracy on x87 math hardware as long
> as they stay in registers.
>=20
> I wonder: if the operating system makes a context switch, the CPU state
> is saved.  Aren't at that point the floating point registers saved to
> memory as part of the context, losing the extra accuracy in the process?

No.  The FPU state, when it is dumped to memory, contains the exact
content of the registers.  AFAIK the x86 FPU includes instructions to
load and save 80-bit floating point values as well as the standard
64-bit ones.  You can even expose this extra precision by using "long
double" variables with recent GCCs.

> Besides, has anyone spent time converting nistp224 to assembly code that
> will also work with current gcc versions?

I wish.
--=20
Bruce Guenter <[email protected]> http://untroubled.org/
OpenPGP key: 699980E8 / D0B7 C8DD 365D A395 29DA  2E2A E96F B2DC 6999 80E8

--AqsLC8rIMeq19msA
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDA52K6W+y3GmZgOgRAm0gAJ0YWtjxYhSb2r4i3Vo8bSh7US45FgCgqeVz
PZJMjYbGTtula7T65vUzQqA=
=TeHe
-----END PGP SIGNATURE-----

--AqsLC8rIMeq19msA--