Return to iv_gen_null.c CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / strongswan / src / libstrongswan / crypto / iv |
1.1 misho 1: /* 2: * Copyright (C) 2015 Tobias Brunner 3: * HSR Hochschule fuer Technik Rapperswil 4: * 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>. 9: * 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 13: * for more details. 14: */ 15: 16: #include "iv_gen_null.h" 17: 18: typedef struct private_iv_gen_t private_iv_gen_t; 19: 20: /** 21: * Private data of an iv_gen_t object. 22: */ 23: struct private_iv_gen_t { 24: 25: /** 26: * Public iv_gen_t interface. 27: */ 28: iv_gen_t public; 29: }; 30: 31: METHOD(iv_gen_t, get_iv, bool, 32: private_iv_gen_t *this, uint64_t seq, size_t size, uint8_t *buffer) 33: { 34: return size == 0; 35: } 36: 37: METHOD(iv_gen_t, allocate_iv, bool, 38: private_iv_gen_t *this, uint64_t seq, size_t size, chunk_t *chunk) 39: { 40: *chunk = chunk_empty; 41: return size == 0; 42: } 43: 44: METHOD(iv_gen_t, destroy, void, 45: private_iv_gen_t *this) 46: { 47: free(this); 48: } 49: 50: iv_gen_t *iv_gen_null_create() 51: { 52: private_iv_gen_t *this; 53: 54: INIT(this, 55: .public = { 56: .get_iv = _get_iv, 57: .allocate_iv = _allocate_iv, 58: .destroy = _destroy, 59: }, 60: ); 61: 62: return &this->public; 63: }