]> git.saurik.com Git - apple/security.git/blobdiff - AppleX509TP/tpTime.h
Security-163.tar.gz
[apple/security.git] / AppleX509TP / tpTime.h
index c4cc1722f14761403299f7fd43c9652865ef975a..f8914189d5e3bc44e16f1d2289c5f976cd3623c1 100644 (file)
@@ -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