make load_tester more strict to use it along stroke
[strongswan.git] / src / libcrypto / libsha2 / hmac_sha2.c
1 #ifdef __KERNEL__
2 #include <linux/types.h>
3 #include <linux/string.h>
4 #else
5 #include <sys/types.h>
6 #include <string.h>
7 #endif
8 #include "hmac_generic.h"
9 #include "sha2.h"
10 #include "hmac_sha2.h"
11
12 void inline sha256_result(sha256_context *ctx, u_int8_t * hash, int hashlen) {
13 sha256_final(ctx);
14 memcpy(hash, &ctx->sha_out[0], hashlen);
15 }
16 void inline sha512_result(sha512_context *ctx, u_int8_t * hash, int hashlen) {
17 sha512_final(ctx);
18 memcpy(hash, &ctx->sha_out[0], hashlen);
19 }
20 HMAC_SET_KEY_IMPL (sha256_hmac_set_key,
21 sha256_hmac_context, SHA256_BLOCKSIZE,
22 sha256_init, sha256_write)
23 HMAC_HASH_IMPL (sha256_hmac_hash,
24 sha256_hmac_context, sha256_context, SHA256_HASHLEN,
25 sha256_write, sha256_result)
26
27 HMAC_SET_KEY_IMPL (sha512_hmac_set_key,
28 sha512_hmac_context, SHA512_BLOCKSIZE,
29 sha512_init, sha512_write)
30 HMAC_HASH_IMPL (sha512_hmac_hash,
31 sha512_hmac_context, sha512_context, SHA512_HASHLEN,
32 sha512_write, sha512_result)