diff options
author | markus <> | 2003-05-12 02:18:40 +0000 |
---|---|---|
committer | markus <> | 2003-05-12 02:18:40 +0000 |
commit | d4fcd82bb7f6d603bd61e19a81ba97337b89dfca (patch) | |
tree | d52e3a0f1f08f65ad283027e560e17ed0d720462 /src/lib/libcrypto/engine/hw_cryptodev.c | |
parent | 582bbd139cd2afd58d10dc051c5b0b989b441074 (diff) | |
download | openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.tar.gz openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.tar.bz2 openbsd-d4fcd82bb7f6d603bd61e19a81ba97337b89dfca.zip |
merge 0.9.7b with local changes; crank majors for libssl/libcrypto
Diffstat (limited to 'src/lib/libcrypto/engine/hw_cryptodev.c')
-rw-r--r-- | src/lib/libcrypto/engine/hw_cryptodev.c | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/src/lib/libcrypto/engine/hw_cryptodev.c b/src/lib/libcrypto/engine/hw_cryptodev.c index 034c7ca213..139119b80c 100644 --- a/src/lib/libcrypto/engine/hw_cryptodev.c +++ b/src/lib/libcrypto/engine/hw_cryptodev.c | |||
@@ -29,8 +29,32 @@ | |||
29 | * | 29 | * |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <sys/types.h> | 32 | #include <openssl/objects.h> |
33 | #include <openssl/engine.h> | ||
34 | #include <openssl/evp.h> | ||
35 | |||
36 | #if (defined(__unix__) || defined(unix)) && !defined(USG) | ||
33 | #include <sys/param.h> | 37 | #include <sys/param.h> |
38 | # if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041) | ||
39 | # define HAVE_CRYPTODEV | ||
40 | # endif | ||
41 | # if (OpenBSD >= 200110) | ||
42 | # define HAVE_SYSLOG_R | ||
43 | # endif | ||
44 | #endif | ||
45 | |||
46 | #ifndef HAVE_CRYPTODEV | ||
47 | |||
48 | void | ||
49 | ENGINE_load_cryptodev(void) | ||
50 | { | ||
51 | /* This is a NOP on platforms without /dev/crypto */ | ||
52 | return; | ||
53 | } | ||
54 | |||
55 | #else | ||
56 | |||
57 | #include <sys/types.h> | ||
34 | #include <crypto/cryptodev.h> | 58 | #include <crypto/cryptodev.h> |
35 | #include <sys/ioctl.h> | 59 | #include <sys/ioctl.h> |
36 | #include <errno.h> | 60 | #include <errno.h> |
@@ -39,9 +63,6 @@ | |||
39 | #include <fcntl.h> | 63 | #include <fcntl.h> |
40 | #include <stdarg.h> | 64 | #include <stdarg.h> |
41 | #include <syslog.h> | 65 | #include <syslog.h> |
42 | #include <ssl/objects.h> | ||
43 | #include <ssl/engine.h> | ||
44 | #include <ssl/evp.h> | ||
45 | #include <errno.h> | 66 | #include <errno.h> |
46 | #include <string.h> | 67 | #include <string.h> |
47 | 68 | ||
@@ -101,10 +122,6 @@ static int cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, | |||
101 | void ENGINE_load_cryptodev(void); | 122 | void ENGINE_load_cryptodev(void); |
102 | 123 | ||
103 | static const ENGINE_CMD_DEFN cryptodev_defns[] = { | 124 | static const ENGINE_CMD_DEFN cryptodev_defns[] = { |
104 | {ENGINE_CMD_BASE, | ||
105 | "SO_PATH", | ||
106 | "Specifies the path to the some stupid shared library", | ||
107 | ENGINE_CMD_FLAG_STRING}, | ||
108 | { 0, NULL, NULL, 0 } | 125 | { 0, NULL, NULL, 0 } |
109 | }; | 126 | }; |
110 | 127 | ||
@@ -1011,12 +1028,18 @@ static DH_METHOD cryptodev_dh = { | |||
1011 | static int | 1028 | static int |
1012 | cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | 1029 | cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) |
1013 | { | 1030 | { |
1031 | #ifdef HAVE_SYSLOG_R | ||
1014 | struct syslog_data sd = SYSLOG_DATA_INIT; | 1032 | struct syslog_data sd = SYSLOG_DATA_INIT; |
1033 | #endif | ||
1015 | 1034 | ||
1016 | switch (cmd) { | 1035 | switch (cmd) { |
1017 | default: | 1036 | default: |
1037 | #ifdef HAVE_SYSLOG_R | ||
1018 | syslog_r(LOG_ERR, &sd, | 1038 | syslog_r(LOG_ERR, &sd, |
1019 | "cryptodev_ctrl: unknown command %d", cmd); | 1039 | "cryptodev_ctrl: unknown command %d", cmd); |
1040 | #else | ||
1041 | syslog(LOG_ERR, "cryptodev_ctrl: unknown command %d", cmd); | ||
1042 | #endif | ||
1020 | break; | 1043 | break; |
1021 | } | 1044 | } |
1022 | return (1); | 1045 | return (1); |
@@ -1043,7 +1066,7 @@ ENGINE_load_cryptodev(void) | |||
1043 | close(fd); | 1066 | close(fd); |
1044 | 1067 | ||
1045 | if (!ENGINE_set_id(engine, "cryptodev") || | 1068 | if (!ENGINE_set_id(engine, "cryptodev") || |
1046 | !ENGINE_set_name(engine, "OpenBSD cryptodev engine") || | 1069 | !ENGINE_set_name(engine, "BSD cryptodev engine") || |
1047 | !ENGINE_set_ciphers(engine, cryptodev_engine_ciphers) || | 1070 | !ENGINE_set_ciphers(engine, cryptodev_engine_ciphers) || |
1048 | !ENGINE_set_digests(engine, cryptodev_engine_digests) || | 1071 | !ENGINE_set_digests(engine, cryptodev_engine_digests) || |
1049 | !ENGINE_set_ctrl_function(engine, cryptodev_ctrl) || | 1072 | !ENGINE_set_ctrl_function(engine, cryptodev_ctrl) || |
@@ -1104,3 +1127,5 @@ ENGINE_load_cryptodev(void) | |||
1104 | ENGINE_free(engine); | 1127 | ENGINE_free(engine); |
1105 | ERR_clear_error(); | 1128 | ERR_clear_error(); |
1106 | } | 1129 | } |
1130 | |||
1131 | #endif /* HAVE_CRYPTODEV */ | ||