diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/arc4random/arc4random_win.h | 11 | ||||
| -rw-r--r-- | src/lib/libcrypto/crypto/arc4random_win.h | 11 | 
2 files changed, 14 insertions, 8 deletions
| diff --git a/src/lib/libcrypto/arc4random/arc4random_win.h b/src/lib/libcrypto/arc4random/arc4random_win.h index 48a1bda128..deec8a1efe 100644 --- a/src/lib/libcrypto/arc4random/arc4random_win.h +++ b/src/lib/libcrypto/arc4random/arc4random_win.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: arc4random_win.h,v 1.5 2015/01/15 06:57:18 deraadt Exp $ */ | 1 | /* $OpenBSD: arc4random_win.h,v 1.6 2016/06/30 12:17:29 bcook Exp $ */ | 
| 2 | 2 | ||
| 3 | /* | 3 | /* | 
| 4 | * Copyright (c) 1996, David Mazieres <dm@uun.org> | 4 | * Copyright (c) 1996, David Mazieres <dm@uun.org> | 
| @@ -52,13 +52,16 @@ _getentropy_fail(void) | |||
| 52 | static inline int | 52 | static inline int | 
| 53 | _rs_allocate(struct _rs **rsp, struct _rsx **rsxp) | 53 | _rs_allocate(struct _rs **rsp, struct _rsx **rsxp) | 
| 54 | { | 54 | { | 
| 55 | *rsp = calloc(1, sizeof(**rsp)); | 55 | *rsp = VirtualAlloc(NULL, sizeof(**rsp), | 
| 56 | MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); | ||
| 56 | if (*rsp == NULL) | 57 | if (*rsp == NULL) | 
| 57 | return (-1); | 58 | return (-1); | 
| 58 | 59 | ||
| 59 | *rsxp = calloc(1, sizeof(**rsxp)); | 60 | *rsxp = VirtualAlloc(NULL, sizeof(**rsxp), | 
| 61 | MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); | ||
| 60 | if (*rsxp == NULL) { | 62 | if (*rsxp == NULL) { | 
| 61 | free(*rsp); | 63 | VirtualFree(*rsp, 0, MEM_RELEASE); | 
| 64 | *rsp = NULL; | ||
| 62 | return (-1); | 65 | return (-1); | 
| 63 | } | 66 | } | 
| 64 | return (0); | 67 | return (0); | 
| diff --git a/src/lib/libcrypto/crypto/arc4random_win.h b/src/lib/libcrypto/crypto/arc4random_win.h index 48a1bda128..deec8a1efe 100644 --- a/src/lib/libcrypto/crypto/arc4random_win.h +++ b/src/lib/libcrypto/crypto/arc4random_win.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: arc4random_win.h,v 1.5 2015/01/15 06:57:18 deraadt Exp $ */ | 1 | /* $OpenBSD: arc4random_win.h,v 1.6 2016/06/30 12:17:29 bcook Exp $ */ | 
| 2 | 2 | ||
| 3 | /* | 3 | /* | 
| 4 | * Copyright (c) 1996, David Mazieres <dm@uun.org> | 4 | * Copyright (c) 1996, David Mazieres <dm@uun.org> | 
| @@ -52,13 +52,16 @@ _getentropy_fail(void) | |||
| 52 | static inline int | 52 | static inline int | 
| 53 | _rs_allocate(struct _rs **rsp, struct _rsx **rsxp) | 53 | _rs_allocate(struct _rs **rsp, struct _rsx **rsxp) | 
| 54 | { | 54 | { | 
| 55 | *rsp = calloc(1, sizeof(**rsp)); | 55 | *rsp = VirtualAlloc(NULL, sizeof(**rsp), | 
| 56 | MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); | ||
| 56 | if (*rsp == NULL) | 57 | if (*rsp == NULL) | 
| 57 | return (-1); | 58 | return (-1); | 
| 58 | 59 | ||
| 59 | *rsxp = calloc(1, sizeof(**rsxp)); | 60 | *rsxp = VirtualAlloc(NULL, sizeof(**rsxp), | 
| 61 | MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); | ||
| 60 | if (*rsxp == NULL) { | 62 | if (*rsxp == NULL) { | 
| 61 | free(*rsp); | 63 | VirtualFree(*rsp, 0, MEM_RELEASE); | 
| 64 | *rsp = NULL; | ||
| 62 | return (-1); | 65 | return (-1); | 
| 63 | } | 66 | } | 
| 64 | return (0); | 67 | return (0); | 
