diff options
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: misc.c,v 1.77 2010/07/02 04:32:44 djm Exp $ */ | 1 | /* $OpenBSD: misc.c,v 1.78 2010/07/13 11:52:06 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2005,2006 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2005,2006 Damien Miller. All rights reserved. |
@@ -850,6 +850,18 @@ ms_to_timeval(struct timeval *tv, int ms) | |||
850 | tv->tv_usec = (ms % 1000) * 1000; | 850 | tv->tv_usec = (ms % 1000) * 1000; |
851 | } | 851 | } |
852 | 852 | ||
853 | int | ||
854 | timing_safe_cmp(const void *_s1, const void *_s2, size_t n) | ||
855 | { | ||
856 | u_char *s1 = (u_char *)_s1; | ||
857 | u_char *s2 = (u_char *)_s2; | ||
858 | int ret = 0; | ||
859 | |||
860 | for (; n > 0; n--, s1++, s2++) | ||
861 | ret |= *s1 ^ *s2; | ||
862 | return ret; | ||
863 | } | ||
864 | |||
853 | void | 865 | void |
854 | sock_set_v6only(int s) | 866 | sock_set_v6only(int s) |
855 | { | 867 | { |