# Botan bindings devlog

**URL:** <https://discourse.haskell.org/t/botan-bindings-devlog/6855>\
**Category:** Uncategorized\
**Created:** [July 5, 2023, 6:17pm UTC](https://discourse.haskell.org/t/botan-bindings-devlog/6855 "2023-07-05T18:17:27Z")\
**Posts on this page:** 1\
**Showing post:** 26

<div class="post-metadata">

**Author:** ![ApothecaLabs](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/apothecalabs/32/3215_2.png) [@ApothecaLabs](https://discourse.haskell.org/u/ApothecaLabs)\
**Post date:** [July 13, 2023, 3:52pm UTC](https://discourse.haskell.org/t/botan-bindings-devlog/6855/26 "2023-07-13T15:52:17Z")

</div>

The sun has risen again. You know what that means. The [repo](https://github.com/apotheca/botan) has been updated again.

 ![Screenshot 2023-07-13 at 10.17.14 AM](https://us1.discourse-cdn.com/flex002/uploads/haskell/original/2X/9/98b8067aacc28a12571683aa977a1599b2569ded.jpeg)

- Added `Botan.Mac` module for Message Authentication Codes
  - Construction of Botan mac type strings (eg, “HMAC(SHA-256)”, “SipHash(2,4)”) is badly-documented.
  - Some MACs require nonces, but this is also badly documented.

- Refined handling of foreign pointers of botan objects / initializers / finalizers
  - Accurate types for opaque struct, pointer, and foreign pointer.
  - Uses `FinalizerPtr` type
  - Avoids an extra pointer indirection
  - Still fiddling with standardizing the nomenclature, only applied to `Botan.Mac`
    - `Botan.Hash` and `Botan.Random` still need retrofitting

  - Thanks to @glguy for [help](http://discourse.haskell.org/t/questions-about-ffi-foreignptr-and-opaque-types/6914/14)

Today’s efforts are going to be focused on updating the foreign pointer handling in `Botan.Hash` and `Botan.Random`, and getting a better sense of what needs to be standardized - eg, whether I will continue with straight 1:1 bindings, or instead do _some_ encapsulation, considering:

- Things like the hash / mac / rng type strings. `macInitName "HMAC(SHA-256)"` are both incredibly simple, yet incredibly awkward, and need constants at the very least.
- Checking for algorithm support is also awkward (read, effectively non-existent)so I need to pick a method of handling it, and standardize that as well.

So basically a grab-bag of things that I want to take care of before we get enough modules to make them difficult.

_Also_, by line count, we are almost 1/4 of the way through the [botan ffi header](https://github.com/randombit/botan/blob/release-3/src/lib/ffi/ffi.h)! Things do get denser towards the bottom, especially with `x509` certs, but still… 🥳

* * *

@david-christiansen  
I’m glad you are! Tough work is so much less of a slog when there are people rooting for you along the way, and the community’s response has really been keeping me going 🙂

---

_[View the full topic](https://discourse.haskell.org/t/botan-bindings-devlog/6855)._
