00001 /* 00002 * Copyright 2003 Michael A. Marsh, Cornell University. All rights reserved. 00003 * This software is released under the modified BSD license. 00004 * See the file LICENSE in the top-level directory for details. 00005 */ 00006 // 00007 // $Id: ModExpFunctional.h,v 1.3 2004/05/19 15:57:00 mmarsh Exp $ 00008 // 00009 // $Log: ModExpFunctional.h,v $ 00010 // Revision 1.3 2004/05/19 15:57:00 mmarsh 00011 // *** empty log message *** 00012 // 00013 // Revision 1.2 2003/11/04 22:31:52 mmarsh 00014 // *** empty log message *** 00015 // 00016 // 00017 00018 #ifndef __CODEX_VSS_MODEXPFUNCTIONAL_H__ 00019 #define __CODEX_VSS_MODEXPFUNCTIONAL_H__ 00020 00021 #include "ShareFunctional.h" 00022 #include "CODEX_ASN1/Base.h" 00023 00024 namespace CODEX_VSS 00025 { 00030 class ModExpFunctionalArgs : public CODEX_ASN1::Base 00031 { 00032 public : 00034 ModExpFunctionalArgs(); 00035 00037 ModExpFunctionalArgs( const CODEX_ASN1::BigNumber& base, 00038 const CODEX_ASN1::BigNumber& modulus ); 00039 00041 ModExpFunctionalArgs( const ModExpFunctionalArgs& aOther ); 00042 00044 virtual ~ModExpFunctionalArgs(); 00045 00047 void operator=( const ModExpFunctionalArgs& aOther ); 00048 00050 const CODEX_ASN1::BigNumber& base() const { return m_base; } 00051 00053 const CODEX_ASN1::BigNumber& modulus() const { return m_modulus; } 00054 00055 int marshal( unsigned char ** pp ) const; 00056 void* unmarshal( void* bogus, unsigned char** pp, long length ); 00057 00058 private : 00059 CODEX_ASN1::BigNumber m_base; 00060 CODEX_ASN1::BigNumber m_modulus; 00061 }; 00062 00067 class ModExpFunctional : public ShareFunctional 00068 { 00069 public : 00071 typedef CODEX_ASN1::BigNumber ArgType; 00072 00074 typedef ModExpFunctionalArgs CtorArgs; 00075 00077 ModExpFunctional( const ArgType& base, const ArgType& modulus ); 00078 00080 ModExpFunctional( const CtorArgs& args ); 00081 00083 virtual ~ModExpFunctional(); 00084 00091 void operator()( const CODEX_ASN1::SecureBigNumber& operand, 00092 CODEX_ASN1::BigNumber& result ) const; 00093 00095 const ArgType& base() const { return m_base; } 00096 00098 const ArgType& modulus() const { return m_modulus; } 00099 00100 private : 00101 ArgType m_base; 00102 ArgType m_modulus; 00103 }; 00104 00105 } 00106 00107 #endif /* __CODEX_VSS_MODEXPFUNCTIONAL_H__ */
1.2.18