aboutsummaryrefslogtreecommitdiff
path: root/openssl
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2018-04-29 09:23:23 -0700
committerGitHub <[email protected]>2018-04-29 09:23:23 -0700
commit80606fc0f00f2b2f6f9699101d5724557da3408b (patch)
treedeba44c1dc58ed6e0fc99a3f36b64465b9560a1d /openssl
parentMerge pull request #905 from sfackler/cleanup (diff)
parentExpose SslSession <-> DER conversion (diff)
downloadrust-openssl-80606fc0f00f2b2f6f9699101d5724557da3408b.tar.xz
rust-openssl-80606fc0f00f2b2f6f9699101d5724557da3408b.zip
Merge pull request #906 from Ralith/session-der
Expose SslSession <-> DER conversion
Diffstat (limited to 'openssl')
-rw-r--r--openssl/src/ssl/mod.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs
index 0f9e8935..ce98b18f 100644
--- a/openssl/src/ssl/mod.rs
+++ b/openssl/src/ssl/mod.rs
@@ -1914,6 +1914,19 @@ impl Clone for SslSession {
}
}
+impl SslSession {
+ from_der! {
+ /// Deserializes a DER-encoded session structure.
+ ///
+ /// This corresponds to [`d2i_SSL_SESSION`].
+ ///
+ /// [`d2i_SSL_SESSION`]: https://www.openssl.org/docs/man1.0.2/ssl/d2i_SSL_SESSION.html
+ from_der,
+ SslSession,
+ ffi::d2i_SSL_SESSION
+ }
+}
+
impl ToOwned for SslSessionRef {
type Owned = SslSession;
@@ -1958,6 +1971,16 @@ impl SslSessionRef {
pub fn master_key(&self, buf: &mut [u8]) -> usize {
unsafe { compat::SSL_SESSION_get_master_key(self.as_ptr(), buf.as_mut_ptr(), buf.len()) }
}
+
+ to_der! {
+ /// Serializes the session into a DER-encoded structure.
+ ///
+ /// This corresponds to [`i2d_SSL_SESSION`].
+ ///
+ /// [`i2d_SSL_SESSION`]: https://www.openssl.org/docs/man1.0.2/ssl/i2d_SSL_SESSION.html
+ to_der,
+ ffi::i2d_SSL_SESSION
+ }
}
foreign_type! {