X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/7948e047ad0cdb129f10661905b2f3eecd5c85a0..df0e469fdcf0e0b3ef74bac6500e5751c40b4ec1:/AppleX509TP/tpTime.h diff --git a/AppleX509TP/tpTime.h b/AppleX509TP/tpTime.h index c4cc1722..f8914189 100644 --- a/AppleX509TP/tpTime.h +++ b/AppleX509TP/tpTime.h @@ -66,18 +66,30 @@ extern int compareTimes( /* * Create a time string, in either UTC (2-digit) or or Generalized (4-digit) * year format. Caller mallocs the output string whose length is at least - * (UTC_TIME_STRLEN+1) or (GENERALIZED_TIME_STRLEN+1) respectively. - * Caller must hold tpTimeLock. + * (UTC_TIME_STRLEN+1), (GENERALIZED_TIME_STRLEN+1), or (CSSM_TIME_STRLEN+1) + * respectively. Caller must hold tpTimeLock. */ typedef enum { TIME_UTC, - TIME_GEN + TIME_GEN, + TIME_CSSM } TpTimeSpec; void timeAtNowPlus(unsigned secFromNow, TpTimeSpec timeSpec, char *outStr); +/* + * Convert a time string, which can be in any of three forms (UTC, + * generalized, or CSSM_TIMESTRING) into a CSSM_TIMESTRING. Caller + * mallocs the result, which must be at least (CSSM_TIME_STRLEN+1) bytes. + * Returns nonzero if incoming time string is badly formed. + */ +int tpTimeToCssmTimestring( + const char *inStr, // not necessarily NULL terminated + unsigned inStrLen, // not including possible NULL + char *outTime); // caller mallocs + #ifdef __cplusplus } #endif