diff options
-rw-r--r-- | src/lib/libssl/d1_lib.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/lib/libssl/d1_lib.c b/src/lib/libssl/d1_lib.c index 7e919a6c9b..45bbd9b45d 100644 --- a/src/lib/libssl/d1_lib.c +++ b/src/lib/libssl/d1_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: d1_lib.c,v 1.42 2017/04/10 17:27:33 jsing Exp $ */ | 1 | /* $OpenBSD: d1_lib.c,v 1.43 2020/02/21 16:12:18 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * DTLS implementation written by Nagendra Modadugu | 3 | * DTLS implementation written by Nagendra Modadugu |
4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. | 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. |
@@ -455,11 +455,19 @@ void | |||
455 | dtls1_build_sequence_number(unsigned char *dst, unsigned char *seq, | 455 | dtls1_build_sequence_number(unsigned char *dst, unsigned char *seq, |
456 | unsigned short epoch) | 456 | unsigned short epoch) |
457 | { | 457 | { |
458 | unsigned char dtlsseq[SSL3_SEQUENCE_SIZE]; | 458 | CBB cbb; |
459 | unsigned char *p; | ||
460 | 459 | ||
461 | p = dtlsseq; | 460 | if (!CBB_init_fixed(&cbb, dst, SSL3_SEQUENCE_SIZE)) |
462 | s2n(epoch, p); | 461 | goto err; |
463 | memcpy(p, &seq[2], SSL3_SEQUENCE_SIZE - 2); | 462 | if (!CBB_add_u16(&cbb, epoch)) |
464 | memcpy(dst, dtlsseq, SSL3_SEQUENCE_SIZE); | 463 | goto err; |
464 | if (!CBB_add_bytes(&cbb, &seq[2], SSL3_SEQUENCE_SIZE - 2)) | ||
465 | goto err; | ||
466 | if (!CBB_finish(&cbb, NULL, NULL)) | ||
467 | goto err; | ||
468 | |||
469 | return; | ||
470 | |||
471 | err: | ||
472 | CBB_cleanup(&cbb); | ||
465 | } | 473 | } |