atalla.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* This header declares the necessary definitions for using the exponentiation
  2. * acceleration capabilities of Atalla cards. The only cryptographic operation
  3. * is performed by "ASI_RSAPrivateKeyOpFn" and this takes a structure that
  4. * defines an "RSA private key". However, it is really only performing a
  5. * regular mod_exp using the supplied modulus and exponent - no CRT form is
  6. * being used. Hence, it is a generic mod_exp function in disguise, and we use
  7. * it as such.
  8. *
  9. * Thanks to the people at Atalla for letting me know these definitions are
  10. * fine and that they can be reproduced here.
  11. *
  12. * Geoff.
  13. */
  14. typedef struct ItemStr
  15. {
  16. unsigned char *data;
  17. int len;
  18. } Item;
  19. typedef struct RSAPrivateKeyStr
  20. {
  21. void *reserved;
  22. Item version;
  23. Item modulus;
  24. Item publicExponent;
  25. Item privateExponent;
  26. Item prime[2];
  27. Item exponent[2];
  28. Item coefficient;
  29. } RSAPrivateKey;
  30. /* Predeclare the function pointer types that we dynamically load from the DSO.
  31. * These use the same names and form that Ben's original support code had (in
  32. * crypto/bn/bn_exp.c) unless of course I've inadvertently changed the style
  33. * somewhere along the way!
  34. */
  35. typedef int tfnASI_GetPerformanceStatistics(int reset_flag,
  36. unsigned int *ret_buf);
  37. typedef int tfnASI_GetHardwareConfig(long card_num, unsigned int *ret_buf);
  38. typedef int tfnASI_RSAPrivateKeyOpFn(RSAPrivateKey * rsaKey,
  39. unsigned char *output,
  40. unsigned char *input,
  41. unsigned int modulus_len);