download pgpRandomPool.pas
Language: Delphi
License: MPL11
Copyright: (C) 2000 Steven R. Heller } (C) 1997 Network Associates Inc. and affiliated companies. }
LOC: 58
Project Info
WinJab
Server: SourceForge
Type: cvs
...rge\w\winjab\winjab\winjab\
   .cvsignore
   About1.pas
   avatars.pas
   Bmplbox.pas
   Bookmark.dfm
   Bookmark.pas
   BrowseClass.pas
   Browser.dfm
   Browser.pas
   Callbacks.pas
   cbrowsedir.pas
   ChatWin.dfm
   ChatWin.pas
   cipher.inc
   cipher1.inc
   Common.pas
   Config.dfm
   Config.pas
   CustomPres.dfm
   CustomPres.pas
   DECConst.pas
   DECUtil.pas
   Dialog.dfm
   Dialog.pas
   FieldFrame.dfm
   FieldFrame.pas
   fListbox.dfm
   fListbox.pas
   fService.dfm
   fService.pas
   GetRoster.dfm
   GetRoster.pas
   GroupWin.dfm
   GroupWin.pas
   GrpJoin.dfm
   GrpJoin.pas
   GrpUtils.pas
   Hash.inc
   Hash.pas
   Header.dfm
   Header.pas
   Headlines.dfm
   Headlines.pas
   History.dfm
   History.pas
   imGauge.pas
   Jabber1.dfm
   Jabber1.pas
   JabUtils.pas
   JCL.INC
   jclmime.pas
   JEDI.INC
   lang-english.xml
   lang.xml
   manifest.rc
   ModGroups.pas
   NewRoster.dfm
   NewRoster.pas
   Password.dfm
   Password.pas
   pgpBase.pas
   pgpEncodePas.pas
   pgpErrors.pas
   pgpFeatures.pas
   pgpGroups.pas
   pgpKeys.pas
   pgpKeyServer.pas
   pgpmain.pas
   pgpOptionList.pas
   pgpPubTypes.pas
   pgpRandomPool.pas
   PGPsdk.pas
   pgpSDKPrefs.pas
   pgpTLS.pas
   pgpUserInterface.pas
   pgpUtilities.pas
   presence.dfm
   presence.pas
   readme.html
   Recips.dfm
   Recips.pas
   register.dfm
   register.pas
   RFC1760.inc
   RosItem.dfm
   RosItem.pas
   roster.dfm
   roster.pas
   RosterClass.pas
   RuleInfo.dfm
   RuleInfo.pas
   RuleList.dfm
   RuleList.pas
   rules.dfm
   rules.pas
   RuleUtils.pas
   Sha1.inc
   Sha1.pas
   splash.dfm
   splash.pas
   Square.inc
   Status.dfm
   Status.pas
   Stringtable.pas
   ThdSaveProfile.pas
   TOVCard.pas
   TrayIcon.pas
   vcard.dfm
   vcard.pas
   Ver.inc
   vlists.pas
   winjab-all.bpg
   WinJab.dpr
   Winjab.manifest
   WinJab.todo
   WinJab_Setup.wse
   wjUtils.pas
   xfer.dfm
   xfer.pas
   xml1.pas
   xmlutils.pas

{************************************************************************}
{                                                                        }
{       Borland Delphi Runtime Library                                   }
{       PGPsdk/pgpRandomPool interface unit                              }
{                                                                        }
{ Portions created by PGP/NAI are                                        }
{ Copyright (C) 1997 Network Associates Inc. and affiliated companies.   }
{ All Rights Reserved.                                                   }
{                                                                        }
{ The original file is: pgpRandomPool.h, released 13 Apr 1999.           }
{ The original Pascal code is: pgpRandomPool.pas, released 10 Apr 2000.  }
{ The initial developer of the Pascal code is Steven R. Heller           }
{ <srheller@oz.net>                                                      }
{                                                                        }
{ Portions created by Steven R. Heller are                               }
{ Copyright (C) 2000 Steven R. Heller                                    }
{                                                                        }
{ Contributors:                                                          }
{ The ASM technique for accessing open arrays is based on the            }
{ original work of Graham Grieve in Kestral Computing's                  }
{ PGPAPI.PAS file: <http://www.kestral.com.au/devtools/pgp>              }
{                                                                        }
{ You may retrieve the latest version of this file here:                 }
{ <http://www.oz.net/~srheller/pgpsdk>                                   }
{                                                                        }
{ Please see                                                             }
{  <http://www.oz.net/~srheller/pgpsdk/index.html#randompool> for        }
{  information on using this unit.                                       }
{                                                                        }
{ The contents of this file are used with permission, subject to         }
{ the Mozilla Public License Version 1.1 (the "License"); you may        }
{ not use this file except in compliance with the License. You may       }
{ obtain a copy of the License at                                        }
{ <http://www.mozilla.org/MPL/MPL-1.1.html>                              }
{                                                                        }
{ Software distributed under the License is distributed on an            }
{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or         }
{ implied. See the License for the specific language governing           }
{ rights and limitations under the License.                              }
{                                                                        }
{************************************************************************}

unit pgpRandomPool;

interface

uses
  pgpBase, pgpPubTypes;

var PGPGlobalRandomPoolAddKeystroke: function (Event: PGPInt32): PGPUInt32; cdecl;

{PGP65+}
var PGPGlobalRandomPoolMouseMoved: function: PGPUInt32; cdecl;

{PGP65+}
var PGPGlobalRandomPoolAddSystemState: function: PGPError; cdecl;

// 'deprecated' since 6.5
var PGPGlobalRandomPoolAddMouse: function (X: PGPUInt32; Y: PGPUInt32): PGPUInt32; cdecl;

// Extra functions for entropy estimation
var PGPGlobalRandomPoolGetEntropy: function: PGPUInt32; cdecl;
var PGPGlobalRandomPoolGetSize: function: PGPUInt32; cdecl;
var PGPGlobalRandomPoolGetMinimumEntropy: function: PGPUInt32; cdecl;
var PGPGlobalRandomPoolHasMinimumEntropy: function: PGPBoolean; cdecl;

{did this unit load the DLL successfully?}
//var pgpRandomPoolLoaded: boolean = false;
function LoadpgpRandomPool: Boolean; //returns True if API successfully loaded
procedure UnLoadpgpRandomPool;
function pgpRandomPoolLoaded: Boolean; //returns if the API is loaded

implementation

uses
  Windows;

var
  PGPsdkLib      : HModule;

function pgpRandomPoolLoaded: boolean;
begin
  result := PGPsdkLib >= 32;
end;

function LoadPGPRandomPool: boolean;
begin
  result := pgpRandomPoolLoaded;

  // try to load PGP 6 version first, then PGP 5.5 version
  PGPsdkLib := LoadLibrary('pgp_sdk.dll');
  if not pgpRandomPoolLoaded then
    PGPsdkLib := LoadLibrary('pgpsdk.dll');

  if pgpRandomPoolLoaded then
  begin
    result := true;
      @PGPGlobalRandomPoolAddKeystroke      := GetProcAddress(PGPsdkLib,'PGPGlobalRandomPoolAddKeystroke');
      @PGPGlobalRandomPoolMouseMoved        := GetProcAddress(PGPsdkLib,'PGPGlobalRandomPoolMouseMoved');
      @PGPGlobalRandomPoolAddSystemState    := GetProcAddress(PGPsdkLib,'PGPGlobalRandomPoolAddSystemState');
      @PGPGlobalRandomPoolAddMouse          := GetProcAddress(PGPsdkLib,'PGPGlobalRandomPoolAddMouse');
      @PGPGlobalRandomPoolGetEntropy        := GetProcAddress(PGPsdkLib,'PGPGlobalRandomPoolGetEntropy');
      @PGPGlobalRandomPoolGetSize           := GetProcAddress(PGPsdkLib,'PGPGlobalRandomPoolGetSize');
      @PGPGlobalRandomPoolGetMinimumEntropy := GetProcAddress(PGPsdkLib,'PGPGlobalRandomPoolGetMinimumEntropy');
      @PGPGlobalRandomPoolHasMinimumEntropy := GetProcAddress(PGPsdkLib,'PGPGlobalRandomPoolHasMinimumEntropy');
    end;
end;

procedure UnLoadpgpRandomPool;
begin
  if pgpRandomPoolLoaded then
  begin
    if PGPsdkLib <> 0 then
      FreeLibrary(PGPsdkLib);
    PGPsdkLib := 0;
  end;
end;

initialization
  LoadPGPRandomPool;
finalization
  if pgpRandomPoolLoaded then
    UnloadpgpRandomPool;

end.

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us