void ST_avmplus_basics::test3() { Stringp s = core->newConstantStringLatin1("ev\xADident"); bool found = s->containsLatin1("\xAD"); #line 63 "ST_avmplus_basics.st" verifyPass(found == true, "found == true", __FILE__, __LINE__); }
void ST_avmplus_basics::test5() { Stringp s = core->newConstantStringLatin1("ev\xADident"); bool matches1 = s->matchesLatin1("\xADi", 2, 2); #line 73 "ST_avmplus_basics.st" verifyPass(matches1 == true, "matches1 == true", __FILE__, __LINE__); }
void ST_avmplus_basics::test4() { Stringp s = core->newConstantStringLatin1("ev\xADident"); int index = s->indexOfLatin1("\xAD"); #line 68 "ST_avmplus_basics.st" verifyPass(index == 2, "index == 2", __FILE__, __LINE__); }
void ST_avmplus_peephole::test0() { #ifdef AVMPLUS_DIRECT_THREADED WordcodeEmitter* t = new WordcodeEmitter(core, NULL, opcode_labels); #else WordcodeEmitter* t = new WordcodeEmitter(core, NULL); #endif t->emitOp1(WOP_getlocal, 5); t->emitOp1(WOP_getlocal, 4); t->emitOp1(WOP_getlocal, 65536); t->emitOp1(WOP_getlocal, 7); t->emitOp1(WOP_getlocal, 6); uint32_t* code; uint32_t len = t->epilogue(&code); verifyPass(len == 6, "len == 6", __FILE__, __LINE__); verifyPass(code[0] == NEW_OPCODE(WOP_get2locals), "code[0] == NEW_OPCODE(WOP_get2locals)", __FILE__, __LINE__); verifyPass(code[1] == ((4 << 16) | 5), "code[1] == ((4 << 16) | 5)", __FILE__, __LINE__); verifyPass(code[2] == NEW_OPCODE(WOP_getlocal), "code[2] == NEW_OPCODE(WOP_getlocal)", __FILE__, __LINE__); verifyPass(code[3] == 65536, "code[3] == 65536", __FILE__, __LINE__); verifyPass(code[4] == NEW_OPCODE(WOP_get2locals), "code[4] == NEW_OPCODE(WOP_get2locals)", __FILE__, __LINE__); verifyPass(code[5] == ((6 << 16) | 7), "code[5] == ((6 << 16) | 7)", __FILE__, __LINE__); delete t; }
void ST_avmplus_peephole::test0() { WordcodeEmitter* t = new WordcodeEmitter(core, NULL); t->emitOp1(WOP_getlocal, 5); t->emitOp1(WOP_getlocal, 4); t->emitOp1(WOP_getlocal, 65536); t->emitOp1(WOP_getlocal, 7); t->emitOp1(WOP_getlocal, 6); uintptr_t* code; uint32_t len = (uint32_t)t->epilogue(&code); #line 76 "ST_avmplus_peephole.st" verifyPass(len == 6, "len == 6", __FILE__, __LINE__); #line 77 "ST_avmplus_peephole.st" verifyPass(code[0] == NEW_OPCODE(WOP_get2locals), "code[0] == NEW_OPCODE(WOP_get2locals)", __FILE__, __LINE__); #line 78 "ST_avmplus_peephole.st" verifyPass(code[1] == ((4 << 16) | 5), "code[1] == ((4 << 16) | 5)", __FILE__, __LINE__); #line 79 "ST_avmplus_peephole.st" verifyPass(code[2] == NEW_OPCODE(WOP_getlocal), "code[2] == NEW_OPCODE(WOP_getlocal)", __FILE__, __LINE__); #line 80 "ST_avmplus_peephole.st" verifyPass(code[3] == 65536, "code[3] == 65536", __FILE__, __LINE__); #line 81 "ST_avmplus_peephole.st" verifyPass(code[4] == NEW_OPCODE(WOP_get2locals), "code[4] == NEW_OPCODE(WOP_get2locals)", __FILE__, __LINE__); #line 82 "ST_avmplus_peephole.st" verifyPass(code[5] == ((6 << 16) | 7), "code[5] == ((6 << 16) | 7)", __FILE__, __LINE__); delete t; }
void ST_avmplus_basics::test6() { Stringp s = core->newConstantStringLatin1("ev\xADident"); bool matches2 = s->matchesLatin1_caseless("\xADIDENT", 2, 2); #line 78 "ST_avmplus_basics.st" verifyPass(matches2 == true, "matches2 == true", __FILE__, __LINE__); }
/* * authenticate to a slot. This loops until we can't recover, the user * gives up, or we succeed. If we're already logged in and this function * is called we will still prompt for a password, but we will probably * succeed no matter what the password was (depending on the implementation * of the PKCS 11 module. */ SECStatus PK11_DoPassword(PK11SlotInfo *slot, PRBool loadCerts, void *wincx) { SECStatus rv = SECFailure; char * password; PRBool attempt = PR_FALSE; if (PK11_NeedUserInit(slot)) { PORT_SetError(SEC_ERROR_IO); return SECFailure; } /* * Central server type applications which control access to multiple * slave applications to single crypto devices need to virtuallize the * login state. This is done by a callback out of PK11_IsLoggedIn and * here. If we are actually logged in, then we got here because the * higher level code told us that the particular client application may * still need to be logged in. If that is the case, we simply tell the * server code that it should now verify the clients password and tell us * the results. */ if (PK11_IsLoggedIn(slot,NULL) && (PK11_Global.verifyPass != NULL)) { if (!PK11_Global.verifyPass(slot,wincx)) { PORT_SetError(SEC_ERROR_BAD_PASSWORD); return SECFailure; } return SECSuccess; } /* get the password. This can drop out of the while loop * for the following reasons: * (1) the user refused to enter a password. * (return error to caller) * (2) the token user password is disabled [usually due to * too many failed authentication attempts]. * (return error to caller) * (3) the password was successful. */ while ((password = pk11_GetPassword(slot, attempt, wincx)) != NULL) { /* if the token has a protectedAuthPath, the application may have * already issued the C_Login as part of it's pk11_GetPassword call. * In this case the application will tell us what the results were in * the password value (retry or the authentication was successful) so * we can skip our own C_Login call (which would force the token to * try to login again). * * Applications that don't know about protectedAuthPath will return a * password, which we will ignore and trigger the token to * 'authenticate' itself anyway. Hopefully the blinking display on * the reader, or the flashing light under the thumbprint reader will * attract the user's attention */ attempt = PR_TRUE; if (slot->protectedAuthPath) { /* application tried to authenticate and failed. it wants to try * again, continue looping */ if (strcmp(password, PK11_PW_RETRY) == 0) { rv = SECWouldBlock; PORT_Free(password); continue; } /* applicaton tried to authenticate and succeeded we're done */ if (strcmp(password, PK11_PW_AUTHENTICATED) == 0) { rv = SECSuccess; PORT_Free(password); break; } } rv = pk11_CheckPassword(slot,password); PORT_Memset(password, 0, PORT_Strlen(password)); PORT_Free(password); if (rv != SECWouldBlock) break; } if (rv == SECSuccess) { if (!PK11_IsFriendly(slot)) { nssTrustDomain_UpdateCachedTokenCerts(slot->nssToken->trustDomain, slot->nssToken); } } else if (!attempt) PORT_SetError(SEC_ERROR_BAD_PASSWORD); return rv; }