1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-23 21:54:53 +02:00

avutil/random_seed: add av_random_bytes()

Uses the existing code for av_get_random_seed() to return a buffer with
cryptographically secure random data, or an error if none could be generated.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2023-07-04 19:46:32 -03:00
parent 7a1128ca07
commit d694c25b44
4 changed files with 40 additions and 13 deletions

View File

@@ -36,6 +36,19 @@
*/
uint32_t av_get_random_seed(void);
/**
* Generate cryptographically secure random data, i.e. suitable for use as
* encryption keys and similar.
*
* @param buf buffer into which the random data will be written
* @param len size of buf in bytes
*
* @retval 0 success, len bytes of random data was written
* into buf
* @retval "a negative AVERROR code" random data could not be generated
*/
int av_random_bytes(uint8_t *buf, size_t len);
/**
* @}
*/