diff options
Diffstat (limited to 'installer/fetcher/crypto.h')
-rw-r--r-- | installer/fetcher/crypto.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/installer/fetcher/crypto.h b/installer/fetcher/crypto.h new file mode 100644 index 00000000..bad9d0e9 --- /dev/null +++ b/installer/fetcher/crypto.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0 + * + * Copyright (c) 2017-2020, Loup Vaillant. All rights reserved. + * Copyright (C) 2020 Jason A. Donenfeld. All Rights Reserved. + */ + +#ifndef _CRYPTO_H +#define _CRYPTO_H + +#include <stdint.h> +#include <stddef.h> +#include <stdbool.h> + +typedef struct { + uint64_t hash[8]; + uint64_t input_offset[2]; + uint64_t input[16]; + size_t input_idx; + size_t hash_size; +} blake2b_ctx; + +void blake2b_init(blake2b_ctx *ctx, size_t hash_size, const uint8_t *key, size_t key_size); + +void blake2b_update(blake2b_ctx *ctx, const void *message, size_t message_size); + +void blake2b_final(blake2b_ctx *ctx, uint8_t *hash); + +bool ed25519_verify(const uint8_t signature[64], const uint8_t public_key[32], + const void *message, size_t message_size); + +#endif |