atalla.h 1.6 KB

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