MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / GetAlgoId

Method GetAlgoId

extra/yassl/taocrypt/src/asn.cpp:639–673  ·  view source on GitHub ↗

process algo OID by summing, return it

Source from the content-addressed store, hash-verified

637
638// process algo OID by summing, return it
639word32 CertDecoder::GetAlgoId()
640{
641 if (source_.GetError().What()) return 0;
642 word32 length = GetSequence();
643
644 if (source_.GetError().What()) return 0;
645
646 byte b = source_.next();
647 if (b != OBJECT_IDENTIFIER) {
648 source_.SetError(OBJECT_ID_E);
649 return 0;
650 }
651
652 length = GetLength(source_);
653 if (source_.IsLeft(length) == false) return 0;
654
655 word32 oid = 0;
656 while(length--)
657 oid += source_.next(); // just sum it up for now
658
659 // could have NULL tag and 0 terminator, but may not
660 b = source_.next();
661 if (b == TAG_NULL) {
662 b = source_.next();
663 if (b != 0) {
664 source_.SetError(EXPECT_0_E);
665 return 0;
666 }
667 }
668 else
669 // go back, didn't have it
670 b = source_.prev();
671
672 return oid;
673}
674
675
676// read cert signature, store in signature_

Callers 1

GetCompareHashMethod · 0.80

Calls 7

GetLengthFunction · 0.85
IsLeftMethod · 0.80
WhatMethod · 0.45
GetErrorMethod · 0.45
nextMethod · 0.45
SetErrorMethod · 0.45
prevMethod · 0.45

Tested by

no test coverage detected