Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto.h: use DTLS_EC_KEY_SIZE for dtls_handshake_parameters_ecdsa_t. #240

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
#define DTLS_MAC_LENGTH DTLS_HMAC_DIGEST_SIZE
#define DTLS_IV_LENGTH 4 /* length of nonce_explicit */

/* EC key size for curve secp256r1 */
#define DTLS_EC_KEY_SIZE 32

/**
* Maximum size of the generated keyblock. Note that MAX_KEYBLOCK_LENGTH must
* be large enough to hold the pre_master_secret, i.e. twice the length of the
Expand Down Expand Up @@ -78,11 +81,11 @@ typedef struct dtls_cipher_context_t {
} dtls_cipher_context_t;

typedef struct {
uint8 own_eph_priv[32];
uint8 other_eph_pub_x[32];
uint8 other_eph_pub_y[32];
uint8 other_pub_x[32];
uint8 other_pub_y[32];
uint8 own_eph_priv[DTLS_EC_KEY_SIZE];
uint8 other_eph_pub_x[DTLS_EC_KEY_SIZE];
uint8 other_eph_pub_y[DTLS_EC_KEY_SIZE];
uint8 other_pub_x[DTLS_EC_KEY_SIZE];
uint8 other_pub_y[DTLS_EC_KEY_SIZE];
} dtls_handshake_parameters_ecdsa_t;

/* This is the maximal supported length of the psk client identity and psk
Expand Down Expand Up @@ -420,8 +423,6 @@ int dtls_decrypt(const unsigned char *src, size_t length,
int dtls_psk_pre_master_secret(unsigned char *key, size_t keylen,
unsigned char *result, size_t result_len);

#define DTLS_EC_KEY_SIZE 32

int dtls_ecdh_pre_master_secret(unsigned char *priv_key,
unsigned char *pub_key_x,
unsigned char *pub_key_y,
Expand Down
Loading