Skip to content

Commit

Permalink
removed DecodeAsymKeyXXX_Assign_ex function, functionality now includ…
Browse files Browse the repository at this point in the history
…ed in original _Assign function
  • Loading branch information
bigbrett committed Nov 15, 2024
1 parent f672105 commit 2207791
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 32 deletions.
24 changes: 4 additions & 20 deletions wolfcrypt/src/asn.c
Original file line number Diff line number Diff line change
Expand Up @@ -35308,7 +35308,7 @@ enum {
|| defined(HAVE_FALCON) || defined(HAVE_DILITHIUM) || defined(HAVE_SPHINCS))


int DecodeAsymKey_Assign_ex(const byte* input, word32* inOutIdx, word32 inSz,
int DecodeAsymKey_Assign(const byte* input, word32* inOutIdx, word32 inSz,
const byte** privKey, word32* privKeyLen,
const byte** pubKey, word32* pubKeyLen, int* inOutKeyType)
{
Expand Down Expand Up @@ -35462,15 +35462,6 @@ int DecodeAsymKey_Assign_ex(const byte* input, word32* inOutIdx, word32 inSz,
#endif /* WOLFSSL_ASN_TEMPLATE */
}


int DecodeAsymKey_Assign(const byte* input, word32* inOutIdx, word32 inSz,
const byte** privKey, word32* privKeyLen,
const byte** pubKey, word32* pubKeyLen, int keyType)
{
return DecodeAsymKey_Assign_ex(input, inOutIdx, inSz, privKey, privKeyLen,
pubKey, pubKeyLen, &keyType);
}

int DecodeAsymKey(const byte* input, word32* inOutIdx, word32 inSz,
byte* privKey, word32* privKeyLen,
byte* pubKey, word32* pubKeyLen, int keyType)
Expand All @@ -35487,7 +35478,7 @@ int DecodeAsymKey(const byte* input, word32* inOutIdx, word32 inSz,

if (ret == 0) {
ret = DecodeAsymKey_Assign(input, inOutIdx, inSz, &privKeyPtr,
&privKeyPtrLen, &pubKeyPtr, &pubKeyPtrLen, keyType);
&privKeyPtrLen, &pubKeyPtr, &pubKeyPtrLen, &keyType);
}
if ((ret == 0) && (privKeyPtrLen > *privKeyLen)) {
ret = BUFFER_E;
Expand All @@ -35509,7 +35500,7 @@ int DecodeAsymKey(const byte* input, word32* inOutIdx, word32 inSz,
return ret;
}

int DecodeAsymKeyPublic_Assign_ex(const byte* input, word32* inOutIdx, word32 inSz,
int DecodeAsymKeyPublic_Assign(const byte* input, word32* inOutIdx, word32 inSz,
const byte** pubKey, word32* pubKeyLen, int *inOutKeyType)
{
int ret = 0;
Expand Down Expand Up @@ -35611,13 +35602,6 @@ int DecodeAsymKeyPublic_Assign_ex(const byte* input, word32* inOutIdx, word32 in

}

int DecodeAsymKeyPublic_Assign(const byte* input, word32* inOutIdx, word32 inSz,
const byte** pubKey, word32* pubKeyLen, int keyType)
{
return DecodeAsymKeyPublic_Assign_ex(input, inOutIdx, inSz, pubKey,
pubKeyLen, &keyType);
}

int DecodeAsymKeyPublic(const byte* input, word32* inOutIdx, word32 inSz,
byte* pubKey, word32* pubKeyLen, int keyType)
{
Expand All @@ -35631,7 +35615,7 @@ int DecodeAsymKeyPublic(const byte* input, word32* inOutIdx, word32 inSz,

if (ret == 0) {
ret = DecodeAsymKeyPublic_Assign(input, inOutIdx, inSz, &pubKeyPtr,
&pubKeyPtrLen, keyType);
&pubKeyPtrLen, &keyType);
}
if ((ret == 0) && (pubKeyPtrLen > *pubKeyLen)) {
ret = BUFFER_E;
Expand Down
12 changes: 6 additions & 6 deletions wolfcrypt/src/dilithium.c
Original file line number Diff line number Diff line change
Expand Up @@ -9594,9 +9594,9 @@ int wc_Dilithium_PrivateKeyDecode(const byte* input, word32* inOutIdx,

if (ret == 0) {
/* Decode the asymmetric key and get out private and public key data. */
ret = DecodeAsymKey_Assign_ex(input, inOutIdx, inSz,
&privKey, &privKeyLen,
&pubKey, &pubKeyLen, &keytype);
ret = DecodeAsymKey_Assign(input, inOutIdx, inSz,
&privKey, &privKeyLen,
&pubKey, &pubKeyLen, &keytype);
if (ret == 0
#ifdef WOLFSSL_WC_DILITHIUM
&& key->params == NULL
Expand Down Expand Up @@ -9873,9 +9873,9 @@ int wc_Dilithium_PublicKeyDecode(const byte* input, word32* inOutIdx,
}
if (ret == 0) {
/* Decode the asymmetric key and get out public key data. */
ret = DecodeAsymKeyPublic_Assign_ex(input, inOutIdx, inSz,
&pubKey, &pubKeyLen,
&keytype);
ret = DecodeAsymKeyPublic_Assign(input, inOutIdx, inSz,
&pubKey, &pubKeyLen,
&keytype);
if (ret == 0
#ifdef WOLFSSL_WC_DILITHIUM
&& key->params == NULL
Expand Down
6 changes: 0 additions & 6 deletions wolfssl/wolfcrypt/asn.h
Original file line number Diff line number Diff line change
Expand Up @@ -2540,9 +2540,6 @@ WOLFSSL_LOCAL void FreeSignatureCtx(SignatureCtx* sigCtx);
WOLFSSL_LOCAL int SetAsymKeyDerPublic(const byte* pubKey, word32 pubKeyLen,
byte* output, word32 outLen, int keyType, int withHeader);
WOLFSSL_LOCAL int DecodeAsymKeyPublic_Assign(const byte* input,
word32* inOutIdx, word32 inSz, const byte** pubKey, word32* pubKeyLen,
int keyType);
WOLFSSL_LOCAL int DecodeAsymKeyPublic_Assign_ex(const byte* input,
word32* inOutIdx, word32 inSz, const byte** pubKey, word32* pubKeyLen,
int* keyType);

Expand Down Expand Up @@ -2899,9 +2896,6 @@ WOLFSSL_LOCAL int VerifyX509Acert(const byte* cert, word32 certSz,
|| (defined(HAVE_CURVE448) && defined(HAVE_CURVE448_KEY_IMPORT)) \
|| defined(HAVE_FALCON) || defined(HAVE_DILITHIUM) || defined(HAVE_SPHINCS))
WOLFSSL_LOCAL int DecodeAsymKey_Assign(const byte* input, word32* inOutIdx,
word32 inSz, const byte** privKey, word32* privKeyLen, const byte** pubKey,
word32* pubKeyLen, int keyType);
WOLFSSL_LOCAL int DecodeAsymKey_Assign_ex(const byte* input, word32* inOutIdx,
word32 inSz, const byte** privKey, word32* privKeyLen, const byte** pubKey,
word32* pubKeyLen, int* inOutKeyType);

Expand Down

0 comments on commit 2207791

Please sign in to comment.