| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 1996, David Mazieres <dm@uun.org> | 2 * Copyright (c) 1996, David Mazieres <dm@uun.org> |
| 3 * Copyright (c) 2008, Damien Miller <djm@openbsd.org> | 3 * Copyright (c) 2008, Damien Miller <djm@openbsd.org> |
| 4 * | 4 * |
| 5 * Permission to use, copy, modify, and distribute this software for any | 5 * Permission to use, copy, modify, and distribute this software for any |
| 6 * purpose with or without fee is hereby granted, provided that the above | 6 * purpose with or without fee is hereby granted, provided that the above |
| 7 * copyright notice and this permission notice appear in all copies. | 7 * copyright notice and this permission notice appear in all copies. |
| 8 * | 8 * |
| 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 /* | 18 /* |
| 19 * Arc4 random number generator for OpenBSD. | 19 * Arc4 random number generator for OpenBSD. |
| 20 * | 20 * |
| 21 * This code is derived from section 17.1 of Applied Cryptography, | 21 * This code is derived from section 17.1 of Applied Cryptography, |
| 22 * second edition, which describes a stream cipher allegedly | 22 * second edition, which describes a stream cipher allegedly |
| 23 * compatible with RSA Labs "RC4" cipher (the actual description of | 23 * compatible with RSA Labs "RC4" cipher (the actual description of |
| 24 * which is a trade secret). The same algorithm is used as a stream | 24 * which is a trade secret). The same algorithm is used as a stream |
| 25 * cipher called "arcfour" in Tatu Ylonen's ssh package. | 25 * cipher called "arcfour" in Tatu Ylonen's ssh package. |
| 26 * | 26 * |
| 27 * RC4 is a registered trademark of RSA Laboratories. | 27 * RC4 is a registered trademark of RSA Laboratories. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #include "sky/engine/config.h" | |
| 31 #include "sky/engine/wtf/CryptographicallyRandomNumber.h" | 30 #include "sky/engine/wtf/CryptographicallyRandomNumber.h" |
| 32 | 31 |
| 33 #include "sky/engine/wtf/StdLibExtras.h" | 32 #include "sky/engine/wtf/StdLibExtras.h" |
| 34 #include "sky/engine/wtf/Threading.h" | 33 #include "sky/engine/wtf/Threading.h" |
| 35 #include "sky/engine/wtf/ThreadingPrimitives.h" | 34 #include "sky/engine/wtf/ThreadingPrimitives.h" |
| 36 | 35 |
| 37 namespace WTF { | 36 namespace WTF { |
| 38 | 37 |
| 39 static RandomNumberSource sourceFunction; | 38 static RandomNumberSource sourceFunction; |
| 40 | 39 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 { | 175 { |
| 177 return sharedRandomNumberGenerator().randomNumber(); | 176 return sharedRandomNumberGenerator().randomNumber(); |
| 178 } | 177 } |
| 179 | 178 |
| 180 void cryptographicallyRandomValues(void* buffer, size_t length) | 179 void cryptographicallyRandomValues(void* buffer, size_t length) |
| 181 { | 180 { |
| 182 sharedRandomNumberGenerator().randomValues(buffer, length); | 181 sharedRandomNumberGenerator().randomValues(buffer, length); |
| 183 } | 182 } |
| 184 | 183 |
| 185 } | 184 } |
| OLD | NEW |