ua_securitypolicy_common.c 605 B

1234567891011121314151617181920
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  4. */
  5. #include <mbedtls/sha1.h>
  6. #include "ua_securitypolicy_common.h"
  7. void
  8. sha1(const unsigned char *input, size_t ilen, unsigned char output[20]) {
  9. mbedtls_sha1_context sha1Context;
  10. mbedtls_sha1_init(&sha1Context);
  11. mbedtls_sha1_starts(&sha1Context);
  12. mbedtls_sha1_update(&sha1Context, input, ilen);
  13. mbedtls_sha1_finish(&sha1Context, output);
  14. mbedtls_sha1_free(&sha1Context);
  15. }