Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
2b1bbac5
Commit
2b1bbac5
authored
Mar 05, 2017
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: remove a duplicate file
parent
aa51b559
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
104 deletions
+0
-104
mysys_ssl/CMakeLists.txt
mysys_ssl/CMakeLists.txt
+0
-1
mysys_ssl/my_rnd.cc
mysys_ssl/my_rnd.cc
+0
-103
No files found.
mysys_ssl/CMakeLists.txt
View file @
2b1bbac5
...
...
@@ -36,7 +36,6 @@ SET(MYSYS_SSL_SOURCES
my_sha1.cc
my_sha2.cc
my_md5.cc
my_rnd.cc
my_crypt.cc
)
...
...
mysys_ssl/my_rnd.cc
deleted
100644 → 0
View file @
aa51b559
/*
Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include <my_global.h>
#include <my_rnd.h>
#include <m_string.h>
#if defined(HAVE_YASSL)
#if defined(YASSL_PREFIX)
#define RAND_bytes yaRAND_bytes
#endif
/* YASSL_PREFIX */
#include <openssl/ssl.h>
#elif defined(HAVE_OPENSSL)
#include <openssl/rand.h>
#endif
/* HAVE_YASSL */
/*
A wrapper to use OpenSSL/yaSSL PRNGs.
*/
extern
"C"
{
/*
Initialize random generator
NOTES
MySQL's password checks depends on this, so don't do any changes
that changes the random numbers that are generated!
*/
void
my_rnd_init
(
struct
my_rnd_struct
*
rand_st
,
ulong
seed1
,
ulong
seed2
)
{
#ifdef HAVE_valgrind
bzero
((
char
*
)
rand_st
,
sizeof
(
*
rand_st
));
/* Avoid UMC varnings */
#endif
rand_st
->
max_value
=
0x3FFFFFFFL
;
rand_st
->
max_value_dbl
=
(
double
)
rand_st
->
max_value
;
rand_st
->
seed1
=
seed1
%
rand_st
->
max_value
;
rand_st
->
seed2
=
seed2
%
rand_st
->
max_value
;
}
/**
Generate random number.
@param rand_st [INOUT] Structure used for number generation.
@retval Generated pseudo random number.
*/
double
my_rnd
(
struct
my_rnd_struct
*
rand_st
)
{
rand_st
->
seed1
=
(
rand_st
->
seed1
*
3
+
rand_st
->
seed2
)
%
rand_st
->
max_value
;
rand_st
->
seed2
=
(
rand_st
->
seed1
+
rand_st
->
seed2
+
33
)
%
rand_st
->
max_value
;
return
(((
double
)
rand_st
->
seed1
)
/
rand_st
->
max_value_dbl
);
}
/**
Generate a random number using the OpenSSL/yaSSL supplied
random number generator if available.
@param rand_st [INOUT] Structure used for number generation
only if none of the SSL libraries are
available.
@retval Generated random number.
*/
double
my_rnd_ssl
(
struct
my_rnd_struct
*
rand_st
)
{
#if defined(HAVE_YASSL) || defined(HAVE_OPENSSL)
int
rc
;
unsigned
int
res
;
#if defined(HAVE_YASSL)
rc
=
yaSSL
::
RAND_bytes
((
unsigned
char
*
)
&
res
,
sizeof
(
unsigned
int
));
#else
rc
=
RAND_bytes
((
unsigned
char
*
)
&
res
,
sizeof
(
unsigned
int
));
#endif
/* HAVE_YASSL */
if
(
rc
)
return
(
double
)
res
/
(
double
)
UINT_MAX
;
#endif
/* defined(HAVE_YASSL) || defined(HAVE_OPENSSL) */
return
my_rnd
(
rand_st
);
}
}
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