summaryrefslogtreecommitdiff
path: root/manual/html_node/Cryptographic-API.html
blob: e2f39ece57d4c07f850f73053ed13765a6f621bd (plain)
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This manual is last updated 4 March 2015 for version
3.5.3 of GnuTLS.

Copyright (C) 2001-2015 Free Software Foundation, Inc.\\
Copyright (C) 2001-2015 Nikos Mavrogiannopoulos

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.  A
copy of the license is included in the section entitled "GNU Free
Documentation License". -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GnuTLS 3.5.3: Cryptographic API</title>

<meta name="description" content="GnuTLS 3.5.3: Cryptographic API">
<meta name="keywords" content="GnuTLS 3.5.3: Cryptographic API">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Function-and-Data-Index.html#Function-and-Data-Index" rel="index" title="Function and Data Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="API-reference.html#API-reference" rel="up" title="API reference">
<link href="Compatibility-API.html#Compatibility-API" rel="next" title="Compatibility API">
<link href="DANE-API.html#DANE-API" rel="prev" title="DANE API">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
body { 
	margin: 2%;
	padding: 0 5%;
	background: #ffffff;
}
h1,h2,h3,h4,h5 {
    font-weight: bold;
    padding: 5px 5px 5px 5px;
    background-color: #c2e0ff;
    color: #336699;
}
h1 {
    padding: 2em 2em 2em 5%;
    color: white;
    background: #336699;
    text-align: center;
    letter-spacing: 3px;
}
h2 { text-decoration: underline; }
pre {
  margin: 0 5%;
  padding: 0.5em;
}
pre.example,pre.verbatim {
  padding-bottom: 1em;

  border: solid #c2e0ff;
  background: #f0faff;
  border-width: 1px 1px 1px 5px;
  margin: 1em auto;
  width: 90%;
}

div.node {
  margin: 0 -5% 0 -2%;
  padding: 0.5em 0.5em;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  font-weight: bold;
}
dd, li {
  padding-top: 0.1em;
  padding-bottom: 0.1em;
}
div.float {

  margin-bottom: 0.5em;
  text-align: center;
}

table {
  text-align: left;
  margin-left:auto;
  margin-right:auto;
  border-spacing: 7px;
  width: 50%;
}

th {
  padding: 0;
  color: #336699;
  background-color: #c2e0ff;
  border: solid #000000;
  border-width: 0px;
  margin: 1em auto;
  text-align: center;
  margin-left:auto;
  margin-right:auto;
}

td {
  padding: 0;
  border: solid #000000;
  background-color: #f0faff;
  border-width: 0px;
  margin: 1em auto;
  text-align: left;
  margin-left:auto;
  margin-right:auto;
  padding-left: 1em;
}

dl {
  text-align: left;
  margin-left:auto;
  margin-right:auto;
  width: 50%;

  padding-left: 1em;
  border: solid #c2e0ff;
  background: #f0faff;
  border-width: 5px 1px 1px 1px;
  margin: 1em auto;
}

-->
</style>


</head>

<body lang="en">
<a name="Cryptographic-API"></a>
<div class="header">
<p>
Next: <a href="Compatibility-API.html#Compatibility-API" accesskey="n" rel="next">Compatibility API</a>, Previous: <a href="DANE-API.html#DANE-API" accesskey="p" rel="prev">DANE API</a>, Up: <a href="API-reference.html#API-reference" accesskey="u" rel="up">API reference</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Data-Index.html#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Cryptographic-API-1"></a>
<h3 class="section">E.13 Cryptographic API</h3>

<p>The following functions are to be used for low-level cryptographic operations.
Their prototypes lie in <samp>gnutls/crypto.h</samp>.
</p>

<a name="gnutls_005faead_005fcipher_005fdecrypt-1"></a>
<h4 class="subheading">gnutls_aead_cipher_decrypt</h4>
<a name="gnutls_005faead_005fcipher_005fdecrypt"></a><dl>
<dt><a name="index-gnutls_005faead_005fcipher_005fdecrypt"></a>Function: <em>int</em> <strong>gnutls_aead_cipher_decrypt</strong> <em>(gnutls_aead_cipher_hd_t <var>handle</var>, const void * <var>nonce</var>, size_t <var>nonce_len</var>, const void * <var>auth</var>, size_t <var>auth_len</var>, size_t <var>tag_size</var>, const void * <var>ctext</var>, size_t <var>ctext_len</var>, void * <var>ptext</var>, size_t * <var>ptext_len</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_aead_cipher_hd_t</code>  type.
</p>
<p><var>nonce</var>: the nonce to set
</p>
<p><var>nonce_len</var>: The length of the nonce
</p>
<p><var>auth</var>: the data to be authenticated
</p>
<p><var>auth_len</var>: The length of the data
</p>
<p><var>tag_size</var>: The size of the tag to use (use zero for the default)
</p>
<p><var>ctext</var>: the data to decrypt
</p>
<p><var>ctext_len</var>: the length of data to decrypt (includes tag size)
</p>
<p><var>ptext</var>: the decrypted data
</p>
<p><var>ptext_len</var>: the length of decrypted data (initially must hold the maximum available size)
</p>
<p>This function will decrypt the given data using the algorithm
specified by the context. This function must be provided the whole
data to be decrypted, including the tag, and will fail if the tag
verification fails.
</p>
<p><strong>Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong>Since:</strong> 3.4.0
</p></dd></dl>

<a name="gnutls_005faead_005fcipher_005fdeinit-1"></a>
<h4 class="subheading">gnutls_aead_cipher_deinit</h4>
<a name="gnutls_005faead_005fcipher_005fdeinit"></a><dl>
<dt><a name="index-gnutls_005faead_005fcipher_005fdeinit"></a>Function: <em>void</em> <strong>gnutls_aead_cipher_deinit</strong> <em>(gnutls_aead_cipher_hd_t <var>handle</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_aead_cipher_hd_t</code>  type.
</p>
<p>This function will deinitialize all resources occupied by the given
authenticated-encryption context.
</p>
<p><strong>Since:</strong> 3.4.0
</p></dd></dl>

<a name="gnutls_005faead_005fcipher_005fencrypt-1"></a>
<h4 class="subheading">gnutls_aead_cipher_encrypt</h4>
<a name="gnutls_005faead_005fcipher_005fencrypt"></a><dl>
<dt><a name="index-gnutls_005faead_005fcipher_005fencrypt"></a>Function: <em>int</em> <strong>gnutls_aead_cipher_encrypt</strong> <em>(gnutls_aead_cipher_hd_t <var>handle</var>, const void * <var>nonce</var>, size_t <var>nonce_len</var>, const void * <var>auth</var>, size_t <var>auth_len</var>, size_t <var>tag_size</var>, const void * <var>ptext</var>, size_t <var>ptext_len</var>, void * <var>ctext</var>, size_t * <var>ctext_len</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_aead_cipher_hd_t</code>  type.
</p>
<p><var>nonce</var>: the nonce to set
</p>
<p><var>nonce_len</var>: The length of the nonce
</p>
<p><var>auth</var>: the data to be authenticated
</p>
<p><var>auth_len</var>: The length of the data
</p>
<p><var>tag_size</var>: The size of the tag to use (use zero for the default)
</p>
<p><var>ptext</var>: the data to encrypt
</p>
<p><var>ptext_len</var>: The length of data to encrypt
</p>
<p><var>ctext</var>: the encrypted data
</p>
<p><var>ctext_len</var>: the length of encrypted data (initially must hold the maximum available size, including space for tag)
</p>
<p>This function will encrypt the given data using the algorithm
specified by the context. The output data will contain the
authentication tag.
</p>
<p><strong>Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong>Since:</strong> 3.4.0
</p></dd></dl>

<a name="gnutls_005faead_005fcipher_005finit-1"></a>
<h4 class="subheading">gnutls_aead_cipher_init</h4>
<a name="gnutls_005faead_005fcipher_005finit"></a><dl>
<dt><a name="index-gnutls_005faead_005fcipher_005finit"></a>Function: <em>int</em> <strong>gnutls_aead_cipher_init</strong> <em>(gnutls_aead_cipher_hd_t * <var>handle</var>, gnutls_cipher_algorithm_t <var>cipher</var>, const gnutls_datum_t * <var>key</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_aead_cipher_hd_t</code>  type.
</p>
<p><var>cipher</var>: the authenticated-encryption algorithm to use
</p>
<p><var>key</var>: The key to be used for encryption
</p>
<p>This function will initialize an context that can be used for
encryption/decryption of data. This will effectively use the
current crypto backend in use by gnutls or the cryptographic
accelerator in use.
</p>
<p><strong>Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong>Since:</strong> 3.4.0
</p></dd></dl>

<a name="gnutls_005fcipher_005fadd_005fauth-1"></a>
<h4 class="subheading">gnutls_cipher_add_auth</h4>
<a name="gnutls_005fcipher_005fadd_005fauth"></a><dl>
<dt><a name="index-gnutls_005fcipher_005fadd_005fauth"></a>Function: <em>int</em> <strong>gnutls_cipher_add_auth</strong> <em>(gnutls_cipher_hd_t <var>handle</var>, const void * <var>ptext</var>, size_t <var>ptext_size</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_cipher_hd_t</code>  type
</p>
<p><var>ptext</var>: the data to be authenticated
</p>
<p><var>ptext_size</var>: the length of the data
</p>
<p>This function operates on authenticated encryption with
associated data (AEAD) ciphers and authenticate the
input data. This function can only be called once
and before any encryption operations.
</p>
<p><strong>Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong>Since:</strong> 3.0
</p></dd></dl>

<a name="gnutls_005fcipher_005fdecrypt-1"></a>
<h4 class="subheading">gnutls_cipher_decrypt</h4>
<a name="gnutls_005fcipher_005fdecrypt"></a><dl>
<dt><a name="index-gnutls_005fcipher_005fdecrypt"></a>Function: <em>int</em> <strong>gnutls_cipher_decrypt</strong> <em>(gnutls_cipher_hd_t <var>handle</var>, void * <var>ctext</var>, size_t <var>ctext_len</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_cipher_hd_t</code>  type
</p>
<p><var>ctext</var>: the data to decrypt
</p>
<p><var>ctext_len</var>: the length of data to decrypt
</p>
<p>This function will decrypt the given data using the algorithm
specified by the context.
</p>
<p>Note that in AEAD ciphers, this will not check the tag. You will
need to compare the tag sent with the value returned from <code>gnutls_cipher_tag()</code> .
</p>
<p><strong>Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong>Since:</strong> 2.10.0
</p></dd></dl>

<a name="gnutls_005fcipher_005fdecrypt2-1"></a>
<h4 class="subheading">gnutls_cipher_decrypt2</h4>
<a name="gnutls_005fcipher_005fdecrypt2"></a><dl>
<dt><a name="index-gnutls_005fcipher_005fdecrypt2"></a>Function: <em>int</em> <strong>gnutls_cipher_decrypt2</strong> <em>(gnutls_cipher_hd_t <var>handle</var>, const void * <var>ctext</var>, size_t <var>ctext_len</var>, void * <var>ptext</var>, size_t <var>ptext_len</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_cipher_hd_t</code>  type
</p>
<p><var>ctext</var>: the data to decrypt
</p>
<p><var>ctext_len</var>: the length of data to decrypt
</p>
<p><var>ptext</var>: the decrypted data
</p>
<p><var>ptext_len</var>: the available length for decrypted data
</p>
<p>This function will decrypt the given data using the algorithm
specified by the context. For block ciphers the  <code>ctext_len</code> must be
a multiple of the block size. For the supported ciphers the plaintext
data length will equal the ciphertext size.
</p>
<p>Note that in AEAD ciphers, this will not check the tag. You will
need to compare the tag sent with the value returned from <code>gnutls_cipher_tag()</code> .
</p>
<p><strong>Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong>Since:</strong> 2.12.0
</p></dd></dl>

<a name="gnutls_005fcipher_005fdeinit-1"></a>
<h4 class="subheading">gnutls_cipher_deinit</h4>
<a name="gnutls_005fcipher_005fdeinit"></a><dl>
<dt><a name="index-gnutls_005fcipher_005fdeinit"></a>Function: <em>void</em> <strong>gnutls_cipher_deinit</strong> <em>(gnutls_cipher_hd_t <var>handle</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_cipher_hd_t</code>  type
</p>
<p>This function will deinitialize all resources occupied by the given
encryption context.
</p>
<p><strong>Since:</strong> 2.10.0
</p></dd></dl>

<a name="gnutls_005fcipher_005fencrypt-1"></a>
<h4 class="subheading">gnutls_cipher_encrypt</h4>
<a name="gnutls_005fcipher_005fencrypt"></a><dl>
<dt><a name="index-gnutls_005fcipher_005fencrypt"></a>Function: <em>int</em> <strong>gnutls_cipher_encrypt</strong> <em>(gnutls_cipher_hd_t <var>handle</var>, void * <var>ptext</var>, size_t <var>ptext_len</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_cipher_hd_t</code>  type
</p>
<p><var>ptext</var>: the data to encrypt
</p>
<p><var>ptext_len</var>: the length of data to encrypt
</p>
<p>This function will encrypt the given data using the algorithm
specified by the context.
</p>
<p><strong>Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong>Since:</strong> 2.10.0
</p></dd></dl>

<a name="gnutls_005fcipher_005fencrypt2-1"></a>
<h4 class="subheading">gnutls_cipher_encrypt2</h4>
<a name="gnutls_005fcipher_005fencrypt2"></a><dl>
<dt><a name="index-gnutls_005fcipher_005fencrypt2"></a>Function: <em>int</em> <strong>gnutls_cipher_encrypt2</strong> <em>(gnutls_cipher_hd_t <var>handle</var>, const void * <var>ptext</var>, size_t <var>ptext_len</var>, void * <var>ctext</var>, size_t <var>ctext_len</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_cipher_hd_t</code>  type
</p>
<p><var>ptext</var>: the data to encrypt
</p>
<p><var>ptext_len</var>: the length of data to encrypt
</p>
<p><var>ctext</var>: the encrypted data
</p>
<p><var>ctext_len</var>: the available length for encrypted data
</p>
<p>This function will encrypt the given data using the algorithm
specified by the context. For block ciphers the  <code>ptext_len</code> must be
a multiple of the block size. For the supported ciphers the encrypted
data length will equal the plaintext size.
</p>
<p><strong>Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong>Since:</strong> 2.12.0
</p></dd></dl>

<a name="gnutls_005fcipher_005fget_005fblock_005fsize-1"></a>
<h4 class="subheading">gnutls_cipher_get_block_size</h4>
<a name="gnutls_005fcipher_005fget_005fblock_005fsize"></a><dl>
<dt><a name="index-gnutls_005fcipher_005fget_005fblock_005fsize"></a>Function: <em>unsigned</em> <strong>gnutls_cipher_get_block_size</strong> <em>(gnutls_cipher_algorithm_t <var>algorithm</var>)</em></dt>
<dd><p><var>algorithm</var>: is an encryption algorithm
</p>

<p><strong>Returns:</strong> the block size of the encryption algorithm.
</p>
<p><strong>Since:</strong> 2.10.0
</p></dd></dl>

<a name="gnutls_005fcipher_005fget_005fiv_005fsize-1"></a>
<h4 class="subheading">gnutls_cipher_get_iv_size</h4>
<a name="gnutls_005fcipher_005fget_005fiv_005fsize"></a><dl>
<dt><a name="index-gnutls_005fcipher_005fget_005fiv_005fsize"></a>Function: <em>unsigned</em> <strong>gnutls_cipher_get_iv_size</strong> <em>(gnutls_cipher_algorithm_t <var>algorithm</var>)</em></dt>
<dd><p><var>algorithm</var>: is an encryption algorithm
</p>
<p>Get block size for encryption algorithm.
</p>
<p><strong>Returns:</strong> block size for encryption algorithm.
</p>
<p><strong>Since:</strong> 3.2.0
</p></dd></dl>

<a name="gnutls_005fcipher_005fget_005ftag_005fsize-1"></a>
<h4 class="subheading">gnutls_cipher_get_tag_size</h4>
<a name="gnutls_005fcipher_005fget_005ftag_005fsize"></a><dl>
<dt><a name="index-gnutls_005fcipher_005fget_005ftag_005fsize"></a>Function: <em>unsigned</em> <strong>gnutls_cipher_get_tag_size</strong> <em>(gnutls_cipher_algorithm_t <var>algorithm</var>)</em></dt>
<dd><p><var>algorithm</var>: is an encryption algorithm
</p>

<p><strong>Returns:</strong> the tag size of the authenticated encryption algorithm.
</p>
<p><strong>Since:</strong> 3.2.2
</p></dd></dl>

<a name="gnutls_005fcipher_005finit-1"></a>
<h4 class="subheading">gnutls_cipher_init</h4>
<a name="gnutls_005fcipher_005finit"></a><dl>
<dt><a name="index-gnutls_005fcipher_005finit"></a>Function: <em>int</em> <strong>gnutls_cipher_init</strong> <em>(gnutls_cipher_hd_t * <var>handle</var>, gnutls_cipher_algorithm_t <var>cipher</var>, const gnutls_datum_t * <var>key</var>, const gnutls_datum_t * <var>iv</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_cipher_hd_t</code>  type
</p>
<p><var>cipher</var>: the encryption algorithm to use
</p>
<p><var>key</var>: the key to be used for encryption/decryption
</p>
<p><var>iv</var>: the IV to use (if not applicable set NULL)
</p>
<p>This function will initialize the  <code>handle</code> context to be usable
for encryption/decryption of data. This will effectively use the
current crypto backend in use by gnutls or the cryptographic
accelerator in use.
</p>
<p><strong>Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong>Since:</strong> 2.10.0
</p></dd></dl>

<a name="gnutls_005fcipher_005fset_005fiv-1"></a>
<h4 class="subheading">gnutls_cipher_set_iv</h4>
<a name="gnutls_005fcipher_005fset_005fiv"></a><dl>
<dt><a name="index-gnutls_005fcipher_005fset_005fiv"></a>Function: <em>void</em> <strong>gnutls_cipher_set_iv</strong> <em>(gnutls_cipher_hd_t <var>handle</var>, void * <var>iv</var>, size_t <var>ivlen</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_cipher_hd_t</code>  type
</p>
<p><var>iv</var>: the IV to set
</p>
<p><var>ivlen</var>: the length of the IV
</p>
<p>This function will set the IV to be used for the next
encryption block.
</p>
<p><strong>Since:</strong> 3.0
</p></dd></dl>

<a name="gnutls_005fcipher_005ftag-1"></a>
<h4 class="subheading">gnutls_cipher_tag</h4>
<a name="gnutls_005fcipher_005ftag"></a><dl>
<dt><a name="index-gnutls_005fcipher_005ftag"></a>Function: <em>int</em> <strong>gnutls_cipher_tag</strong> <em>(gnutls_cipher_hd_t <var>handle</var>, void * <var>tag</var>, size_t <var>tag_size</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_cipher_hd_t</code>  type
</p>
<p><var>tag</var>: will hold the tag
</p>
<p><var>tag_size</var>: the length of the tag to return
</p>
<p>This function operates on authenticated encryption with
associated data (AEAD) ciphers and will return the
output tag.
</p>
<p><strong>Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong>Since:</strong> 3.0
</p></dd></dl>

<a name="gnutls_005fcrypto_005fregister_005faead_005fcipher-1"></a>
<h4 class="subheading">gnutls_crypto_register_aead_cipher</h4>
<a name="gnutls_005fcrypto_005fregister_005faead_005fcipher"></a><dl>
<dt><a name="index-gnutls_005fcrypto_005fregister_005faead_005fcipher-1"></a>Function: <em>int</em> <strong>gnutls_crypto_register_aead_cipher</strong> <em>(gnutls_cipher_algorithm_t <var>algorithm</var>, int <var>priority</var>, gnutls_cipher_init_func <var>init</var>, gnutls_cipher_setkey_func <var>setkey</var>, gnutls_cipher_aead_encrypt_func <var>aead_encrypt</var>, gnutls_cipher_aead_decrypt_func <var>aead_decrypt</var>, gnutls_cipher_deinit_func <var>deinit</var>)</em></dt>
<dd><p><var>algorithm</var>: is the gnutls AEAD cipher identifier
</p>
<p><var>priority</var>: is the priority of the algorithm
</p>
<p><var>init</var>: A function which initializes the cipher
</p>
<p><var>setkey</var>: A function which sets the key of the cipher
</p>
<p><var>aead_encrypt</var>: Perform the AEAD encryption
</p>
<p><var>aead_decrypt</var>: Perform the AEAD decryption
</p>
<p><var>deinit</var>: A function which deinitializes the cipher
</p>
<p>This function will register a cipher algorithm to be used by
gnutls.  Any algorithm registered will override the included
algorithms and by convention kernel implemented algorithms have
priority of 90 and CPU-assisted of 80.  The algorithm with the lowest priority will be
used by gnutls.
</p>
<p>In the case the registered init or setkey functions return <code>GNUTLS_E_NEED_FALLBACK</code> ,
GnuTLS will attempt to use the next in priority registered cipher.
</p>
<p>The functions registered will be used with the new AEAD API introduced in
GnuTLS 3.4.0. Internally GnuTLS uses the new AEAD API.
</p>
<p><strong>Returns:</strong> <code>GNUTLS_E_SUCCESS</code>  on success, otherwise a negative error code.
</p>
<p><strong>Since:</strong> 3.4.0
</p></dd></dl>

<a name="gnutls_005fcrypto_005fregister_005fcipher-1"></a>
<h4 class="subheading">gnutls_crypto_register_cipher</h4>
<a name="gnutls_005fcrypto_005fregister_005fcipher"></a><dl>
<dt><a name="index-gnutls_005fcrypto_005fregister_005fcipher-1"></a>Function: <em>int</em> <strong>gnutls_crypto_register_cipher</strong> <em>(gnutls_cipher_algorithm_t <var>algorithm</var>, int <var>priority</var>, gnutls_cipher_init_func <var>init</var>, gnutls_cipher_setkey_func <var>setkey</var>, gnutls_cipher_setiv_func <var>setiv</var>, gnutls_cipher_encrypt_func <var>encrypt</var>, gnutls_cipher_decrypt_func <var>decrypt</var>, gnutls_cipher_deinit_func <var>deinit</var>)</em></dt>
<dd><p><var>algorithm</var>: is the gnutls algorithm identifier
</p>
<p><var>priority</var>: is the priority of the algorithm
</p>
<p><var>init</var>: A function which initializes the cipher
</p>
<p><var>setkey</var>: A function which sets the key of the cipher
</p>
<p><var>setiv</var>: A function which sets the nonce/IV of the cipher (non-AEAD)
</p>
<p><var>encrypt</var>: A function which performs encryption (non-AEAD)
</p>
<p><var>decrypt</var>: A function which performs decryption (non-AEAD)
</p>
<p><var>deinit</var>: A function which deinitializes the cipher
</p>
<p>This function will register a cipher algorithm to be used by
gnutls.  Any algorithm registered will override the included
algorithms and by convention kernel implemented algorithms have
priority of 90 and CPU-assisted of 80.  The algorithm with the lowest priority will be
used by gnutls.
</p>
<p>In the case the registered init or setkey functions return <code>GNUTLS_E_NEED_FALLBACK</code> ,
GnuTLS will attempt to use the next in priority registered cipher.
</p>
<p>The functions which are marked as non-AEAD they are not required when
registering a cipher to be used with the new AEAD API introduced in
GnuTLS 3.4.0. Internally GnuTLS uses the new AEAD API.
</p>
<p><strong>Returns:</strong> <code>GNUTLS_E_SUCCESS</code>  on success, otherwise a negative error code.
</p>
<p><strong>Since:</strong> 3.4.0
</p></dd></dl>

<a name="gnutls_005fcrypto_005fregister_005fdigest-1"></a>
<h4 class="subheading">gnutls_crypto_register_digest</h4>
<a name="gnutls_005fcrypto_005fregister_005fdigest"></a><dl>
<dt><a name="index-gnutls_005fcrypto_005fregister_005fdigest-1"></a>Function: <em>int</em> <strong>gnutls_crypto_register_digest</strong> <em>(gnutls_digest_algorithm_t <var>algorithm</var>, int <var>priority</var>, gnutls_digest_init_func <var>init</var>, gnutls_digest_hash_func <var>hash</var>, gnutls_digest_output_func <var>output</var>, gnutls_digest_deinit_func <var>deinit</var>, gnutls_digest_fast_func <var>hash_fast</var>)</em></dt>
<dd><p><var>algorithm</var>: is the gnutls digest identifier
</p>
<p><var>priority</var>: is the priority of the algorithm
</p>
<p><var>init</var>: A function which initializes the digest
</p>
<p><var>hash</var>: Perform the hash operation
</p>
<p><var>output</var>: Provide the output of the digest
</p>
<p><var>deinit</var>: A function which deinitializes the digest
</p>
<p><var>hash_fast</var>: Perform the digest operation in one go
</p>
<p>This function will register a digest algorithm to be used by gnutls.
Any algorithm registered will override the included algorithms and
by convention kernel implemented algorithms have priority of 90
and CPU-assisted of 80.
The algorithm with the lowest priority will be used by gnutls.
</p>
<p><strong>Returns:</strong> <code>GNUTLS_E_SUCCESS</code>  on success, otherwise a negative error code.
</p>
<p><strong>Since:</strong> 3.4.0
</p></dd></dl>

<a name="gnutls_005fcrypto_005fregister_005fmac-1"></a>
<h4 class="subheading">gnutls_crypto_register_mac</h4>
<a name="gnutls_005fcrypto_005fregister_005fmac"></a><dl>
<dt><a name="index-gnutls_005fcrypto_005fregister_005fmac-1"></a>Function: <em>int</em> <strong>gnutls_crypto_register_mac</strong> <em>(gnutls_mac_algorithm_t <var>algorithm</var>, int <var>priority</var>, gnutls_mac_init_func <var>init</var>, gnutls_mac_setkey_func <var>setkey</var>, gnutls_mac_setnonce_func <var>setnonce</var>, gnutls_mac_hash_func <var>hash</var>, gnutls_mac_output_func <var>output</var>, gnutls_mac_deinit_func <var>deinit</var>, gnutls_mac_fast_func <var>hash_fast</var>)</em></dt>
<dd><p><var>algorithm</var>: is the gnutls MAC identifier
</p>
<p><var>priority</var>: is the priority of the algorithm
</p>
<p><var>init</var>: A function which initializes the MAC
</p>
<p><var>setkey</var>: A function which sets the key of the MAC
</p>
<p><var>setnonce</var>: A function which sets the nonce for the mac (may be <code>NULL</code>  for common MAC algorithms)
</p>
<p><var>hash</var>: Perform the hash operation
</p>
<p><var>output</var>: Provide the output of the MAC
</p>
<p><var>deinit</var>: A function which deinitializes the MAC
</p>
<p><var>hash_fast</var>: Perform the MAC operation in one go
</p>
<p>This function will register a MAC algorithm to be used by gnutls.
Any algorithm registered will override the included algorithms and
by convention kernel implemented algorithms have priority of 90
and CPU-assisted of 80.
The algorithm with the lowest priority will be used by gnutls.
</p>
<p><strong>Returns:</strong> <code>GNUTLS_E_SUCCESS</code>  on success, otherwise a negative error code.
</p>
<p><strong>Since:</strong> 3.4.0
</p></dd></dl>

<a name="gnutls_005fdecode_005fber_005fdigest_005finfo-1"></a>
<h4 class="subheading">gnutls_decode_ber_digest_info</h4>
<a name="gnutls_005fdecode_005fber_005fdigest_005finfo"></a><dl>
<dt><a name="index-gnutls_005fdecode_005fber_005fdigest_005finfo"></a>Function: <em>int</em> <strong>gnutls_decode_ber_digest_info</strong> <em>(const gnutls_datum_t * <var>info</var>, gnutls_digest_algorithm_t * <var>hash</var>, unsigned char * <var>digest</var>, unsigned int * <var>digest_size</var>)</em></dt>
<dd><p><var>info</var>: an RSA BER encoded DigestInfo structure
</p>
<p><var>hash</var>: will contain the hash algorithm of the structure
</p>
<p><var>digest</var>: will contain the hash output of the structure
</p>
<p><var>digest_size</var>: will contain the hash size of the structure; initially must hold the maximum size of  <code>digest</code> 
</p>
<p>This function will parse an RSA PKCS<code>1</code>  1.5 DigestInfo structure
and report the hash algorithm used as well as the digest data.
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise
an error code is returned.
</p>
<p><strong>Since:</strong> 3.5.0
</p></dd></dl>

<a name="gnutls_005fencode_005fber_005fdigest_005finfo-1"></a>
<h4 class="subheading">gnutls_encode_ber_digest_info</h4>
<a name="gnutls_005fencode_005fber_005fdigest_005finfo"></a><dl>
<dt><a name="index-gnutls_005fencode_005fber_005fdigest_005finfo"></a>Function: <em>int</em> <strong>gnutls_encode_ber_digest_info</strong> <em>(gnutls_digest_algorithm_t <var>hash</var>, const gnutls_datum_t * <var>digest</var>, gnutls_datum_t * <var>output</var>)</em></dt>
<dd><p><var>hash</var>: the hash algorithm that was used to get the digest
</p>
<p><var>digest</var>: must contain the digest data
</p>
<p><var>output</var>: will contain the allocated DigestInfo BER encoded data
</p>
<p>This function will encode the provided digest data, and its
algorithm into an RSA PKCS<code>1</code>  1.5 DigestInfo structure. 
</p>
<p><strong>Returns:</strong> On success, <code>GNUTLS_E_SUCCESS</code>  (0) is returned, otherwise
an error code is returned.
</p>
<p><strong>Since:</strong> 3.5.0
</p></dd></dl>

<a name="gnutls_005fhash-1"></a>
<h4 class="subheading">gnutls_hash</h4>
<a name="gnutls_005fhash"></a><dl>
<dt><a name="index-gnutls_005fhash"></a>Function: <em>int</em> <strong>gnutls_hash</strong> <em>(gnutls_hash_hd_t <var>handle</var>, const void * <var>ptext</var>, size_t <var>ptext_len</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_hash_hd_t</code>  type
</p>
<p><var>ptext</var>: the data to hash
</p>
<p><var>ptext_len</var>: the length of data to hash
</p>
<p>This function will hash the given data using the algorithm
specified by the context.
</p>
<p><strong>Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong>Since:</strong> 2.10.0
</p></dd></dl>

<a name="gnutls_005fhash_005fdeinit-1"></a>
<h4 class="subheading">gnutls_hash_deinit</h4>
<a name="gnutls_005fhash_005fdeinit"></a><dl>
<dt><a name="index-gnutls_005fhash_005fdeinit"></a>Function: <em>void</em> <strong>gnutls_hash_deinit</strong> <em>(gnutls_hash_hd_t <var>handle</var>, void * <var>digest</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_hash_hd_t</code>  type
</p>
<p><var>digest</var>: is the output value of the hash
</p>
<p>This function will deinitialize all resources occupied by
the given hash context.
</p>
<p><strong>Since:</strong> 2.10.0
</p></dd></dl>

<a name="gnutls_005fhash_005ffast-1"></a>
<h4 class="subheading">gnutls_hash_fast</h4>
<a name="gnutls_005fhash_005ffast"></a><dl>
<dt><a name="index-gnutls_005fhash_005ffast"></a>Function: <em>int</em> <strong>gnutls_hash_fast</strong> <em>(gnutls_digest_algorithm_t <var>algorithm</var>, const void * <var>ptext</var>, size_t <var>ptext_len</var>, void * <var>digest</var>)</em></dt>
<dd><p><var>algorithm</var>: the hash algorithm to use
</p>
<p><var>ptext</var>: the data to hash
</p>
<p><var>ptext_len</var>: the length of data to hash
</p>
<p><var>digest</var>: is the output value of the hash
</p>
<p>This convenience function will hash the given data and return output
on a single call.
</p>
<p><strong>Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong>Since:</strong> 2.10.0
</p></dd></dl>

<a name="gnutls_005fhash_005fget_005flen-1"></a>
<h4 class="subheading">gnutls_hash_get_len</h4>
<a name="gnutls_005fhash_005fget_005flen"></a><dl>
<dt><a name="index-gnutls_005fhash_005fget_005flen"></a>Function: <em>unsigned</em> <strong>gnutls_hash_get_len</strong> <em>(gnutls_digest_algorithm_t <var>algorithm</var>)</em></dt>
<dd><p><var>algorithm</var>: the hash algorithm to use
</p>
<p>This function will return the length of the output data
of the given hash algorithm.
</p>
<p><strong>Returns:</strong> The length or zero on error.
</p>
<p><strong>Since:</strong> 2.10.0
</p></dd></dl>

<a name="gnutls_005fhash_005finit-1"></a>
<h4 class="subheading">gnutls_hash_init</h4>
<a name="gnutls_005fhash_005finit"></a><dl>
<dt><a name="index-gnutls_005fhash_005finit"></a>Function: <em>int</em> <strong>gnutls_hash_init</strong> <em>(gnutls_hash_hd_t * <var>dig</var>, gnutls_digest_algorithm_t <var>algorithm</var>)</em></dt>
<dd><p><var>dig</var>: is a <code>gnutls_hash_hd_t</code>  type
</p>
<p><var>algorithm</var>: the hash algorithm to use
</p>
<p>This function will initialize an context that can be used to
produce a Message Digest of data.  This will effectively use the
current crypto backend in use by gnutls or the cryptographic
accelerator in use.
</p>
<p><strong>Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong>Since:</strong> 2.10.0
</p></dd></dl>

<a name="gnutls_005fhash_005foutput-1"></a>
<h4 class="subheading">gnutls_hash_output</h4>
<a name="gnutls_005fhash_005foutput"></a><dl>
<dt><a name="index-gnutls_005fhash_005foutput"></a>Function: <em>void</em> <strong>gnutls_hash_output</strong> <em>(gnutls_hash_hd_t <var>handle</var>, void * <var>digest</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_hash_hd_t</code>  type
</p>
<p><var>digest</var>: is the output value of the hash
</p>
<p>This function will output the current hash value
and reset the state of the hash.
</p>
<p><strong>Since:</strong> 2.10.0
</p></dd></dl>

<a name="gnutls_005fhmac-1"></a>
<h4 class="subheading">gnutls_hmac</h4>
<a name="gnutls_005fhmac"></a><dl>
<dt><a name="index-gnutls_005fhmac"></a>Function: <em>int</em> <strong>gnutls_hmac</strong> <em>(gnutls_hmac_hd_t <var>handle</var>, const void * <var>ptext</var>, size_t <var>ptext_len</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_hmac_hd_t</code>  type
</p>
<p><var>ptext</var>: the data to hash
</p>
<p><var>ptext_len</var>: the length of data to hash
</p>
<p>This function will hash the given data using the algorithm
specified by the context.
</p>
<p><strong>Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong>Since:</strong> 2.10.0
</p></dd></dl>

<a name="gnutls_005fhmac_005fdeinit-1"></a>
<h4 class="subheading">gnutls_hmac_deinit</h4>
<a name="gnutls_005fhmac_005fdeinit"></a><dl>
<dt><a name="index-gnutls_005fhmac_005fdeinit"></a>Function: <em>void</em> <strong>gnutls_hmac_deinit</strong> <em>(gnutls_hmac_hd_t <var>handle</var>, void * <var>digest</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_hmac_hd_t</code>  type
</p>
<p><var>digest</var>: is the output value of the MAC
</p>
<p>This function will deinitialize all resources occupied by
the given hmac context.
</p>
<p><strong>Since:</strong> 2.10.0
</p></dd></dl>

<a name="gnutls_005fhmac_005ffast-1"></a>
<h4 class="subheading">gnutls_hmac_fast</h4>
<a name="gnutls_005fhmac_005ffast"></a><dl>
<dt><a name="index-gnutls_005fhmac_005ffast"></a>Function: <em>int</em> <strong>gnutls_hmac_fast</strong> <em>(gnutls_mac_algorithm_t <var>algorithm</var>, const void * <var>key</var>, size_t <var>keylen</var>, const void * <var>ptext</var>, size_t <var>ptext_len</var>, void * <var>digest</var>)</em></dt>
<dd><p><var>algorithm</var>: the hash algorithm to use
</p>
<p><var>key</var>: the key to use
</p>
<p><var>keylen</var>: the length of the key
</p>
<p><var>ptext</var>: the data to hash
</p>
<p><var>ptext_len</var>: the length of data to hash
</p>
<p><var>digest</var>: is the output value of the hash
</p>
<p>This convenience function will hash the given data and return output
on a single call.
</p>
<p><strong>Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong>Since:</strong> 2.10.0
</p></dd></dl>

<a name="gnutls_005fhmac_005fget_005flen-1"></a>
<h4 class="subheading">gnutls_hmac_get_len</h4>
<a name="gnutls_005fhmac_005fget_005flen"></a><dl>
<dt><a name="index-gnutls_005fhmac_005fget_005flen"></a>Function: <em>unsigned</em> <strong>gnutls_hmac_get_len</strong> <em>(gnutls_mac_algorithm_t <var>algorithm</var>)</em></dt>
<dd><p><var>algorithm</var>: the hmac algorithm to use
</p>
<p>This function will return the length of the output data
of the given hmac algorithm.
</p>
<p><strong>Returns:</strong> The length or zero on error.
</p>
<p><strong>Since:</strong> 2.10.0
</p></dd></dl>

<a name="gnutls_005fhmac_005finit-1"></a>
<h4 class="subheading">gnutls_hmac_init</h4>
<a name="gnutls_005fhmac_005finit"></a><dl>
<dt><a name="index-gnutls_005fhmac_005finit"></a>Function: <em>int</em> <strong>gnutls_hmac_init</strong> <em>(gnutls_hmac_hd_t * <var>dig</var>, gnutls_mac_algorithm_t <var>algorithm</var>, const void * <var>key</var>, size_t <var>keylen</var>)</em></dt>
<dd><p><var>dig</var>: is a <code>gnutls_hmac_hd_t</code>  type
</p>
<p><var>algorithm</var>: the HMAC algorithm to use
</p>
<p><var>key</var>: the key to be used for encryption
</p>
<p><var>keylen</var>: the length of the key
</p>
<p>This function will initialize an context that can be used to
produce a Message Authentication Code (MAC) of data.  This will
effectively use the current crypto backend in use by gnutls or the
cryptographic accelerator in use.
</p>
<p>Note that despite the name of this function, it can be used
for other MAC algorithms than HMAC.
</p>
<p><strong>Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong>Since:</strong> 2.10.0
</p></dd></dl>

<a name="gnutls_005fhmac_005foutput-1"></a>
<h4 class="subheading">gnutls_hmac_output</h4>
<a name="gnutls_005fhmac_005foutput"></a><dl>
<dt><a name="index-gnutls_005fhmac_005foutput"></a>Function: <em>void</em> <strong>gnutls_hmac_output</strong> <em>(gnutls_hmac_hd_t <var>handle</var>, void * <var>digest</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_hmac_hd_t</code>  type
</p>
<p><var>digest</var>: is the output value of the MAC
</p>
<p>This function will output the current MAC value
and reset the state of the MAC.
</p>
<p><strong>Since:</strong> 2.10.0
</p></dd></dl>

<a name="gnutls_005fhmac_005fset_005fnonce-1"></a>
<h4 class="subheading">gnutls_hmac_set_nonce</h4>
<a name="gnutls_005fhmac_005fset_005fnonce"></a><dl>
<dt><a name="index-gnutls_005fhmac_005fset_005fnonce"></a>Function: <em>void</em> <strong>gnutls_hmac_set_nonce</strong> <em>(gnutls_hmac_hd_t <var>handle</var>, const void * <var>nonce</var>, size_t <var>nonce_len</var>)</em></dt>
<dd><p><var>handle</var>: is a <code>gnutls_hmac_hd_t</code>  type
</p>
<p><var>nonce</var>: the data to set as nonce
</p>
<p><var>nonce_len</var>: the length of data
</p>
<p>This function will set the nonce in the MAC algorithm.
</p>
<p><strong>Since:</strong> 3.2.0
</p></dd></dl>

<a name="gnutls_005fmac_005fget_005fnonce_005fsize-1"></a>
<h4 class="subheading">gnutls_mac_get_nonce_size</h4>
<a name="gnutls_005fmac_005fget_005fnonce_005fsize"></a><dl>
<dt><a name="index-gnutls_005fmac_005fget_005fnonce_005fsize"></a>Function: <em>size_t</em> <strong>gnutls_mac_get_nonce_size</strong> <em>(gnutls_mac_algorithm_t <var>algorithm</var>)</em></dt>
<dd><p><var>algorithm</var>: is an encryption algorithm
</p>
<p>Returns the size of the nonce used by the MAC in TLS.
</p>
<p><strong>Returns:</strong> length (in bytes) of the given MAC nonce size, or 0.
</p>
<p><strong>Since:</strong> 3.2.0
</p></dd></dl>

<a name="gnutls_005frnd-1"></a>
<h4 class="subheading">gnutls_rnd</h4>
<a name="gnutls_005frnd"></a><dl>
<dt><a name="index-gnutls_005frnd-1"></a>Function: <em>int</em> <strong>gnutls_rnd</strong> <em>(gnutls_rnd_level_t <var>level</var>, void * <var>data</var>, size_t <var>len</var>)</em></dt>
<dd><p><var>level</var>: a security level
</p>
<p><var>data</var>: place to store random bytes
</p>
<p><var>len</var>: The requested size
</p>
<p>This function will generate random data and store it to output
buffer.
</p>
<p>This function is thread-safe and also fork-safe.
</p>
<p><strong>Returns:</strong> Zero on success, or a negative error code on error.
</p>
<p><strong>Since:</strong> 2.12.0
</p></dd></dl>

<a name="gnutls_005frnd_005frefresh-1"></a>
<h4 class="subheading">gnutls_rnd_refresh</h4>
<a name="gnutls_005frnd_005frefresh"></a><dl>
<dt><a name="index-gnutls_005frnd_005frefresh"></a>Function: <em>void</em> <strong>gnutls_rnd_refresh</strong> <em>( <var>void</var>)</em></dt>
<dd>
<p>This function refreshes the random generator state.
That is the current precise time, CPU usage, and
other values are input into its state.
</p>
<p>On a slower rate input from /dev/urandom is mixed too.
</p>
<p><strong>Since:</strong> 3.1.7
</p></dd></dl>


<hr>
<div class="header">
<p>
Next: <a href="Compatibility-API.html#Compatibility-API" accesskey="n" rel="next">Compatibility API</a>, Previous: <a href="DANE-API.html#DANE-API" accesskey="p" rel="prev">DANE API</a>, Up: <a href="API-reference.html#API-reference" accesskey="u" rel="up">API reference</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Data-Index.html#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>