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

Method GetDate

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

process a Date, either BEFORE or AFTER

Source from the content-addressed store, hash-verified

863
864// process a Date, either BEFORE or AFTER
865void CertDecoder::GetDate(DateType dt)
866{
867 if (source_.GetError().What()) return;
868
869 byte b = source_.next();
870 if (b != UTC_TIME && b != GENERALIZED_TIME) {
871 source_.SetError(TIME_E);
872 return;
873 }
874
875 word32 length = GetLength(source_);
876 if (source_.IsLeft(length) == false) return;
877
878 byte date[MAX_DATE_SZ];
879 if (length > MAX_DATE_SZ || length < MIN_DATE_SZ) {
880 source_.SetError(DATE_SZ_E);
881 return;
882 }
883
884 memcpy(date, source_.get_current(), length);
885 source_.advance(length);
886
887 if (!ValidateDate(date, b, dt) && verify_) {
888 if (dt == BEFORE)
889 source_.SetError(BEFORE_DATE_E);
890 else
891 source_.SetError(AFTER_DATE_E);
892 }
893
894 // save for later use
895 if (dt == BEFORE) {
896 memcpy(beforeDate_, date, length);
897 beforeDate_[length] = 0;
898 beforeDateType_= b;
899 }
900 else { // after
901 memcpy(afterDate_, date, length);
902 afterDate_[length] = 0;
903 afterDateType_= b;
904 }
905}
906
907
908void CertDecoder::GetValidity()

Callers

nothing calls this directly

Calls 9

GetLengthFunction · 0.85
ValidateDateFunction · 0.85
IsLeftMethod · 0.80
advanceMethod · 0.80
WhatMethod · 0.45
GetErrorMethod · 0.45
nextMethod · 0.45
SetErrorMethod · 0.45
get_currentMethod · 0.45

Tested by

no test coverage detected