} else { tsize -= 2;
PK11_SaveSMimeProfile(PK11SlotInfo *slot, char *emailAddr, SECItem *derSubj,				 SECItem *emailProfile,  SECItem *profileTime){    CK_OBJECT_CLASS smimeClass = CKO_NETSCAPE_SMIME;    CK_BBOOL ck_true = CK_TRUE;    CK_ATTRIBUTE theTemplate[] = {	{ CKA_CLASS, NULL, 0 },	{ CKA_TOKEN, NULL, 0 },	{ CKA_SUBJECT, NULL, 0 },	{ CKA_NETSCAPE_EMAIL, NULL, 0 },	{ CKA_NETSCAPE_SMIME_TIMESTAMP, NULL, 0 },	{ CKA_VALUE, NULL, 0 }    };    /* if you change the array, change the variable below as well */    int tsize = sizeof(theTemplate)/sizeof(theTemplate[0]);    CK_OBJECT_HANDLE smimeh = CK_INVALID_HANDLE;    CK_ATTRIBUTE *attrs = theTemplate;    CK_SESSION_HANDLE rwsession;    CK_RV crv;    PK11_SETATTRS(attrs, CKA_CLASS, &smimeClass, sizeof(smimeClass)); attrs++;    PK11_SETATTRS(attrs, CKA_TOKEN, &ck_true, sizeof(ck_true)); attrs++;    PK11_SETATTRS(attrs, CKA_SUBJECT, derSubj->data, derSubj->len); attrs++;    PK11_SETATTRS(attrs, CKA_NETSCAPE_EMAIL, 				emailAddr, PORT_Strlen(emailAddr)+1); attrs++;    if (profileTime) {	PK11_SETATTRS(attrs, CKA_NETSCAPE_SMIME_TIMESTAMP, profileTime->data,	                                            profileTime->len); attrs++;	PK11_SETATTRS(attrs, CKA_VALUE,emailProfile->data,	                                            emailProfile->len); attrs++;    } else {	tsize -= 2;    }    if (slot == NULL) {	slot = PK11_GetInternalKeySlot();	/* we need to free the key slot in the end!!! */    }    rwsession = PK11_GetRWSession(slot);    if (rwsession == CK_INVALID_SESSION) {	PORT_SetError(SEC_ERROR_READ_ONLY);	return SECFailure;    }    crv = PK11_GETTAB(slot)->                        C_CreateObject(rwsession,theTemplate,tsize,&smimeh);    if (crv != CKR_OK) {        PORT_SetError( PK11_MapError(crv) );    }    PK11_RestoreROSession(slot,rwsession);    return SECSuccess;}