NCBI C++ ToolKit
Macros | Functions | Variables
des.c File Reference
#include <config.h>
#include <freetds/tds.h>
#include <freetds/bytes.h>
#include "des.h"
+ Include dependency graph for des.c:

Go to the source code of this file.

Go to the SVN repository for this file.

Macros

#define P32I_INDEX_ROW(n, i, a, b, c, d)    n==a ? 0+i : n==b ? 1+i : n==c ? 2+i : n==d ? 3+i
 
#define P32I_INDEX(n)
 

Functions

void tds_des_set_odd_parity (des_cblock key)
 
static void permute_ip (des_cblock inblock, DES_KEY *key, des_cblock outblock)
 
static void permute_fp (des_cblock inblock, DES_KEY *key, des_cblock outblock)
 
static void perminit_ip (DES_KEY *key)
 
static void spinit (DES_KEY *key)
 
static void perminit_fp (DES_KEY *key)
 
static TDS_UINT f (DES_KEY *key, register TDS_UINT r, register unsigned char *subkey)
 
static int des_init (DES_KEY *key)
 
int tds_des_set_key (DES_KEY *dkey, const des_cblock user_key, size_t len)
 
void tds_des_encrypt (DES_KEY *key, des_cblock block)
 
int tds_des_ecb_encrypt (const void *plaintext, size_t len, DES_KEY *akey, unsigned char *output)
 

Variables

static const char ip []
 
static const char fp []
 
static const char pc1 []
 
static const char totrot []
 
static const char pc2 []
 
static const char si [8][64]
 
static const char pbox [32]
 
static const int bytebit []
 
static const int nibblebit []
 

Macro Definition Documentation

◆ P32I_INDEX

#define P32I_INDEX (   n)
Value:
(P32I_INDEX_ROW(n, 0, 16, 7, 20, 21) :\
P32I_INDEX_ROW(n, 4, 29, 12, 28, 17) :\
P32I_INDEX_ROW(n, 8, 1, 15, 23, 26) :\
P32I_INDEX_ROW(n,12, 5, 18, 31, 10) :\
P32I_INDEX_ROW(n,16, 2, 8, 24, 14) :\
P32I_INDEX_ROW(n,20, 32, 27, 3, 9) :\
P32I_INDEX_ROW(n,24, 19, 13, 30, 6) :\
P32I_INDEX_ROW(n,28, 22, 11, 4, 25) : 0x7f)
#define P32I_INDEX_ROW(n, i, a, b, c, d)
Definition: des.c:211
yy_size_t n

Definition at line 213 of file des.c.

◆ P32I_INDEX_ROW

#define P32I_INDEX_ROW (   n,
  i,
  a,
  b,
  c,
 
)     n==a ? 0+i : n==b ? 1+i : n==c ? 2+i : n==d ? 3+i

Definition at line 211 of file des.c.

Function Documentation

◆ des_init()

static int des_init ( DES_KEY key)
static

Definition at line 275 of file des.c.

References ncbi::grid::netcache::search::fields::key, perminit_fp(), perminit_ip(), and spinit().

Referenced by tds_des_set_key().

◆ f()

static TDS_UINT f ( DES_KEY key,
register TDS_UINT  r,
register unsigned char *  subkey 
)
static

◆ perminit_fp()

static void perminit_fp ( DES_KEY key)
static

Definition at line 575 of file des.c.

References bytebit, fp, i, ncbi::grid::netcache::search::fields::key, and nibblebit.

Referenced by des_init().

◆ perminit_ip()

static void perminit_ip ( DES_KEY key)
static

Definition at line 553 of file des.c.

References bytebit, i, ip, ncbi::grid::netcache::search::fields::key, and nibblebit.

Referenced by des_init().

◆ permute_fp()

static void permute_fp ( des_cblock  inblock,
DES_KEY key,
des_cblock  outblock 
)
static

Definition at line 472 of file des.c.

References ncbi::grid::netcache::search::fields::key.

Referenced by tds_des_encrypt().

◆ permute_ip()

static void permute_ip ( des_cblock  inblock,
DES_KEY key,
des_cblock  outblock 
)
static

Definition at line 444 of file des.c.

References ncbi::grid::netcache::search::fields::key.

Referenced by tds_des_encrypt().

◆ spinit()

static void spinit ( DES_KEY key)
static

Definition at line 598 of file des.c.

References i, ncbi::grid::netcache::search::fields::key, pbox, si, and val.

Referenced by des_init().

◆ tds_des_ecb_encrypt()

int tds_des_ecb_encrypt ( const void *  plaintext,
size_t  len,
DES_KEY akey,
unsigned char *  output 
)

Definition at line 625 of file des.c.

References len, output, and tds_des_encrypt().

◆ tds_des_encrypt()

void tds_des_encrypt ( DES_KEY key,
des_cblock  block 
)

◆ tds_des_set_key()

int tds_des_set_key ( DES_KEY dkey,
const des_cblock  user_key,
size_t  len 
)

Definition at line 288 of file des.c.

References bytebit, des_init(), i, des_key::kn, pc1, pc2, and totrot.

◆ tds_des_set_odd_parity()

void tds_des_set_odd_parity ( des_cblock  key)

Definition at line 46 of file des.c.

References i, and ncbi::grid::netcache::search::fields::key.

Variable Documentation

◆ bytebit

const int bytebit[]
static
Initial value:
= {
0200, 0100, 040, 020, 010, 04, 02, 01
}

Definition at line 263 of file des.c.

Referenced by perminit_fp(), perminit_ip(), and tds_des_set_key().

◆ fp

const char fp[]
static
Initial value:
= {
40, 8, 48, 16, 56, 24, 64, 32,
39, 7, 47, 15, 55, 23, 63, 31,
38, 6, 46, 14, 54, 22, 62, 30,
37, 5, 45, 13, 53, 21, 61, 29,
36, 4, 44, 12, 52, 20, 60, 28,
35, 3, 43, 11, 51, 19, 59, 27,
34, 2, 42, 10, 50, 18, 58, 26,
33, 1, 41, 9, 49, 17, 57, 25
}

Definition at line 87 of file des.c.

Referenced by _mm_load_pd(), _mm_load_sd(), CProjectService::AddProjectView(), bisection(), Blast_ScoreBlkMatrixFill(), BlastScoreBlkNucleotideMatrixRead(), BlastScoreBlkProteinMatrixRead(), BZ2_bzclose(), bzopen_or_bzdopen(), CORE_SetLOGFILE(), CORE_SetLOGFILE_Ex(), CORE_SetLOGFILE_NAME_Ex(), CSimpleProjectView::CreateView(), Deleter< FILE >::Delete(), SeqTreeAsnizer::fillAsnSeqTreeNode(), fopen_output_safely(), SBamIndexRefIndex::GetAlnOverStarts(), CViewGraphic::GetAnnotNames(), CViewGraphic::InitView(), ir_locate(), LOG_ToFILE(), LOG_ToFILE_Ex(), CNWAligner::MakePattern(), mdb_cursor_put(), mdb_xcursor_init1(), newtonRaphson(), CGraphicPanel::OnAssemblySelected(), operator<<(), CObjFingerprint::ParseSignature(), perminit_fp(), PssmMaker::printAlignmentByColumn(), printMsa(), read_file(), CJson_Document::ReadBuffered(), s_GetToolkitRCLogLocation(), s_ReadFileString(), CProjectViewBase::SetFingerprint(), SkipTitle(), tds_vasprintf(), test(), CNWAligner::x_CalcFingerPrint64(), CGraphicPanel::x_CheckLoaded(), CTar::x_ExtractSparseFile(), CNWAligner::x_FindFingerPrint64(), CDockContainer::x_GetDockPanel(), x_json_serialize_to_file(), x_json_serialize_to_file_pretty(), x_ReadLine(), and XReadFile().

◆ ip

const char ip[]
static
Initial value:
= {
58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6,
64, 56, 48, 40, 32, 24, 16, 8,
57, 49, 41, 33, 25, 17, 9, 1,
59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5,
63, 55, 47, 39, 31, 23, 15, 7
}

Definition at line 75 of file des.c.

Referenced by CChain::ClipToPolyA(), CombineCorrectionsAndIndels(), CChainer::CChainerImpl::CreateChainsForPartialProteins(), CNCDistributionConf::CreateHostAlias(), CMatrix4< T >::Determinant(), CMytestApplication::DoProcess(), CMytestApplication::DoProcessFeatureGeneOverlap(), CAlignCollapser::FilterAlignments(), CChainer::CChainerImpl::FindContainedAlignments(), g_NetService_gethostbyname(), g_NetService_gethostnamebyaddr(), g_NetService_TryResolveHost(), CTaskServer::GetHostByIP(), CTaskServer::GetIPByHost(), CNCDistributionConf::GetMainSrvIP(), CMytestApplication::GetSeqEntry(), CNCDistributionConf::GetSrvIdByIP(), CNCDistributionConf::InitMirrorConfig(), CTaskServer::IPToString(), CSmallDNS::IsValidIP(), CSmallDNS::LocalBackResolveDNS(), CChainer::CChainerImpl::MakeChains(), NcbiIsAPIPA(), NcbiIsInIPRange(), NcbiIsLocalIP(), NcbiIsPrivateIP(), ICitationBase::NoteSup(), DeBruijn::CKmerCountTemplate< LargeInt< 1 >, LargeInt< 2 >, LargeInt< 4 >, LargeInt< 8 >, LargeInt< 16 > >::uniq::operator()(), perminit_ip(), SInteractiveNewRequestStart::SExtra::Print(), SDebugPrintout::Print(), CPSG_MyNCBIFactory::ResolveAccessPoint(), CMytestApplication::Run(), s_IsPrivateIP(), s_ReqStart(), CRequestContext::SetClientIP(), SOCK_IsLoopbackAddress(), test_incexc(), CMytestApplication::TestFeatureGeneOverlap(), x_ChooseSelfIP(), x_ClientAddress(), x_IPv6ToString(), CDBLBClientApp::x_RunWhatIs(), CDiagContext::x_StartRequest(), and x_StringToIPv6().

◆ nibblebit

const int nibblebit[]
static
Initial value:
= {
010, 04, 02, 01
}

Definition at line 267 of file des.c.

Referenced by perminit_fp(), and perminit_ip().

◆ pbox

const char pbox[32]
static

Definition at line 223 of file des.c.

Referenced by spinit().

◆ pc1

const char pc1[]
static
Initial value:
= {
57, 49, 41, 33, 25, 17, 9,
1, 58, 50, 42, 34, 26, 18,
10, 2, 59, 51, 43, 35, 27,
19, 11, 3, 60, 52, 44, 36,
63, 55, 47, 39, 31, 23, 15,
7, 62, 54, 46, 38, 30, 22,
14, 6, 61, 53, 45, 37, 29,
21, 13, 5, 28, 20, 12, 4
}

Definition at line 116 of file des.c.

Referenced by col_equal(), SStringLess< TComp >::operator()(), and tds_des_set_key().

◆ pc2

const char pc2[]
static
Initial value:
= {
14, 17, 11, 24, 1, 5,
3, 28, 15, 6, 21, 10,
23, 19, 12, 4, 26, 8,
16, 7, 27, 20, 13, 2,
41, 52, 31, 37, 47, 55,
30, 40, 51, 45, 33, 48,
44, 49, 39, 56, 34, 53,
46, 42, 50, 36, 29, 32
}

Definition at line 134 of file des.c.

Referenced by col_equal(), SStringLess< TComp >::operator()(), and tds_des_set_key().

◆ si

const char si[8][64]
static

Definition at line 146 of file des.c.

Referenced by _bcp_get_col_data(), _bcp_read_hostfile(), CSeqDBGiList::AddSi(), CSeqDBNegativeList::AddSi(), CAlignmentAssistant::AdjustAlign(), CInputGiList::AppendSi(), bcp_write_prefix(), BOOST_AUTO_TEST_CASE(), CSpliceProblems::CalculateSpliceProblems(), CNewCleanup_imp::CdRegionEC(), check_attr_ard(), check_attr_ird(), NWinHook::CHookedFunction::CHookedFunction(), CORE_GetVMPageSize(), CTableAnnotDataSource::CreateFeature(), CTableAnnotDataSource::CreateSnpFeature(), CTableAnnotDataSource::CreateSnps(), CDense_seg::ExtractSlice(), CSeqDBGiList::FindSi(), CSeqDBNegativeList::FindSi(), get_attr_stmt(), SBamIndexRefIndex::GetAlnOverEnds(), CSystemInfo::GetCpuCount(), CShowBlastDeflineTest::GetDeflineInfo(), CSeqidlistRead::GetIds(), CBioseq_set::GetLabel(), CRegexp_loc::GetLoc(), CSeqDbSeqInfoSrc::GetMasks(), CRemoteBlast::GetMasks(), CSearchResultSet::GetResults(), CSystemInfo::GetVirtualMemoryAllocationGranularity(), CSystemInfo::GetVirtualMemoryPageSize(), IsClassInEntry(), LBSM_HINFO_CpuClock(), LBSM_HINFO_CpuCount(), LBSM_HINFO_CpuUnits(), LBSM_HINFO_LoadAverage(), LBSM_HINFO_MachineParams(), LBSM_HINFO_Memusage(), LBSM_HINFO_PortUsage(), LBSM_HINFO_Status(), LBSM_HINFO_TaskCount(), main(), CSeqMasker::MergeMaskInfo(), odbc_c2string(), operator<<(), CSeq_entry::Parentize(), CSeq_entry::ParentizeOneLevel(), StructureObject::RealignStructure(), CAutoDefWithTaxonomy::RegeneratePopsetTitles(), ReorderStructureAlignments(), CCleanup::RepackageProteins(), CChainer::CChainerImpl::ReplicatePStops(), TMaskedQueryRegions::RestrictToSeqInt(), CDiscrepancyReportJob::Run(), CMacroFunction_Autodef::s_AutodefSets(), CMacroFunction_Autodef::s_AutodefSetsNoTitle(), s_CutDensegSegment(), s_FillXref(), s_GetSysinfo(), s_IsLocDirSub(), s_LocIntervalsSpanOrigin(), CMacroFunction_RefreshDefline::s_RefreshDeflineCommand(), salu(), CValidError_imp::Setup(), sgoi(), CSeqDBGiList::SiToOid(), slou(), spinit(), tds_put_smallint(), CShowBlastDeflineTest::TestData(), unfinished_query_test(), CValidError_imp::Validate(), CValidError_bioseq::ValidateCompleteGenome(), CSpliceProblems::ValidateSpliceExon(), CVdbFastaExtractor::Write(), WriteDB_EaaToBinary(), WriteDB_IupacaaToBinary(), WriteDB_IupacnaToBinary(), WriteDB_Ncbi2naToBinary(), WriteDB_StdaaToBinary(), CFlatSeqLoc::x_Add(), CGeneValidator::x_AllIntervalGapsAreMobileElements(), CWriteDB_Impl::x_ComputeSeqLength(), CWriteDB_Impl::x_CookSequence(), CBLASTSeqToolJob::x_CreateProjectItems(), CVectorTrimPanel::x_CutDensegSegment(), CReportTrim::x_CutDensegSegment(), CFlatSeqLoc::x_FuzzToDisplayed(), CSeq_loc_Mapper_Base::x_Map_PackedInt_Element(), CGFFReader::x_ResolveLoc(), and CGeneValidator::x_ValidateMultiIntervalGene().

◆ totrot

const char totrot[]
static
Initial value:
= {
1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28
}

Definition at line 129 of file des.c.

Referenced by tds_des_set_key().

Modified on Mon May 27 04:34:48 2024 by modify_doxy.py rev. 669887