Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.6 KiB

  1. /* rsa_fast.h
  2. *
  3. * Headers for performance critical RSA routines.
  4. */
  5. /*
  6. *
  7. * #defines used by RSA routines
  8. */
  9. #define DIGIT_BYTES 4
  10. #define DIGIT_BITS 32
  11. #define DIGIT_HIBIT 0x80000000
  12. #define DIGIT_ALLONES 0xffffffff
  13. #define ULTRA unsigned __int64
  14. #define U_RADIX (ULTRA)0x100000000
  15. #ifndef BIGENDIAN
  16. #define LODWORD(x) (DWORD)(x & DIGIT_ALLONES)
  17. #else
  18. #define LODWORD(x) (DWORD)(x)
  19. #endif
  20. // warning!!!!!
  21. // the following macro defines a highspeed 32 bit right shift by modeling an ULTRA
  22. // as a low dword followed by a high dword. We just pick up the high dword instead
  23. // of shifting.
  24. #ifndef BIGENDIAN
  25. #define HIDWORD(x) (DWORD)(*(((DWORD *)&x)+1))
  26. #else
  27. #define HIDWORD(x) (DWORD)(*(((DWORD *)&x)))
  28. #endif
  29. // Sub(A, B, C, N)
  30. // A = B - C
  31. // All operands are N DWORDS long.
  32. DWORD Sub(LPDWORD A, LPDWORD B, LPDWORD C, DWORD N);
  33. // Add(A, B, C, N)
  34. // A = B + C
  35. // All operands are N DWORDS long.
  36. DWORD Add(LPDWORD A, LPDWORD B, LPDWORD C, DWORD N);
  37. // BaseMult(A, B, C, N)
  38. // A = B * C
  39. // returns A[N]
  40. // All operands are N DWORDS long.
  41. DWORD BaseMult(LPDWORD A, DWORD B, LPDWORD C, DWORD N);
  42. // Accumulate(A, B, C, N)
  43. // A = A + B * C
  44. // returns A[N]
  45. // All operands are N DWORDS long.
  46. DWORD Accumulate(LPDWORD A, DWORD B, LPDWORD C, DWORD N);
  47. // Reduce(A, B, C, N)
  48. // A = A - C * B
  49. // returns -A[N]
  50. // All operands are N DWORDS long.
  51. DWORD Reduce(LPDWORD A, DWORD B, LPDWORD C, DWORD N);
  52. // square the digits in B, and add them to A
  53. void AccumulateSquares(LPDWORD A, LPDWORD B, DWORD blen);