зеркало из https://github.com/mozilla/gecko-dev.git
fix up problems in last change
This commit is contained in:
Родитель
9952745848
Коммит
a4a2117751
|
@ -389,7 +389,8 @@ pk11_InitGeneric(PK11Session *session,PK11SessionContext **contextPtr,
|
||||||
/* find the key */
|
/* find the key */
|
||||||
if (keyPtr) {
|
if (keyPtr) {
|
||||||
CK_KEY_TYPE kt;
|
CK_KEY_TYPE kt;
|
||||||
unsigned int size, i;
|
unsigned int size;
|
||||||
|
int i;
|
||||||
key = pk11_ObjectFromHandle(hKey,session);
|
key = pk11_ObjectFromHandle(hKey,session);
|
||||||
if (key == NULL) {
|
if (key == NULL) {
|
||||||
return CKR_KEY_HANDLE_INVALID;
|
return CKR_KEY_HANDLE_INVALID;
|
||||||
|
@ -406,8 +407,12 @@ pk11_InitGeneric(PK11Session *session,PK11SessionContext **contextPtr,
|
||||||
PORT_Assert(att != NULL);
|
PORT_Assert(att != NULL);
|
||||||
size = sizeof(CK_KEY_TYPE);
|
size = sizeof(CK_KEY_TYPE);
|
||||||
kt = 0;
|
kt = 0;
|
||||||
for (i=0; i<size; i+=8) {
|
for (i=att->attrib.ulValueLen-1; i>=0; i--) {
|
||||||
kt |= ((unsigned char *)att->attrib.pValue)[i] << i*8;
|
#ifdef IS_LITTLE_ENDIAN
|
||||||
|
kt |= ((unsigned char *)att->attrib.pValue)[i] << (i*8);
|
||||||
|
#else
|
||||||
|
kt |= ((unsigned char *)att->attrib.pValue)[i] << ((size-1-i)*8);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
*keyTypePtr = kt;
|
*keyTypePtr = kt;
|
||||||
pk11_FreeAttribute(att);
|
pk11_FreeAttribute(att);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче