]>
git.ipfire.org Git - thirdparty/openssl.git/blob - include/crypto/siphash.h
2 * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #ifndef OSSL_CRYPTO_SIPHASH_H
11 # define OSSL_CRYPTO_SIPHASH_H
16 # define SIPHASH_BLOCK_SIZE 8
17 # define SIPHASH_KEY_SIZE 16
18 # define SIPHASH_MIN_DIGEST_SIZE 8
19 # define SIPHASH_MAX_DIGEST_SIZE 16
21 typedef struct siphash_st SIPHASH
;
23 size_t SipHash_ctx_size(void);
24 size_t SipHash_hash_size(SIPHASH
*ctx
);
25 int SipHash_set_hash_size(SIPHASH
*ctx
, size_t hash_size
);
26 int SipHash_Init(SIPHASH
*ctx
, const unsigned char *k
,
27 int crounds
, int drounds
);
28 void SipHash_Update(SIPHASH
*ctx
, const unsigned char *in
, size_t inlen
);
29 int SipHash_Final(SIPHASH
*ctx
, unsigned char *out
, size_t outlen
);
31 /* Based on https://131002.net/siphash C reference implementation */
40 unsigned int hash_size
;
43 unsigned char leavings
[SIPHASH_BLOCK_SIZE
];
46 /* default: SipHash-2-4 */
47 # define SIPHASH_C_ROUNDS 2
48 # define SIPHASH_D_ROUNDS 4