-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathgnutls.h.in
More file actions
3640 lines (3175 loc) · 144 KB
/
Copy pathgnutls.h.in
File metadata and controls
3640 lines (3175 loc) · 144 KB
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
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* -*- c -*-
* Copyright (C) 2000-2016 Free Software Foundation, Inc.
* Copyright (C) 2015-2017 Red Hat, Inc.
*
* Author: Nikos Mavrogiannopoulos
*
* 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 <https://www.gnu.org/licenses/>
*
*/
/* This file contains the types and prototypes for all the
* high level functionality of the gnutls main library.
*
* If the optional C++ binding was built, it is available in
* gnutls/gnutlsxx.h.
*
* The openssl compatibility layer (which is under the GNU GPL
* license) is in gnutls/openssl.h.
*
* The low level cipher functionality is in gnutls/crypto.h.
*/
#ifndef GNUTLS_GNUTLS_H
#define GNUTLS_GNUTLS_H
/* Get ssize_t. */
#include <sys/types.h>
/* Get size_t. */
#include <stddef.h>
/* Get time_t. */
#include <time.h>
#ifdef __cplusplus
extern "C" {
#endif
#define GNUTLS_VERSION "@VERSION@"
/* clang-format off */
#define GNUTLS_VERSION_MAJOR @MAJOR_VERSION@
#define GNUTLS_VERSION_MINOR @MINOR_VERSION@
#define GNUTLS_VERSION_PATCH @PATCH_VERSION@
#define GNUTLS_VERSION_NUMBER @NUMBER_VERSION@
/* clang-format on */
#define GNUTLS_CIPHER_RIJNDAEL_128_CBC GNUTLS_CIPHER_AES_128_CBC
#define GNUTLS_CIPHER_RIJNDAEL_256_CBC GNUTLS_CIPHER_AES_256_CBC
#define GNUTLS_CIPHER_RIJNDAEL_CBC GNUTLS_CIPHER_AES_128_CBC
#define GNUTLS_CIPHER_ARCFOUR GNUTLS_CIPHER_ARCFOUR_128
#if !defined(GNUTLS_INTERNAL_BUILD) && defined(_WIN32)
#define _SYM_EXPORT __declspec(dllimport)
#else
#define _SYM_EXPORT
#endif
#ifdef __GNUC__
#define __GNUTLS_CONST__ __attribute__((const))
#define __GNUTLS_PURE__ __attribute__((pure))
#else
#define __GNUTLS_CONST__
#define __GNUTLS_PURE__
#endif
/* Use the following definition globally in your program to disable
* implicit initialization of gnutls. */
#define GNUTLS_SKIP_GLOBAL_INIT \
int _gnutls_global_init_skip(void); \
int _gnutls_global_init_skip(void) \
{ \
return 1; \
}
/**
* gnutls_cipher_algorithm_t:
* @GNUTLS_CIPHER_UNKNOWN: Value to identify an unknown/unsupported algorithm.
* @GNUTLS_CIPHER_NULL: The NULL (identity) encryption algorithm.
* @GNUTLS_CIPHER_ARCFOUR_128: ARCFOUR stream cipher with 128-bit keys.
* @GNUTLS_CIPHER_3DES_CBC: 3DES in CBC mode.
* @GNUTLS_CIPHER_AES_128_CBC: AES in CBC mode with 128-bit keys.
* @GNUTLS_CIPHER_AES_192_CBC: AES in CBC mode with 192-bit keys.
* @GNUTLS_CIPHER_AES_256_CBC: AES in CBC mode with 256-bit keys.
* @GNUTLS_CIPHER_AES_128_CFB8: AES in CFB8 mode with 128-bit keys.
* @GNUTLS_CIPHER_AES_192_CFB8: AES in CFB8 mode with 192-bit keys.
* @GNUTLS_CIPHER_AES_256_CFB8: AES in CFB8 mode with 256-bit keys.
* @GNUTLS_CIPHER_ARCFOUR_40: ARCFOUR stream cipher with 40-bit keys.
* @GNUTLS_CIPHER_CAMELLIA_128_CBC: Camellia in CBC mode with 128-bit keys.
* @GNUTLS_CIPHER_CAMELLIA_192_CBC: Camellia in CBC mode with 192-bit keys.
* @GNUTLS_CIPHER_CAMELLIA_256_CBC: Camellia in CBC mode with 256-bit keys.
* @GNUTLS_CIPHER_RC2_40_CBC: RC2 in CBC mode with 40-bit keys.
* @GNUTLS_CIPHER_DES_CBC: DES in CBC mode (56-bit keys).
* @GNUTLS_CIPHER_AES_128_GCM: AES in GCM mode with 128-bit keys (AEAD).
* @GNUTLS_CIPHER_AES_256_GCM: AES in GCM mode with 256-bit keys (AEAD).
* @GNUTLS_CIPHER_AES_128_CCM: AES in CCM mode with 128-bit keys (AEAD).
* @GNUTLS_CIPHER_AES_256_CCM: AES in CCM mode with 256-bit keys (AEAD).
* @GNUTLS_CIPHER_AES_128_CCM_8: AES in CCM mode with 64-bit tag and 128-bit keys (AEAD).
* @GNUTLS_CIPHER_AES_256_CCM_8: AES in CCM mode with 64-bit tag and 256-bit keys (AEAD).
* @GNUTLS_CIPHER_CAMELLIA_128_GCM: CAMELLIA in GCM mode with 128-bit keys (AEAD).
* @GNUTLS_CIPHER_CAMELLIA_256_GCM: CAMELLIA in GCM mode with 256-bit keys (AEAD).
* @GNUTLS_CIPHER_SALSA20_256: Salsa20 with 256-bit keys.
* @GNUTLS_CIPHER_ESTREAM_SALSA20_256: Estream's Salsa20 variant with 256-bit keys.
* @GNUTLS_CIPHER_CHACHA20_32: Chacha20 cipher with 96-bit nonces and 32-bit block counters.
* @GNUTLS_CIPHER_CHACHA20_64: Chacha20 cipher with 64-bit nonces and 64-bit block counters.
* @GNUTLS_CIPHER_CHACHA20_POLY1305: The Chacha20 cipher with the Poly1305 authenticator (AEAD).
* @GNUTLS_CIPHER_GOST28147_TC26Z_CFB: GOST 28147-89 (Magma) cipher in CFB mode with TC26 Z S-box.
* @GNUTLS_CIPHER_GOST28147_CPA_CFB: GOST 28147-89 (Magma) cipher in CFB mode with CryptoPro A S-box.
* @GNUTLS_CIPHER_GOST28147_CPB_CFB: GOST 28147-89 (Magma) cipher in CFB mode with CryptoPro B S-box.
* @GNUTLS_CIPHER_GOST28147_CPC_CFB: GOST 28147-89 (Magma) cipher in CFB mode with CryptoPro C S-box.
* @GNUTLS_CIPHER_GOST28147_CPD_CFB: GOST 28147-89 (Magma) cipher in CFB mode with CryptoPro D S-box.
* @GNUTLS_CIPHER_AES_128_XTS: AES in XTS mode with 128-bit key + 128bit tweak key.
* @GNUTLS_CIPHER_AES_256_XTS: AES in XTS mode with 256-bit key + 256bit tweak key.
* Note that the XTS ciphers are message oriented.
* The whole message needs to be provided with a single call, because
* cipher-stealing requires to know where the message actually terminates
* in order to be able to compute where the stealing occurs.
* @GNUTLS_CIPHER_GOST28147_TC26Z_CNT: GOST 28147-89 (Magma) cipher in CNT mode with TC26 Z S-box.
* @GNUTLS_CIPHER_MAGMA_CTR_ACPKM: GOST R 34.12-2015 (Magma) cipher in CTR-ACPKM mode.
* @GNUTLS_CIPHER_KUZNYECHIK_CTR_ACPKM: GOST R 34.12-2015 (Kuznyechik) cipher in CTR-ACPKM mode.
* @GNUTLS_CIPHER_IDEA_PGP_CFB: IDEA in CFB mode (placeholder - unsupported).
* @GNUTLS_CIPHER_3DES_PGP_CFB: 3DES in CFB mode (placeholder - unsupported).
* @GNUTLS_CIPHER_CAST5_PGP_CFB: CAST5 in CFB mode (placeholder - unsupported).
* @GNUTLS_CIPHER_BLOWFISH_PGP_CFB: Blowfish in CFB mode (placeholder - unsupported).
* @GNUTLS_CIPHER_SAFER_SK128_PGP_CFB: Safer-SK in CFB mode with 128-bit keys (placeholder - unsupported).
* @GNUTLS_CIPHER_AES128_PGP_CFB: AES in CFB mode with 128-bit keys (placeholder - unsupported).
* @GNUTLS_CIPHER_AES192_PGP_CFB: AES in CFB mode with 192-bit keys (placeholder - unsupported).
* @GNUTLS_CIPHER_AES256_PGP_CFB: AES in CFB mode with 256-bit keys (placeholder - unsupported).
* @GNUTLS_CIPHER_TWOFISH_PGP_CFB: Twofish in CFB mode (placeholder - unsupported).
* @GNUTLS_CIPHER_AES_128_SIV: AES in SIV mode with 128-bit key.
* @GNUTLS_CIPHER_AES_256_SIV: AES in SIV mode with 256-bit key.
* Note that the SIV ciphers can only be used with
* the AEAD interface, and the IV plays a role as
* the authentication tag while it is prepended to
* the cipher text.
* @GNUTLS_CIPHER_AES_192_GCM: AES in GCM mode with 192-bit keys (AEAD).
* @GNUTLS_CIPHER_AES_128_SIV_GCM: AES in SIV-GCM mode with 128-bit key.
* @GNUTLS_CIPHER_AES_256_SIV_GCM: AES in SIV-GCM mode with 256-bit key.
* @GNUTLS_CIPHER_AES_128_CFB: AES in CFB mode with 128-bit keys.
* @GNUTLS_CIPHER_AES_192_CFB: AES in CFB mode with 192-bit keys.
* @GNUTLS_CIPHER_AES_256_CFB: AES in CFB mode with 256-bit keys.
*
* Enumeration of different symmetric encryption algorithms.
*/
typedef enum gnutls_cipher_algorithm {
GNUTLS_CIPHER_UNKNOWN = 0,
GNUTLS_CIPHER_NULL = 1,
GNUTLS_CIPHER_ARCFOUR_128 = 2,
GNUTLS_CIPHER_3DES_CBC = 3,
GNUTLS_CIPHER_AES_128_CBC = 4,
GNUTLS_CIPHER_AES_256_CBC = 5,
GNUTLS_CIPHER_ARCFOUR_40 = 6,
GNUTLS_CIPHER_CAMELLIA_128_CBC = 7,
GNUTLS_CIPHER_CAMELLIA_256_CBC = 8,
GNUTLS_CIPHER_AES_192_CBC = 9,
GNUTLS_CIPHER_AES_128_GCM = 10,
GNUTLS_CIPHER_AES_256_GCM = 11,
GNUTLS_CIPHER_CAMELLIA_192_CBC = 12,
GNUTLS_CIPHER_SALSA20_256 = 13,
GNUTLS_CIPHER_ESTREAM_SALSA20_256 = 14,
GNUTLS_CIPHER_CAMELLIA_128_GCM = 15,
GNUTLS_CIPHER_CAMELLIA_256_GCM = 16,
GNUTLS_CIPHER_RC2_40_CBC = 17,
GNUTLS_CIPHER_DES_CBC = 18,
GNUTLS_CIPHER_AES_128_CCM = 19,
GNUTLS_CIPHER_AES_256_CCM = 20,
GNUTLS_CIPHER_AES_128_CCM_8 = 21,
GNUTLS_CIPHER_AES_256_CCM_8 = 22,
GNUTLS_CIPHER_CHACHA20_POLY1305 = 23,
GNUTLS_CIPHER_GOST28147_TC26Z_CFB = 24,
GNUTLS_CIPHER_GOST28147_CPA_CFB = 25,
GNUTLS_CIPHER_GOST28147_CPB_CFB = 26,
GNUTLS_CIPHER_GOST28147_CPC_CFB = 27,
GNUTLS_CIPHER_GOST28147_CPD_CFB = 28,
GNUTLS_CIPHER_AES_128_CFB8 = 29,
GNUTLS_CIPHER_AES_192_CFB8 = 30,
GNUTLS_CIPHER_AES_256_CFB8 = 31,
GNUTLS_CIPHER_AES_128_XTS = 32,
GNUTLS_CIPHER_AES_256_XTS = 33,
GNUTLS_CIPHER_GOST28147_TC26Z_CNT = 34,
GNUTLS_CIPHER_CHACHA20_64 = 35,
GNUTLS_CIPHER_CHACHA20_32 = 36,
GNUTLS_CIPHER_AES_128_SIV = 37,
GNUTLS_CIPHER_AES_256_SIV = 38,
GNUTLS_CIPHER_AES_192_GCM = 39,
GNUTLS_CIPHER_MAGMA_CTR_ACPKM = 40,
GNUTLS_CIPHER_KUZNYECHIK_CTR_ACPKM = 41,
GNUTLS_CIPHER_AES_128_SIV_GCM = 42,
GNUTLS_CIPHER_AES_256_SIV_GCM = 43,
GNUTLS_CIPHER_AES_128_CFB = 44,
GNUTLS_CIPHER_AES_192_CFB = 45,
GNUTLS_CIPHER_AES_256_CFB = 46,
/* used only for PGP internals. Ignored in TLS/SSL
*/
GNUTLS_CIPHER_IDEA_PGP_CFB = 200,
GNUTLS_CIPHER_3DES_PGP_CFB = 201,
GNUTLS_CIPHER_CAST5_PGP_CFB = 202,
GNUTLS_CIPHER_BLOWFISH_PGP_CFB = 203,
GNUTLS_CIPHER_SAFER_SK128_PGP_CFB = 204,
GNUTLS_CIPHER_AES128_PGP_CFB = 205,
GNUTLS_CIPHER_AES192_PGP_CFB = 206,
GNUTLS_CIPHER_AES256_PGP_CFB = 207,
GNUTLS_CIPHER_TWOFISH_PGP_CFB = 208
} gnutls_cipher_algorithm_t;
/**
* gnutls_kx_algorithm_t:
* @GNUTLS_KX_UNKNOWN: Unknown key-exchange algorithm.
* @GNUTLS_KX_RSA: RSA key-exchange algorithm.
* @GNUTLS_KX_DHE_DSS: DHE-DSS key-exchange algorithm.
* @GNUTLS_KX_DHE_RSA: DHE-RSA key-exchange algorithm.
* @GNUTLS_KX_ECDHE_RSA: ECDHE-RSA key-exchange algorithm.
* @GNUTLS_KX_ECDHE_ECDSA: ECDHE-ECDSA key-exchange algorithm.
* @GNUTLS_KX_ANON_DH: Anon-DH key-exchange algorithm.
* @GNUTLS_KX_ANON_ECDH: Anon-ECDH key-exchange algorithm.
* @GNUTLS_KX_SRP: SRP key-exchange algorithm.
* @GNUTLS_KX_RSA_EXPORT: RSA-EXPORT key-exchange algorithm (defunc).
* @GNUTLS_KX_SRP_RSA: SRP-RSA key-exchange algorithm.
* @GNUTLS_KX_SRP_DSS: SRP-DSS key-exchange algorithm.
* @GNUTLS_KX_PSK: PSK key-exchange algorithm.
* @GNUTLS_KX_DHE_PSK: DHE-PSK key-exchange algorithm.
* @GNUTLS_KX_ECDHE_PSK: ECDHE-PSK key-exchange algorithm.
* @GNUTLS_KX_RSA_PSK: RSA-PSK key-exchange algorithm.
* @GNUTLS_KX_VKO_GOST_12: VKO GOST R 34.10-2012 key-exchange algorithm.
*
* Enumeration of different key exchange algorithms.
*/
typedef enum {
GNUTLS_KX_UNKNOWN = 0,
GNUTLS_KX_RSA = 1,
GNUTLS_KX_DHE_DSS = 2,
GNUTLS_KX_DHE_RSA = 3,
GNUTLS_KX_ANON_DH = 4,
GNUTLS_KX_SRP = 5,
GNUTLS_KX_RSA_EXPORT = 6,
GNUTLS_KX_SRP_RSA = 7,
GNUTLS_KX_SRP_DSS = 8,
GNUTLS_KX_PSK = 9,
GNUTLS_KX_DHE_PSK = 10,
GNUTLS_KX_ANON_ECDH = 11,
GNUTLS_KX_ECDHE_RSA = 12,
GNUTLS_KX_ECDHE_ECDSA = 13,
GNUTLS_KX_ECDHE_PSK = 14,
GNUTLS_KX_RSA_PSK = 15,
GNUTLS_KX_VKO_GOST_12 = 16
} gnutls_kx_algorithm_t;
/**
* gnutls_params_type_t:
* @GNUTLS_PARAMS_RSA_EXPORT: Session RSA-EXPORT parameters (defunc).
* @GNUTLS_PARAMS_DH: Session Diffie-Hellman parameters.
* @GNUTLS_PARAMS_ECDH: Session Elliptic-Curve Diffie-Hellman parameters.
*
* Enumeration of different TLS session parameter types.
*/
typedef enum {
GNUTLS_PARAMS_RSA_EXPORT = 1,
GNUTLS_PARAMS_DH = 2,
GNUTLS_PARAMS_ECDH = 3
} gnutls_params_type_t;
/**
* gnutls_credentials_type_t:
* @GNUTLS_CRD_CERTIFICATE: Certificate credential.
* @GNUTLS_CRD_ANON: Anonymous credential.
* @GNUTLS_CRD_SRP: SRP credential.
* @GNUTLS_CRD_PSK: PSK credential.
* @GNUTLS_CRD_IA: IA credential.
*
* Enumeration of different credential types.
*/
typedef enum {
GNUTLS_CRD_CERTIFICATE = 1,
GNUTLS_CRD_ANON,
GNUTLS_CRD_SRP,
GNUTLS_CRD_PSK,
GNUTLS_CRD_IA
} gnutls_credentials_type_t;
#define GNUTLS_MAC_SHA GNUTLS_MAC_SHA1
#define GNUTLS_DIG_SHA GNUTLS_DIG_SHA1
/**
* gnutls_mac_algorithm_t:
* @GNUTLS_MAC_UNKNOWN: Unknown MAC algorithm.
* @GNUTLS_MAC_NULL: NULL MAC algorithm (empty output).
* @GNUTLS_MAC_MD5: HMAC-MD5 algorithm.
* @GNUTLS_MAC_SHA1: HMAC-SHA-1 algorithm.
* @GNUTLS_MAC_RMD160: HMAC-RMD160 algorithm.
* @GNUTLS_MAC_MD2: HMAC-MD2 algorithm.
* @GNUTLS_MAC_SHA256: HMAC-SHA-256 algorithm.
* @GNUTLS_MAC_SHA384: HMAC-SHA-384 algorithm.
* @GNUTLS_MAC_SHA512: HMAC-SHA-512 algorithm.
* @GNUTLS_MAC_SHA224: HMAC-SHA-224 algorithm.
* @GNUTLS_MAC_MD5_SHA1: Combined MD5+SHA1 MAC placeholder.
* @GNUTLS_MAC_GOSTR_94: HMAC GOST R 34.11-94 algorithm.
* @GNUTLS_MAC_STREEBOG_256: HMAC GOST R 34.11-2001 (Streebog) algorithm, 256 bit.
* @GNUTLS_MAC_STREEBOG_512: HMAC GOST R 34.11-2001 (Streebog) algorithm, 512 bit.
* @GNUTLS_MAC_AEAD: MAC implicit through AEAD cipher.
* @GNUTLS_MAC_UMAC_96: The UMAC-96 MAC algorithm (requires nonce).
* @GNUTLS_MAC_UMAC_128: The UMAC-128 MAC algorithm (requires nonce).
* @GNUTLS_MAC_AES_CMAC_128: The AES-CMAC-128 MAC algorithm.
* @GNUTLS_MAC_AES_CMAC_256: The AES-CMAC-256 MAC algorithm.
* @GNUTLS_MAC_AES_GMAC_128: The AES-GMAC-128 MAC algorithm (requires nonce).
* @GNUTLS_MAC_AES_GMAC_192: The AES-GMAC-192 MAC algorithm (requires nonce).
* @GNUTLS_MAC_AES_GMAC_256: The AES-GMAC-256 MAC algorithm (requires nonce).
* @GNUTLS_MAC_SHA3_224: Reserved; unimplemented.
* @GNUTLS_MAC_SHA3_256: Reserved; unimplemented.
* @GNUTLS_MAC_SHA3_384: Reserved; unimplemented.
* @GNUTLS_MAC_SHA3_512: Reserved; unimplemented.
* @GNUTLS_MAC_GOST28147_TC26Z_IMIT: The GOST 28147-89 working in IMIT mode with TC26 Z S-box.
* @GNUTLS_MAC_SHAKE_128: The SHAKE128 extendable output function.
* @GNUTLS_MAC_SHAKE_256: The SHAKE256 extendable output function.
* @GNUTLS_MAC_MAGMA_OMAC: GOST R 34.12-2015 (Magma) in OMAC (CMAC) mode.
* @GNUTLS_MAC_KUZNYECHIK_OMAC: GOST R 34.12-2015 (Kuznyechik) in OMAC (CMAC) mode.
*
* Enumeration of different Message Authentication Code (MAC)
* algorithms.
*/
typedef enum {
GNUTLS_MAC_UNKNOWN = 0,
GNUTLS_MAC_NULL = 1,
GNUTLS_MAC_MD5 = 2,
GNUTLS_MAC_SHA1 = 3,
GNUTLS_MAC_RMD160 = 4,
GNUTLS_MAC_MD2 = 5,
GNUTLS_MAC_SHA256 = 6,
GNUTLS_MAC_SHA384 = 7,
GNUTLS_MAC_SHA512 = 8,
GNUTLS_MAC_SHA224 = 9,
GNUTLS_MAC_SHA3_224 = 10, /* reserved: no implementation */
GNUTLS_MAC_SHA3_256 = 11, /* reserved: no implementation */
GNUTLS_MAC_SHA3_384 = 12, /* reserved: no implementation */
GNUTLS_MAC_SHA3_512 = 13, /* reserved: no implementation */
GNUTLS_MAC_MD5_SHA1 = 14, /* reserved: no implementation */
GNUTLS_MAC_GOSTR_94 = 15,
GNUTLS_MAC_STREEBOG_256 = 16,
GNUTLS_MAC_STREEBOG_512 = 17,
/* If you add anything here, make sure you align with
gnutls_digest_algorithm_t. */
GNUTLS_MAC_AEAD = 200, /* indicates that MAC is on the cipher */
GNUTLS_MAC_UMAC_96 = 201,
GNUTLS_MAC_UMAC_128 = 202,
GNUTLS_MAC_AES_CMAC_128 = 203,
GNUTLS_MAC_AES_CMAC_256 = 204,
GNUTLS_MAC_AES_GMAC_128 = 205,
GNUTLS_MAC_AES_GMAC_192 = 206,
GNUTLS_MAC_AES_GMAC_256 = 207,
GNUTLS_MAC_GOST28147_TC26Z_IMIT = 208,
GNUTLS_MAC_SHAKE_128 = 209,
GNUTLS_MAC_SHAKE_256 = 210,
GNUTLS_MAC_MAGMA_OMAC = 211,
GNUTLS_MAC_KUZNYECHIK_OMAC = 212,
GNUTLS_MAC_PBMAC1 =
213 /* indicates that PBMAC1 is embedded the PKCS#12 structure */
} gnutls_mac_algorithm_t;
/**
* gnutls_digest_algorithm_t:
* @GNUTLS_DIG_UNKNOWN: Unknown hash algorithm.
* @GNUTLS_DIG_NULL: NULL hash algorithm (empty output).
* @GNUTLS_DIG_MD5: MD5 algorithm.
* @GNUTLS_DIG_SHA1: SHA-1 algorithm.
* @GNUTLS_DIG_RMD160: RMD160 algorithm.
* @GNUTLS_DIG_MD2: MD2 algorithm.
* @GNUTLS_DIG_SHA256: SHA-256 algorithm.
* @GNUTLS_DIG_SHA384: SHA-384 algorithm.
* @GNUTLS_DIG_SHA512: SHA-512 algorithm.
* @GNUTLS_DIG_SHA224: SHA-224 algorithm.
* @GNUTLS_DIG_SHA3_224: SHA3-224 algorithm.
* @GNUTLS_DIG_SHA3_256: SHA3-256 algorithm.
* @GNUTLS_DIG_SHA3_384: SHA3-384 algorithm.
* @GNUTLS_DIG_SHA3_512: SHA3-512 algorithm.
* @GNUTLS_DIG_MD5_SHA1: Combined MD5+SHA1 algorithm.
* @GNUTLS_DIG_GOSTR_94: GOST R 34.11-94 algorithm.
* @GNUTLS_DIG_STREEBOG_256: GOST R 34.11-2001 (Streebog) algorithm, 256 bit.
* @GNUTLS_DIG_STREEBOG_512: GOST R 34.11-2001 (Streebog) algorithm, 512 bit.
* @GNUTLS_DIG_SHAKE_128: The SHAKE128 extendable output function.
* @GNUTLS_DIG_SHAKE_256: The SHAKE256 extendable output function.
*
* Enumeration of different digest (hash) algorithms.
*/
typedef enum {
GNUTLS_DIG_UNKNOWN = GNUTLS_MAC_UNKNOWN,
GNUTLS_DIG_NULL = GNUTLS_MAC_NULL,
GNUTLS_DIG_MD5 = GNUTLS_MAC_MD5,
GNUTLS_DIG_SHA1 = GNUTLS_MAC_SHA1,
GNUTLS_DIG_RMD160 = GNUTLS_MAC_RMD160,
GNUTLS_DIG_MD2 = GNUTLS_MAC_MD2,
GNUTLS_DIG_SHA256 = GNUTLS_MAC_SHA256,
GNUTLS_DIG_SHA384 = GNUTLS_MAC_SHA384,
GNUTLS_DIG_SHA512 = GNUTLS_MAC_SHA512,
GNUTLS_DIG_SHA224 = GNUTLS_MAC_SHA224,
GNUTLS_DIG_SHA3_224 = GNUTLS_MAC_SHA3_224,
GNUTLS_DIG_SHA3_256 = GNUTLS_MAC_SHA3_256,
GNUTLS_DIG_SHA3_384 = GNUTLS_MAC_SHA3_384,
GNUTLS_DIG_SHA3_512 = GNUTLS_MAC_SHA3_512,
GNUTLS_DIG_MD5_SHA1 = GNUTLS_MAC_MD5_SHA1,
GNUTLS_DIG_GOSTR_94 = GNUTLS_MAC_GOSTR_94,
GNUTLS_DIG_STREEBOG_256 = GNUTLS_MAC_STREEBOG_256,
GNUTLS_DIG_STREEBOG_512 = GNUTLS_MAC_STREEBOG_512,
GNUTLS_DIG_SHAKE_128 = GNUTLS_MAC_SHAKE_128,
GNUTLS_DIG_SHAKE_256 = GNUTLS_MAC_SHAKE_256
/* If you add anything here, make sure you align with
gnutls_mac_algorithm_t. */
} gnutls_digest_algorithm_t;
/* exported for other gnutls headers. This is the maximum number of
* algorithms (ciphers, kx or macs).
*/
#define GNUTLS_MAX_ALGORITHM_NUM 128
#define GNUTLS_MAX_SESSION_ID_SIZE 32
/**
* gnutls_compression_method_t:
* @GNUTLS_COMP_UNKNOWN: Unknown compression method.
* @GNUTLS_COMP_NULL: The NULL compression method (no compression).
* @GNUTLS_COMP_DEFLATE: The DEFLATE compression method from zlib.
* @GNUTLS_COMP_ZLIB: Same as %GNUTLS_COMP_DEFLATE.
* @GNUTLS_COMP_BROTLI: Brotli compression method.
* @GNUTLS_COMP_ZSTD: Zstandard compression method.
*
* Enumeration of different TLS compression methods.
*/
typedef enum {
GNUTLS_COMP_UNKNOWN = 0,
GNUTLS_COMP_NULL = 1,
GNUTLS_COMP_DEFLATE = 2,
GNUTLS_COMP_ZLIB = GNUTLS_COMP_DEFLATE,
GNUTLS_COMP_BROTLI = 3,
GNUTLS_COMP_ZSTD = 4
} gnutls_compression_method_t;
/**
* gnutls_init_flags_t:
*
* @GNUTLS_SERVER: Connection end is a server.
* @GNUTLS_CLIENT: Connection end is a client.
* @GNUTLS_DATAGRAM: Connection is datagram oriented (DTLS). Since 3.0.0.
* @GNUTLS_NONBLOCK: Connection should not block. Since 3.0.0.
* @GNUTLS_NO_SIGNAL: In systems where SIGPIPE is delivered on send, it will be disabled. That flag has effect in systems which support the MSG_NOSIGNAL sockets flag (since 3.4.2).
* @GNUTLS_NO_DEFAULT_EXTENSIONS: Do not enable any TLS extensions by default such as session tickets and OCSP certificate status request (since 3.1.2). As TLS 1.2 and later require extensions this option is considered obsolete and should not be used.
* @GNUTLS_NO_REPLAY_PROTECTION: Disable any replay protection in DTLS. This must only be used if replay protection is achieved using other means. Since 3.2.2.
* @GNUTLS_ALLOW_ID_CHANGE: Allow the peer to replace its certificate, or change its ID during a rehandshake. This change is often used in attacks and thus prohibited by default. Since 3.5.0.
* @GNUTLS_ENABLE_FALSE_START: Enable the TLS false start on client side if the negotiated ciphersuites allow it. This will enable sending data prior to the handshake being complete, and may introduce a risk of crypto failure when combined with certain key exchanged; for that GnuTLS may not enable that option in ciphersuites that are known to be not safe for false start. Since 3.5.0.
* @GNUTLS_ENABLE_EARLY_START: Under TLS1.3 allow the server to return earlier than the full handshake
* finish; similarly to false start the handshake will be completed once data are received by the
* client, while the server is able to transmit sooner. This is not enabled by default as it could
* break certain existing server assumptions and use-cases. Since 3.6.4.
* @GNUTLS_ENABLE_EARLY_DATA: Under TLS1.3 allow the server to receive early data sent as part of the initial ClientHello (0-RTT).
* This can also be used to explicitly indicate that the client will send early data.
* This is not enabled by default as early data has weaker security properties than other data. Since 3.6.5.
* @GNUTLS_FORCE_CLIENT_CERT: When in client side and only a single cert is specified, send that certificate irrespective of the issuers expected by the server. Since 3.5.0.
* @GNUTLS_NO_TICKETS: Flag to indicate that the session should not use resumption with session tickets.
* @GNUTLS_NO_TICKETS_TLS12: Flag to indicate that the session should not use resumption with session tickets. This flag only has effect if TLS 1.2 is used.
* @GNUTLS_KEY_SHARE_TOP3: Generate key shares for the top-3 different groups which are enabled.
* That is, as each group is associated with a key type (EC, finite field, x25519), generate
* three keys using %GNUTLS_PK_DH, %GNUTLS_PK_EC, %GNUTLS_PK_ECDH_X25519 if all of them are enabled.
* @GNUTLS_KEY_SHARE_TOP2: Generate key shares for the top-2 different groups which are enabled.
* For example (ECDH + x25519). This is the default.
* @GNUTLS_KEY_SHARE_TOP: Generate key share for the first group which is enabled.
* For example x25519. This option is the most performant for client (less CPU spent
* generating keys), but if the server doesn't support the advertised option it may
* result to more roundtrips needed to discover the server's choice.
* @GNUTLS_NO_AUTO_REKEY: Disable auto-rekeying under TLS1.3. If this option is not specified
* gnutls will force a rekey after 2^24 records have been sent.
* @GNUTLS_POST_HANDSHAKE_AUTH: Enable post handshake authentication for server and client. When set and
* a server requests authentication after handshake %GNUTLS_E_REAUTH_REQUEST will be returned
* by gnutls_record_recv(). A client should then call gnutls_reauth() to re-authenticate.
* @GNUTLS_SAFE_PADDING_CHECK: Flag to indicate that the TLS 1.3 padding check will be done in a
* safe way which doesn't leak the pad size based on GnuTLS processing time. This is of use to
* applications which hide the length of transferred data via the TLS1.3 padding mechanism and
* are already taking steps to hide the data processing time. This comes at a performance
* penalty.
* @GNUTLS_AUTO_REAUTH: Enable transparent re-authentication in client side when the server
* requests to. That is, reauthentication is handled within gnutls_record_recv(), and
* the %GNUTLS_E_REHANDSHAKE or %GNUTLS_E_REAUTH_REQUEST are not returned. This must be
* enabled with %GNUTLS_POST_HANDSHAKE_AUTH for TLS1.3. Enabling this flag requires to restore
* interrupted calls to gnutls_record_recv() based on the output of gnutls_record_get_direction(),
* since gnutls_record_recv() could be interrupted when sending when this flag is enabled.
* Note this flag may not be used if you are using the same session for sending and receiving
* in different threads.
* @GNUTLS_ENABLE_RAWPK: Allows raw public-keys to be negotiated during the handshake. Since 3.6.6.
* @GNUTLS_NO_AUTO_SEND_TICKET: Under TLS1.3 disable auto-sending of
* session tickets during the handshake.
* @GNUTLS_NO_END_OF_EARLY_DATA: Under TLS1.3 suppress sending EndOfEarlyData message. Since 3.7.2.
* @GNUTLS_NO_STATUS_REQUEST: Prevents client from including the "status_request" TLS extension
* in the client hello, thus disabling the receival of certificate status information. Since 3.8.0.
*
* Enumeration of different flags for gnutls_init() function. All the flags
* can be combined except @GNUTLS_SERVER and @GNUTLS_CLIENT which are mutually
* exclusive.
*
* The key share options relate to the TLS 1.3 key share extension
* which is a speculative key generation expecting that the server
* would support the generated key.
*/
typedef enum {
GNUTLS_SERVER = 1,
GNUTLS_CLIENT = (1 << 1),
GNUTLS_DATAGRAM = (1 << 2),
GNUTLS_NONBLOCK = (1 << 3),
GNUTLS_NO_DEFAULT_EXTENSIONS = (1 << 4),
GNUTLS_NO_REPLAY_PROTECTION = (1 << 5),
GNUTLS_NO_SIGNAL = (1 << 6),
GNUTLS_ALLOW_ID_CHANGE = (1 << 7),
GNUTLS_ENABLE_FALSE_START = (1 << 8),
GNUTLS_FORCE_CLIENT_CERT = (1 << 9),
GNUTLS_NO_TICKETS = (1 << 10),
GNUTLS_KEY_SHARE_TOP = (1 << 11),
GNUTLS_KEY_SHARE_TOP2 = (1 << 12),
GNUTLS_KEY_SHARE_TOP3 = (1 << 13),
GNUTLS_POST_HANDSHAKE_AUTH = (1 << 14),
GNUTLS_NO_AUTO_REKEY = (1 << 15),
GNUTLS_SAFE_PADDING_CHECK = (1 << 16),
GNUTLS_ENABLE_EARLY_START = (1 << 17),
GNUTLS_ENABLE_RAWPK = (1 << 18),
GNUTLS_AUTO_REAUTH = (1 << 19),
GNUTLS_ENABLE_EARLY_DATA = (1 << 20),
GNUTLS_NO_AUTO_SEND_TICKET = (1 << 21),
GNUTLS_NO_END_OF_EARLY_DATA = (1 << 22),
GNUTLS_NO_TICKETS_TLS12 = (1 << 23),
GNUTLS_NO_STATUS_REQUEST = (1 << 24)
} gnutls_init_flags_t;
/* compatibility defines (previous versions of gnutls
* used defines instead of enumerated values). */
#define GNUTLS_SERVER (1)
#define GNUTLS_CLIENT (1 << 1)
#define GNUTLS_DATAGRAM (1 << 2)
#define GNUTLS_NONBLOCK (1 << 3)
#define GNUTLS_NO_DEFAULT_EXTENSIONS (1 << 4)
#define GNUTLS_NO_REPLAY_PROTECTION (1 << 5)
#define GNUTLS_NO_SIGNAL (1 << 6)
#define GNUTLS_ALLOW_ID_CHANGE (1 << 7)
#define GNUTLS_ENABLE_FALSE_START (1 << 8)
#define GNUTLS_FORCE_CLIENT_CERT (1 << 9)
#define GNUTLS_NO_TICKETS (1 << 10)
#define GNUTLS_ENABLE_CERT_TYPE_NEG 0
// Here for compatibility reasons
/* Keep backward compatibility */
#define GNUTLS_NO_EXTENSIONS GNUTLS_NO_DEFAULT_EXTENSIONS
/**
* gnutls_alert_level_t:
* @GNUTLS_AL_WARNING: Alert of warning severity.
* @GNUTLS_AL_FATAL: Alert of fatal severity.
*
* Enumeration of different TLS alert severities.
*/
typedef enum {
GNUTLS_AL_WARNING = 1,
GNUTLS_AL_FATAL
} gnutls_alert_level_t;
/**
* gnutls_alert_description_t:
* @GNUTLS_A_CLOSE_NOTIFY: Close notify.
* @GNUTLS_A_UNEXPECTED_MESSAGE: Unexpected message.
* @GNUTLS_A_BAD_RECORD_MAC: Bad record MAC.
* @GNUTLS_A_DECRYPTION_FAILED: Decryption failed.
* @GNUTLS_A_RECORD_OVERFLOW: Record overflow.
* @GNUTLS_A_DECOMPRESSION_FAILURE: Decompression failed.
* @GNUTLS_A_HANDSHAKE_FAILURE: Handshake failed.
* @GNUTLS_A_SSL3_NO_CERTIFICATE: No certificate.
* @GNUTLS_A_BAD_CERTIFICATE: Certificate is bad.
* @GNUTLS_A_UNSUPPORTED_CERTIFICATE: Certificate is not supported.
* @GNUTLS_A_CERTIFICATE_REVOKED: Certificate was revoked.
* @GNUTLS_A_CERTIFICATE_EXPIRED: Certificate is expired.
* @GNUTLS_A_CERTIFICATE_UNKNOWN: Unknown certificate.
* @GNUTLS_A_ILLEGAL_PARAMETER: Illegal parameter.
* @GNUTLS_A_UNKNOWN_CA: CA is unknown.
* @GNUTLS_A_ACCESS_DENIED: Access was denied.
* @GNUTLS_A_DECODE_ERROR: Decode error.
* @GNUTLS_A_DECRYPT_ERROR: Decrypt error.
* @GNUTLS_A_EXPORT_RESTRICTION: Export restriction.
* @GNUTLS_A_PROTOCOL_VERSION: Error in protocol version.
* @GNUTLS_A_INSUFFICIENT_SECURITY: Insufficient security.
* @GNUTLS_A_INTERNAL_ERROR: Internal error.
* @GNUTLS_A_INAPPROPRIATE_FALLBACK: Inappropriate fallback,
* @GNUTLS_A_USER_CANCELED: User canceled.
* @GNUTLS_A_NO_RENEGOTIATION: No renegotiation is allowed.
* @GNUTLS_A_MISSING_EXTENSION: An extension was expected but was not seen
* @GNUTLS_A_UNSUPPORTED_EXTENSION: An unsupported extension was
* sent.
* @GNUTLS_A_CERTIFICATE_UNOBTAINABLE: Could not retrieve the
* specified certificate.
* @GNUTLS_A_UNRECOGNIZED_NAME: The server name sent was not
* recognized.
* @GNUTLS_A_UNKNOWN_PSK_IDENTITY: The SRP/PSK username is missing
* or not known.
* @GNUTLS_A_CERTIFICATE_REQUIRED: Certificate is required.
* @GNUTLS_A_NO_APPLICATION_PROTOCOL: The ALPN protocol requested is
* not supported by the peer.
*
* Enumeration of different TLS alerts.
*/
typedef enum {
GNUTLS_A_CLOSE_NOTIFY,
GNUTLS_A_UNEXPECTED_MESSAGE = 10,
GNUTLS_A_BAD_RECORD_MAC = 20,
GNUTLS_A_DECRYPTION_FAILED,
GNUTLS_A_RECORD_OVERFLOW,
GNUTLS_A_DECOMPRESSION_FAILURE = 30,
GNUTLS_A_HANDSHAKE_FAILURE = 40,
GNUTLS_A_SSL3_NO_CERTIFICATE = 41,
GNUTLS_A_BAD_CERTIFICATE = 42,
GNUTLS_A_UNSUPPORTED_CERTIFICATE,
GNUTLS_A_CERTIFICATE_REVOKED,
GNUTLS_A_CERTIFICATE_EXPIRED,
GNUTLS_A_CERTIFICATE_UNKNOWN,
GNUTLS_A_ILLEGAL_PARAMETER,
GNUTLS_A_UNKNOWN_CA,
GNUTLS_A_ACCESS_DENIED,
GNUTLS_A_DECODE_ERROR = 50,
GNUTLS_A_DECRYPT_ERROR,
GNUTLS_A_EXPORT_RESTRICTION = 60,
GNUTLS_A_PROTOCOL_VERSION = 70,
GNUTLS_A_INSUFFICIENT_SECURITY,
GNUTLS_A_INTERNAL_ERROR = 80,
GNUTLS_A_INAPPROPRIATE_FALLBACK = 86,
GNUTLS_A_USER_CANCELED = 90,
GNUTLS_A_NO_RENEGOTIATION = 100,
GNUTLS_A_MISSING_EXTENSION = 109,
GNUTLS_A_UNSUPPORTED_EXTENSION = 110,
GNUTLS_A_CERTIFICATE_UNOBTAINABLE = 111,
GNUTLS_A_UNRECOGNIZED_NAME = 112,
GNUTLS_A_UNKNOWN_PSK_IDENTITY = 115,
GNUTLS_A_CERTIFICATE_REQUIRED = 116,
GNUTLS_A_NO_APPLICATION_PROTOCOL = 120,
GNUTLS_A_MAX = GNUTLS_A_NO_APPLICATION_PROTOCOL
} gnutls_alert_description_t;
/**
* gnutls_handshake_description_t:
* @GNUTLS_HANDSHAKE_HELLO_REQUEST: Hello request.
* @GNUTLS_HANDSHAKE_HELLO_VERIFY_REQUEST: DTLS Hello verify request.
* @GNUTLS_HANDSHAKE_CLIENT_HELLO: Client hello.
* @GNUTLS_HANDSHAKE_SERVER_HELLO: Server hello.
* @GNUTLS_HANDSHAKE_END_OF_EARLY_DATA: End of early data.
* @GNUTLS_HANDSHAKE_HELLO_RETRY_REQUEST: Hello retry request.
* @GNUTLS_HANDSHAKE_NEW_SESSION_TICKET: New session ticket.
* @GNUTLS_HANDSHAKE_CERTIFICATE_PKT: Certificate packet.
* @GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE: Server key exchange.
* @GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST: Certificate request.
* @GNUTLS_HANDSHAKE_SERVER_HELLO_DONE: Server hello done.
* @GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY: Certificate verify.
* @GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE: Client key exchange.
* @GNUTLS_HANDSHAKE_FINISHED: Finished.
* @GNUTLS_HANDSHAKE_CERTIFICATE_STATUS: Certificate status (OCSP).
* @GNUTLS_HANDSHAKE_KEY_UPDATE: TLS1.3 key update message.
* @GNUTLS_HANDSHAKE_COMPRESSED_CERTIFICATE_PKT: Compressed certificate packet.
* @GNUTLS_HANDSHAKE_SUPPLEMENTAL: Supplemental.
* @GNUTLS_HANDSHAKE_CHANGE_CIPHER_SPEC: Change Cipher Spec.
* @GNUTLS_HANDSHAKE_CLIENT_HELLO_V2: SSLv2 Client Hello.
* @GNUTLS_HANDSHAKE_ENCRYPTED_EXTENSIONS: Encrypted extensions message.
*
* Enumeration of different TLS handshake packets.
*/
typedef enum {
GNUTLS_HANDSHAKE_HELLO_REQUEST = 0,
GNUTLS_HANDSHAKE_CLIENT_HELLO = 1,
GNUTLS_HANDSHAKE_SERVER_HELLO = 2,
GNUTLS_HANDSHAKE_HELLO_VERIFY_REQUEST = 3,
GNUTLS_HANDSHAKE_NEW_SESSION_TICKET = 4,
GNUTLS_HANDSHAKE_END_OF_EARLY_DATA = 5,
GNUTLS_HANDSHAKE_ENCRYPTED_EXTENSIONS = 8,
GNUTLS_HANDSHAKE_CERTIFICATE_PKT = 11,
GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE = 12,
GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST = 13,
GNUTLS_HANDSHAKE_SERVER_HELLO_DONE = 14,
GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY = 15,
GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE = 16,
GNUTLS_HANDSHAKE_FINISHED = 20,
GNUTLS_HANDSHAKE_CERTIFICATE_STATUS = 22,
GNUTLS_HANDSHAKE_SUPPLEMENTAL = 23,
GNUTLS_HANDSHAKE_KEY_UPDATE = 24,
GNUTLS_HANDSHAKE_COMPRESSED_CERTIFICATE_PKT = 25,
GNUTLS_HANDSHAKE_CHANGE_CIPHER_SPEC = 254,
GNUTLS_HANDSHAKE_CLIENT_HELLO_V2 = 1024,
GNUTLS_HANDSHAKE_HELLO_RETRY_REQUEST = 1025,
} gnutls_handshake_description_t;
#define GNUTLS_HANDSHAKE_ANY ((unsigned int)-1)
const char *
gnutls_handshake_description_get_name(gnutls_handshake_description_t type);
/**
* gnutls_certificate_status_t:
* @GNUTLS_CERT_INVALID: The certificate is not signed by one of the
* known authorities or the signature is invalid (deprecated by the flags
* %GNUTLS_CERT_SIGNATURE_FAILURE and %GNUTLS_CERT_SIGNER_NOT_FOUND).
* @GNUTLS_CERT_SIGNATURE_FAILURE: The signature verification failed.
* @GNUTLS_CERT_REVOKED: Certificate is revoked by its authority. In X.509 this will be
* set only if CRLs are checked.
* @GNUTLS_CERT_SIGNER_NOT_FOUND: The certificate's issuer is not known.
* This is the case if the issuer is not included in the trusted certificate list.
* @GNUTLS_CERT_SIGNER_NOT_CA: The certificate's signer was not a CA. This
* may happen if this was a version 1 certificate, which is common with
* some CAs, or a version 3 certificate without the basic constrains extension.
* @GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE: The certificate's signer constraints were
* violated.
* @GNUTLS_CERT_INSECURE_ALGORITHM: The certificate was signed using an insecure
* algorithm such as MD2 or MD5. These algorithms have been broken and
* should not be trusted.
* @GNUTLS_CERT_NOT_ACTIVATED: The certificate is not yet activated.
* @GNUTLS_CERT_EXPIRED: The certificate has expired.
* @GNUTLS_CERT_REVOCATION_DATA_SUPERSEDED: The revocation data are old and have been superseded.
* @GNUTLS_CERT_REVOCATION_DATA_ISSUED_IN_FUTURE: The revocation data have a future issue date.
* @GNUTLS_CERT_UNEXPECTED_OWNER: The owner is not the expected one.
* @GNUTLS_CERT_MISMATCH: The certificate presented isn't the expected one (TOFU)
* @GNUTLS_CERT_PURPOSE_MISMATCH: The certificate or an intermediate does not match the intended purpose (extended key usage).
* @GNUTLS_CERT_MISSING_OCSP_STATUS: The certificate requires the server to send the certificate status, but no status was received.
* @GNUTLS_CERT_INVALID_OCSP_STATUS: The received OCSP status response is invalid.
* @GNUTLS_CERT_UNKNOWN_CRIT_EXTENSIONS: The certificate has extensions marked as critical which are not supported.
*
* Enumeration of certificate status codes. Note that the status
* bits may have different meanings in OpenPGP keys and X.509
* certificate verification.
*/
typedef enum {
GNUTLS_CERT_INVALID = 1 << 1,
GNUTLS_CERT_REVOKED = 1 << 5,
GNUTLS_CERT_SIGNER_NOT_FOUND = 1 << 6,
GNUTLS_CERT_SIGNER_NOT_CA = 1 << 7,
GNUTLS_CERT_INSECURE_ALGORITHM = 1 << 8,
GNUTLS_CERT_NOT_ACTIVATED = 1 << 9,
GNUTLS_CERT_EXPIRED = 1 << 10,
GNUTLS_CERT_SIGNATURE_FAILURE = 1 << 11,
GNUTLS_CERT_REVOCATION_DATA_SUPERSEDED = 1 << 12,
GNUTLS_CERT_UNEXPECTED_OWNER = 1 << 14,
GNUTLS_CERT_REVOCATION_DATA_ISSUED_IN_FUTURE = 1 << 15,
GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE = 1 << 16,
GNUTLS_CERT_MISMATCH = 1 << 17,
GNUTLS_CERT_PURPOSE_MISMATCH = 1 << 18,
GNUTLS_CERT_MISSING_OCSP_STATUS = 1 << 19,
GNUTLS_CERT_INVALID_OCSP_STATUS = 1 << 20,
GNUTLS_CERT_UNKNOWN_CRIT_EXTENSIONS = 1 << 21
} gnutls_certificate_status_t;
/**
* gnutls_certificate_request_t:
* @GNUTLS_CERT_IGNORE: Ignore certificate.
* @GNUTLS_CERT_REQUEST: Request certificate.
* @GNUTLS_CERT_REQUIRE: Require certificate.
*
* Enumeration of certificate request types.
*/
typedef enum {
GNUTLS_CERT_IGNORE = 0,
GNUTLS_CERT_REQUEST = 1,
GNUTLS_CERT_REQUIRE = 2
} gnutls_certificate_request_t;
/**
* gnutls_openpgp_crt_status_t:
* @GNUTLS_OPENPGP_CERT: Send entire certificate.
* @GNUTLS_OPENPGP_CERT_FINGERPRINT: Send only certificate fingerprint.
*
* Enumeration of ways to send OpenPGP certificate.
*/
typedef enum {
GNUTLS_OPENPGP_CERT = 0,
GNUTLS_OPENPGP_CERT_FINGERPRINT = 1
} gnutls_openpgp_crt_status_t;
/**
* gnutls_close_request_t:
* @GNUTLS_SHUT_RDWR: Disallow further receives/sends.
* @GNUTLS_SHUT_WR: Disallow further sends.
*
* Enumeration of how TLS session should be terminated. See gnutls_bye().
*/
typedef enum {
GNUTLS_SHUT_RDWR = 0,
GNUTLS_SHUT_WR = 1
} gnutls_close_request_t;
/**
* gnutls_protocol_t:
* @GNUTLS_SSL3: SSL version 3.0.
* @GNUTLS_TLS1_0: TLS version 1.0.
* @GNUTLS_TLS1: Same as %GNUTLS_TLS1_0.
* @GNUTLS_TLS1_1: TLS version 1.1.
* @GNUTLS_TLS1_2: TLS version 1.2.
* @GNUTLS_TLS1_3: TLS version 1.3.
* @GNUTLS_DTLS1_0: DTLS version 1.0.
* @GNUTLS_DTLS1_2: DTLS version 1.2.
* @GNUTLS_DTLS0_9: DTLS version 0.9 (Cisco AnyConnect / OpenSSL 0.9.8e).
* @GNUTLS_TLS_VERSION_MAX: Maps to the highest supported TLS version.
* @GNUTLS_DTLS_VERSION_MAX: Maps to the highest supported DTLS version.
* @GNUTLS_VERSION_UNKNOWN: Unknown SSL/TLS version.
*
* Enumeration of different SSL/TLS protocol versions.
*/
typedef enum {
GNUTLS_SSL3 = 1,
GNUTLS_TLS1_0 = 2,
GNUTLS_TLS1 = GNUTLS_TLS1_0,
GNUTLS_TLS1_1 = 3,
GNUTLS_TLS1_2 = 4,
GNUTLS_TLS1_3 = 5,
GNUTLS_DTLS0_9 = 200,
GNUTLS_DTLS1_0 = 201, /* 201 */
GNUTLS_DTLS1_2 = 202,
GNUTLS_DTLS_VERSION_MIN = GNUTLS_DTLS0_9,
GNUTLS_DTLS_VERSION_MAX = GNUTLS_DTLS1_2,
GNUTLS_TLS_VERSION_MAX = GNUTLS_TLS1_3,
GNUTLS_VERSION_UNKNOWN = 0xff /* change it to 0xffff */
} gnutls_protocol_t;
#define GNUTLS_CRT_RAW GNUTLS_CRT_RAWPK
/**
* gnutls_certificate_type_t:
* @GNUTLS_CRT_UNKNOWN: Unknown certificate type.
* @GNUTLS_CRT_X509: X.509 Certificate.
* @GNUTLS_CRT_OPENPGP: OpenPGP certificate.
* @GNUTLS_CRT_RAWPK: Raw public-key (SubjectPublicKeyInfo)
*
* Enumeration of different certificate types.
*/
typedef enum {
GNUTLS_CRT_UNKNOWN = 0,
GNUTLS_CRT_X509 = 1,
GNUTLS_CRT_OPENPGP = 2,
GNUTLS_CRT_RAWPK = 3,
GNUTLS_CRT_MAX = GNUTLS_CRT_RAWPK
} gnutls_certificate_type_t;
/**
* gnutls_x509_crt_fmt_t:
* @GNUTLS_X509_FMT_DER: X.509 certificate in DER format (binary).
* @GNUTLS_X509_FMT_PEM: X.509 certificate in PEM format (text).
*
* Enumeration of different certificate encoding formats.
*/
typedef enum {
GNUTLS_X509_FMT_DER = 0,
GNUTLS_X509_FMT_PEM = 1
} gnutls_x509_crt_fmt_t;
/**
* gnutls_certificate_print_formats_t:
* @GNUTLS_CRT_PRINT_FULL: Full information about certificate.
* @GNUTLS_CRT_PRINT_FULL_NUMBERS: Full information about certificate and include easy to parse public key parameters.
* @GNUTLS_CRT_PRINT_COMPACT: Information about certificate name in one line, plus identification of the public key.
* @GNUTLS_CRT_PRINT_ONELINE: Information about certificate in one line.
* @GNUTLS_CRT_PRINT_UNSIGNED_FULL: All info for an unsigned certificate.
*
* Enumeration of different certificate printing variants.
*/
typedef enum gnutls_certificate_print_formats {
GNUTLS_CRT_PRINT_FULL = 0,
GNUTLS_CRT_PRINT_ONELINE = 1,
GNUTLS_CRT_PRINT_UNSIGNED_FULL = 2,
GNUTLS_CRT_PRINT_COMPACT = 3,
GNUTLS_CRT_PRINT_FULL_NUMBERS = 4
} gnutls_certificate_print_formats_t;
#define GNUTLS_PK_ECC GNUTLS_PK_ECDSA
#define GNUTLS_PK_EC GNUTLS_PK_ECDSA
#define GNUTLS_PK_ECDHX GNUTLS_PK_ECDH_X25519
/**
* gnutls_pk_algorithm_t:
* @GNUTLS_PK_UNKNOWN: Unknown public-key algorithm.
* @GNUTLS_PK_RSA: RSA public-key algorithm.
* @GNUTLS_PK_RSA_OAEP: RSA public-key algorithm, with OAEP padding.
* @GNUTLS_PK_RSA_PSS: RSA public-key algorithm, with PSS padding.
* @GNUTLS_PK_DSA: DSA public-key algorithm.
* @GNUTLS_PK_DH: Diffie-Hellman algorithm. Used to generate parameters.
* @GNUTLS_PK_ECDSA: Elliptic curve algorithm. These parameters are compatible with the ECDSA and ECDH algorithm.
* @GNUTLS_PK_ECDH_X25519: Elliptic curve algorithm, restricted to ECDH as per rfc7748.
* @GNUTLS_PK_EDDSA_ED25519: Edwards curve Digital signature algorithm. Used with SHA512 on signatures.
* @GNUTLS_PK_GOST_01: GOST R 34.10-2001 algorithm per rfc5832.
* @GNUTLS_PK_GOST_12_256: GOST R 34.10-2012 algorithm, 256-bit key per rfc7091.
* @GNUTLS_PK_GOST_12_512: GOST R 34.10-2012 algorithm, 512-bit key per rfc7091.
* @GNUTLS_PK_ECDH_X448: Elliptic curve algorithm, restricted to ECDH as per rfc7748.
* @GNUTLS_PK_EDDSA_ED448: Edwards curve Digital signature algorithm. Used with SHAKE256 on signatures.
* @GNUTLS_PK_MLKEM768: ML-KEM-768 key encapsulation algorithm as per FIPS 203.
* @GNUTLS_PK_MLKEM1024: ML-KEM-1024 key encapsulation algorithm as per FIPS 203.
* @GNUTLS_PK_MLDSA44: ML-DSA-44 digital signature algorithm as per FIPS 204.
* @GNUTLS_PK_MLDSA65: ML-DSA-65 digital signature algorithm as per FIPS 204.
* @GNUTLS_PK_MLDSA87: ML-DSA-87 digital signature algorithm as per FIPS 204.
*
* Enumeration of different public-key algorithms.
*/
typedef enum {
GNUTLS_PK_UNKNOWN = 0,
GNUTLS_PK_RSA = 1,
GNUTLS_PK_DSA = 2,
GNUTLS_PK_DH = 3,
GNUTLS_PK_ECDSA = 4,
GNUTLS_PK_ECDH_X25519 = 5,
GNUTLS_PK_RSA_PSS = 6,
GNUTLS_PK_EDDSA_ED25519 = 7,
GNUTLS_PK_GOST_01 = 8,
GNUTLS_PK_GOST_12_256 = 9,
GNUTLS_PK_GOST_12_512 = 10,
GNUTLS_PK_ECDH_X448 = 11,
GNUTLS_PK_EDDSA_ED448 = 12,
GNUTLS_PK_RSA_OAEP = 13,
GNUTLS_PK_MLKEM768 = 14,
GNUTLS_PK_MLDSA44 = 15,
GNUTLS_PK_MLDSA65 = 16,
GNUTLS_PK_MLDSA87 = 17,
GNUTLS_PK_MLKEM1024 = 18,
GNUTLS_PK_MAX = GNUTLS_PK_MLKEM1024,
/* Experimental algorithms */
GNUTLS_PK_EXP_KYBER768 = 256,
GNUTLS_PK_EXP_MAX = GNUTLS_PK_EXP_KYBER768
} gnutls_pk_algorithm_t;
const char *gnutls_pk_algorithm_get_name(gnutls_pk_algorithm_t algorithm);
/**
* gnutls_sign_algorithm_t:
* @GNUTLS_SIGN_UNKNOWN: Unknown signature algorithm.
* @GNUTLS_SIGN_RSA_RAW: Digital signature algorithm RSA with DigestInfo formatted data
* @GNUTLS_SIGN_RSA_SHA1: Digital signature algorithm RSA with SHA-1
* @GNUTLS_SIGN_RSA_SHA: Same as %GNUTLS_SIGN_RSA_SHA1.
* @GNUTLS_SIGN_DSA_SHA1: Digital signature algorithm DSA with SHA-1
* @GNUTLS_SIGN_DSA_SHA224: Digital signature algorithm DSA with SHA-224
* @GNUTLS_SIGN_DSA_SHA256: Digital signature algorithm DSA with SHA-256
* @GNUTLS_SIGN_DSA_SHA384: Digital signature algorithm DSA with SHA-384
* @GNUTLS_SIGN_DSA_SHA512: Digital signature algorithm DSA with SHA-512
* @GNUTLS_SIGN_DSA_SHA: Same as %GNUTLS_SIGN_DSA_SHA1.
* @GNUTLS_SIGN_RSA_MD5: Digital signature algorithm RSA with MD5.
* @GNUTLS_SIGN_RSA_MD2: Digital signature algorithm RSA with MD2.
* @GNUTLS_SIGN_RSA_RMD160: Digital signature algorithm RSA with RMD-160.
* @GNUTLS_SIGN_RSA_SHA256: Digital signature algorithm RSA with SHA-256.
* @GNUTLS_SIGN_RSA_SHA384: Digital signature algorithm RSA with SHA-384.
* @GNUTLS_SIGN_RSA_SHA512: Digital signature algorithm RSA with SHA-512.
* @GNUTLS_SIGN_RSA_SHA224: Digital signature algorithm RSA with SHA-224.
* @GNUTLS_SIGN_ECDSA_SHA1: ECDSA with SHA1.
* @GNUTLS_SIGN_ECDSA_SHA224: Digital signature algorithm ECDSA with SHA-224.
* @GNUTLS_SIGN_ECDSA_SHA256: Digital signature algorithm ECDSA with SHA-256.
* @GNUTLS_SIGN_ECDSA_SHA384: Digital signature algorithm ECDSA with SHA-384.
* @GNUTLS_SIGN_ECDSA_SHA512: Digital signature algorithm ECDSA with SHA-512.
* @GNUTLS_SIGN_ECDSA_SECP256R1_SHA256: Digital signature algorithm ECDSA-SECP256R1 with SHA-256 (used in TLS 1.3 but not PKIX).
* @GNUTLS_SIGN_ECDSA_SECP384R1_SHA384: Digital signature algorithm ECDSA-SECP384R1 with SHA-384 (used in TLS 1.3 but not PKIX).
* @GNUTLS_SIGN_ECDSA_SECP521R1_SHA512: Digital signature algorithm ECDSA-SECP521R1 with SHA-512 (used in TLS 1.3 but not PKIX).
* @GNUTLS_SIGN_ECDSA_SHA3_224: Digital signature algorithm ECDSA with SHA3-224.
* @GNUTLS_SIGN_ECDSA_SHA3_256: Digital signature algorithm ECDSA with SHA3-256.
* @GNUTLS_SIGN_ECDSA_SHA3_384: Digital signature algorithm ECDSA with SHA3-384.
* @GNUTLS_SIGN_ECDSA_SHA3_512: Digital signature algorithm ECDSA with SHA3-512.
* @GNUTLS_SIGN_DSA_SHA3_224: Digital signature algorithm DSA with SHA3-224.
* @GNUTLS_SIGN_DSA_SHA3_256: Digital signature algorithm DSA with SHA3-256.
* @GNUTLS_SIGN_DSA_SHA3_384: Digital signature algorithm DSA with SHA3-384.
* @GNUTLS_SIGN_DSA_SHA3_512: Digital signature algorithm DSA with SHA3-512.
* @GNUTLS_SIGN_RSA_SHA3_224: Digital signature algorithm RSA with SHA3-224.
* @GNUTLS_SIGN_RSA_SHA3_256: Digital signature algorithm RSA with SHA3-256.
* @GNUTLS_SIGN_RSA_SHA3_384: Digital signature algorithm RSA with SHA3-384.
* @GNUTLS_SIGN_RSA_SHA3_512: Digital signature algorithm RSA with SHA3-512.
* @GNUTLS_SIGN_RSA_PSS_RSAE_SHA256: Digital signature algorithm RSA with SHA-256,
* with PSS padding (RSA PKCS#1 1.5 certificate). This signature is identical
* to #GNUTLS_SIGN_RSA_PSS_SHA256, but they are distinct as the TLS1.3 protocol
* treats them differently.
* @GNUTLS_SIGN_RSA_PSS_RSAE_SHA384: Digital signature algorithm RSA with SHA-384,
* with PSS padding (RSA PKCS#1 1.5 certificate). This signature is identical
* to #GNUTLS_SIGN_RSA_PSS_SHA384, but they are distinct as the TLS1.3 protocol
* treats them differently.
* @GNUTLS_SIGN_RSA_PSS_RSAE_SHA512: Digital signature algorithm RSA with SHA-512,
* with PSS padding (RSA PKCS#1 1.5 certificate). This signature is identical
* to #GNUTLS_SIGN_RSA_PSS_SHA512, but they are distinct as the TLS1.3 protocol
* treats them differently.
* @GNUTLS_SIGN_RSA_PSS_SHA256: Digital signature algorithm RSA with SHA-256, with PSS padding (RSA-PSS certificate).
* @GNUTLS_SIGN_RSA_PSS_SHA384: Digital signature algorithm RSA with SHA-384, with PSS padding (RSA-PSS certificate).
* @GNUTLS_SIGN_RSA_PSS_SHA512: Digital signature algorithm RSA with SHA-512, with PSS padding (RSA-PSS certificate).
* @GNUTLS_SIGN_EDDSA_ED25519: Digital signature algorithm EdDSA with Ed25519 curve.
* @GNUTLS_SIGN_GOST_94: Digital signature algorithm GOST R 34.10-2001 with GOST R 34.11-94
* @GNUTLS_SIGN_GOST_256: Digital signature algorithm GOST R 34.10-2012 with GOST R 34.11-2012 256 bit
* @GNUTLS_SIGN_GOST_512: Digital signature algorithm GOST R 34.10-2012 with GOST R 34.11-2012 512 bit
* @GNUTLS_SIGN_EDDSA_ED448: Digital signature algorithm EdDSA with Ed448 curve.
* @GNUTLS_SIGN_MLDSA44: Digital signature algorithm ML-DSA-44.
* @GNUTLS_SIGN_MLDSA65: Digital signature algorithm ML-DSA-65.
* @GNUTLS_SIGN_MLDSA87: Digital signature algorithm ML-DSA-87.
*
* Enumeration of different digital signature algorithms.