+\r
+#ifdef TLS_RX\r
+ // kernel 4.17 adds TLS_RX support\r
+ struct tls12_crypto_info_aes_gcm_128 crypto_info_read;\r
+\r
+ crypto_info_read.info.version = TLS_1_2_VERSION;\r
+ crypto_info_read.info.cipher_type = TLS_CIPHER_AES_GCM_128;\r
+\r
+ uint64_t remote_sequence_number = htonll(context->remote_sequence_number);\r
+ memcpy(crypto_info_read.iv, &remote_sequence_number, TLS_CIPHER_AES_GCM_128_IV_SIZE);\r
+ memcpy(crypto_info_read.rec_seq, &remote_sequence_number, TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE);\r
+ memcpy(crypto_info_read.key, context->exportable_keys + TLS_CIPHER_AES_GCM_128_KEY_SIZE, TLS_CIPHER_AES_GCM_128_KEY_SIZE);\r
+ memcpy(crypto_info_read.salt, context->crypto.ctx_remote_mac.remote_aead_iv, TLS_CIPHER_AES_GCM_128_SALT_SIZE);\r
+\r
+ int err = setsockopt(socket, SOL_TLS, TLS_RX, &crypto_info_read, sizeof(crypto_info_read));\r
+ if (err)\r
+ return err;\r
+#endif\r