prng.h

来自「很好用的安全RTP开源库」· C头文件 代码 · 共 55 行

H
55
字号
/* * prng.h * * pseudorandom source * * David A. McGrew * Cisco Systems, Inc. */#ifndef PRNG_H#define PRNG_H#include "rand_source.h"  /* for rand_source_func_t definition       */#include "aes.h"          /* for aes                                 */#include "aes_icm.h"      /* for aes ctr                             */#define MAX_PRNG_OUT_LEN 0xffffffffU/* * x917_prng is an ANSI X9.17-like AES-based PRNG */typedef struct {  v128_t   state;          /* state data                              */  aes_expanded_key_t key;  /* secret key                              */  uint32_t octet_count;    /* number of octets output since last init */  rand_source_func_t rand; /* random source for re-initialization     */} x917_prng_t;err_status_tx917_prng_init(rand_source_func_t random_source);err_status_tx917_prng_get_octet_string(uint8_t *dest, uint32_t len);/* * ctr_prng is an AES-CTR based PRNG */typedef struct {  uint32_t octet_count;    /* number of octets output since last init */  aes_icm_ctx_t   state;   /* state data                              */  rand_source_func_t rand; /* random source for re-initialization     */} ctr_prng_t;err_status_tctr_prng_init(rand_source_func_t random_source);err_status_tctr_prng_get_octet_string(void *dest, uint32_t len);#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?