add comments to RSA funcs, fix 80 char line limits

This commit is contained in:
Chris Conlon
2015-03-18 10:06:48 -06:00
parent 6b0bfa1b2c
commit 913240f6e4
2 changed files with 12 additions and 8 deletions

View File

@@ -1272,8 +1272,9 @@ int wc_RsaPublicKeyDecode(const byte* input, word32* inOutIdx, RsaKey* key,
return 0;
}
int wc_RsaPublicKeyDecodeRaw(const byte* n, word32 nSz, const byte* e, word32 eSz,
RsaKey* key)
/* import RSA public key elements (n, e) into RsaKey structure (key) */
int wc_RsaPublicKeyDecodeRaw(const byte* n, word32 nSz, const byte* e,
word32 eSz, RsaKey* key)
{
if (n == NULL || e == NULL || key == NULL)
return BAD_FUNC_ARG;

View File

@@ -302,8 +302,8 @@ static int RsaUnPad(const byte *pkcsBlock, unsigned int pkcsBlockLen,
}
static int wc_RsaFunction(const byte* in, word32 inLen, byte* out, word32* outLen,
int type, RsaKey* key)
static int wc_RsaFunction(const byte* in, word32 inLen, byte* out,
word32* outLen, int type, RsaKey* key)
{
#define ERROR_OUT(x) { ret = (x); goto done;}
@@ -416,7 +416,8 @@ int wc_RsaPublicEncrypt(const byte* in, word32 inLen, byte* out, word32 outLen,
if (ret != 0)
return ret;
if ((ret = wc_RsaFunction(out, sz, out, &outLen, RSA_PUBLIC_ENCRYPT, key)) < 0)
if ((ret = wc_RsaFunction(out, sz, out, &outLen,
RSA_PUBLIC_ENCRYPT, key)) < 0)
sz = ret;
return sz;
@@ -561,7 +562,8 @@ int wc_RsaSSL_Sign(const byte* in, word32 inLen, byte* out, word32 outLen,
if (ret != 0)
return ret;
if ((ret = wc_RsaFunction(out, sz, out, &outLen, RSA_PRIVATE_ENCRYPT,key)) < 0)
if ((ret = wc_RsaFunction(out, sz, out, &outLen,
RSA_PRIVATE_ENCRYPT,key)) < 0)
sz = ret;
return sz;
@@ -577,8 +579,9 @@ int wc_RsaEncryptSize(RsaKey* key)
return mp_unsigned_bin_size(&key->n);
}
int wc_RsaFlattenPublicKey(RsaKey* key, byte* e, word32* eSz, byte* n, word32* nSz)
/* flatten RsaKey structure into individual elements (e, n) */
int wc_RsaFlattenPublicKey(RsaKey* key, byte* e, word32* eSz, byte* n,
word32* nSz)
{
int sz, ret;