Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

52 linhas
1.4 KiB

  1. // +build amd64,!noasm
  2. package p751
  3. import (
  4. . "github.com/cloudflare/sidh/internal/isogeny"
  5. // This is imported only because arith_amd64.s needs
  6. // some symbols from cpuid.go
  7. _ "github.com/cloudflare/sidh/internal/utils"
  8. )
  9. // If choice = 0, leave x,y unchanged. If choice = 1, set x,y = y,x.
  10. // If choice is neither 0 nor 1 then behaviour is undefined.
  11. // This function executes in constant time.
  12. //go:noescape
  13. func fp751ConditionalSwap(x, y *FpElement, choice uint8)
  14. // Compute z = x + y (mod p).
  15. //go:noescape
  16. func fp751AddReduced(z, x, y *FpElement)
  17. // Compute z = x - y (mod p).
  18. //go:noescape
  19. func fp751SubReduced(z, x, y *FpElement)
  20. // Compute z = x + y, without reducing mod p.
  21. //go:noescape
  22. func fp751AddLazy(z, x, y *FpElement)
  23. // Compute z = x + y, without reducing mod p.
  24. //go:noescape
  25. func fp751X2AddLazy(z, x, y *FpElementX2)
  26. // Compute z = x - y, without reducing mod p.
  27. //go:noescape
  28. func fp751X2SubLazy(z, x, y *FpElementX2)
  29. // Compute z = x * y.
  30. //go:noescape
  31. func fp751Mul(z *FpElementX2, x, y *FpElement)
  32. // Function pointer that should point to one of the
  33. // fp751MontgomeryReduce implementations below.
  34. // When set, it performs Montgomery reduction: set z = x R^{-1} (mod 2*p).
  35. // It may destroy the input value.
  36. //go:noescape
  37. func fp751MontgomeryReduce(z *FpElement, x *FpElementX2)
  38. // Reduce a field element in [0, 2*p) to one in [0,p).
  39. //go:noescape
  40. func fp751StrongReduce(x *FpElement)