7 #define GetSSLSession(obj, sess) do { \
8 Data_Get_Struct((obj), SSL_SESSION, (sess)); \
10 ossl_raise(rb_eRuntimeError, "SSL Session wasn't initialized."); \
14 #define SafeGetSSLSession(obj, sess) do { \
15 OSSL_Check_Kind((obj), cSSLSession); \
16 GetSSLSession((obj), (sess)); \
38 SSL_SESSION *ctx =
NULL;
40 if (
RDATA(
self)->data)
48 if (!ssl || (ctx = SSL_get1_session(ssl)) ==
NULL)
57 ctx = d2i_SSL_SESSION_bio(in,
NULL);
70 RDATA(
self)->data = ctx;
75 #if HAVE_SSL_SESSION_CMP == 0
78 if (a->ssl_version != b->ssl_version ||
79 a->session_id_length != b->session_id_length)
81 return memcmp(a->session_id,b-> session_id, a->session_id_length);
92 SSL_SESSION *ctx1, *ctx2;
117 t = SSL_SESSION_get_time(ctx);
139 t = SSL_SESSION_get_timeout(ctx);
162 SSL_SESSION_set_time(ctx, t);
180 SSL_SESSION_set_timeout(ctx, t);
184 #ifdef HAVE_SSL_SESSION_GET_ID
191 static VALUE ossl_ssl_session_get_id(
VALUE self)
194 const unsigned char *
p =
NULL;
199 p = SSL_SESSION_get_id(ctx, &i);
219 len = i2d_SSL_SESSION(ctx,
NULL);
226 i2d_SSL_SESSION(ctx, &p);
247 if (!(out = BIO_new(BIO_s_mem()))) {
251 if (!(i=PEM_write_bio_SSL_SESSION(out, ctx))) {
256 BIO_get_mem_ptr(out, &buf);
279 if (!(out = BIO_new(BIO_s_mem()))) {
283 if (!SSL_SESSION_print(out, ctx)) {
288 BIO_get_mem_ptr(out, &buf);
315 #ifdef HAVE_SSL_SESSION_GET_ID