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