libbtc
bitcoinclibrary
Functions
random.c File Reference
#include "random.h"
#include "libbtc-config.h"
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <time.h>

Go to the source code of this file.

Functions

void random_init (void)
 
btc_bool random_bytes (uint8_t *buf, uint32_t len, const uint8_t update_seed)
 

Function Documentation

btc_bool random_bytes ( uint8_t *  buf,
uint32_t  len,
const uint8_t  update_seed 
)

Definition at line 57 of file random.c.

References RANDOM_DEVICE.

Referenced by btc_privkey_gen(), btc_privkey_verify_pubkey(), and ecc_start().

58 {
59  (void)update_seed; //unused
60  FILE* frand = fopen(RANDOM_DEVICE, "r");
61  if (!frand) {
62  return false;
63  }
64 
65  size_t len_read = fread(buf, 1, len, frand);
66  assert(len_read == len);
67  fclose(frand);
68  return true;
69 }
size_t len
Definition: buffer.h:16
#define RANDOM_DEVICE
Definition: libbtc-config.h:75
void random_init ( void  )

Definition at line 54 of file random.c.

54 {}