Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ dtls_security_parameters_t *dtls_security_new(void)
memset(security, 0, sizeof(*security));

if (security) {
security->cipher = TLS_NULL_WITH_NULL_NULL;
security->cipher_index = DTLS_CIPHER_INDEX_NULL;
security->compression = TLS_COMPRESSION_NULL;
}
return security;
Expand Down
6 changes: 4 additions & 2 deletions crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
#define DTLS_MASTER_SECRET_LENGTH 48
#define DTLS_RANDOM_LENGTH 32

#define DTLS_CIPHER_INDEX_NULL 0

typedef enum { AES128=0
} dtls_crypto_alg;

Expand Down Expand Up @@ -105,7 +107,7 @@ typedef struct {
typedef struct {
dtls_compression_t compression; /**< compression method */

dtls_cipher_t cipher; /**< cipher type */
int cipher_index; /**< internal index for cipher_suite_params, DTLS_CIPHER_INDEX_NULL for TLS_NULL_WITH_NULL_NULL */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being an index into an array, size_t would be the correct data type here.
(As the array usually should not have more than, say, 255 non-NULL elements, another unsigned type such as uint8_t might do as well. However, I do not expect cipher_index to be negative at any point in time.)

uint16_t epoch; /**< counter for cipher state changes*/
uint64_t rseq; /**< sequence number of last record sent */

Expand Down Expand Up @@ -135,7 +137,7 @@ typedef struct {
dtls_hs_state_t hs_state; /**< handshake protocol status */

dtls_compression_t compression; /**< compression method */
dtls_cipher_t cipher; /**< cipher type */
int cipher_index; /**< internal index for cipher_suite_params, DTLS_CIPHER_INDEX_NULL for TLS_NULL_WITH_NULL_NULL */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

unsigned int do_client_auth:1;
unsigned int extended_master_secret:1;
union {
Expand Down
Loading