X-Git-Url: https://git.syn-net.org/debian/?p=anytun.git;a=blobdiff_plain;f=src%2FauthAlgoFactory.cpp;h=0cd22ce2ea4293b0b73d296653c3e48daa8f9408;hp=d1b2fc57e0b209a0a94e8dd76998fd96316a42bd;hb=ef0cacf2508418915d3f64b04003be3c13fed3cc;hpb=ece844834d2cecc028ce81ca283f5d441088580e diff --git a/src/authAlgoFactory.cpp b/src/authAlgoFactory.cpp index d1b2fc5..0cd22ce 100644 --- a/src/authAlgoFactory.cpp +++ b/src/authAlgoFactory.cpp @@ -11,7 +11,7 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. @@ -39,25 +39,30 @@ AuthAlgo* AuthAlgoFactory::create(std::string const& type, kd_dir_t dir) { - if(type == "null") + if(type == "null") { return new NullAuthAlgo(); + } #ifndef NO_CRYPT - else if(type == "sha1") + else if(type == "sha1") { return new Sha1AuthAlgo(dir); + } #endif - else + else { throw std::invalid_argument("auth algo not available"); + } } -u_int32_t AuthAlgoFactory::getDigestLength(std::string const& type) +uint32_t AuthAlgoFactory::getDigestLength(std::string const& type) { - if(type == "null") + if(type == "null") { return NullAuthAlgo::DIGEST_LENGTH; + } #ifndef NO_CRYPT - else if(type == "sha1") + else if(type == "sha1") { return Sha1AuthAlgo::DIGEST_LENGTH; + } #endif - else + else { throw std::invalid_argument("auth algo not available"); + } } -