Skip to content

Instantly share code, notes, and snippets.

@JohnMaguire JohnMaguire/Makefile
Created Aug 22, 2019

What would you like to do?
#include <stdio.h>
#include <openssl/err.h>
#include <openssl/rand.h>
int main(int argc, char **argv) {
unsigned long code;
code = ERR_get_error();
if (code) {
printf("error code %lu", code);
return 1;
const char *file;
char buffer[256];
file = RAND_file_name(buffer, sizeof(buffer));
if (file == NULL) {
printf("No RAND_file_name\n");
return 0;
printf("RAND_file_name: %s\n", file);
RAND_load_file(file, -1);
if (RAND_status() == 0) {
printf("RAND_status() == 0\n");
return 1;
code = ERR_get_error();
if (code) {
printf("error code %lu\n", code);
char *buf;
ERR_error_string(code, buf);
printf("error: %s\n", buf);
return 1;
FLAGS=-lssl -lcrypto
all: test-1.1 test-1.0
gcc main.c ${FLAGS} -I/usr/lib -o test-1.1
gcc -I/usr/include/openssl-1.0 main.c ${FLAGS} -o test-1.0 -L/usr/lib/openssl-1.0
rm test-1.0 test-1.1

This comment has been minimized.

Copy link
Owner Author

JohnMaguire commented Aug 22, 2019

jmaguire@scorpion [12:18:07 PM] [~/test-openssl]
-> % ./test-1.0
RAND_file_name: /home/jmaguire/.rnd
jmaguire@scorpion [12:18:10 PM] [~/test-openssl]
-> % ./test-1.1
RAND_file_name: /home/jmaguire/.rnd
error code 604434553
error: (null)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.