Annotation of embedaddon/strongswan/src/libstrongswan/crypto/iv/iv_gen.c, revision 1.1

1.1     ! misho       1: /*
        !             2:  * Copyright (C) 2015 Tobias Brunner
        !             3:  * HSR Hochschule fuer Technik Rapperswil
        !             4:  *
        !             5:  * Copyright (C) 2015 Martin Willi
        !             6:  * Copyright (C) 2015 revosec AG
        !             7:  *
        !             8:  * This program is free software; you can redistribute it and/or modify it
        !             9:  * under the terms of the GNU General Public License as published by the
        !            10:  * Free Software Foundation; either version 2 of the License, or (at your
        !            11:  * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
        !            12:  *
        !            13:  * This program is distributed in the hope that it will be useful, but
        !            14:  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
        !            15:  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        !            16:  * for more details.
        !            17:  */
        !            18: 
        !            19: #include "iv_gen.h"
        !            20: #include "iv_gen_rand.h"
        !            21: #include "iv_gen_seq.h"
        !            22: #include "iv_gen_null.h"
        !            23: 
        !            24: /**
        !            25:  * See header.
        !            26:  */
        !            27: iv_gen_t* iv_gen_create_for_alg(encryption_algorithm_t alg)
        !            28: {
        !            29:        switch (alg)
        !            30:        {
        !            31:                case ENCR_DES:
        !            32:                case ENCR_3DES:
        !            33:                case ENCR_RC5:
        !            34:                case ENCR_IDEA:
        !            35:                case ENCR_CAST:
        !            36:                case ENCR_BLOWFISH:
        !            37:                case ENCR_3IDEA:
        !            38:                case ENCR_AES_CBC:
        !            39:                case ENCR_CAMELLIA_CBC:
        !            40:                case ENCR_SERPENT_CBC:
        !            41:                case ENCR_TWOFISH_CBC:
        !            42:                case ENCR_RC2_CBC:
        !            43:                        return iv_gen_rand_create();
        !            44:                case ENCR_AES_CTR:
        !            45:                case ENCR_AES_CCM_ICV8:
        !            46:                case ENCR_AES_CCM_ICV12:
        !            47:                case ENCR_AES_CCM_ICV16:
        !            48:                case ENCR_AES_GCM_ICV8:
        !            49:                case ENCR_AES_GCM_ICV12:
        !            50:                case ENCR_AES_GCM_ICV16:
        !            51:                case ENCR_CAMELLIA_CTR:
        !            52:                case ENCR_CAMELLIA_CCM_ICV8:
        !            53:                case ENCR_CAMELLIA_CCM_ICV12:
        !            54:                case ENCR_CAMELLIA_CCM_ICV16:
        !            55:                case ENCR_CHACHA20_POLY1305:
        !            56:                case ENCR_NULL_AUTH_AES_GMAC:
        !            57:                        return iv_gen_seq_create();
        !            58:                case ENCR_NULL:
        !            59:                        return iv_gen_null_create();
        !            60:                case ENCR_UNDEFINED:
        !            61:                case ENCR_DES_ECB:
        !            62:                case ENCR_DES_IV32:
        !            63:                case ENCR_DES_IV64:
        !            64:                case ENCR_AES_ECB:
        !            65:                        break;
        !            66:        }
        !            67:        return NULL;
        !            68: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>