sha.c 445 B

123456789101112131415161718192021
  1. /* Copyright 2016 The Chromium OS Authors. All rights reserved.
  2. * Use of this source code is governed by a BSD-style license that can be
  3. * found in the LICENSE file.
  4. */
  5. #include <string.h>
  6. #include "2sha.h"
  7. #include "bdb.h"
  8. int bdb_sha256(void *digest, const void *buf, size_t size)
  9. {
  10. struct vb2_sha256_context ctx;
  11. vb2_sha256_init(&ctx);
  12. vb2_sha256_update(&ctx, buf, size);
  13. vb2_sha256_finalize(&ctx, digest);
  14. return BDB_SUCCESS;
  15. }