*/
#include "SecAssessment.h"
#include "notarization.h"
-#include "unix++.h"
+#include <security_utilities/unix++.h>
typedef struct __attribute__((packed)) _package_trailer {
uint8_t magic[4];
secinfo("notarization", "Registering stapled ticket with system");
#if TARGET_OS_OSX
- CFErrorRef error = NULL;
- if (!SecAssessmentTicketRegister(data, &error)) {
- secerror("Error registering stapled ticket: %@", data);
+ CFRef<CFErrorRef> error;
+ if (!SecAssessmentTicketRegister(data, &error.aref())) {
+ secerror("Error registering stapled ticket: %@", error.get());
}
#endif // TARGET_OS_OSX
}
goto lb_exit;
}
- data = CFDataCreateWithBytesNoCopy(NULL, ticketData, trailer.length, NULL);
+ data.take(makeCFDataMalloc(ticketData, trailer.length));
if (data.get() == NULL) {
secerror("unable to create cfdata for notarization");
goto lb_exit;
if (fd) {
close(fd);
}
- if (ticketData) {
- free(ticketData);
- }
}
void
goto lb_exit;
}
- data = CFDataCreateWithBytesNoCopy(NULL, ticketData, ticketLength, NULL);
+ data.take(makeCFDataMalloc(ticketData, ticketLength));
if (data.get() == NULL) {
secerror("unable to create cfdata for notarization");
goto lb_exit;
if (fd) {
close(fd);
}
- if (ticketData) {
- free(ticketData);
- }
}
void