summaryrefslogtreecommitdiff
path: root/libavutil/des.h
diff options
context:
space:
mode:
authorDavid Goldwich <david.goldwich@gmail.com>2011-09-02 08:20:58 +0200
committerAnton Khirnov <anton@khirnov.net>2011-09-21 08:28:20 +0200
commitb3e144a7dfc6953df3b3e478eb8b8521ab5c6ecc (patch)
tree7a560a4854c9316d3e7e64bdbc14cb30e8734716 /libavutil/des.h
parent3ffe32eb96e2414bdd87b353953d77fb83eca8ae (diff)
des: add possibility to calculate DES-CBC-MAC with small buffer
This patch adds the possibility to calculate the DES-CBC-MAC of a source buffer (i.e. the last block of the buffer encrypted in CBC mode) without having to allocate a destination buffer that is as long as the complete source buffer, but instead only 8 bytes for the MAC. Signed-off-by: David Goldwich <david.goldwich@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavutil/des.h')
-rw-r--r--libavutil/des.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/libavutil/des.h b/libavutil/des.h
index 935d7c5d71..cda98122d3 100644
--- a/libavutil/des.h
+++ b/libavutil/des.h
@@ -33,7 +33,7 @@ struct AVDES {
* @brief Initializes an AVDES context.
*
* @param key_bits must be 64 or 192
- * @param decrypt 0 for encryption, 1 for decryption
+ * @param decrypt 0 for encryption/CBC-MAC, 1 for decryption
*/
int av_des_init(struct AVDES *d, const uint8_t *key, int key_bits, int decrypt);
@@ -49,4 +49,13 @@ int av_des_init(struct AVDES *d, const uint8_t *key, int key_bits, int decrypt);
*/
void av_des_crypt(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt);
+/**
+ * @brief Calculates CBC-MAC using the DES algorithm.
+ *
+ * @param count number of 8 byte blocks
+ * @param dst destination array, can be equal to src, must be 8-byte aligned
+ * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL
+ */
+void av_des_mac(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count);
+
#endif /* AVUTIL_DES_H */