Signature SignalSubscriber::signature() const { if (handler) { if (handler.functionType() == dynamicFunctionTypeInterface()) return Signature(); // no arity checking is possible else return handler.parametersSignature(); } else if (target) { AnyObject locked = target->lock(); if (!locked) return Signature(); const MetaMethod* ms = locked.metaObject().method(method); if (!ms) { qiLogWarning() << "Method " << method <<" not found."; return Signature(); } else return ms->parametersSignature(); } else return Signature(); }
Signature PrivateKey::sign( Hasher hasher, const void* data, Size size, Monitor& monitor ) { if (!monitor) return Signature(); Signer signer = getSigner(monitor); if (!monitor) return Signature(); signer.setHasher(hasher,monitor); return signer.sign(*this,data,size,monitor); }
bool cCamCryptNagra::MakeSessionKey(unsigned char *out, const unsigned char *camdata) { if(!hasMod) return false; if(LOG(L_SC_PROC)) { unsigned char bb[64]; camMod.Put(bb,sizeof(bb)); LDUMP(L_SC_PROC,bb,sizeof(bb),"Sessionkey negotiation CAMMOD:"); } //decrypt $2A data here and prepare $2B reply if(rsa.RSA(out,camdata,64,camExp,camMod)!=64) return false; LDUMP(L_SC_PROC,out,64,"CMD 2A/26 after RSA:"); unsigned char key[16], sess[16]; InitKey(key,signature,cardid); LDUMP(L_SC_PROC,key,16,"first IDEA key: "); Signature(sess,key,out,32); memcpy(key,sess,8); memcpy(key+8,sess,8); LDUMP(L_SC_PROC,key,16,"second IDEA key:"); Signature(sess+8,key,out,32); LDUMP(L_SC_PROC,sess,16,"SESSION KEY: "); idea.SetDecKey(sess,&sessKey); if(rsa.RSA(out,out,64,camExp,camMod)!=64) return false; LDUMP(L_SC_PROC,out,64,"CMD 2B/27 data:"); return true; }
static bool isIntegerOrDouble(AnyReference value) { Signature signature(value.signature()); return signature.isConvertibleTo(Signature("i")) != 0.0 || signature.isConvertibleTo(Signature("d")) != 0.0; }
BView* AmStdViewFactory::NewPrefView( BRect f, BMessage* prefs, const BString& key) { if (key == CONTROL_CHANGE) return new AmControlChangePrefView(f, prefs, Signature(), key); AmStdFactoryPrefView* v = new AmStdFactoryPrefView(f, prefs, Signature(), key); if (v) v->AddViews(); return v; }
BOOL CNodeList::CheckNode(CNode* pNode) { BOOL flag = FALSE; // controlla i puntatori e confronta la signature if(pNode) if(*pNode->signature) flag = memcmp(pNode->signature,Signature(),strlen(Signature()))==0; return(flag); }
Signature TextureProxy::MakeSignature(const Proxy<res::Image> &image, vid::opengl::TextureFormat format, vid::opengl::TextureFlags flags, const math::Vector<2, bool> &clamp) { std::ostringstream ss(image.GetSignature()); switch (format) { case vid::opengl::defaultTextureFormat: break; case vid::opengl::alphaTextureFormat: ss << ":alpha"; break; case vid::opengl::luminanceTextureFormat: ss << ":luminance"; break; default: assert(!"invalid texture format"); } if (flags & vid::opengl::filterTextureFlag) ss << ":filter"; if (flags & vid::opengl::mipmapTextureFlag) ss << ":mipmap"; if (Any(clamp)) { ss << ":clamp"; if (!clamp.x) ss << ".y"; else if (!clamp.y) ss << ".x"; } return Signature("OpenGL texture", ss.str()); }
int SignatureLeptonTagger::Train(Event const& event, boca::PreCuts const&, Tag tag) { INFO0; std::vector<Lepton> leptons = event.Leptons().leptons(); if (leptons.size() < 2) return 0; std::vector<Particle> particles = event.Partons().GenParticles(); std::vector<Particle> lepton_particle = CopyIfParticles(particles, {Id::electron, Id::muon}); // ERROR(lepton_particle); lepton_particle = CopyIfGrandMother(lepton_particle, Id::top); // ERROR(lepton_particle); std::vector<Lepton> final_leptons = CopyIfClose(leptons, lepton_particle); // ERROR(final_leptons); std::vector<Doublet> doublets = higgs_reader_.Multiplets(event); std::vector<Particle> higgses = CopyIfParticles(particles, {Id::higgs, Id::CP_violating_higgs}); std::vector<Doublet> final_doublets = BestMatches(doublets, higgses, tag); std::vector<MultipletSignature<Quartet211>> quartets = Triples(final_leptons, final_doublets, [&](Singlet const& singlet_1, Singlet const& singlet_2, Doublet const& doublet) { MultipletSignature<Quartet211> quartet = Signature(doublet, singlet_1, singlet_2); quartet.SetTag(tag); return quartet; }); DEBUG(quartets.size()); if (tag == Tag::signal) quartets = ReduceResult(quartets, 1); DEBUG(quartets.size()); return SaveEntries(quartets); }
Signature SignerReal::sign( PrivateKey privkey, Digest hash, Monitor& monitor ) { if (!check_interface(monitor)) return Signature(); Parameters params = privkey.getAlgParams(acSign, Monitor()); if (params) setAlgParams(params,monitor); Padder curpad = padder; if (privkey.getPadder(Monitor())) { curpad = privkey.getPadder(monitor); } else { //TODO: find default padder } Error error; if (random) { IRef<eprovider::ProviderInterface> randomer = creator.getCreatureCurrentInterface(random); if (randomer) iface->setRandom(session, randomer.cast<eprovider::RandomGenerator>().get(), error); } eprovider::TheKey thekey = creator.getCreatureCurrentTheKey(privkey); Size hashsize = iface->getMaxHashSize(thekey, error); if (curpad.ok() && hashsize.bits()) hash = curpad.pad(hash, hashsize, monitor); if (!monitor) return Signature(); Data hashblock = hash.asData(); eprovider::Block binsign; RECOVER_CALL( (binsign = iface->signHash(session, hashblock.get(), hashblock.size(), thekey, error)) ); Snapshot snapshot = creator.createSnapshot(binsign.get(), binsign.size(), binsign.encid(), iface->getKeyId(kcSignature)); return snapshot.reviveSignature(monitor); }
static int entry_point(lua_State* L) { function_object_impl const* impl = *static_cast<function_object_impl const**>( lua_touserdata(L, lua_upvalueindex(1))); int results = 0; bool error = false; # ifndef LUABIND_NO_EXCEPTIONS try #endif // Scope neeeded to destroy invoke_context before calling lua_error() { invoke_context ctx; results = invoke( L, *impl, ctx, impl->f, Signature(), impl->policies); if (!ctx) { ctx.format_error(L, impl); error = true; } } #ifndef LUABIND_NO_EXCEPTIONS catch (...) { error = true; handle_exception_aux(L); } #endif if (error) lua_error(L); return results; }
bool ParameterModel::addChoice(ChoiceModelPtr choice) { qiLogDebug() << "addChoice function" << std::endl; Signature signature(_p->_metaProperty.signature()); //if false choice and parameter are the same type if(Signature(choice->value().signature()).isConvertibleTo(signature) < 1.0f ) { qiLogWarning() << "choice.type (i.e " << choice->value().signature().toString() << ") != parameter.type (i.e " << _p->_defaultValue.signature().toString() <<")" << std::endl; return false; } //If choice.value is not in [parameter.min, paramater.max] then the choice //is incorrect if(!_p->inInterval(choice->value(), _p->_min, _p->_max) ) { qiLogInfo() << "Choice : is not in interval" << std::endl; return false; } _p->_choices.push_front(choice); return true; }
int SignatureT::Train(boca::Event const& event, boca::PreCuts const&, Tag tag) { INFO0; auto particles = event.GenParticles(); auto triplets = top_reader_.Multiplets(event); auto tops = CopyIfParticle(particles, Id::top); auto final_triplets = triplets; // auto final_triplets = BestMatches(triplets, tops, tag); DEBUG(triplets.size(), tops.size(), final_triplets.size()); auto doublets = higgs_reader_.Multiplets(event); auto higgses = CopyIfParticles(particles, {Id::higgs, Id::CP_violating_higgs}); auto final_doublets = doublets; // auto final_doublets = BestMatches(doublets, higgses, tag); DEBUG(doublets.size(), higgses.size(), final_doublets.size()); auto octets = Triples(final_triplets, final_doublets, [&](Triplet const & triplet_1, Triplet const & triplet_2, Doublet const & doublet) { auto octet = Signature(triplet_1, triplet_2, doublet); octet.SetTag(tag); return octet; }); DEBUG(octets.size()); return SaveEntries(octets, 1); }
bool cCamCryptNagra::DecryptDT08(const unsigned char *dt08, unsigned int irdid, cBN *irdmod, bool fakeid) { if(LOG(L_SC_PROC)) { unsigned char bb[64]; irdmod->Put(bb,sizeof(bb)); LDUMP(L_SC_PROC,bb,sizeof(bb),"DT08 decrypt IRDID: %08x IRDMOD:",irdid); } unsigned char buff[72]; if(rsa.RSA(buff,dt08+1,64,camExp,*irdmod)!=64) return false; memcpy(buff+64,dt08+1+64,8); buff[63]|=dt08[0]&0x80; LDUMP(L_SC_PROC,buff,72,"DT08 after RSA"); unsigned char key[16]; InitKey(key,boxkey,irdid); LDUMP(L_SC_PROC,key,16,"DT08 IDEA key"); IdeaKS dks; idea.SetDecKey(key,&dks); idea.Decrypt(buff,72,&dks,0); LDUMP(L_SC_PROC,buff,72,"DT08 after IDEA"); memcpy(signature,buff,8); LDUMP(L_SC_PROC,signature,8,"signature"); BYTE4_BE(buff ,0); BYTE4_BE(buff+4,fakeid?0xFFFFFFFF:cardid); Signature(buff,key,buff,72); LDUMP(L_SC_PROC,buff,8,"check sig"); if(memcmp(signature,buff,8)) { PRINTF(L_SC_PROC,"DT08 signature failed"); return false; } BN_bin2bn(buff+8,64,camMod); hasMod=true; return true; }
std::vector<MetaObject::CompatibleMethod> MetaObjectPrivate::findCompatibleMethod(const std::string &nameOrSignature) { boost::recursive_mutex::scoped_lock sl(_methodsMutex); std::vector<MetaObject::CompatibleMethod> ret; std::string cname(nameOrSignature); //no signature specified fallback on findMethod if (cname.find(':') == std::string::npos) { std::vector<MetaMethod> r = findMethod(cname); ret.reserve(r.size()); for (unsigned i=0; i<r.size(); ++i) ret.push_back(std::make_pair(r[i], 1.0f)); return ret; } std::vector<std::string> sigsorig = qi::signatureSplit(nameOrSignature); if (sigsorig[1].empty()) return ret; Signature sresolved(sigsorig[2]); for (auto& method: _methods) { const qi::MetaMethod& mm = method.second; if (sigsorig[1] != mm.name()) continue; float score = sresolved.isConvertibleTo(Signature(mm.parametersSignature())); if (score) ret.push_back(std::make_pair(mm, score)); } return ret; }
//--------------------------------------------------------------------------- void File_Png::Data_Parse() { if (!Signature_Parsed) { Signature(); return; } Element_Size-=4; //For CRC #define CASE_INFO(_NAME, _DETAIL) \ case Elements::_NAME : Element_Info1(_DETAIL); _NAME(); break; //Parsing switch (Element_Code) { CASE_INFO(IDAT, "Image data"); CASE_INFO(IEND, "Image trailer"); CASE_INFO(IHDR, "Image header"); CASE_INFO(PLTE, "Palette table"); default : Skip_XX(Element_Size, "Unknown"); } Element_Size+=4; //For CRC Skip_B4( "CRC"); }
int invoke( lua_State* L, function_object const& self, invoke_context& ctx , tagged_function<Signature, F> const& tagged , Signature, Policies const& policies) { return invoke(L, self, ctx, tagged.f, Signature(), policies); }
static int entry_point(lua_State* L) { function_object_impl const* impl_const = *(function_object_impl const**) lua_touserdata(L, lua_upvalueindex(1)); // TODO: Can this be done differently? function_object_impl* impl = const_cast<function_object_impl*>(impl_const); invoke_context ctx; int results = 0; # ifndef LUABIND_NO_EXCEPTIONS bool exception_caught = invoke_defer(L, impl, ctx, results); if(exception_caught) lua_error(L); # else #ifndef LUABIND_NO_INTERNAL_TAG_ARGUMENTS results = invoke(L, *impl, ctx, impl->f, Signature(), InjectorList()); #else results = invoke<InjectorList, Signature>(L, *impl, ctx, impl->f); #endif # endif if(!ctx) { ctx.format_error(L, impl); lua_error(L); } return results; }
int invoke( lua_State* L, function_object const& self, invoke_context& ctx // std::bind operator() is nonconst... is that fixable? , tagged_function<Signature, F> /*const*/& tagged , Signature, meta::type_list<PolicyInjectors...> const& injectors) { return invoke(L, self, ctx, tagged.f, Signature(), injectors); }
int call(lua_State* L, invoke_context& ctx) /*const*/ { #ifndef LUABIND_NO_INTERNAL_TAG_ARGUMENTS return invoke(L, *this, ctx, f, Signature(), InjectorList()); #else return invoke<InjectorList, Signature>(L, *this, ctx, f); #endif }
int invoke(lua_State* L, F const& f, Signature, Policies const& policies) { return invoke0( L, f, Signature(), policies , boost::is_void<typename mpl::front<Signature>::type>() , boost::is_member_function_pointer<F>() ); }
inline int invoke0( lua_State* L, function_object const& self, invoke_context& ctx, F const& f, Signature, Policies const& policies, IsVoid, mpl::false_) { return invoke_normal( L, self, ctx, f, Signature(), policies , mpl::long_<mpl::size<Signature>::value - 1>(), IsVoid() ); }
int invoke0( lua_State* L, F const& f, Signature , Policies const& policies, IsVoid, mpl::false_) { return invoke_normal( L, f, Signature(), policies , mpl::long_<mpl::size<Signature>::value - 1>(), IsVoid() ); }
inline static void apply( ClassT& cl , Signature const& args , NArgs) { cl.template exposeCtor<Signature, NArgs>(); typedef typename mpl::prior<NArgs>::type next_nargs; define_ctor_helper<NDefaults - 1>::apply(cl, Signature(), next_nargs()); }
/* InitializeNode() Inizializza il nodo. Non inizializza il puntatore al nodo successivo dato che i nodi inutilizzati vengono riciclati (il ptr al nodo successivo viene inizializzato solo quando si inserisce un nuovo nodo nella lista con InsertNode()). */ void CNodeList::InitializeNode(CNode* pNode,int status,void* ptr) { #ifdef _DEBUG memset(pNode->signature,'\0',SIGNATURE_LEN+1); strcpyn(pNode->signature,Signature(),SIGNATURE_LEN+1); #endif pNode->index = 0; pNode->status = status; pNode->data = ptr; }
object make_function(lua_State* L, F f, Signature, Policies) { return detail::make_function_aux( L , detail::compute_arity(Signature(), Policies()) , detail::function_invoke<F, Signature, Policies>(f) , detail::function_score<Signature, Policies>() , detail::function_signature<Signature>() ); }
inline int invoke( lua_State* L, function_object const& self, invoke_context& ctx , F const& f, Signature, Policies const& policies) { return invoke0( L, self, ctx, f, Signature(), policies , boost::is_void<typename mpl::front<Signature>::type>() , boost::is_member_function_pointer<F>() ); }
/** * This function is used internally to handle pinging the server and detecting timeouts. Timeouts are enabled and disabled server side. */ void ClientProtocolTcpPrivate::ping() { if (lastPing.secsTo(QDateTime::currentDateTime()) > timeout) { qCritical() << "Remove host has timed out."; qxt_p().protocolDisconnect(); return; } qxt_p().callProtocolFunction(Signature("ping()"), Arguments()); }
/** * This function is reimplemented from the ClientProtocolIODevice class, and is called between connection and service selecting. It tells the server if it wants to enable SSL or not. */ void ClientProtocolTcp::connected() { qxt_d().lastPing = QDateTime::currentDateTime(); if (url().scheme() == "tcp") { callProtocolFunction(Signature("setSsl(bool)"), Arguments() << false); } else if (url().scheme() == "tcps") { callProtocolFunction(Signature("setSsl(bool)"), Arguments() << true); // qxt_d().socket.startClientEncryption(); // qxt_d().socket.waitForEncrypted(); } else { qCritical(qPrintable(QString("Error: Tcp does not support protocol: %1").arg(url().scheme()))); emit returnReceived(Message(connectId(), ReturnValue(1, QString("Error: Tcp does not support protocol: %1").arg(url().scheme())))); } }
EXPORT_C TBool CSignedObject::VerifySignatureL(const TDesC8& aEncodedKey, const TDesC8& aHash) const { const CAlgorithmIdentifier& algId = iSigningAlgorithm->AsymmetricAlgorithm(); const CAlgorithmIdentifier& digestId = iSigningAlgorithm->DigestAlgorithm(); TBool verifyResult = EFalse; if (algId.Algorithm() == EDSA) { if (digestId.Algorithm() != ESHA1) { User::Leave(KErrArgument); } CDSAPublicKey* key = NULL; if (algId.EncodedParams().Length() != 0) { key = iKeyFactory->DSAPublicKeyL(algId.EncodedParams(), aEncodedKey); } else { if (iParameters != NULL) { const CDSAParameters* params = iParameters->DSAParams(); if (!params) { User::Leave(KErrArgument);//no params } else { key = iKeyFactory->DSAPublicKeyL(*params, aEncodedKey); } } } if (key == NULL) { User::Leave(KErrArgument); } CleanupStack::PushL(key); CDSAVerifier* verifier = CDSAVerifier::NewLC(*key); CDSASignature* sig = iKeyFactory->DSASignatureL(Signature()); CleanupStack::PushL(sig); verifyResult = verifier->VerifyL(aHash, *sig); CleanupStack::PopAndDestroy(3);// key, verifier, sig } else { TRAPD(result, verifyResult = VerifyRSASignatureL(aEncodedKey, aHash)); if (result==KErrNoMemory) // Leave if OOM, anything else is a verify User::Leave(result); // error => verifyResult = EFalse } return verifyResult; }
Decode03Fixture() { // initialize all elements to non-empty, to verify wireDecode clears them d.setName("/A"); d.setContentType(tlv::ContentType_Key); d.setContent("1504C0C1C2C3"_block); d.setSignature(Signature("160A 1B0101 1C050703080142"_block, "1780 B48F1707A3BCA3CFC5F32DE51D9B46C32D7D262A21544EBDA88C3B415D637503" "FC9BEF20F88202A56AF9831E0D30205FD4154B08502BCDEE860267A5C3E03D8E" "A6CB74BE391C01E0A57B991B4404FC11B7D777F1B700A4B65F201118CF1840A8" "30A2A7C17DB4B7A8777E58515121AF9E2498627F8475414CDFD9801B8152AD5B"_block)); }