tls_rsa.h 955 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright (C) 2017 Denys Vlasenko
  3. *
  4. * Licensed under GPLv2, see file LICENSE in this source tree.
  5. *
  6. * Selected few declarations for RSA.
  7. */
  8. typedef struct {
  9. pstm_int e, d, N, qP, dP, dQ, p, q;
  10. uint32 size; /* Size of the key in bytes */
  11. int32 optimized; /* 1 for optimized */
  12. //bbox psPool_t *pool;
  13. } psRsaKey_t;
  14. static ALWAYS_INLINE void psRsaKey_clear(psRsaKey_t *key)
  15. {
  16. pstm_clear(&key->N);
  17. pstm_clear(&key->e);
  18. pstm_clear(&key->d);
  19. pstm_clear(&key->p);
  20. pstm_clear(&key->q);
  21. pstm_clear(&key->dP);
  22. pstm_clear(&key->dQ);
  23. pstm_clear(&key->qP);
  24. }
  25. #define psRsaEncryptPub(pool, key, in, inlen, out, outlen, data) \
  26. psRsaEncryptPub( key, in, inlen, out, outlen)
  27. int32 psRsaEncryptPub(psPool_t *pool, psRsaKey_t *key,
  28. unsigned char *in, uint32 inlen,
  29. unsigned char *out, uint32 outlen, void *data) FAST_FUNC;