LCOV - code coverage report
Current view: top level - src/random - zero.c (source / functions) Hit Total Coverage
Test: passgen-test.info Lines: 14 14 100.0 %
Date: 2024-11-29 06:05:05 Functions: 3 3 100.0 %

          Line data    Source code
       1             : #include "passgen/assert.h"
       2             : #include "passgen/config.h"
       3             : #include "passgen/random.h"
       4             : #include "passgen/util/endian.h"
       5             : #include <stdlib.h>
       6             : #include <string.h>
       7             : 
       8           3 : static size_t passgen_random_zero_read(void *context, void *dest, size_t size) {
       9             :     (void) context;
      10           3 :     memset(dest, 0, size);
      11           3 :     return size;
      12             : }
      13             : 
      14           3 : static void passgen_random_zero_close(void *context) {
      15             :     (void) context;
      16           3 : }
      17             : 
      18           3 : passgen_random *passgen_random_zero_open(passgen_random *random) {
      19           3 :     if(!random) {
      20           2 :         random = malloc(sizeof(passgen_random));
      21           2 :         if(!random) return NULL;
      22             :     }
      23             : 
      24           3 :     random->context = NULL;
      25           3 :     random->read = passgen_random_zero_read;
      26           3 :     random->close = passgen_random_zero_close;
      27           3 :     passgen_random_reload(random);
      28           3 :     return random;
      29             : }

Generated by: LCOV version 1.14