Adding std::unique_ptr definition for the ASN1_TIME type.
authorSaurabh Singh <singhsrb@fb.com>
Thu, 14 Jul 2016 23:51:10 +0000 (16:51 -0700)
committerFacebook Github Bot 8 <facebook-github-bot-8-bot@fb.com>
Thu, 14 Jul 2016 23:53:24 +0000 (16:53 -0700)
Summary:
The ASN1_TIME is the typically used within OpenSSL for representing
time. For example, it can be used to represent the NotBefore and NotAfter
properties of a certificate to be verified. This diff introduces a
ASN1TimeUniquePtr type to take care of the ownership of the ASN1_TIME.

Reviewed By: yfeldblum

Differential Revision: D3561274

fbshipit-source-id: ca4d1431b33098cccd727253dd301e209d2561a5

folly/io/async/ssl/OpenSSLPtrTypes.h

index b39c3e8740fad66301618047e0ef317b53f1b83b..97f89ff334d531ebe08621fa0db0f948d7c7a147 100644 (file)
 #pragma once
 
 #include <glog/logging.h>
+
+#include <openssl/asn1.h>
+#include <openssl/bio.h>
 #include <openssl/bn.h>
-#include <openssl/evp.h>
-#include <openssl/rsa.h>
-#include <openssl/ssl.h>
 #ifndef OPENSSL_NO_EC
 #include <openssl/ec.h>
 #endif
-#include <folly/Memory.h>
-#include <openssl/bio.h>
+#include <openssl/evp.h>
+#include <openssl/rsa.h>
+#include <openssl/ssl.h>
 #include <openssl/x509.h>
 
+#include <folly/Memory.h>
+
 namespace folly {
 namespace ssl {
 
+// ASN1
+using ASN1TimeDeleter =
+    folly::static_function_deleter<ASN1_TIME, &ASN1_TIME_free>;
+using ASN1TimeUniquePtr = std::unique_ptr<ASN1_TIME, ASN1TimeDeleter>;
+
 // X509
 using X509Deleter = folly::static_function_deleter<X509, &X509_free>;
 using X509UniquePtr = std::unique_ptr<X509, X509Deleter>;