0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-27 11:18:51 +02:00

ircd: Split crypto.cc to hash.cc and rand.cc.

This commit is contained in:
Jason Volk 2017-11-06 13:29:50 -08:00
parent b172fd5739
commit ea097c9f53
3 changed files with 42 additions and 31 deletions

View file

@ -60,7 +60,8 @@ libircd_la_LIBADD = \
libircd_la_SOURCES = \
client.cc \
crypto.cc \
hash.cc \
rand.cc \
ctx.cc \
db.cc \
exception.cc \

40
ircd/hash.cc Normal file
View file

@ -0,0 +1,40 @@
/*
* Copyright (C) 2017 Charybdis Development Team
* Copyright (C) 2017 Jason Volk <jason@zemos.net>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice is present in all copies.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
ircd::crh::hash::~hash()
noexcept
{
}
ircd::crh::hash &
ircd::crh::hash::operator+=(const const_raw_buffer &buf)
{
update(buf);
return *this;
}
void
ircd::crh::hash::operator()(const mutable_raw_buffer &out,
const const_raw_buffer &in)
{
update(in);
finalize(out);
}

View file

@ -19,36 +19,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
///////////////////////////////////////////////////////////////////////////////
//
// hash.h
//
ircd::crh::hash::~hash()
noexcept
{
}
ircd::crh::hash &
ircd::crh::hash::operator+=(const const_raw_buffer &buf)
{
update(buf);
return *this;
}
void
ircd::crh::hash::operator()(const mutable_raw_buffer &out,
const const_raw_buffer &in)
{
update(in);
finalize(out);
}
///////////////////////////////////////////////////////////////////////////////
//
// rand.h
//
decltype(ircd::rand::device) ircd::rand::device
{
// on linux: uses RDRND or /dev/urandom