Skip to content

Commit 13f4591

Browse files
authored
Merge pull request #10372 from MarkAtwood/fix/ed448-der-const
fix: add const to wc_Ed448 DER export function key parameters
2 parents 44564dd + d48b070 commit 13f4591

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

doc/dox_comments/header_files/asn_public.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2845,7 +2845,7 @@ int wc_Ed448PublicKeyDecode(const byte* input, word32* inOutIdx,
28452845
28462846
\sa wc_Ed448PrivateKeyToDer
28472847
*/
2848-
int wc_Ed448KeyToDer(ed448_key* key, byte* output, word32 inLen);
2848+
int wc_Ed448KeyToDer(const ed448_key* key, byte* output, word32 inLen);
28492849

28502850
/*!
28512851
\ingroup Ed448
@@ -2868,7 +2868,7 @@ int wc_Ed448KeyToDer(ed448_key* key, byte* output, word32 inLen);
28682868
28692869
\sa wc_Ed448PrivateKeyDecode
28702870
*/
2871-
int wc_Ed448PrivateKeyToDer(ed448_key* key, byte* output,
2871+
int wc_Ed448PrivateKeyToDer(const ed448_key* key, byte* output,
28722872
word32 inLen);
28732873

28742874
/*!
@@ -2881,19 +2881,20 @@ int wc_Ed448PrivateKeyToDer(ed448_key* key, byte* output,
28812881
\param key Ed448 key structure with public key
28822882
\param output Buffer for DER encoded public key
28832883
\param inLen Size of output buffer
2884+
\param withAlg 1 to include algorithm identifier, 0 for key data only
28842885
28852886
_Example_
28862887
\code
28872888
ed448_key key;
28882889
byte der[1024];
28892890
int derSz = wc_Ed448PublicKeyToDer(&key, der,
2890-
sizeof(der));
2891+
sizeof(der), 1);
28912892
\endcode
28922893
28932894
\sa wc_Ed448PublicKeyDecode
28942895
*/
2895-
int wc_Ed448PublicKeyToDer(ed448_key* key, byte* output,
2896-
int inLen);
2896+
int wc_Ed448PublicKeyToDer(const ed448_key* key, byte* output,
2897+
word32 inLen, int withAlg);
28972898

28982899
/*!
28992900
\ingroup Curve448

wolfcrypt/src/asn.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12920,7 +12920,7 @@ int wc_Ed25519PublicKeyToDer(const ed25519_key* key, byte* output, word32 inLen,
1292012920
* @return BAD_FUNC_ARG when key is NULL.
1292112921
* @return MEMORY_E when dynamic memory allocation failed.
1292212922
*/
12923-
int wc_Ed448PublicKeyToDer(ed448_key* key, byte* output, word32 inLen,
12923+
int wc_Ed448PublicKeyToDer(const ed448_key* key, byte* output, word32 inLen,
1292412924
int withAlg)
1292512925
{
1292612926
int ret;
@@ -32368,7 +32368,7 @@ int wc_Curve448PublicKeyDecode(const byte* input, word32* inOutIdx,
3236832368
#if defined(HAVE_ED448) && defined(HAVE_ED448_KEY_EXPORT)
3236932369
/* Write a Private ecc key, including public to DER format,
3237032370
* length on success else < 0 */
32371-
int wc_Ed448KeyToDer(ed448_key* key, byte* output, word32 inLen)
32371+
int wc_Ed448KeyToDer(const ed448_key* key, byte* output, word32 inLen)
3237232372
{
3237332373
if (key == NULL) {
3237432374
return BAD_FUNC_ARG;
@@ -32379,7 +32379,7 @@ int wc_Ed448KeyToDer(ed448_key* key, byte* output, word32 inLen)
3237932379

3238032380
/* Write only private ecc key to DER format,
3238132381
* length on success else < 0 */
32382-
int wc_Ed448PrivateKeyToDer(ed448_key* key, byte* output, word32 inLen)
32382+
int wc_Ed448PrivateKeyToDer(const ed448_key* key, byte* output, word32 inLen)
3238332383
{
3238432384
if (key == NULL) {
3238532385
return BAD_FUNC_ARG;

wolfssl/wolfcrypt/asn_public.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -857,11 +857,11 @@ WOLFSSL_API int wc_Ed448PublicKeyDecode(
857857
const byte* input, word32* inOutIdx, ed448_key* key, word32 inSz);
858858
#endif
859859
#ifdef HAVE_ED448_KEY_EXPORT
860-
WOLFSSL_API int wc_Ed448KeyToDer(ed448_key* key, byte* output, word32 inLen);
860+
WOLFSSL_API int wc_Ed448KeyToDer(const ed448_key* key, byte* output, word32 inLen);
861861
WOLFSSL_API int wc_Ed448PrivateKeyToDer(
862-
ed448_key* key, byte* output, word32 inLen);
862+
const ed448_key* key, byte* output, word32 inLen);
863863
WOLFSSL_API int wc_Ed448PublicKeyToDer(
864-
ed448_key* key, byte* output, word32 inLen, int withAlg);
864+
const ed448_key* key, byte* output, word32 inLen, int withAlg);
865865
#endif
866866
#endif /* HAVE_ED448 */
867867

0 commit comments

Comments
 (0)