diff options
Diffstat (limited to 'crypto/engine/eng_cryptodev.c')
-rw-r--r-- | crypto/engine/eng_cryptodev.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c index 09ef3292b5..eef1e2d814 100644 --- a/crypto/engine/eng_cryptodev.c +++ b/crypto/engine/eng_cryptodev.c @@ -186,7 +186,6 @@ get_dev_crypto(void) if ((fd = open_dev_crypto()) == -1) return (-1); -#ifndef CRIOGET_NOT_NEEDED if (ioctl(fd, CRIOGET, &retfd) == -1) return (-1); @@ -195,19 +194,9 @@ get_dev_crypto(void) close(retfd); return (-1); } -#else - retfd = fd; -#endif return (retfd); } -static void put_dev_crypto(int fd) -{ -#ifndef CRIOGET_NOT_NEEDED - close(fd); -#endif -} - /* Caching version for asym operations */ static int get_asym_dev_crypto(void) @@ -293,7 +282,7 @@ get_cryptodev_ciphers(const int **cnids) ioctl(fd, CIOCFSESSION, &sess.ses) != -1) nids[count++] = ciphers[i].nid; } - put_dev_crypto(fd); + close(fd); if (count > 0) *cnids = nids; @@ -330,7 +319,7 @@ get_cryptodev_digests(const int **cnids) ioctl(fd, CIOCFSESSION, &sess.ses) != -1) nids[count++] = digests[i].nid; } - put_dev_crypto(fd); + close(fd); if (count > 0) *cnids = nids; @@ -468,7 +457,7 @@ cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, sess->cipher = cipher; if (ioctl(state->d_fd, CIOCGSESSION, sess) == -1) { - put_dev_crypto(state->d_fd); + close(state->d_fd); state->d_fd = -1; return (0); } @@ -505,7 +494,7 @@ cryptodev_cleanup(EVP_CIPHER_CTX *ctx) } else { ret = 1; } - put_dev_crypto(state->d_fd); + close(state->d_fd); state->d_fd = -1; return (ret); @@ -1095,11 +1084,11 @@ ENGINE_load_cryptodev(void) * find out what asymmetric crypto algorithms we support */ if (ioctl(fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) { - put_dev_crypto(fd); + close(fd); ENGINE_free(engine); return; } - put_dev_crypto(fd); + close(fd); if (!ENGINE_set_id(engine, "cryptodev") || !ENGINE_set_name(engine, "BSD cryptodev engine") || |