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 */
| 65 | @retval 0 OK |
| 66 | */ |
| 67 | int |
| 68 | my_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 | /** |
no test coverage detected