2 * Copyright (C) 2015 Martin Willi
3 * Copyright (C) 2015 revosec AG
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 #include "aesni_plugin.h"
17 #include "aesni_cbc.h"
22 #include <utils/debug.h>
23 #include <utils/cpu_feature.h>
25 typedef struct private_aesni_plugin_t private_aesni_plugin_t
;
26 typedef enum cpuid_feature_t cpuid_feature_t
;
29 * private data of aesni_plugin
31 struct private_aesni_plugin_t
{
36 aesni_plugin_t
public;
39 METHOD(plugin_t
, get_name
, char*,
40 private_aesni_plugin_t
*this)
45 METHOD(plugin_t
, get_features
, int,
46 private_aesni_plugin_t
*this, plugin_feature_t
*features
[])
48 static plugin_feature_t f
[] = {
49 PLUGIN_REGISTER(CRYPTER
, aesni_cbc_create
),
50 PLUGIN_PROVIDE(CRYPTER
, ENCR_AES_CBC
, 16),
51 PLUGIN_PROVIDE(CRYPTER
, ENCR_AES_CBC
, 24),
52 PLUGIN_PROVIDE(CRYPTER
, ENCR_AES_CBC
, 32),
56 if (cpu_feature_available(CPU_FEATURE_AESNI
))
63 METHOD(plugin_t
, destroy
, void,
64 private_aesni_plugin_t
*this)
72 plugin_t
*aesni_plugin_create()
74 private_aesni_plugin_t
*this;
79 .get_name
= _get_name
,
80 .get_features
= _get_features
,
81 .reload
= (void*)return_false
,
87 return &this->public.plugin
;