summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrelyea%netscape.com <devnull@localhost>2002-01-29 21:10:50 +0000
committerrelyea%netscape.com <devnull@localhost>2002-01-29 21:10:50 +0000
commit536c9904f352e0c30fc324ad671827b0e36f77fd (patch)
tree5a63e507403657c53f2c5848e0b53cfb2f4e693a
parent0e7234e689bc6a9078db05d0a6379a519e4c4e0e (diff)
downloadnss-hg-536c9904f352e0c30fc324ad671827b0e36f77fd.tar.gz
Token and slot names are already converted to NULL terminated strings in the slot structure
-rw-r--r--security/nss/lib/pk11wrap/dev3hack.c29
1 files changed, 2 insertions, 27 deletions
diff --git a/security/nss/lib/pk11wrap/dev3hack.c b/security/nss/lib/pk11wrap/dev3hack.c
index 23dd7b21f..fee77308d 100644
--- a/security/nss/lib/pk11wrap/dev3hack.c
+++ b/security/nss/lib/pk11wrap/dev3hack.c
@@ -47,19 +47,6 @@ static const char CVS_ID[] = "@(#) $RCSfile$ $Revision$ $Date$ $Name$";
#include "devt.h"
#endif /* DEVT_H */
-/* copied from devutil.c in dev */
-static PRUint32
-nssdevPKCS11StringLength(CK_CHAR *pkcs11Str, PRUint32 bufLen)
-{
- PRInt32 i;
- for (i = bufLen - 1; i>=0; ) {
- if (pkcs11Str[i] != ' ') break;
- --i;
- }
- return (PRUint32)(i + 1);
-}
-
-
#include "dev3hack.h"
#ifndef BASE_H
@@ -124,7 +111,6 @@ nssSession_Destroy
static NSSSlot *
nssSlot_CreateFromPK11SlotInfo(NSSTrustDomain *td, PK11SlotInfo *nss3slot)
{
- PRUint32 length;
NSSSlot *rvSlot;
rvSlot = nss_ZNEW(td->arena, NSSSlot);
if (!rvSlot) {
@@ -136,19 +122,13 @@ nssSlot_CreateFromPK11SlotInfo(NSSTrustDomain *td, PK11SlotInfo *nss3slot)
rvSlot->slotID = nss3slot->slotID;
rvSlot->trustDomain = td;
/* Grab the slot name from the PKCS#11 fixed-length buffer */
- length = nssdevPKCS11StringLength((CK_CHAR *)nss3slot->slot_name,
- sizeof(nss3slot->slot_name));
- if (length > 0) {
- rvSlot->name = nssUTF8_Create(td->arena, nssStringType_UTF8String,
- (void *)nss3slot->slot_name, length);
- }
+ rvSlot->name = nssUTF8_Duplicate(nss3slot->slot_name,td->arena);
return rvSlot;
}
NSS_IMPLEMENT NSSToken *
nssToken_CreateFromPK11SlotInfo(NSSTrustDomain *td, PK11SlotInfo *nss3slot)
{
- PRUint32 length;
NSSToken *rvToken;
rvToken = nss_ZNEW(td->arena, NSSToken);
if (!rvToken) {
@@ -163,12 +143,7 @@ nssToken_CreateFromPK11SlotInfo(NSSTrustDomain *td, PK11SlotInfo *nss3slot)
nss3slot->defRWSession);
rvToken->trustDomain = td;
/* Grab the token name from the PKCS#11 fixed-length buffer */
- length = nssdevPKCS11StringLength((CK_CHAR *)nss3slot->token_name,
- sizeof(nss3slot->token_name));
- if (length > 0) {
- rvToken->name = nssUTF8_Create(td->arena, nssStringType_UTF8String,
- (void *)nss3slot->token_name, length);
- }
+ rvToken->name = nssUTF8_Duplicate(nss3slot->token_name,td->arena);
rvToken->slot = nssSlot_CreateFromPK11SlotInfo(td, nss3slot);
rvToken->slot->token = rvToken;
rvToken->defaultSession->slot = rvToken->slot;