浏览代码

[rng] Remove obsolete (and unfinished) get_random_bytes() function

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 12 年前
父节点
当前提交
ffb6d6be6d
共有 2 个文件被更改,包括 0 次插入57 次删除
  1. 0
    55
      src/crypto/crandom.c
  2. 0
    2
      src/include/ipxe/crypto.h

+ 0
- 55
src/crypto/crandom.c 查看文件

@@ -1,55 +0,0 @@
1
-/*
2
- * Copyright (c) 2009 Joshua Oreman <oremanj@rwcr.net>.
3
- *
4
- * This program is free software; you can redistribute it and/or
5
- * modify it under the terms of the GNU General Public License as
6
- * published by the Free Software Foundation; either version 2 of the
7
- * License, or any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful, but
10
- * WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
- * General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU General Public License
15
- * along with this program; if not, write to the Free Software
16
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
- */
18
-
19
-FILE_LICENCE ( GPL2_OR_LATER );
20
-
21
-/** @file
22
- *
23
- * Cryptographically strong random number generator
24
- *
25
- * Currently the cryptographic part is not implemented, and this just
26
- * uses random().
27
- */
28
-
29
-#include <ipxe/crypto.h>
30
-#include <stdlib.h>
31
-
32
-/**
33
- * Get cryptographically strong random bytes
34
- *
35
- * @v buf	Buffer in which to store random bytes
36
- * @v len	Number of random bytes to generate
37
- *
38
- * @b WARNING: This function is currently underimplemented, and does
39
- * not give numbers any stronger than random()!
40
- */
41
-void get_random_bytes ( void *buf, size_t len )
42
-{
43
-	u8 *bufp = buf;
44
-
45
-	/*
46
-	 * Somewhat arbitrarily, choose the 0x00FF0000-masked byte
47
-	 * returned by random() as having good entropy. PRNGs often
48
-	 * don't provide good entropy in lower bits, and the top byte
49
-	 * might show a pattern because of sign issues.
50
-	 */
51
-
52
-	while ( len-- ) {
53
-		*bufp++ = ( random() >> 16 ) & 0xFF;
54
-	}
55
-}

+ 0
- 2
src/include/ipxe/crypto.h 查看文件

@@ -151,6 +151,4 @@ extern struct digest_algorithm digest_null;
151 151
 extern struct cipher_algorithm cipher_null;
152 152
 extern struct pubkey_algorithm pubkey_null;
153 153
 
154
-void get_random_bytes ( void *buf, size_t len );
155
-
156 154
 #endif /* _IPXE_CRYPTO_H */

正在加载...
取消
保存