rt: Fix iaac_init using wrong type and not seeding correctly

This was a result of changing the vector representation to contain
a box header.
This commit is contained in:
Brian Anderson
2012-06-04 23:26:06 -07:00
parent e04e9488ad
commit 78fe75a741
3 changed files with 16 additions and 5 deletions

View File

@@ -128,16 +128,16 @@ inline void isaac_seed(rust_kernel* kernel, uint8_t* dest)
}
inline void
isaac_init(rust_kernel *kernel, randctx *rctx, rust_vec* user_seed)
isaac_init(rust_kernel *kernel, randctx *rctx, rust_vec_box* user_seed)
{
memset(rctx, 0, sizeof(randctx));
char *env_seed = kernel->env->rust_seed;
if (user_seed != NULL) {
// ignore bytes after the required length
size_t seed_len = user_seed->fill < sizeof(rctx->randrsl)
? user_seed->fill : sizeof(rctx->randrsl);
memcpy(&rctx->randrsl, user_seed->data, seed_len);
size_t seed_len = user_seed->body.fill < sizeof(rctx->randrsl)
? user_seed->body.fill : sizeof(rctx->randrsl);
memcpy(&rctx->randrsl, user_seed->body.data, seed_len);
} else if (env_seed != NULL) {
ub4 seed = (ub4) atoi(env_seed);
for (size_t i = 0; i < RANDSIZ; i ++) {