summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/osmo-auc-gen.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c
index 1f5c8386..9d1215c8 100644
--- a/utils/osmo-auc-gen.c
+++ b/utils/osmo-auc-gen.c
@@ -34,6 +34,7 @@
#include <osmocom/crypt/auth.h>
#include <osmocom/core/utils.h>
+#include <osmocom/gsm/gsm_utils.h>
static void dump_triplets_dat(struct osmo_auth_vector *vec)
{
@@ -247,14 +248,11 @@ int main(int argc, char **argv)
}
if (!rand_is_set) {
- int i;
- printf("WARNING: We're using really weak random numbers!\n\n");
- srand(time(NULL));
-
- for (i = 0; i < 4; ++i) {
- uint32_t r;
- r = rand();
- memcpy(&_rand[i*4], &r, 4);
+ rc = osmo_get_rand_id(_rand, 16);
+ if (rc < 0) {
+ fprintf(stderr, "\nError: unable to obtain secure random numbers: %s!\n",
+ strerror(-rc));
+ exit(3);
}
}