1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
|
/*
* Copyright (C) 2001-2016 Free Software Foundation, Inc.
* Copyright (C) 2015-2016 Red Hat, Inc.
*
* Author: Nikos Mavrogiannopoulos, Simon Josefsson
*
* This file is part of GnuTLS.
*
* The GnuTLS is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
/* Functions that relate to the TLS hello extension parsing.
* Hello extensions are packets appended in the TLS hello packet, and
* allow for extra functionality.
*/
#include "gnutls_int.h"
#include "extensions.h"
#include "errors.h"
#include "ext/max_record.h"
#include <ext/cert_type.h>
#include <ext/server_name.h>
#include <ext/srp.h>
#include <ext/heartbeat.h>
#include <ext/session_ticket.h>
#include <ext/safe_renegotiation.h>
#include <ext/signature.h>
#include <ext/safe_renegotiation.h>
#include <ext/ecc.h>
#include <ext/status_request.h>
#include <ext/ext_master_secret.h>
#include <ext/srtp.h>
#include <ext/alpn.h>
#include <ext/dumbfw.h>
#include <ext/etm.h>
#include <num.h>
static int ext_register(extension_entry_st * mod);
static void _gnutls_ext_unset_resumed_session_data(gnutls_session_t
session, uint16_t type);
static extension_entry_st const *extfunc[MAX_EXT_TYPES+1] = {
&ext_mod_max_record_size,
&ext_mod_ext_master_secret,
&ext_mod_etm,
#ifdef ENABLE_OCSP
&ext_mod_status_request,
#endif
#ifdef ENABLE_OPENPGP
&ext_mod_cert_type,
#endif
&ext_mod_server_name,
&ext_mod_sr,
#ifdef ENABLE_SRP
&ext_mod_srp,
#endif
#ifdef ENABLE_HEARTBEAT
&ext_mod_heartbeat,
#endif
#ifdef ENABLE_SESSION_TICKETS
&ext_mod_session_ticket,
#endif
&ext_mod_supported_ecc,
&ext_mod_supported_ecc_pf,
&ext_mod_sig,
#ifdef ENABLE_DTLS_SRTP
&ext_mod_srtp,
#endif
#ifdef ENABLE_ALPN
&ext_mod_alpn,
#endif
/* This must be the last extension registered.
*/
&ext_mod_dumbfw,
NULL
};
static gnutls_ext_parse_type_t _gnutls_ext_parse_type(uint16_t type)
{
size_t i;
for (i = 0; extfunc[i] != NULL; i++) {
if (extfunc[i]->type == type)
return extfunc[i]->parse_type;
}
return GNUTLS_EXT_NONE;
}
static gnutls_ext_recv_func
_gnutls_ext_func_recv(uint16_t type, gnutls_ext_parse_type_t parse_type)
{
size_t i;
for (i = 0; extfunc[i] != NULL; i++)
if (extfunc[i]->type == type)
if (parse_type == GNUTLS_EXT_ANY
|| extfunc[i]->parse_type == parse_type)
return extfunc[i]->recv_func;
return NULL;
}
static gnutls_ext_deinit_data_func _gnutls_ext_func_deinit(uint16_t type)
{
size_t i;
for (i = 0; extfunc[i] != NULL; i++)
if (extfunc[i]->type == type)
return extfunc[i]->deinit_func;
return NULL;
}
static gnutls_ext_unpack_func _gnutls_ext_func_unpack(uint16_t type)
{
size_t i;
for (i = 0; extfunc[i] != NULL; i++)
if (extfunc[i]->type == type)
return extfunc[i]->unpack_func;
return NULL;
}
/**
* gnutls_ext_get_name:
* @ext: is a TLS extension numeric ID
*
* Convert a TLS extension numeric ID to a printable string.
*
* Returns: a pointer to a string that contains the name of the
* specified cipher, or %NULL.
**/
const char *gnutls_ext_get_name(unsigned int ext)
{
size_t i;
for (i = 0; extfunc[i] != NULL; i++)
if (extfunc[i]->type == ext)
return extfunc[i]->name;
return NULL;
}
/* Checks if the extension @type provided has been requested
* by us (in client side). In that case it returns zero,
* otherwise a negative error value.
*/
int
_gnutls_extension_list_check(gnutls_session_t session, uint16_t type)
{
int i;
for (i = 0; i < session->internals.extensions_sent_size; i++) {
if (type == session->internals.extensions_sent[i])
return 0; /* ok found */
}
return GNUTLS_E_RECEIVED_ILLEGAL_EXTENSION;
}
int
_gnutls_parse_extensions(gnutls_session_t session,
gnutls_ext_parse_type_t parse_type,
const uint8_t * data, int data_size)
{
int next, ret;
int pos = 0;
uint16_t type;
const uint8_t *sdata;
gnutls_ext_recv_func ext_recv;
uint16_t size;
#ifdef DEBUG
int i;
if (session->security_parameters.entity == GNUTLS_CLIENT)
for (i = 0; i < session->internals.extensions_sent_size;
i++) {
_gnutls_handshake_log
("EXT[%d]: expecting extension '%s'\n",
session,
gnutls_ext_get_name(session->internals.
extensions_sent
[i]));
}
#endif
DECR_LENGTH_RET(data_size, 2, 0);
next = _gnutls_read_uint16(data);
pos += 2;
DECR_LENGTH_RET(data_size, next, GNUTLS_E_UNEXPECTED_EXTENSIONS_LENGTH);
do {
DECR_LENGTH_RET(next, 2, GNUTLS_E_UNEXPECTED_EXTENSIONS_LENGTH);
type = _gnutls_read_uint16(&data[pos]);
pos += 2;
if (session->security_parameters.entity == GNUTLS_CLIENT) {
if ((ret =
_gnutls_extension_list_check(session, type)) < 0) {
gnutls_assert();
return ret;
}
} else {
_gnutls_extension_list_add(session, type);
}
DECR_LENGTH_RET(next, 2, GNUTLS_E_UNEXPECTED_EXTENSIONS_LENGTH);
size = _gnutls_read_uint16(&data[pos]);
pos += 2;
DECR_LENGTH_RET(next, size, GNUTLS_E_UNEXPECTED_EXTENSIONS_LENGTH);
sdata = &data[pos];
pos += size;
ext_recv = _gnutls_ext_func_recv(type, parse_type);
if (ext_recv == NULL) {
_gnutls_handshake_log
("EXT[%p]: Found extension '%s/%d'\n", session,
gnutls_ext_get_name(type), type);
continue;
}
_gnutls_handshake_log
("EXT[%p]: Parsing extension '%s/%d' (%d bytes)\n",
session, gnutls_ext_get_name(type), type,
size);
if ((ret = ext_recv(session, sdata, size)) < 0) {
gnutls_assert();
return ret;
}
}
while (next > 2);
return 0;
}
/* Adds the extension we want to send in the extensions list.
* This list is used to check whether the (later) received
* extensions are the ones we requested.
*/
void _gnutls_extension_list_add(gnutls_session_t session, uint16_t type)
{
if (session->internals.extensions_sent_size <
MAX_EXT_TYPES) {
session->internals.extensions_sent[session->
internals.extensions_sent_size]
= type;
session->internals.extensions_sent_size++;
} else {
_gnutls_handshake_log
("extensions: Increase MAX_EXT_TYPES\n");
}
}
int
_gnutls_gen_extensions(gnutls_session_t session,
gnutls_buffer_st * extdata,
gnutls_ext_parse_type_t parse_type)
{
int size;
int pos, size_pos, ret;
size_t i, init_size = extdata->length;
pos = extdata->length; /* we will store length later on */
ret = _gnutls_buffer_append_prefix(extdata, 16, 0);
if (ret < 0)
return gnutls_assert_val(ret);
for (i = 0; extfunc[i] != NULL; i++) {
const extension_entry_st *p = extfunc[i];
if (p->send_func == NULL)
continue;
if (parse_type != GNUTLS_EXT_ANY
&& p->parse_type != parse_type)
continue;
/* ensure we are sending only what we received */
if (session->security_parameters.entity == GNUTLS_SERVER) {
if ((ret =
_gnutls_extension_list_check(session, p->type)) < 0) {
continue;
}
}
ret = _gnutls_buffer_append_prefix(extdata, 16, p->type);
if (ret < 0)
return gnutls_assert_val(ret);
size_pos = extdata->length;
ret = _gnutls_buffer_append_prefix(extdata, 16, 0);
if (ret < 0)
return gnutls_assert_val(ret);
size = p->send_func(session, extdata);
/* returning GNUTLS_E_INT_RET_0 means to send an empty
* extension of this type.
*/
if (size > 0 || size == GNUTLS_E_INT_RET_0) {
if (size == GNUTLS_E_INT_RET_0)
size = 0;
/* write the real size */
_gnutls_write_uint16(size,
&extdata->data[size_pos]);
/* add this extension to the extension list
*/
if (session->security_parameters.entity == GNUTLS_CLIENT)
_gnutls_extension_list_add(session, p->type);
_gnutls_handshake_log
("EXT[%p]: Sending extension %s (%d bytes)\n",
session, p->name, size);
} else if (size < 0) {
gnutls_assert();
return size;
} else if (size == 0)
extdata->length -= 4; /* reset type and size */
}
/* remove any initial data, and the size of the header */
size = extdata->length - init_size - 2;
if (size > UINT16_MAX) /* sent too many extensions */
return gnutls_assert_val(GNUTLS_E_HANDSHAKE_TOO_LARGE);
if (size > 0)
_gnutls_write_uint16(size, &extdata->data[pos]);
else if (size == 0)
extdata->length -= 2; /* the length bytes */
return size;
}
int _gnutls_ext_init(void)
{
return GNUTLS_E_SUCCESS;
}
void _gnutls_ext_deinit(void)
{
unsigned i;
for (i = 0; extfunc[i] != NULL; i++) {
if (extfunc[i]->free_struct != 0) {
gnutls_free((void*)extfunc[i]->name);
gnutls_free((void*)extfunc[i]);
extfunc[i] = NULL;
}
}
}
static
int ext_register(extension_entry_st * mod)
{
unsigned i = 0;
while(extfunc[i] != NULL) {
i++;
}
if (i >= MAX_EXT_TYPES-1) {
return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR);
}
extfunc[i] = mod;
extfunc[i+1] = NULL;
return GNUTLS_E_SUCCESS;
}
int _gnutls_ext_pack(gnutls_session_t session, gnutls_buffer_st * packed)
{
unsigned int i;
int ret;
gnutls_ext_priv_data_t data;
int cur_size;
int size_offset;
int total_exts_pos;
int exts = 0;
total_exts_pos = packed->length;
BUFFER_APPEND_NUM(packed, 0);
for (i = 0; extfunc[i] != NULL; i++) {
ret =
_gnutls_ext_get_session_data(session, extfunc[i]->type,
&data);
if (ret >= 0 && extfunc[i]->pack_func != NULL) {
BUFFER_APPEND_NUM(packed, extfunc[i]->type);
size_offset = packed->length;
BUFFER_APPEND_NUM(packed, 0);
cur_size = packed->length;
ret = extfunc[i]->pack_func(data, packed);
if (ret < 0) {
gnutls_assert();
return ret;
}
exts++;
/* write the actual size */
_gnutls_write_uint32(packed->length - cur_size,
packed->data + size_offset);
}
}
_gnutls_write_uint32(exts, packed->data + total_exts_pos);
return 0;
}
void _gnutls_ext_restore_resumed_session(gnutls_session_t session)
{
int i;
/* clear everything except MANDATORY extensions */
for (i = 0; i < MAX_EXT_TYPES; i++) {
if (session->internals.extension_int_data[i].set != 0 &&
_gnutls_ext_parse_type(session->
internals.extension_int_data[i].
type) != GNUTLS_EXT_MANDATORY) {
_gnutls_ext_unset_session_data(session,
session->internals.
extension_int_data
[i].type);
}
}
/* copy resumed to main */
for (i = 0; i < MAX_EXT_TYPES; i++) {
if (session->internals.resumed_extension_int_data[i].set !=
0
&& _gnutls_ext_parse_type(session->internals.
resumed_extension_int_data
[i].type) !=
GNUTLS_EXT_MANDATORY) {
_gnutls_ext_set_session_data(session,
session->internals.
resumed_extension_int_data
[i].type,
session->internals.
resumed_extension_int_data
[i].priv);
session->internals.resumed_extension_int_data[i].
set = 0;
}
}
}
static void
_gnutls_ext_set_resumed_session_data(gnutls_session_t session,
uint16_t type,
gnutls_ext_priv_data_t data)
{
int i;
for (i = 0; i < MAX_EXT_TYPES; i++) {
if (session->internals.resumed_extension_int_data[i].
type == type
|| session->internals.resumed_extension_int_data[i].
set == 0) {
if (session->internals.
resumed_extension_int_data[i].set != 0)
_gnutls_ext_unset_resumed_session_data
(session, type);
session->internals.resumed_extension_int_data[i].
type = type;
session->internals.resumed_extension_int_data[i].
priv = data;
session->internals.resumed_extension_int_data[i].
set = 1;
return;
}
}
}
int _gnutls_ext_unpack(gnutls_session_t session, gnutls_buffer_st * packed)
{
int i, ret;
gnutls_ext_priv_data_t data;
gnutls_ext_unpack_func unpack;
int max_exts = 0;
uint16_t type;
int size_for_type, cur_pos;
BUFFER_POP_NUM(packed, max_exts);
for (i = 0; i < max_exts; i++) {
BUFFER_POP_NUM(packed, type);
BUFFER_POP_NUM(packed, size_for_type);
cur_pos = packed->length;
unpack = _gnutls_ext_func_unpack(type);
if (unpack == NULL) {
gnutls_assert();
return GNUTLS_E_PARSING_ERROR;
}
ret = unpack(packed, &data);
if (ret < 0) {
gnutls_assert();
return ret;
}
/* verify that unpack read the correct bytes */
cur_pos = cur_pos - packed->length;
if (cur_pos /* read length */ != size_for_type) {
gnutls_assert();
return GNUTLS_E_PARSING_ERROR;
}
_gnutls_ext_set_resumed_session_data(session, type, data);
}
return 0;
error:
return ret;
}
void
_gnutls_ext_unset_session_data(gnutls_session_t session, uint16_t type)
{
gnutls_ext_deinit_data_func deinit;
gnutls_ext_priv_data_t data;
int ret, i;
deinit = _gnutls_ext_func_deinit(type);
ret = _gnutls_ext_get_session_data(session, type, &data);
if (ret >= 0 && deinit != NULL) {
deinit(data);
}
for (i = 0; i < MAX_EXT_TYPES; i++) {
if (session->internals.extension_int_data[i].type == type) {
session->internals.extension_int_data[i].set = 0;
return;
}
}
}
static void
_gnutls_ext_unset_resumed_session_data(gnutls_session_t session,
uint16_t type)
{
gnutls_ext_deinit_data_func deinit;
gnutls_ext_priv_data_t data;
int ret, i;
deinit = _gnutls_ext_func_deinit(type);
ret = _gnutls_ext_get_resumed_session_data(session, type, &data);
if (ret >= 0 && deinit != NULL) {
deinit(data);
}
for (i = 0; i < MAX_EXT_TYPES; i++) {
if (session->internals.resumed_extension_int_data[i].
type == type) {
session->internals.resumed_extension_int_data[i].
set = 0;
return;
}
}
}
/* Deinitializes all data that are associated with TLS extensions.
*/
void _gnutls_ext_free_session_data(gnutls_session_t session)
{
unsigned int i;
for (i = 0; extfunc[i] != NULL; i++) {
_gnutls_ext_unset_session_data(session, extfunc[i]->type);
}
for (i = 0; extfunc[i] != NULL; i++) {
_gnutls_ext_unset_resumed_session_data(session,
extfunc[i]->type);
}
}
/* This function allows an extension to store data in the current session
* and retrieve them later on. We use functions instead of a pointer to a
* private pointer, to allow API additions by individual extensions.
*/
void
_gnutls_ext_set_session_data(gnutls_session_t session, uint16_t type,
gnutls_ext_priv_data_t data)
{
unsigned int i;
gnutls_ext_deinit_data_func deinit;
deinit = _gnutls_ext_func_deinit(type);
for (i = 0; i < MAX_EXT_TYPES; i++) {
if (session->internals.extension_int_data[i].type == type
|| session->internals.extension_int_data[i].set == 0) {
if (session->internals.extension_int_data[i].set !=
0) {
if (deinit)
deinit(session->internals.
extension_int_data[i].priv);
}
session->internals.extension_int_data[i].type =
type;
session->internals.extension_int_data[i].priv =
data;
session->internals.extension_int_data[i].set = 1;
return;
}
}
}
int
_gnutls_ext_get_session_data(gnutls_session_t session,
uint16_t type, gnutls_ext_priv_data_t * data)
{
int i;
for (i = 0; i < MAX_EXT_TYPES; i++) {
if (session->internals.extension_int_data[i].set != 0 &&
session->internals.extension_int_data[i].type == type)
{
*data =
session->internals.extension_int_data[i].priv;
return 0;
}
}
return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE;
}
int
_gnutls_ext_get_resumed_session_data(gnutls_session_t session,
uint16_t type,
gnutls_ext_priv_data_t * data)
{
int i;
for (i = 0; i < MAX_EXT_TYPES; i++) {
if (session->internals.resumed_extension_int_data[i].set !=
0
&& session->internals.resumed_extension_int_data[i].
type == type) {
*data =
session->internals.
resumed_extension_int_data[i].priv;
return 0;
}
}
return GNUTLS_E_INVALID_REQUEST;
}
/**
* gnutls_ext_register:
* @name: the name of the extension to register
* @type: the numeric id of the extension
* @parse_type: the parse type of the extension (see gnutls_ext_parse_type_t)
* @recv_func: a function to receive the data
* @send_func: a function to send the data
* @deinit_func: a function deinitialize any private data
* @pack_func: a function which serializes the extension's private data (used on session packing for resumption)
* @unpack_func: a function which will deserialize the extension's private data
*
* This function will register a new extension type. The extension will remain
* registered until gnutls_global_deinit() is called. If the extension type
* is already registered then %GNUTLS_E_ALREADY_REGISTERED will be returned.
*
* Each registered extension can store temporary data into the gnutls_session_t
* structure using gnutls_ext_set_data(), and they can be retrieved using
* gnutls_ext_get_data().
*
* This function is not thread safe.
*
* Returns: %GNUTLS_E_SUCCESS on success, otherwise a negative error code.
*
* Since: 3.4.0
**/
int
gnutls_ext_register(const char *name, int type, gnutls_ext_parse_type_t parse_type,
gnutls_ext_recv_func recv_func, gnutls_ext_send_func send_func,
gnutls_ext_deinit_data_func deinit_func, gnutls_ext_pack_func pack_func,
gnutls_ext_unpack_func unpack_func)
{
extension_entry_st *tmp_mod;
int ret;
unsigned i;
for (i = 0; extfunc[i] != NULL; i++) {
if (extfunc[i]->type == type)
return gnutls_assert_val(GNUTLS_E_ALREADY_REGISTERED);
}
tmp_mod = gnutls_calloc(1, sizeof(*tmp_mod));
if (tmp_mod == NULL)
return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR);
tmp_mod->name = gnutls_strdup(name);
tmp_mod->free_struct = 1;
tmp_mod->type = type;
tmp_mod->parse_type = parse_type;
tmp_mod->recv_func = recv_func;
tmp_mod->send_func = send_func;
tmp_mod->deinit_func = deinit_func;
tmp_mod->pack_func = pack_func;
tmp_mod->unpack_func = unpack_func;
ret = ext_register(tmp_mod);
if (ret < 0) {
gnutls_free((void*)tmp_mod->name);
gnutls_free(tmp_mod);
}
return ret;
}
/**
* gnutls_ext_set_data:
* @session: a #gnutls_session_t opaque pointer
* @type: the numeric id of the extension
* @data: the private data to set
*
* This function allows an extension handler to store data in the current session
* and retrieve them later on. The set data will be deallocated using
* the gnutls_ext_deinit_data_func.
*
* Since: 3.4.0
**/
void
gnutls_ext_set_data(gnutls_session_t session, unsigned type,
gnutls_ext_priv_data_t data)
{
_gnutls_ext_set_session_data(session, type, data);
}
/**
* gnutls_ext_get_data:
* @session: a #gnutls_session_t opaque pointer
* @type: the numeric id of the extension
* @data: a pointer to the private data to retrieve
*
* This function retrieves any data previously stored with gnutls_ext_set_data().
*
* Returns: %GNUTLS_E_SUCCESS on success, otherwise a negative error code.
*
* Since: 3.4.0
**/
int
gnutls_ext_get_data(gnutls_session_t session,
unsigned type, gnutls_ext_priv_data_t *data)
{
return _gnutls_ext_get_session_data(session, type, data);
}
|