|
27 | 27 | } |
28 | 28 | \endcode |
29 | 29 |
|
30 | | - \sa wc_RsaInitCavium |
31 | 30 | \sa wc_FreeRsaKey |
32 | 31 | \sa wc_RsaSetRNG |
33 | 32 | */ |
@@ -77,7 +76,6 @@ int wc_InitRsaKey(RsaKey* key, void* heap); |
77 | 76 | \endcode |
78 | 77 |
|
79 | 78 | \sa wc_InitRsaKey |
80 | | - \sa wc_RsaInitCavium |
81 | 79 | \sa wc_FreeRsaKey |
82 | 80 | \sa wc_RsaSetRNG |
83 | 81 | */ |
@@ -133,6 +131,51 @@ int wc_RsaSetRNG(RsaKey* key, WC_RNG* rng); |
133 | 131 | */ |
134 | 132 | int wc_FreeRsaKey(RsaKey* key); |
135 | 133 |
|
| 134 | +/*! |
| 135 | + \ingroup RSA |
| 136 | +
|
| 137 | + \brief Function that does the RSA operation directly with no padding. The input |
| 138 | + size must match key size. Typically this is |
| 139 | + used when padding is already done on the RSA input. |
| 140 | +
|
| 141 | + \return size On successfully encryption the size of the encrypted buffer |
| 142 | + is returned |
| 143 | + \return RSA_BUFFER_E RSA buffer error, output too small or input too large |
| 144 | +
|
| 145 | + \param in buffer to do operation on |
| 146 | + \param inLen length of input buffer |
| 147 | + \param out buffer to hold results |
| 148 | + \param outSz gets set to size of result buffer. Should be passed in as length |
| 149 | + of out buffer. If the pointer "out" is null then outSz gets set to the |
| 150 | + expected buffer size needed and LENGTH_ONLY_E gets returned. |
| 151 | + \param key initialized RSA key to use for encrypt/decrypt |
| 152 | + \param type if using private or public key (RSA_PUBLIC_ENCRYPT, |
| 153 | + RSA_PUBLIC_DECRYPT, RSA_PRIVATE_ENCRYPT, RSA_PRIVATE_DECRYPT) |
| 154 | + \param rng initialized WC_RNG struct |
| 155 | +
|
| 156 | + _Example_ |
| 157 | + \code |
| 158 | + int ret; |
| 159 | + WC_RNG rng; |
| 160 | + RsaKey key; |
| 161 | + byte in[256]; |
| 162 | + byte out[256]; |
| 163 | + word32 outSz = (word32)sizeof(out); |
| 164 | + … |
| 165 | +
|
| 166 | + ret = wc_RsaDirect(in, (word32)sizeof(in), out, &outSz, &key, |
| 167 | + RSA_PRIVATE_ENCRYPT, &rng); |
| 168 | + if (ret < 0) { |
| 169 | + //handle error |
| 170 | + } |
| 171 | + \endcode |
| 172 | +
|
| 173 | + \sa wc_RsaPublicEncrypt |
| 174 | + \sa wc_RsaPrivateDecrypt |
| 175 | +*/ |
| 176 | +int wc_RsaDirect(byte* in, word32 inLen, byte* out, word32* outSz, |
| 177 | + RsaKey* key, int type, WC_RNG* rng); |
| 178 | + |
136 | 179 | /*! |
137 | 180 | \ingroup RSA |
138 | 181 |
|
|
0 commit comments