VirtualBox

source: vbox/trunk/src/libs/openssl-1.1.1l/util/perl/TLSProxy/NewSessionTicket.pm@ 91772

Last change on this file since 91772 was 91772, checked in by vboxsync, 3 years ago

openssl-1.1.1l: Applied and adjusted our OpenSSL changes to 1.1.1l. bugref:10126

File size: 1.7 KB
Line 
1# Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
2#
3# Licensed under the OpenSSL license (the "License"). You may not use
4# this file except in compliance with the License. You can obtain a copy
5# in the file LICENSE in the source distribution or at
6# https://www.openssl.org/source/license.html
7
8use strict;
9
10package TLSProxy::NewSessionTicket;
11
12use vars '@ISA';
13push @ISA, 'TLSProxy::Message';
14
15sub new
16{
17 my $class = shift;
18 my ($server,
19 $data,
20 $records,
21 $startoffset,
22 $message_frag_lens) = @_;
23
24 my $self = $class->SUPER::new(
25 $server,
26 TLSProxy::Message::MT_NEW_SESSION_TICKET,
27 $data,
28 $records,
29 $startoffset,
30 $message_frag_lens);
31
32 $self->{ticket_lifetime_hint} = 0;
33 $self->{ticket} = "";
34
35 return $self;
36}
37
38sub parse
39{
40 my $self = shift;
41
42 my $ticket_lifetime_hint = unpack('N', $self->data);
43 my $ticket_len = unpack('n', $self->data);
44 my $ticket = substr($self->data, 6, $ticket_len);
45
46 $self->ticket_lifetime_hint($ticket_lifetime_hint);
47 $self->ticket($ticket);
48}
49
50
51#Reconstruct the on-the-wire message data following changes
52sub set_message_contents
53{
54 my $self = shift;
55 my $data;
56
57 $data = pack('N', $self->ticket_lifetime_hint);
58 $data .= pack('n', length($self->ticket));
59 $data .= $self->ticket;
60
61 $self->data($data);
62}
63
64#Read/write accessors
65sub ticket_lifetime_hint
66{
67 my $self = shift;
68 if (@_) {
69 $self->{ticket_lifetime_hint} = shift;
70 }
71 return $self->{ticket_lifetime_hint};
72}
73sub ticket
74{
75 my $self = shift;
76 if (@_) {
77 $self->{ticket} = shift;
78 }
79 return $self->{ticket};
80}
811;
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette