X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fsec%2Fcipher.h;h=845a32d24a72b890eec5437f6299b6128cfbcfab;hb=94f23fc17d4a4a56e66d76e76f23ca35c176f3a6;hp=24c24b0da656f1ae6d32f5f666db5155a7811eff;hpb=42621a35d4428a3e73441fe91ccfd502992233ec;p=bertos.git diff --git a/bertos/sec/cipher.h b/bertos/sec/cipher.h index 24c24b0d..845a32d2 100644 --- a/bertos/sec/cipher.h +++ b/bertos/sec/cipher.h @@ -188,4 +188,32 @@ void cipher_ctr_decrypt(BlockCipher *c, void *block); */ void cipher_ctr_step(BlockCipher *c, void *block); + +/*********************************************************************************/ +/* OFB mode */ +/*********************************************************************************/ + +/** + * Initialize OFB by setting the IV. + * + * \note the memory pointed by \a iv will be used and modified by the CBC + * functions. It is caller's responsibility to keep it available until there is + * no more OFB work to do. + */ +INLINE void cipher_ofb_begin(BlockCipher *c, void *iv) +{ + c->buf = iv; +} + +/** + * Encrypt a block (in-place) using the current key in OFB mode. + */ +void cipher_ofb_encrypt(BlockCipher *c, void *block); + +/** + * Decrypt a block (in-place) using the current key in OFB mode. + */ +void cipher_ofb_decrypt(BlockCipher *c, void *block); + + #endif /* SEC_CIPHER_H */