Fix a TODO(3.0) in the siphash code

All 3 files that included crypto/siphash.h also included siphash_local.h,
and no other files included siphash_local.h independently. They probably
should be just one header file.

Fixes #14360

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14558)
This commit is contained in:
Matt Caswell 2021-03-15 17:44:42 +00:00 committed by Pauli
parent 37cddb2e2d
commit 5db682733d
5 changed files with 19 additions and 36 deletions

View File

@ -28,7 +28,6 @@
#include <openssl/crypto.h>
#include "crypto/siphash.h"
#include "siphash_local.h"
#define ROTL(x, b) (uint64_t)(((x) << (b)) | ((x) >> (64 - (b))))

View File

@ -1,28 +0,0 @@
/*
* Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
/* Based on https://131002.net/siphash C reference implementation */
struct siphash_st {
uint64_t total_inlen;
uint64_t v0;
uint64_t v1;
uint64_t v2;
uint64_t v3;
unsigned int len;
unsigned int hash_size;
unsigned int crounds;
unsigned int drounds;
unsigned char leavings[SIPHASH_BLOCK_SIZE];
};
/* default: SipHash-2-4 */
#define SIPHASH_C_ROUNDS 2
#define SIPHASH_D_ROUNDS 4

View File

@ -28,4 +28,23 @@ int SipHash_Init(SIPHASH *ctx, const unsigned char *k,
void SipHash_Update(SIPHASH *ctx, const unsigned char *in, size_t inlen);
int SipHash_Final(SIPHASH *ctx, unsigned char *out, size_t outlen);
/* Based on https://131002.net/siphash C reference implementation */
struct siphash_st {
uint64_t total_inlen;
uint64_t v0;
uint64_t v1;
uint64_t v2;
uint64_t v3;
unsigned int len;
unsigned int hash_size;
unsigned int crounds;
unsigned int drounds;
unsigned char leavings[SIPHASH_BLOCK_SIZE];
};
/* default: SipHash-2-4 */
# define SIPHASH_C_ROUNDS 2
# define SIPHASH_D_ROUNDS 4
#endif

View File

@ -16,12 +16,6 @@
#include <openssl/proverr.h>
#include "crypto/siphash.h"
/*
* TODO(3.0) when siphash has moved entirely to our providers, this
* header should be moved to the provider include directory. For the
* moment, crypto/siphash/siphash_ameth.c has us stuck.
*/
#include "../../../crypto/siphash/siphash_local.h"
#include "prov/implementations.h"
#include "prov/providercommon.h"

View File

@ -15,7 +15,6 @@
#include <openssl/bio.h>
#include "testutil.h"
#include "crypto/siphash.h"
#include "../crypto/siphash/siphash_local.h"
#include "internal/nelem.h"
typedef struct {