Botan 1.10.17
aes_ni.h
Go to the documentation of this file.
1/*
2* AES using AES-NI instructions
3* (C) 2009 Jack Lloyd
4*
5* Distributed under the terms of the Botan license
6*/
7
8#ifndef BOTAN_AES_NI_H__
9#define BOTAN_AES_NI_H__
10
11#include <botan/block_cipher.h>
12
13namespace Botan {
14
15/**
16* AES-128 using AES-NI
17*/
18class BOTAN_DLL AES_128_NI : public Block_Cipher_Fixed_Params<16, 16>
19 {
20 public:
21 size_t parallelism() const { return 4; }
22
23 void encrypt_n(const byte in[], byte out[], size_t blocks) const;
24 void decrypt_n(const byte in[], byte out[], size_t blocks) const;
25
26 void clear();
27 std::string name() const { return "AES-128"; }
28 BlockCipher* clone() const { return new AES_128_NI; }
29
30 AES_128_NI() : EK(44), DK(44) { }
31 private:
32 void key_schedule(const byte[], size_t);
33
35 };
36
37/**
38* AES-192 using AES-NI
39*/
40class BOTAN_DLL AES_192_NI : public Block_Cipher_Fixed_Params<16, 24>
41 {
42 public:
43 size_t parallelism() const { return 4; }
44
45 void encrypt_n(const byte in[], byte out[], size_t blocks) const;
46 void decrypt_n(const byte in[], byte out[], size_t blocks) const;
47
48 void clear();
49 std::string name() const { return "AES-192"; }
50 BlockCipher* clone() const { return new AES_192_NI; }
51
52 AES_192_NI() : EK(52), DK(52) { }
53 private:
54 void key_schedule(const byte[], size_t);
55
57 };
58
59/**
60* AES-256 using AES-NI
61*/
62class BOTAN_DLL AES_256_NI : public Block_Cipher_Fixed_Params<16, 32>
63 {
64 public:
65 size_t parallelism() const { return 4; }
66
67 void encrypt_n(const byte in[], byte out[], size_t blocks) const;
68 void decrypt_n(const byte in[], byte out[], size_t blocks) const;
69
70 void clear();
71 std::string name() const { return "AES-256"; }
72 BlockCipher* clone() const { return new AES_256_NI; }
73
74 AES_256_NI() : EK(60), DK(60) { }
75 private:
76 void key_schedule(const byte[], size_t);
77
79 };
80
81}
82
83#endif
size_t parallelism() const
Definition aes_ni.h:21
BlockCipher * clone() const
Definition aes_ni.h:28
std::string name() const
Definition aes_ni.h:27
BlockCipher * clone() const
Definition aes_ni.h:50
size_t parallelism() const
Definition aes_ni.h:43
std::string name() const
Definition aes_ni.h:49
size_t parallelism() const
Definition aes_ni.h:65
std::string name() const
Definition aes_ni.h:71
BlockCipher * clone() const
Definition aes_ni.h:72