summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am1
-rw-r--r--src/aes_prng.c5
-rw-r--r--src/aes_prng.h6
3 files changed, 9 insertions, 3 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 03942157..25766ca0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -132,6 +132,7 @@ deh_weapon.c
# source files needed for FEATURE_MULTIPLAYER
FEATURE_MULTIPLAYER_SOURCE_FILES= \
+aes_prng.c aes_prng.h \
net_client.c net_client.h \
net_common.c net_common.h \
net_dedicated.c net_dedicated.h \
diff --git a/src/aes_prng.c b/src/aes_prng.c
index 0a68efb5..f6ded3c1 100644
--- a/src/aes_prng.c
+++ b/src/aes_prng.c
@@ -70,6 +70,7 @@
#include <stdlib.h>
#include <string.h> /* for memcmp() */
+#include "aes_prng.h"
#include "doomtype.h"
#include "i_system.h"
@@ -948,7 +949,7 @@ static unsigned int prng_value_index = 0;
// Initialize Pseudo-RNG using the specified 128-bit key.
-void PRNG_Start(byte *key)
+void PRNG_Start(prng_seed_t key)
{
char *errormsg;
@@ -959,7 +960,7 @@ void PRNG_Start(byte *key)
I_Error("Failed to initialize PRNG: %s", errormsg);
}
- AES_SetKey(&prng_context, key, 128 / 8);
+ AES_SetKey(&prng_context, key, sizeof(prng_seed_t));
prng_value_index = 4;
prng_input_counter = 0;
prng_enabled = true;
diff --git a/src/aes_prng.h b/src/aes_prng.h
index c58166b8..4c06f3a3 100644
--- a/src/aes_prng.h
+++ b/src/aes_prng.h
@@ -28,7 +28,11 @@
#include "doomtype.h"
-void PRNG_Start(byte *key);
+// Nonce value used as random seed for secure demos.
+
+typedef byte prng_seed_t[16];
+
+void PRNG_Start(prng_seed_t seed);
void PRNG_Stop(void);
unsigned int PRNG_Random(void);