RAND_bytes() return 1 for cryptographic strong data, check for that.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18479 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -950,9 +950,9 @@ random_data(void *opt, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = RAND_bytes(ptr, len);
|
ret = RAND_bytes(ptr, len);
|
||||||
if (ret != len) {
|
if (ret != 1) {
|
||||||
free(ptr);
|
free(ptr);
|
||||||
fprintf(stderr, "requested %d bytes, got %d bytes\n", len, ret);
|
fprintf(stderr, "did not get cryptographic strong random\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user