Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
hash.h
Go to the documentation of this file.
1/*
2 * Copyright 2015-2018 Yubico AB
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/* hash.h
18**
19** Implements platform specific hashing operations
20*/
21
22#ifndef _YUBICOM_HASH_H_
23#define _YUBICOM_HASH_H_
24
25#include <stdbool.h>
26#include <stdint.h>
27#include <stddef.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
40
41#ifndef __WIN32
42#define YH_INTERNAL __attribute__((visibility("hidden")))
43#else
44#define YH_INTERNAL
45#endif
46
47bool YH_INTERNAL hash_bytes(const uint8_t *in, size_t len, hash_t hash,
48 uint8_t *out, size_t *out_len);
49
50typedef struct _hash_ctx _hash_ctx, *hash_ctx;
51
54bool YH_INTERNAL hash_update(hash_ctx ctx, const uint8_t *in, size_t cb_in);
55bool YH_INTERNAL hash_final(hash_ctx ctx, uint8_t *out, size_t *pcb_out);
57
58#ifndef _WIN32_BCRYPT
59#include <openssl/evp.h>
60const YH_INTERNAL EVP_MD *get_hash(hash_t hash);
61#else
62#include <windows.h>
63#include <bcrypt.h>
64LPCWSTR YH_INTERNAL get_hash(hash_t hash);
65#endif
66
67#ifdef __cplusplus
68}
69#endif
70
71#endif /* _YUBICOM_HASH_H_ */
struct _hash_ctx * hash_ctx
Definition hash.h:50
unsigned char uint8_t
Definition stdint.h:124
bool YH_INTERNAL hash_final(hash_ctx ctx, uint8_t *out, size_t *pcb_out)
const YH_INTERNAL EVP_MD * get_hash(hash_t hash)
Definition hash.c:42
bool YH_INTERNAL hash_update(hash_ctx ctx, const uint8_t *in, size_t cb_in)
hash_t
Definition hash.h:33
@ _SHA512
Definition hash.h:38
@ _SHA384
Definition hash.h:37
@ _SHA1
Definition hash.h:35
@ _NONE
Definition hash.h:34
@ _SHA256
Definition hash.h:36
bool YH_INTERNAL hash_create(hash_ctx *ctx, hash_t hash)
bool YH_INTERNAL hash_init(hash_ctx ctx)
#define YH_INTERNAL
Definition hash.h:42
bool YH_INTERNAL hash_bytes(const uint8_t *in, size_t len, hash_t hash, uint8_t *out, size_t *out_len)
Definition hash.c:90
bool YH_INTERNAL hash_destroy(hash_ctx ctx)
size_t out_len
size_t len