MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / my_rand_buffer

Function my_rand_buffer

mysys_ssl/my_rnd.cc:67–88  ·  view source on GitHub ↗

Fill a buffer with random bytes using the SSL library routines @param buffer [OUT] Buffer to receive the random data @param buffer_size [IN] sizeof the the buffer @retval 1 error ocurred. @retval 0 OK */

Source from the content-addressed store, hash-verified

65@retval 0 OK
66*/
67int
68my_rand_buffer(unsigned char *buffer, size_t buffer_size)
69{
70 int rc;
71#if defined(HAVE_YASSL) /* YaSSL */
72 rc= yaSSL::RAND_bytes(buffer, buffer_size);
73
74 if (!rc)
75 return 1;
76#elif defined(HAVE_OPENSSL)
77 rc= RAND_bytes(buffer, buffer_size);
78
79 if (!rc)
80 {
81 ERR_clear_error();
82 return 1;
83 }
84#else /* no SSL */
85#error not using an SSL library not supported
86#endif
87 return 0;
88}
89
90
91/**

Callers 1

my_rnd_sslFunction · 0.85

Calls 1

RAND_bytesFunction · 0.85

Tested by

no test coverage detected