Skip to content

Commit 3b5d0aa

Browse files
committed
Fix up whitespace changes from editor autoformat
1 parent f9af463 commit 3b5d0aa

1 file changed

Lines changed: 19 additions & 13 deletions

File tree

  • doc/dox_comments/header_files

doc/dox_comments/header_files/rsa.h

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
int ret;
2424
ret = wc_InitRsaKey(&enc, NULL); // not using heap hint. No custom memory
2525
if ( ret != 0 ) {
26-
// error initializing RSA key
26+
// error initializing RSA key
2727
}
2828
\endcode
2929
@@ -166,7 +166,7 @@ int wc_FreeRsaKey(RsaKey* key);
166166
ret = wc_RsaDirect(in, (word32)sizeof(in), out, &outSz, &key,
167167
RSA_PRIVATE_ENCRYPT, &rng);
168168
if (ret < 0) {
169-
//handle error
169+
//handle error
170170
}
171171
\endcode
172172
@@ -240,7 +240,7 @@ int wc_RsaDirect(byte* in, word32 inLen, byte* out, word32* outSz,
240240
// initialize with received public key parameters
241241
ret = wc_RsaPublicEncrypt(msg, sizeof(msg), out, sizeof(out), &pub, &rng);
242242
if ( ret != 0 ) {
243-
// error encrypting message
243+
// error encrypting message
244244
}
245245
\endcode
246246
@@ -333,6 +333,12 @@ int wc_RsaPrivateDecrypt(const byte* in, word32 inLen, byte* out,
333333
if (ret < 0) {
334334
return -1;
335335
}
336+
if (ret != inLen) {
337+
return -1;
338+
}
339+
if (XMEMCMP(in, plain, ret) != 0) {
340+
return -1;
341+
}
336342
\endcode
337343
338344
\sa wc_RsaPad
@@ -1043,7 +1049,7 @@ int wc_RsaEncryptSize(RsaKey* key);
10431049
wc_InitRsaKey(&enc, NULL); // not using heap hint. No custom memory
10441050
ret = wc_RsaPrivateKeyDecode(der, &idx, &enc, sizeof(der));
10451051
if( ret != 0 ) {
1046-
// error parsing private key
1052+
// error parsing private key
10471053
}
10481054
\endcode
10491055
@@ -1093,7 +1099,7 @@ int wc_RsaPrivateKeyDecode(const byte* input, word32* inOutIdx,
10931099
wc_InitRsaKey(&pub, NULL); // not using heap hint. No custom memory
10941100
ret = wc_RsaPublicKeyDecode(der, &idx, &pub, sizeof(der));
10951101
if( ret != 0 ) {
1096-
// error parsing public key
1102+
// error parsing public key
10971103
}
10981104
\endcode
10991105
@@ -1138,7 +1144,7 @@ int wc_RsaPublicKeyDecode(const byte* input, word32* inOutIdx,
11381144
wc_InitRsaKey(&pub, NULL); // not using heap hint. No custom memory
11391145
ret = wc_RsaPublicKeyDecodeRaw(n, sizeof(n), e, sizeof(e), &pub);
11401146
if( ret != 0 ) {
1141-
// error parsing public key elements
1147+
// error parsing public key elements
11421148
}
11431149
\endcode
11441150
@@ -1221,7 +1227,7 @@ int wc_RsaKeyToDer(RsaKey* key, byte* output, word32 inLen);
12211227
ret = wc_RsaPublicEncrypt_ex(in, sizeof(in), out, sizeof(out), &key, &rng,
12221228
WC_RSA_OAEP_PAD, WC_HASH_TYPE_SHA, WC_MGF1SHA1, NULL, 0);
12231229
if (ret < 0) {
1224-
//handle error
1230+
//handle error
12251231
}
12261232
\endcode
12271233
@@ -1268,14 +1274,14 @@ int wc_RsaPublicEncrypt_ex(const byte* in, word32 inLen, byte* out,
12681274
ret = wc_RsaPublicEncrypt_ex(in, sizeof(in), out, sizeof(out), &key,
12691275
&rng, WC_RSA_OAEP_PAD, WC_HASH_TYPE_SHA, WC_MGF1SHA1, NULL, 0);
12701276
if (ret < 0) {
1271-
//handle error
1277+
//handle error
12721278
}
12731279
12741280
ret = wc_RsaPrivateDecrypt_ex(out, ret, plain, sizeof(plain), &key,
12751281
WC_RSA_OAEP_PAD, WC_HASH_TYPE_SHA, WC_MGF1SHA1, NULL, 0);
12761282
12771283
if (ret < 0) {
1278-
//handle error
1284+
//handle error
12791285
}
12801286
\endcode
12811287
@@ -1326,14 +1332,14 @@ int wc_RsaPrivateDecrypt_ex(const byte* in, word32 inLen,
13261332
&rng, WC_RSA_OAEP_PAD, WC_HASH_TYPE_SHA, WC_MGF1SHA1, NULL, 0);
13271333
13281334
if (ret < 0) {
1329-
//handle error
1335+
//handle error
13301336
}
13311337
13321338
ret = wc_RsaPrivateDecryptInline_ex(out, ret, &plain, &key,
13331339
WC_RSA_OAEP_PAD, WC_HASH_TYPE_SHA, WC_MGF1SHA1, NULL, 0);
13341340
13351341
if (ret < 0) {
1336-
//handle error
1342+
//handle error
13371343
}
13381344
\endcode
13391345
@@ -1376,7 +1382,7 @@ int wc_RsaPrivateDecryptInline_ex(byte* in, word32 inLen,
13761382
...
13771383
ret = wc_RsaFlattenPublicKey(&key, e, &eSz, n, &nSz);
13781384
if (ret != 0) {
1379-
// Failure case.
1385+
// Failure case.
13801386
}
13811387
\endcode
13821388
@@ -1522,7 +1528,7 @@ int wc_RsaKeyToPublicDer_ex(RsaKey* key, byte* output, word32 inLen,
15221528
// generate 2048 bit long private key
15231529
ret = wc_MakeRsaKey(&priv, 2048, e, &rng);
15241530
if( ret != 0 ) {
1525-
// error generating private key
1531+
// error generating private key
15261532
}
15271533
\endcode
15281534

0 commit comments

Comments
 (0)