diff options
| author | jsing <> | 2014-06-21 17:02:25 +0000 |
|---|---|---|
| committer | jsing <> | 2014-06-21 17:02:25 +0000 |
| commit | 02babdba577ac3bdb34a3b46d951667c47c21306 (patch) | |
| tree | f082331208091f9dab5ae7971f7bcd9d557ce5ea /src/lib/libssl/d1_lib.c | |
| parent | 522ebc32880362b9d27945aa24a411183ecb725c (diff) | |
| download | openbsd-02babdba577ac3bdb34a3b46d951667c47c21306.tar.gz openbsd-02babdba577ac3bdb34a3b46d951667c47c21306.tar.bz2 openbsd-02babdba577ac3bdb34a3b46d951667c47c21306.zip | |
Pull the code that builds a DTLS sequence number out into its own function
to avoid duplication. Also use fewer magic numbers.
ok miod@
Diffstat (limited to 'src/lib/libssl/d1_lib.c')
| -rw-r--r-- | src/lib/libssl/d1_lib.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lib/libssl/d1_lib.c b/src/lib/libssl/d1_lib.c index 13c93a77cf..b90cc8eed3 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.20 2014/06/13 04:29:13 miod Exp $ */ | 1 | /* $OpenBSD: d1_lib.c,v 1.21 2014/06/21 17:02:25 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. |
| @@ -460,3 +460,16 @@ dtls1_listen(SSL *s, struct sockaddr *client) | |||
| 460 | (void)BIO_dgram_get_peer(SSL_get_rbio(s), client); | 460 | (void)BIO_dgram_get_peer(SSL_get_rbio(s), client); |
| 461 | return 1; | 461 | return 1; |
| 462 | } | 462 | } |
| 463 | |||
| 464 | void | ||
| 465 | dtls1_build_sequence_number(unsigned char *dst, unsigned char *seq, | ||
| 466 | unsigned short epoch) | ||
| 467 | { | ||
| 468 | unsigned char dtlsseq[SSL3_SEQUENCE_SIZE]; | ||
| 469 | unsigned char *p; | ||
| 470 | |||
| 471 | p = dtlsseq; | ||
| 472 | s2n(epoch, p); | ||
| 473 | memcpy(p, &seq[2], SSL3_SEQUENCE_SIZE - 2); | ||
| 474 | memcpy(dst, dtlsseq, SSL3_SEQUENCE_SIZE); | ||
| 475 | } | ||
