aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2010-07-16 10:12:22 +0200
committerMartin Willi <martin@revosec.ch>2010-08-04 09:26:20 +0200
commit353d10d5902e5ead75ebfa701b903a8ff20660da (patch)
treeb16625c56ea4c2afa471d36142952ffb61e8de02 /src/libcharon/plugins
parent5f1e4438cbce7723ad4c2afcdb01ec39bf64335c (diff)
downloadstrongswan-353d10d5902e5ead75ebfa701b903a8ff20660da.tar.bz2
strongswan-353d10d5902e5ead75ebfa701b903a8ff20660da.tar.xz
Reuse generic passphrase build part, not a dedicated PIN part
Diffstat (limited to 'src/libcharon/plugins')
-rw-r--r--src/libcharon/plugins/stroke/stroke_cred.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/libcharon/plugins/stroke/stroke_cred.c b/src/libcharon/plugins/stroke/stroke_cred.c
index 14f221431..d683afa8a 100644
--- a/src/libcharon/plugins/stroke/stroke_cred.c
+++ b/src/libcharon/plugins/stroke/stroke_cred.c
@@ -929,7 +929,7 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level,
else if (match("PIN", &token))
{
chunk_t sc = chunk_empty, secret = chunk_empty;
- char smartcard[64], keyid[64], pin[64], module[64], *pos;
+ char smartcard[64], keyid[64], module[64], *pos;
private_key_t *key;
u_int slot;
enum {
@@ -997,8 +997,6 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level,
DBG1(DBG_CFG, "line %d: malformed PIN: %s", line_nr, ugh);
goto error;
}
- snprintf(pin, sizeof(pin), "%.*s", secret.len, secret.ptr);
- pin[sizeof(pin) - 1] = '\0';
switch (format)
{
@@ -1008,20 +1006,20 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level,
BUILD_PKCS11_SLOT, slot,
BUILD_PKCS11_MODULE, module,
BUILD_PKCS11_KEYID, keyid,
- BUILD_PKCS11_PIN, pin, BUILD_END);
+ BUILD_PASSPHRASE, secret, BUILD_END);
break;
case SC_FORMAT_SLOT_KEYID:
key = lib->creds->create(lib->creds,
CRED_PRIVATE_KEY, KEY_ANY,
BUILD_PKCS11_SLOT, slot,
BUILD_PKCS11_KEYID, keyid,
- BUILD_PKCS11_PIN, pin, BUILD_END);
+ BUILD_PASSPHRASE, secret, BUILD_END);
break;
case SC_FORMAT_KEYID:
key = lib->creds->create(lib->creds,
CRED_PRIVATE_KEY, KEY_ANY,
BUILD_PKCS11_KEYID, keyid,
- BUILD_PKCS11_PIN, pin, BUILD_END);
+ BUILD_PASSPHRASE, secret, BUILD_END);
break;
}
if (key)
@@ -1029,7 +1027,6 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level,
DBG1(DBG_CFG, " loaded private key from %.*s", sc.len, sc.ptr);
this->private->insert_last(this->private, key);
}
- memset(pin, 0, sizeof(pin));
chunk_clear(&secret);
}
else if ((match("PSK", &token) && (type = SHARED_IKE)) ||