auth_core: Make sure we always save the RAND in the vector
diff --git a/src/gsm/auth_core.c b/src/gsm/auth_core.c
index c2a13a5..d0c9f1c 100644
--- a/src/gsm/auth_core.c
+++ b/src/gsm/auth_core.c
@@ -72,11 +72,18 @@
const uint8_t *_rand)
{
struct osmo_auth_impl *impl = selected_auths[aud->algo];
+ int rc;
if (!impl)
return -ENOENT;
- return impl->gen_vec(vec, aud, _rand);
+ rc = impl->gen_vec(vec, aud, _rand);
+ if (rc < 0)
+ return rc;
+
+ memcpy(vec->rand, _rand, sizeof(vec->rand));
+
+ return 0;
}
int osmo_auth_gen_vec_auts(struct osmo_auth_vector *vec,