pkcs11-tool: CKA_VALUE of imported GOST key has to be presented in the little endian order

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5518 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
vtarasov 2011-05-29 17:55:26 +00:00
parent 71b1f55f7c
commit 4d2428378d
1 changed files with 5 additions and 0 deletions

View File

@ -1822,11 +1822,16 @@ static int write_object(CK_SLOT_ID slot, CK_SESSION_HANDLE session)
#if OPENSSL_VERSION_NUMBER >= 0x10000000L && !defined(OPENSSL_NO_EC)
else if (evp_key->type == NID_id_GostR3410_2001) {
CK_KEY_TYPE type = CKK_GOSTR3410;
FILL_ATTR(privkey_templ[n_privkey_attr], CKA_KEY_TYPE, &type, sizeof(type));
n_privkey_attr++;
FILL_ATTR(privkey_templ[n_privkey_attr], CKA_GOSTR3410_PARAMS, gost.param_oid.value, gost.param_oid.len);
n_privkey_attr++;
FILL_ATTR(privkey_templ[n_privkey_attr], CKA_VALUE, gost.private.value, gost.private.len);
/* CKA_VALUE of the GOST key has to be in the little endian order */
rv = sc_mem_reverse(privkey_templ[n_privkey_attr].pValue, privkey_templ[n_privkey_attr].ulValueLen);
if (rv)
return rv;
n_privkey_attr++;
}
#endif