mac_simple.c 411 B

1234567891011121314151617
  1. /*
  2. * Convenience function to MAC a single piece of data, wrapping up
  3. * the faff of making and freeing an ssh_mac.
  4. */
  5. #include "ssh.h"
  6. void mac_simple(const ssh2_macalg *alg, ptrlen key, ptrlen data, void *output)
  7. {
  8. ssh2_mac *mac = ssh2_mac_new(alg, NULL);
  9. ssh2_mac_setkey(mac, key);
  10. ssh2_mac_start(mac);
  11. put_datapl(mac, data);
  12. ssh2_mac_genresult(mac, output);
  13. ssh2_mac_free(mac);
  14. }