2 * Copyright (C) 2013 Gregor Pintar <grpintar@gmail.com>
4 * Permission is granted to deal in this work without any restriction,
5 * including unlimited rights to use, publicly perform, publish,
6 * reproduce, relicence, modify, merge, and/or distribute in any form,
7 * for any purpose, with or without fee, and by any means.
9 * This work is provided "AS IS" and WITHOUT WARRANTY of any kind,
10 * to the utmost extent permitted by applicable law. In no event
11 * shall a licensor, author or contributor be held liable for any
12 * issues arising in any way out of dealing in the work.
17 #include <kripto/mac_desc.h>
19 #include <kripto/mac.h>
23 const kripto_mac_desc
*desc
;
26 kripto_mac
*kripto_mac_create
28 const kripto_mac_desc
*desc
,
41 return desc
->create(desc
, rounds
, key
, key_len
, tag_len
);
44 kripto_mac
*kripto_mac_recreate
55 assert(s
->desc
->recreate
);
60 return s
->desc
->recreate(s
, rounds
, key
, key_len
, tag_len
);
63 void kripto_mac_input(kripto_mac
*s
, const void *in
, size_t len
)
67 assert(s
->desc
->input
);
69 s
->desc
->input(s
, in
, len
);
72 void kripto_mac_tag(kripto_mac
*s
, void *tag
, unsigned int len
)
78 s
->desc
->tag(s
, tag
, len
);
81 void kripto_mac_destroy(kripto_mac
*s
)
85 assert(s
->desc
->destroy
);
92 const kripto_mac_desc
*desc
,
106 s
= kripto_mac_create(desc
, rounds
, key
, key_len
, tag_len
);
109 kripto_mac_input(s
, in
, in_len
);
110 kripto_mac_tag(s
, tag
, tag_len
);
112 kripto_mac_destroy(s
);
117 const kripto_mac_desc
*kripto_mac_getdesc(const kripto_mac
*s
)
125 unsigned int kripto_mac_maxtag(const kripto_mac_desc
*desc
)