crypto/weakcryptospi/source/hash/sha1.cpp
changeset 19 cd501b96611d
equal deleted inserted replaced
15:da2ae96f639b 19:cd501b96611d
       
     1 /*
       
     2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32std.h>
       
    20 #include <hash.h>
       
    21 #include "hashshim.h"
       
    22 
       
    23 #define EXPANDLOOP
       
    24 
       
    25 //
       
    26 // 32bit endian-independent SHA-1 implementation
       
    27 //
       
    28 CSHA1::CSHA1()
       
    29 	{		
       
    30 	}
       
    31 	
       
    32 EXPORT_C CSHA1* CSHA1::NewL(void)
       
    33 	{
       
    34 	CSHA1* self=CSHA1Shim::NewL();
       
    35 	self->Reset();
       
    36 	return self;
       
    37 	}
       
    38 	
       
    39 EXPORT_C CSHA1::~CSHA1(void)
       
    40 	{
       
    41 	}
       
    42 	
       
    43 // All these methods have been replaced by the shim
       
    44 #ifdef _BullseyeCoverage
       
    45 #pragma suppress_warnings on
       
    46 #pragma BullseyeCoverage off
       
    47 #pragma suppress_warnings off
       
    48 #endif
       
    49 EXPORT_C CMessageDigest* CSHA1::ReplicateL(void)
       
    50 	{
       
    51 	// Method replaced by shim
       
    52 	ASSERT(EFalse);	
       
    53 	return NULL;
       
    54 	}
       
    55 
       
    56 EXPORT_C TPtrC8 CSHA1::Hash(const TDesC8& /*aMessage*/)
       
    57 	{
       
    58 	// Method replaced by shim
       
    59 	ASSERT(EFalse);	
       
    60 	return KNullDesC8();
       
    61 	}
       
    62 
       
    63 EXPORT_C CMessageDigest* CSHA1::CopyL(void)
       
    64 	{
       
    65 	// Method replaced by shim
       
    66 	ASSERT(EFalse);	
       
    67 	return NULL;
       
    68 	}
       
    69 	
       
    70 EXPORT_C TInt CSHA1::BlockSize(void)
       
    71 	{
       
    72 	ASSERT(EFalse);	
       
    73 	return KErrNotSupported;
       
    74 	}
       
    75 	
       
    76 EXPORT_C TInt CSHA1::HashSize(void)
       
    77 	{
       
    78 	ASSERT(EFalse);
       
    79 	return KErrNotSupported;
       
    80 	}
       
    81 
       
    82 EXPORT_C void CSHA1::Reset(void)
       
    83 	{
       
    84 	ASSERT(EFalse);
       
    85 	}
       
    86 
       
    87 EXPORT_C void CSHA1::Update(const TDesC8& /*aMessage*/)
       
    88 	{
       
    89 	ASSERT(EFalse);
       
    90 	}
       
    91 
       
    92 EXPORT_C TPtrC8 CSHA1::Final(const TDesC8& /*aMessage*/)
       
    93 	{
       
    94 	ASSERT(EFalse);	
       
    95 	return KNullDesC8();
       
    96 	}
       
    97 
       
    98 EXPORT_C TPtrC8 CSHA1::Final()
       
    99 	{
       
   100 	ASSERT(EFalse);
       
   101 	return KNullDesC8();
       
   102 	}
       
   103 
       
   104 void CSHA1::RestoreState()
       
   105 	{
       
   106 	ASSERT(EFalse);
       
   107 	}
       
   108 
       
   109 void CSHA1::StoreState()
       
   110 	{
       
   111 	ASSERT(EFalse);
       
   112 	}
       
   113 
       
   114 ///////////////////////////////////////////////////////////////////////////////////////
       
   115 //	CSHA code is deprecated
       
   116 ///////////////////////////////////////////////////////////////////////////////////////
       
   117 
       
   118 _LIT(KSHA, "HASH::CSHA");
       
   119 
       
   120 EXPORT_C CSHA* CSHA::NewL(void)
       
   121 {
       
   122 	User::Panic(KSHA, KErrNotSupported);
       
   123 	return (NULL);	//	Shut compiler up
       
   124 }
       
   125 
       
   126 EXPORT_C CSHA::~CSHA(void)
       
   127 {
       
   128 	User::Panic(KSHA, KErrNotSupported);
       
   129 }
       
   130 
       
   131 EXPORT_C TPtrC8 CSHA::Hash(const TDesC8& /*aMessage*/)
       
   132 {
       
   133 	User::Panic(KSHA, KErrNotSupported);
       
   134 	return (KNullDesC8());	//	Shut compiler up
       
   135 }
       
   136 
       
   137 EXPORT_C TInt CSHA::HashSize(void)
       
   138 {
       
   139 	User::Panic(KSHA, KErrNotSupported);
       
   140 	return (-1);	//	Shut compiler up
       
   141 }
       
   142 
       
   143 EXPORT_C TInt CSHA::BlockSize(void)
       
   144 {
       
   145 	User::Panic(KSHA, KErrNotSupported);
       
   146 	return (-1);	//	Shut compiler up
       
   147 }
       
   148 
       
   149 EXPORT_C CMessageDigest* CSHA::CopyL(void)
       
   150 {
       
   151 	User::Panic(KSHA, KErrNotSupported);
       
   152 	return (NULL);	//	Shut compiler up
       
   153 }
       
   154 
       
   155 EXPORT_C CMessageDigest* CSHA::ReplicateL(void)
       
   156 {
       
   157 	User::Panic(KSHA, KErrNotSupported);
       
   158 	return (NULL);	//	Shut compiler up
       
   159 }
       
   160 
       
   161 EXPORT_C void CSHA::Reset(void)
       
   162 {
       
   163 	User::Panic(KSHA, KErrNotSupported);
       
   164 }
       
   165 
       
   166 EXPORT_C void CSHA::Update(const TDesC8& /*aMessage*/)
       
   167 {
       
   168 	User::Panic(KSHA, KErrNotSupported);
       
   169 }
       
   170 
       
   171 EXPORT_C TPtrC8 CSHA::Final(const TDesC8& /*aMessage*/)
       
   172 {
       
   173 	User::Panic(KSHA, KErrNotSupported);
       
   174 	return (KNullDesC8());	//	Shut compiler up
       
   175 }
       
   176 
       
   177 EXPORT_C TPtrC8 CSHA::Final()
       
   178 {
       
   179 	User::Panic(KSHA, KErrNotSupported);
       
   180 	return (KNullDesC8());	//	Shut compiler up
       
   181 }
       
   182 
       
   183 void CSHA::RestoreState()
       
   184 {
       
   185 	User::Panic(KSHA, KErrNotSupported);
       
   186 }
       
   187 void CSHA::StoreState()
       
   188 {
       
   189 	User::Panic(KSHA, KErrNotSupported);
       
   190 }