X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fengine%2Feng_cryptodev.c;h=b32be08c8e6f3149c95e6062801e6cf6232c3e85;hp=df887b03d4983fc37796762c4a9f4f713017f0ee;hb=0c3426da8678d248c2ebfe02c84d6fdab122a21e;hpb=76dfca879f026844297b6540fa39dfb5d25ade39 diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c index df887b03d4..b32be08c8e 100644 --- a/crypto/engine/eng_cryptodev.c +++ b/crypto/engine/eng_cryptodev.c @@ -33,19 +33,28 @@ #include #include -#ifndef __OpenBSD__ +#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 + +#ifndef HAVE_CRYPTODEV void ENGINE_load_cryptodev(void) { - /* This is a NOP unless __OpenBSD__ is defined */ + /* This is a NOP on platforms without /dev/crypto */ return; } -#else /* __OpenBSD__ */ - +#else + #include -#include #include #include #include @@ -1020,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); @@ -1052,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) || @@ -1114,4 +1129,4 @@ ENGINE_load_cryptodev(void) ERR_clear_error(); } -#endif /* __OpenBSD__ */ +#endif /* HAVE_CRYPTODEV */