X-Git-Url: https://git.openssl.org/?a=blobdiff_plain;f=crypto%2Fengine%2Feng_cryptodev.c;h=b32be08c8e6f3149c95e6062801e6cf6232c3e85;hb=0c3426da8678d248c2ebfe02c84d6fdab122a21e;hp=be7ed6bb3f808c036859a1c5e4fd11a3e8d17fcb;hpb=b84d5b72f193d65d8da7af513dbea3ad972b1ae6;p=openssl.git diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c index be7ed6bb3f..b32be08c8e 100644 --- a/crypto/engine/eng_cryptodev.c +++ b/crypto/engine/eng_cryptodev.c @@ -33,31 +33,28 @@ #include #include -#ifndef __OpenBSD__ - -void -ENGINE_load_cryptodev(void) -{ - /* This is a NOP unless __OpenBSD__ is defined */ - return; -} - -#else /* __OpenBSD__ */ - -#include +#if (defined(__unix__) || defined(unix)) && !defined(USG) #include +# if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041) +# define HAVE_CRYPTODEV +# endif +# if (OpenBSD >= 200110) +# define HAVE_SYSLOG_R +# endif +#endif -#if OpenBSD < 200112 +#ifndef HAVE_CRYPTODEV void ENGINE_load_cryptodev(void) { - /* This is a NOP unless we have release 3.0 (released december 2001) */ + /* This is a NOP on platforms without /dev/crypto */ return; } -#else /* OpenBSD 3.0 or above */ - +#else + +#include #include #include #include @@ -1032,12 +1029,18 @@ static DH_METHOD cryptodev_dh = { static int cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) { +#ifdef HAVE_SYSLOG_R struct syslog_data sd = SYSLOG_DATA_INIT; +#endif switch (cmd) { default: +#ifdef HAVE_SYSLOG_R syslog_r(LOG_ERR, &sd, "cryptodev_ctrl: unknown command %d", cmd); +#else + syslog(LOG_ERR, "cryptodev_ctrl: unknown command %d", cmd); +#endif break; } return (1); @@ -1064,7 +1067,7 @@ ENGINE_load_cryptodev(void) close(fd); if (!ENGINE_set_id(engine, "cryptodev") || - !ENGINE_set_name(engine, "OpenBSD cryptodev engine") || + !ENGINE_set_name(engine, "BSD cryptodev engine") || !ENGINE_set_ciphers(engine, cryptodev_engine_ciphers) || !ENGINE_set_digests(engine, cryptodev_engine_digests) || !ENGINE_set_ctrl_function(engine, cryptodev_ctrl) || @@ -1126,5 +1129,4 @@ ENGINE_load_cryptodev(void) ERR_clear_error(); } -#endif /* OpenBSD 3.0 or above */ -#endif /* __OpenBSD__ */ +#endif /* HAVE_CRYPTODEV */