"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "compat/getentropy_osx.c" between
openbgpd-6.7p0.tar.gz and openbgpd-6.8p0.tar.gz

About: OpenBGPD is a Border Gateway Protocol (BGP) daemon which manages the network routing tables. Its main purpose is to exchange information concerning "network reachability" with other BGP systems.

getentropy_osx.c  (openbgpd-6.7p0):getentropy_osx.c  (openbgpd-6.8p0)
/* $OpenBSD: getentropy_osx.c,v 1.12 2018/11/20 08:04:28 deraadt Exp $ * / /* $OpenBSD: getentropy_osx.c,v 1.13 2020/05/17 14:44:20 deraadt Exp $ * /
/* /*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
* Copyright (c) 2014 Bob Beck <beck@obtuse.com> * Copyright (c) 2014 Bob Beck <beck@obtuse.com>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies. * copyright notice and this permission notice appear in all copies.
* *
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
skipping to change at line 69 skipping to change at line 69
#include <netinet/udp_var.h> #include <netinet/udp_var.h>
#endif #endif
#include <CommonCrypto/CommonDigest.h> #include <CommonCrypto/CommonDigest.h>
#define SHA512_Update(a, b, c) (CC_SHA512_Update((a), (b), (c))) #define SHA512_Update(a, b, c) (CC_SHA512_Update((a), (b), (c)))
#define SHA512_Init(xxx) (CC_SHA512_Init((xxx))) #define SHA512_Init(xxx) (CC_SHA512_Init((xxx)))
#define SHA512_Final(xxx, yyy) (CC_SHA512_Final((xxx), (yyy))) #define SHA512_Final(xxx, yyy) (CC_SHA512_Final((xxx), (yyy)))
#define SHA512_CTX CC_SHA512_CTX #define SHA512_CTX CC_SHA512_CTX
#define SHA512_DIGEST_LENGTH CC_SHA512_DIGEST_LENGTH #define SHA512_DIGEST_LENGTH CC_SHA512_DIGEST_LENGTH
#define REPEAT 5 #define REPEAT 5
#define min(a, b) (((a) < (b)) ? (a) : (b)) #define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
#define HX(a, b) \ #define HX(a, b) \
do { \ do { \
if ((a)) \ if ((a)) \
HD(errno); \ HD(errno); \
else \ else \
HD(b); \ HD(b); \
} while (0) } while (0)
#define HR(x, l) (SHA512_Update(&ctx, (char *)(x), (l))) #define HR(x, l) (SHA512_Update(&ctx, (char *)(x), (l)))
skipping to change at line 410 skipping to change at line 410
HX((e = gettimeofday(&tv, NULL)) == -1, tv); HX((e = gettimeofday(&tv, NULL)) == -1, tv);
if (e != -1) { if (e != -1) {
cnt += (int)tv.tv_sec; cnt += (int)tv.tv_sec;
cnt += (int)tv.tv_usec; cnt += (int)tv.tv_usec;
} }
HD(cnt); HD(cnt);
} }
SHA512_Final(results, &ctx); SHA512_Final(results, &ctx);
memcpy((char *)buf + i, results, min(sizeof(results), len - i)); memcpy((char *)buf + i, results, MINIMUM(sizeof(results), len - i
i += min(sizeof(results), len - i); ));
i += MINIMUM(sizeof(results), len - i);
} }
explicit_bzero(&ctx, sizeof ctx); explicit_bzero(&ctx, sizeof ctx);
explicit_bzero(results, sizeof results); explicit_bzero(results, sizeof results);
errno = save_errno; errno = save_errno;
return (0); /* satisfied */ return (0); /* satisfied */
} }
 End of changes. 3 change blocks. 
4 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)