just return if we are asked for 0 bytes

This commit is contained in:
Love Hornquist Astrand
2009-11-22 12:51:23 -08:00
parent 2454e93c62
commit b9bb21f185

View File

@@ -3,6 +3,8 @@
* (Royal Institute of Technology, Stockholm, Sweden). * (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved. * All rights reserved.
* *
* Portions Copyright (c) 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
@@ -95,6 +97,8 @@ RAND_seed(const void *indata, size_t size)
int int
RAND_bytes(void *outdata, size_t size) RAND_bytes(void *outdata, size_t size)
{ {
if (size == 0)
return 1;
init_method(); init_method();
return (*selected_meth->bytes)(outdata, size); return (*selected_meth->bytes)(outdata, size);
} }