Skip to main content

x509_cmp_current_time

API Overview

X509_cmp_current_time is an API in openssl. This rule belongs to the return value check type. This rule is generated using AURC.

Rule Description

tip

X509_cmp_time() and X509_cmp_current_time() return -1 if B<asn1_time> is earlier than, or equal to, B<in_tm> (resp. current time), and 1 otherwise. These methods return 0 on error.

info
  • Tags: return value check
  • Parameter Index: N/A
  • CWE Type: CWE-253

Rule Code

import cpp

class OpenSSLFunctionCall extends FunctionCall {
OpenSSLFunctionCall() {
this.getTarget().hasName("X509_cmp_current_time")
}
}

from OpenSSLFunctionCall call, UnaryOperation uop
where
uop.getOperator() = "!" and
uop.getOperand() = call.getAnAccess()
select uop, "This negation checks the return value of X509_cmp_current_time."