Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
external
mbedtls
Commits
f96f7b60
Commit
f96f7b60
authored
Apr 30, 2014
by
Paul Bakker
Browse files
On OpenBSD, use arc4random_buf() instead of rand() to prevent warnings
parent
6384440b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
0 deletions
+15
-0
ChangeLog
ChangeLog
+1
-0
library/rsa.c
library/rsa.c
+7
-0
tests/suites/helpers.function
tests/suites/helpers.function
+7
-0
No files found.
ChangeLog
View file @
f96f7b60
...
...
@@ -24,6 +24,7 @@ Bugfix
* Improve interoperability by not writing extension length in ClientHello /
ServerHello when no extensions are present (found by Matthew Page)
* rsa_check_pubkey() now allows an E up to N
* On OpenBSD, use arc4random_buf() instead of rand() to prevent warnings
= PolarSSL 1.3.6 released on 2014-04-11
...
...
library/rsa.c
View file @
f96f7b60
...
...
@@ -1469,6 +1469,7 @@ void rsa_free( rsa_context *ctx )
#if defined(POLARSSL_PKCS1_V15)
static
int
myrand
(
void
*
rng_state
,
unsigned
char
*
output
,
size_t
len
)
{
#if !defined(__OpenBSD__)
size_t
i
;
if
(
rng_state
!=
NULL
)
...
...
@@ -1476,6 +1477,12 @@ static int myrand( void *rng_state, unsigned char *output, size_t len )
for
(
i
=
0
;
i
<
len
;
++
i
)
output
[
i
]
=
rand
();
#else
if
(
rng_state
!=
NULL
)
rng_state
=
NULL
;
arc4random_buf
(
output
,
len
);
#endif
/* !OpenBSD */
return
(
0
);
}
...
...
tests/suites/helpers.function
View file @
f96f7b60
...
...
@@ -105,6 +105,7 @@ static void hexify(unsigned char *obuf, const unsigned char *ibuf, int len)
*/
static int rnd_std_rand( void *rng_state, unsigned char *output, size_t len )
{
#if !defined(__OpenBSD__)
size_t i;
if( rng_state != NULL )
...
...
@@ -112,6 +113,12 @@ static int rnd_std_rand( void *rng_state, unsigned char *output, size_t len )
for( i = 0; i < len; ++i )
output[i] = rand();
#else
if( rng_state != NULL )
rng_state = NULL;
arc4random_buf( output, len );
#endif /* !OpenBSD */
return( 0 );
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment