XRootD
XrdCryptoMsgDigest.cc
Go to the documentation of this file.
1 /******************************************************************************/
2 /* */
3 /* X r d C r y p t o M s g D i g e s t . c c */
4 /* */
5 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */
6 /* Produced by Gerri Ganis for CERN */
7 /* */
8 /* This file is part of the XRootD software suite. */
9 /* */
10 /* XRootD is free software: you can redistribute it and/or modify it under */
11 /* the terms of the GNU Lesser General Public License as published by the */
12 /* Free Software Foundation, either version 3 of the License, or (at your */
13 /* option) any later version. */
14 /* */
15 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
16 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
17 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
18 /* License for more details. */
19 /* */
20 /* You should have received a copy of the GNU Lesser General Public License */
21 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
22 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
23 /* */
24 /* The copyright holder's institutional names and contributor's names may not */
25 /* be used to endorse or promote products derived from this software without */
26 /* specific prior written permission of the institution or contributor. */
27 /******************************************************************************/
28 
29 /* ************************************************************************** */
30 /* */
31 /* Abstract interface for Message Digest crypto functionality. */
32 /* Allows to plug-in modules based on different crypto implementation */
33 /* (OpenSSL, Botan, ...) */
34 /* */
35 /* ************************************************************************** */
36 
37 #include <cstring>
38 
41 
42 //_____________________________________________________________________________
44 {
45  // Check key validity
46  ABSTRACTMETHOD("XrdCryptoMsgDigest::IsValid");
47  return 0;
48 }
49 
50 //______________________________________________________________________________
52 {
53  // Compare msg digest md to local md: return 1 if matches, 0 if not
54 
55  if (md.Length() == Length()) {
56  if (!memcmp(md.Buffer(),Buffer(),Length()))
57  return 1;
58  }
59  return 0;
60 }
61 //_____________________________________________________________________________
62 int XrdCryptoMsgDigest::Reset(const char *dgst)
63 {
64  // Re-Init the message digest calculation
65 
66  ABSTRACTMETHOD("XrdCryptoMsgDigest::Reset");
67  return -1;
68 }
69 
70 //_____________________________________________________________________________
71 int XrdCryptoMsgDigest::Update(const char *b, int l)
72 {
73  // Update message digest with the MD of l bytes at b.
74 
75  ABSTRACTMETHOD("XrdCryptoMsgDigest::Update");
76  return -1;
77 }
78 
79 //_____________________________________________________________________________
81 {
82  // Finalize message digest calculation.
83 
84  ABSTRACTMETHOD("XrdCryptoMsgDigest::Final");
85  return -1;
86 }
#define ABSTRACTMETHOD(x)
Definition: XrdCryptoAux.hh:41
virtual int Length() const
virtual char * Buffer() const
virtual bool IsValid()
bool operator==(const XrdCryptoMsgDigest md)
virtual int Update(const char *b, int l)
virtual int Reset(const char *dgst)