summaryrefslogtreecommitdiffstats
path: root/lib/libssl/src/ssl/d1_lib.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2014-06-21 17:02:25 +0000
committerjsing <jsing@openbsd.org>2014-06-21 17:02:25 +0000
commit63152afb14736fcf33702fb45a5e1372494fa25c (patch)
tree2b9c6d494cec89c88abe69fff9113e0fa4f16b46 /lib/libssl/src/ssl/d1_lib.c
parentSpecify the correct strength bits for 3DES cipher suites. (diff)
downloadwireguard-openbsd-63152afb14736fcf33702fb45a5e1372494fa25c.tar.xz
wireguard-openbsd-63152afb14736fcf33702fb45a5e1372494fa25c.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 'lib/libssl/src/ssl/d1_lib.c')
-rw-r--r--lib/libssl/src/ssl/d1_lib.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/libssl/src/ssl/d1_lib.c b/lib/libssl/src/ssl/d1_lib.c
index 13c93a77cfc..b90cc8eed3a 100644
--- a/lib/libssl/src/ssl/d1_lib.c
+++ b/lib/libssl/src/ssl/d1_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: d1_lib.c,v 1.20 2014/06/13 04:29:13 miod Exp $ */
+/* $OpenBSD: d1_lib.c,v 1.21 2014/06/21 17:02:25 jsing Exp $ */
/*
* DTLS implementation written by Nagendra Modadugu
* (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -460,3 +460,16 @@ dtls1_listen(SSL *s, struct sockaddr *client)
(void)BIO_dgram_get_peer(SSL_get_rbio(s), client);
return 1;
}
+
+void
+dtls1_build_sequence_number(unsigned char *dst, unsigned char *seq,
+ unsigned short epoch)
+{
+ unsigned char dtlsseq[SSL3_SEQUENCE_SIZE];
+ unsigned char *p;
+
+ p = dtlsseq;
+ s2n(epoch, p);
+ memcpy(p, &seq[2], SSL3_SEQUENCE_SIZE - 2);
+ memcpy(dst, dtlsseq, SSL3_SEQUENCE_SIZE);
+}