Skip to content

Commit 9106d12

Browse files
authored
Merge pull request #8651 from billphipps/fix_curve25519_enums
Update to expose reasonable DER buffer sizes for Curve25519
2 parents 43e68ad + eca0318 commit 9106d12

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

wolfcrypt/test/test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35648,8 +35648,8 @@ static wc_test_ret_t curve255519_der_test(void)
3564835648
0xA2, 0x5B, 0x38, 0xFD, 0x96, 0xDB, 0x2A, 0x26
3564935649
};
3565035650
curve25519_key key;
35651-
byte output[128];
35652-
word32 outputSz = 128;
35651+
byte output[CURVE25519_MAX_KEY_TO_DER_SZ];
35652+
word32 outputSz = (word32)sizeof(output);
3565335653
word32 idx;
3565435654

3565535655
ret = wc_curve25519_init_ex(&key, HEAP_HINT, devId);

wolfssl/wolfcrypt/curve25519.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@
4545
#define CURVE25519_KEYSIZE 32
4646
#define CURVE25519_PUB_KEY_SIZE 32
4747

48+
enum {
49+
CURVE25519_MAX_KEY_TO_DER_SZ = 82, /* for exported DER keys temp buffer */
50+
51+
WOLF_ENUM_DUMMY_LAST_ELEMENT(CURVE25519)
52+
};
53+
4854
#ifdef WOLFSSL_NAMES_STATIC
4955
typedef char curve25519_str[12];
5056
#else

0 commit comments

Comments
 (0)