From b9bb21f185e6edf5ee0f9f6c52926461327ded6e Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Sun, 22 Nov 2009 12:51:23 -0800 Subject: [PATCH] just return if we are asked for 0 bytes --- lib/hcrypto/rand.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/hcrypto/rand.c b/lib/hcrypto/rand.c index 3cd65989c..009498658 100644 --- a/lib/hcrypto/rand.c +++ b/lib/hcrypto/rand.c @@ -3,6 +3,8 @@ * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * + * Portions Copyright (c) 2009 Apple Inc. All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -95,6 +97,8 @@ RAND_seed(const void *indata, size_t size) int RAND_bytes(void *outdata, size_t size) { + if (size == 0) + return 1; init_method(); return (*selected_meth->bytes)(outdata, size); }