os/security/crypto/weakcryptospi/source/hash/sha1.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/crypto/weakcryptospi/source/hash/sha1.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,190 @@
     1.4 +/*
     1.5 +* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#include <e32std.h>
    1.23 +#include <hash.h>
    1.24 +#include "hashshim.h"
    1.25 +
    1.26 +#define EXPANDLOOP
    1.27 +
    1.28 +//
    1.29 +// 32bit endian-independent SHA-1 implementation
    1.30 +//
    1.31 +CSHA1::CSHA1()
    1.32 +	{		
    1.33 +	}
    1.34 +	
    1.35 +EXPORT_C CSHA1* CSHA1::NewL(void)
    1.36 +	{
    1.37 +	CSHA1* self=CSHA1Shim::NewL();
    1.38 +	self->Reset();
    1.39 +	return self;
    1.40 +	}
    1.41 +	
    1.42 +EXPORT_C CSHA1::~CSHA1(void)
    1.43 +	{
    1.44 +	}
    1.45 +	
    1.46 +// All these methods have been replaced by the shim
    1.47 +#ifdef _BullseyeCoverage
    1.48 +#pragma suppress_warnings on
    1.49 +#pragma BullseyeCoverage off
    1.50 +#pragma suppress_warnings off
    1.51 +#endif
    1.52 +EXPORT_C CMessageDigest* CSHA1::ReplicateL(void)
    1.53 +	{
    1.54 +	// Method replaced by shim
    1.55 +	ASSERT(EFalse);	
    1.56 +	return NULL;
    1.57 +	}
    1.58 +
    1.59 +EXPORT_C TPtrC8 CSHA1::Hash(const TDesC8& /*aMessage*/)
    1.60 +	{
    1.61 +	// Method replaced by shim
    1.62 +	ASSERT(EFalse);	
    1.63 +	return KNullDesC8();
    1.64 +	}
    1.65 +
    1.66 +EXPORT_C CMessageDigest* CSHA1::CopyL(void)
    1.67 +	{
    1.68 +	// Method replaced by shim
    1.69 +	ASSERT(EFalse);	
    1.70 +	return NULL;
    1.71 +	}
    1.72 +	
    1.73 +EXPORT_C TInt CSHA1::BlockSize(void)
    1.74 +	{
    1.75 +	ASSERT(EFalse);	
    1.76 +	return KErrNotSupported;
    1.77 +	}
    1.78 +	
    1.79 +EXPORT_C TInt CSHA1::HashSize(void)
    1.80 +	{
    1.81 +	ASSERT(EFalse);
    1.82 +	return KErrNotSupported;
    1.83 +	}
    1.84 +
    1.85 +EXPORT_C void CSHA1::Reset(void)
    1.86 +	{
    1.87 +	ASSERT(EFalse);
    1.88 +	}
    1.89 +
    1.90 +EXPORT_C void CSHA1::Update(const TDesC8& /*aMessage*/)
    1.91 +	{
    1.92 +	ASSERT(EFalse);
    1.93 +	}
    1.94 +
    1.95 +EXPORT_C TPtrC8 CSHA1::Final(const TDesC8& /*aMessage*/)
    1.96 +	{
    1.97 +	ASSERT(EFalse);	
    1.98 +	return KNullDesC8();
    1.99 +	}
   1.100 +
   1.101 +EXPORT_C TPtrC8 CSHA1::Final()
   1.102 +	{
   1.103 +	ASSERT(EFalse);
   1.104 +	return KNullDesC8();
   1.105 +	}
   1.106 +
   1.107 +void CSHA1::RestoreState()
   1.108 +	{
   1.109 +	ASSERT(EFalse);
   1.110 +	}
   1.111 +
   1.112 +void CSHA1::StoreState()
   1.113 +	{
   1.114 +	ASSERT(EFalse);
   1.115 +	}
   1.116 +
   1.117 +///////////////////////////////////////////////////////////////////////////////////////
   1.118 +//	CSHA code is deprecated
   1.119 +///////////////////////////////////////////////////////////////////////////////////////
   1.120 +
   1.121 +_LIT(KSHA, "HASH::CSHA");
   1.122 +
   1.123 +EXPORT_C CSHA* CSHA::NewL(void)
   1.124 +{
   1.125 +	User::Panic(KSHA, KErrNotSupported);
   1.126 +	return (NULL);	//	Shut compiler up
   1.127 +}
   1.128 +
   1.129 +EXPORT_C CSHA::~CSHA(void)
   1.130 +{
   1.131 +	User::Panic(KSHA, KErrNotSupported);
   1.132 +}
   1.133 +
   1.134 +EXPORT_C TPtrC8 CSHA::Hash(const TDesC8& /*aMessage*/)
   1.135 +{
   1.136 +	User::Panic(KSHA, KErrNotSupported);
   1.137 +	return (KNullDesC8());	//	Shut compiler up
   1.138 +}
   1.139 +
   1.140 +EXPORT_C TInt CSHA::HashSize(void)
   1.141 +{
   1.142 +	User::Panic(KSHA, KErrNotSupported);
   1.143 +	return (-1);	//	Shut compiler up
   1.144 +}
   1.145 +
   1.146 +EXPORT_C TInt CSHA::BlockSize(void)
   1.147 +{
   1.148 +	User::Panic(KSHA, KErrNotSupported);
   1.149 +	return (-1);	//	Shut compiler up
   1.150 +}
   1.151 +
   1.152 +EXPORT_C CMessageDigest* CSHA::CopyL(void)
   1.153 +{
   1.154 +	User::Panic(KSHA, KErrNotSupported);
   1.155 +	return (NULL);	//	Shut compiler up
   1.156 +}
   1.157 +
   1.158 +EXPORT_C CMessageDigest* CSHA::ReplicateL(void)
   1.159 +{
   1.160 +	User::Panic(KSHA, KErrNotSupported);
   1.161 +	return (NULL);	//	Shut compiler up
   1.162 +}
   1.163 +
   1.164 +EXPORT_C void CSHA::Reset(void)
   1.165 +{
   1.166 +	User::Panic(KSHA, KErrNotSupported);
   1.167 +}
   1.168 +
   1.169 +EXPORT_C void CSHA::Update(const TDesC8& /*aMessage*/)
   1.170 +{
   1.171 +	User::Panic(KSHA, KErrNotSupported);
   1.172 +}
   1.173 +
   1.174 +EXPORT_C TPtrC8 CSHA::Final(const TDesC8& /*aMessage*/)
   1.175 +{
   1.176 +	User::Panic(KSHA, KErrNotSupported);
   1.177 +	return (KNullDesC8());	//	Shut compiler up
   1.178 +}
   1.179 +
   1.180 +EXPORT_C TPtrC8 CSHA::Final()
   1.181 +{
   1.182 +	User::Panic(KSHA, KErrNotSupported);
   1.183 +	return (KNullDesC8());	//	Shut compiler up
   1.184 +}
   1.185 +
   1.186 +void CSHA::RestoreState()
   1.187 +{
   1.188 +	User::Panic(KSHA, KErrNotSupported);
   1.189 +}
   1.190 +void CSHA::StoreState()
   1.191 +{
   1.192 +	User::Panic(KSHA, KErrNotSupported);
   1.193 +}