]> git.ipfire.org Git - thirdparty/strongswan.git/blob - src/libstrongswan/crypto/iv/iv_gen_null.c
Update copyright headers after acquisition by secunet
[thirdparty/strongswan.git] / src / libstrongswan / crypto / iv / iv_gen_null.c
1 /*
2 * Copyright (C) 2015 Tobias Brunner
3 *
4 * Copyright (C) secunet Security Networks AG
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17 #include "iv_gen_null.h"
18
19 typedef struct private_iv_gen_t private_iv_gen_t;
20
21 /**
22 * Private data of an iv_gen_t object.
23 */
24 struct private_iv_gen_t {
25
26 /**
27 * Public iv_gen_t interface.
28 */
29 iv_gen_t public;
30 };
31
32 METHOD(iv_gen_t, get_iv, bool,
33 private_iv_gen_t *this, uint64_t seq, size_t size, uint8_t *buffer)
34 {
35 return size == 0;
36 }
37
38 METHOD(iv_gen_t, allocate_iv, bool,
39 private_iv_gen_t *this, uint64_t seq, size_t size, chunk_t *chunk)
40 {
41 *chunk = chunk_empty;
42 return size == 0;
43 }
44
45 METHOD(iv_gen_t, destroy, void,
46 private_iv_gen_t *this)
47 {
48 free(this);
49 }
50
51 iv_gen_t *iv_gen_null_create()
52 {
53 private_iv_gen_t *this;
54
55 INIT(this,
56 .public = {
57 .get_iv = _get_iv,
58 .allocate_iv = _allocate_iv,
59 .destroy = _destroy,
60 },
61 );
62
63 return &this->public;
64 }