]> git.lizzy.rs Git - plan9front.git/blob - sys/man/2/aes
libsec: remove aesCTRencrypt()/aesCTRdecrypt() (thanks mischief and qrstuv)
[plan9front.git] / sys / man / 2 / aes
1 .TH AES 2
2 .SH NAME
3 setupAESstate, aesCBCencrypt, aesCBCdecrypt, setupAESXCBCstate, aesXCBCmac - advanced encryption standard (rijndael)
4 .SH SYNOPSIS
5 .B #include <u.h>
6 .br
7 .B #include <libc.h>
8 .br
9 .B #include <mp.h>
10 .br
11 .B #include <libsec.h>
12 .PP
13 .in +0.5i
14 .ti -0.5i
15 .B
16 void    aes_encrypt(ulong rk[], int Nr, uchar pt[16], uchar ct[16]);
17 .PP
18 .B
19 void    aes_decrypt(ulong rk[], int Nr, uchar ct[16], uchar pt[16]);
20 .PP
21 .B
22 void    setupAESstate(AESstate *s, uchar key[], int keybytes, uchar *ivec)
23 .PP
24 .B
25 void    aesCBCencrypt(uchar *p, int len, AESstate *s)
26 .PP
27 .B
28 void    aesCBCdecrypt(uchar *p, int len, AESstate *s)
29 .PP
30 .B
31 void    setupAESXCBCstate(AESstate *s)
32 .PP
33 .B
34 void    aesXCBCmac(uchar *p, int len, AESstate *s)
35 .SH DESCRIPTION
36 AES (a.k.a. Rijndael) has replaced DES as the preferred
37 block cipher.
38 .I Aes_encrypt
39 and
40 .I aes_decrypt
41 are the block ciphers, corresponding to
42 .IR des (2)'s
43 .IR block_cipher .
44 .IR SetupAESstate ,
45 .IR aesCBCencrypt ,
46 and
47 .I aesCBCdecrypt
48 implement cipher-block-chaining encryption.
49 .I setupAESXCBCstate
50 and
51 .I aesXCBCmac
52 implement AES XCBC message authentication, per RFC 3566.
53 All ciphering is performed in place.
54 .I Keybytes
55 should be 16, 24, or 32.
56 The initialization vector
57 .I ivec
58 of
59 .I AESbsize
60 bytes should be random enough to be unlikely to be reused
61 but does not need to be
62 cryptographically strongly unpredictable.
63 .SH SOURCE
64 .B /sys/src/libsec
65 .SH SEE ALSO
66 .I aescbc
67 in
68 .IR secstore (1),
69 .IR mp (2),
70 .IR blowfish (2),
71 .IR des (2),
72 .IR dsa (2),
73 .IR elgamal (2),
74 .IR rc4 (2),
75 .IR rsa (2),
76 .IR sechash (2),
77 .IR prime (2),
78 .IR rand (2)
79 .br
80 .B http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
81 .SH BUGS
82 The functions
83 .IR aes_encrypt ,
84 .IR aes_decrypt ,
85 .IR setupAESXCBCstate ,
86 and
87 .IR aesXCBCmac
88 have not yet been verified by running test vectors through them.