chiark / gitweb /
hbcrypto hash-{init,update,final} for incremental hashing
[chiark-tcl.git] / crypto / crypto.tct
1 # crypto - Tcl bindings for parts of the `nettle' crypto library
2 # Copyright 2006 Ian Jackson
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 2 of the
7 # License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this library; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17 # 02110-1301, USA.
18
19
20 Table *hbcryptotoplevel TopLevel_Command
21         hbcrypto
22                 dispatch(HBCrypto/_SubCommand, "hbcrypto subcommand")
23
24 Table hbcrypto HBCrypto_SubCommand
25         pad
26                 op      enum(PadOp/, "hbcrypto pad subcommand")
27                 v       hbv
28                 blocksz obj
29                 meth    enum(PadMethodInfo/, "pad method")
30                 ...     methargs
31         blockcipher
32                 op      enum(BlockCipherOp/, "op")
33                 ...     obj
34         hash
35                 alg     enum(HashAlgInfo/, "hash alg")
36                 message hb
37                 =>      hb
38         hash-init
39                 alg     enum(HashAlgInfo/, "hash alg")
40                 =>      iddata(&cht_hash_states)
41         hash-update
42                 stateh  iddata(&cht_hash_states)
43                 message hb
44         hash-final
45                 stateh  iddata(&cht_hash_states)
46                 =>      hb
47         hash-discard
48                 stateh  iddata(&cht_hash_states)
49         hash-clonestate
50                 stateh  iddata(&cht_hash_states)
51                 =>      iddata(&cht_hash_states)
52         hmac
53                 alg     enum(HashAlgInfo/, "hash alg for hmac")
54                 message hb
55                 key     obj
56                 ?maclen obj
57                 =>      hb
58         hash-prop
59                 prop    enum(HashAlgPropInfo/, "prop")
60                 alg     enum(HashAlgInfo/, "alg")
61                 =>      int
62
63 Table padmethodinfo PadMethodInfo
64         pkcs5
65                 =>      int
66         rfc2406
67                 nxthdr  obj
68                 =>      int
69
70 Table blockcipherop BlockCipherOp
71         e       1
72                 v       hbv
73                 alg     enum(BlockCipherAlgInfo/, "alg")
74                 key     obj
75                 mode    enum(BlockCipherModeInfo/, "mode")
76                 ?iv     hb
77                 =>      hb
78         d       0
79                 v       hbv
80                 alg     enum(BlockCipherAlgInfo/, "alg")
81                 key     obj
82                 mode    enum(BlockCipherModeInfo/, "mode")
83                 ?iv     hb
84                 =>      hb
85         mac     -1
86                 msg     hb
87                 alg     enum(BlockCipherAlgInfo/, "alg")
88                 key     obj
89                 mode    enum(BlockCipherModeInfo/, "mode")
90                 iv      hb
91                 =>      hb
92         prop    -1
93                 prop    enum(BlockCipherPropInfo/, "prop")
94                 alg     enum(BlockCipherAlgInfo/, "alg")
95                 =>      int
96
97 EntryExtra BlockCipherOp
98         int encrypt;