summaryrefslogtreecommitdiff
path: root/security/opencryptoki/files/patch-usr-lib-common-loadsave.c
diff options
context:
space:
mode:
authorHiroki Sato <hrs@FreeBSD.org>2022-05-06 17:31:40 +0900
committerHiroki Sato <hrs@FreeBSD.org>2022-05-06 17:32:09 +0900
commitcd09274aa2c59b5a06508ed00bf5bded7b7b6213 (patch)
tree9089f1274785e194391aa2e01883fa0e37af02e2 /security/opencryptoki/files/patch-usr-lib-common-loadsave.c
parentpackage: fix inverted logic (diff)
security/opencryptoki: update to 3.18.0
Diffstat (limited to 'security/opencryptoki/files/patch-usr-lib-common-loadsave.c')
-rw-r--r--security/opencryptoki/files/patch-usr-lib-common-loadsave.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/security/opencryptoki/files/patch-usr-lib-common-loadsave.c b/security/opencryptoki/files/patch-usr-lib-common-loadsave.c
index 2ac5ea0f2587..4560b35b683c 100644
--- a/security/opencryptoki/files/patch-usr-lib-common-loadsave.c
+++ b/security/opencryptoki/files/patch-usr-lib-common-loadsave.c
@@ -1,10 +1,12 @@
---- usr/lib/common/loadsave.c.orig 2018-11-16 14:53:03 UTC
+--- usr/lib/common/loadsave.c.orig 2022-04-25 11:04:51 UTC
+++ usr/lib/common/loadsave.c
-@@ -20,11 +20,9 @@
+@@ -20,17 +20,22 @@
#include <string.h>
#include <strings.h>
#include <unistd.h>
--#include <alloca.h>
++#if !defined(__FreeBSD__)
+ #include <alloca.h>
++#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ipc.h>
@@ -12,12 +14,34 @@
#include <errno.h>
#include <syslog.h>
#include <pwd.h>
-@@ -370,7 +368,7 @@ void set_perm(int file)
+ #include <grp.h>
+ #include <openssl/evp.h>
++#if !defined(__FreeBSD__)
+ #include <endian.h>
++#else
++#include <sys/endian.h>
++#endif
+
+ #include "pkcs11types.h"
+ #include "defs.h"
+@@ -132,7 +137,7 @@ void set_perm(int file)
// Set absolute permissions or rw-rw----
fchmod(file, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
- grp = getgrnam("pkcs11"); // Obtain the group id
+ grp = getgrnam(PKCS11GROUP); // Obtain the group id
if (grp) {
- // set ownership to root, and pkcs11 group
- if (fchown(file, getuid(), grp->gr_gid) != 0) {
+ // set ownership to pkcs11 group
+ if (fchown(file, -1, grp->gr_gid) != 0) {
+@@ -303,7 +308,11 @@ CK_RV init_data_store(STDLL_TokData_t *tokdata, char *
+ tokdata->pk_dir = NULL;
+ }
+
++#if !defined(__FreeBSD__)
+ if ((pkdir = secure_getenv("PKCS_APP_STORE")) != NULL) {
++#else
++ if ((pkdir = getenv("PKCS_APP_STORE")) != NULL) {
++#endif
+ pklen = strlen(pkdir) + 1024;
+ tokdata->pk_dir = (char *) calloc(pklen, 1);
+ if (!(tokdata->pk_dir))