Displaying 2 results from an estimated 2 matches for "pkcs11_read_pinfile".
2016 Nov 16
3
[PATCH] ssh-pkcs11: allow providing unconditional pin code for PKCS11
...11_PIN_BYTES 128
+
struct pkcs11_slotinfo {
CK_TOKEN_INFO token;
CK_SESSION_HANDLE session;
@@ -216,6 +218,36 @@ pkcs11_find(struct pkcs11_provider *p, CK_ULONG slotidx, CK_ATTRIBUTE *attr,
return (ret);
}
+/* read pin from a file specified in SSH_PKCS11_PINFILE if one exists */
+char *
+pkcs11_read_pinfile()
+{
+ FILE *f;
+ char *pinfilename;
+ char buf[SSH_MAX_PKCS11_PIN_BYTES];
+ int i;
+
+ if ((pinfilename = getenv("SSH_PKCS11_PINFILE")) == NULL)
+ return NULL;
+ if ((f = fopen(pinfilename, "r")) == NULL) {
+ debug("failed to read SSH_PKCS11_PINFILE");
+ return NUL...
2016 Nov 16
2
[PATCH] ssh-pkcs11: allow providing unconditional pin code for PKCS11
..._MAX_PKCS11_PIN_BYTES 128
+
struct pkcs11_slotinfo {
CK_TOKEN_INFO token;
CK_SESSION_HANDLE session;
@@ -216,6 +218,36 @@ pkcs11_find(struct pkcs11_provider *p, CK_ULONG slotidx, CK_ATTRIBUTE *attr,
return (ret);
}
+/* read pin from a file specified in SSH_PKCS11_PINFILE if one exists */
+char *
+pkcs11_read_pinfile()
+{
+ FILE *f;
+ char *pinfilename;
+ char buf[SSH_MAX_PKCS11_PIN_BYTES];
+ int i;
+
+ if ((pinfilename = getenv("SSH_PKCS11_PINFILE")) == NULL)
+ return NULL;
+ if ((f = fopen(pinfilename, "r")) == NULL) {
+ debug("failed to read SSH_PKCS11_PINFILE");
+ return NUL...