Skip to content

Commit 3d62896

Browse files
committed
Add documentation for wc_RsaDirect.
1 parent 12dafec commit 3d62896

3 files changed

Lines changed: 45 additions & 19 deletions

File tree

doc/dox_comments/header_files-ja/rsa.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// error initializing RSA key
1414
}
1515
\endcode
16-
\sa wc_RsaInitCavium
1716
\sa wc_FreeRsaKey
1817
\sa wc_RsaSetRNG
1918
*/
@@ -47,7 +46,6 @@ int wc_InitRsaKey(RsaKey* key, void* heap);
4746
}
4847
\endcode
4948
\sa wc_InitRsaKey
50-
\sa wc_RsaInitCavium
5149
\sa wc_FreeRsaKey
5250
\sa wc_RsaSetRNG
5351
*/

doc/dox_comments/header_files/rsa.h

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
}
2828
\endcode
2929
30-
\sa wc_RsaInitCavium
3130
\sa wc_FreeRsaKey
3231
\sa wc_RsaSetRNG
3332
*/
@@ -77,7 +76,6 @@ int wc_InitRsaKey(RsaKey* key, void* heap);
7776
\endcode
7877
7978
\sa wc_InitRsaKey
80-
\sa wc_RsaInitCavium
8179
\sa wc_FreeRsaKey
8280
\sa wc_RsaSetRNG
8381
*/
@@ -133,6 +131,51 @@ int wc_RsaSetRNG(RsaKey* key, WC_RNG* rng);
133131
*/
134132
int wc_FreeRsaKey(RsaKey* key);
135133

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+
136179
/*!
137180
\ingroup RSA
138181

wolfcrypt/src/rsa.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2868,21 +2868,6 @@ static int wc_RsaFunctionAsync(const byte* in, word32 inLen, byte* out,
28682868
#endif /* WOLFSSL_ASYNC_CRYPT && WC_ASYNC_ENABLE_RSA */
28692869

28702870
#if defined(WC_RSA_DIRECT) || defined(WC_RSA_NO_PADDING)
2871-
/* Function that does the RSA operation directly with no padding.
2872-
*
2873-
* in buffer to do operation on
2874-
* inLen length of input buffer
2875-
* out buffer to hold results
2876-
* outSz gets set to size of result buffer. Should be passed in as length
2877-
* of out buffer. If the pointer "out" is null then outSz gets set to
2878-
* the expected buffer size needed and LENGTH_ONLY_E gets returned.
2879-
* key RSA key to use for encrypt/decrypt
2880-
* type if using private or public key {RSA_PUBLIC_ENCRYPT,
2881-
* RSA_PUBLIC_DECRYPT, RSA_PRIVATE_ENCRYPT, RSA_PRIVATE_DECRYPT}
2882-
* rng wolfSSL RNG to use if needed
2883-
*
2884-
* returns size of result on success
2885-
*/
28862871
int wc_RsaDirect(byte* in, word32 inLen, byte* out, word32* outSz,
28872872
RsaKey* key, int type, WC_RNG* rng)
28882873
{

0 commit comments

Comments
 (0)