aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/cxx/include/aesnixx/data.hpp
blob: bd7e9bd4ba0f28437e60167d2d1e7df552c70581 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
 * \file
 * \author Egor Tensin <Egor.Tensin@gmail.com>
 * \date 2015
 * \copyright This file is licensed under the terms of the MIT License.
 *            See LICENSE.txt for details.
 */

#pragma once

#include "error.hpp"

#include <aesni/all.h>

namespace aesni
{
    typedef AesNI_Block128 Block128;

    inline void make_block(Block128& dest, int hi3, int hi2, int lo1, int lo0)
    {
        dest = aesni_make_block128(hi3, hi2, lo1, lo0);
    }

    inline void load_block(Block128& dest, const void* src)
    {
        dest = aesni_load_block128(src);
    }

    inline void load_block_aligned(Block128& dest, const void* src)
    {
        dest = aesni_load_block128_aligned(src);
    }

    inline void store_block(void* dest, Block128& src)
    {
        aesni_store_block128(dest, src);
    }

    inline void store_block_aligned(void* dest, Block128& src)
    {
        aesni_store_block128_aligned(dest, src);
    }

    inline Block128 xor_block(Block128& a, Block128& b)
    {
        return aesni_xor_block128(a, b);
    }
}