Browse Source

* Added some constants and encoding functions.

git-svn-id: trunk@25708 -
michael 12 years ago
parent
commit
eeb3d8236a
1 changed files with 233 additions and 0 deletions
  1. 233 0
      packages/openssl/src/openssl.pas

+ 233 - 0
packages/openssl/src/openssl.pas

@@ -604,6 +604,51 @@ const
   BIO_C_SET_EX_ARG		= 153;
   BIO_C_SET_EX_ARG		= 153;
   BIO_C_GET_EX_ARG		= 154;
   BIO_C_GET_EX_ARG		= 154;
 
 
+  BIO_CTRL_RESET  =    1  ; { opt - rewind/zero etc }
+  BIO_CTRL_EOF    =    2  ; { opt - are we at the eof }
+  BIO_CTRL_INFO   =     3  ; { opt - extra tit-bits }
+  BIO_CTRL_SET    =     4  ; { man - set the 'IO' type }
+  BIO_CTRL_GET    =     5  ; { man - get the 'IO' type }
+  BIO_CTRL_PUSH   =     6  ; { opt - internal, used to signify change }
+  BIO_CTRL_POP    =     7  ; { opt - internal, used to signify change }
+  BIO_CTRL_GET_CLOSE =  8  ; { man - set the 'close' on free }
+  BIO_CTRL_SET_CLOSE =  9  ; { man - set the 'close' on free }
+  BIO_CTRL_PENDING   =  10  ; { opt - is their more data buffered }
+  BIO_CTRL_FLUSH     =  11  ; { opt - 'flush' buffered output }
+  BIO_CTRL_DUP       =  12  ; { man - extra stuff for 'duped' BIO }
+  BIO_CTRL_WPENDING  =  13  ; { opt - number of bytes still to write }
+  BIO_CTRL_SET_CALLBACK   = 14  ; { opt - set callback function }
+  BIO_CTRL_GET_CALLBACK   = 15  ; { opt - set callback function }
+  BIO_CTRL_SET_FILENAME   = 30  ; { BIO_s_file special }
+  BIO_CTRL_DGRAM_CONNECT  = 31  ; { BIO dgram special }
+  BIO_CTRL_DGRAM_SET_CONNECTED      = 32  ; { allow for an externally }
+  BIO_CTRL_DGRAM_SET_RECV_TIMEOUT   = 33 ; { setsockopt, essentially }
+  BIO_CTRL_DGRAM_GET_RECV_TIMEOUT   = 34 ; { getsockopt, essentially }
+  BIO_CTRL_DGRAM_SET_SEND_TIMEOUT   = 35 ; { setsockopt, essentially }
+  BIO_CTRL_DGRAM_GET_SEND_TIMEOUT   = 36 ; { getsockopt, essentially }
+  BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP = 37 ; { flag whether the last }
+  BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP = 38 ; { I/O operation tiemd out }
+  BIO_CTRL_DGRAM_MTU_DISCOVER       = 39 ; { set DF bit on egress packets }
+  BIO_CTRL_DGRAM_QUERY_MTU          = 40 ; { as kernel for current MTU }
+  BIO_CTRL_DGRAM_GET_FALLBACK_MTU   = 47 ;
+  BIO_CTRL_DGRAM_GET_MTU            = 41 ; { get cached value for MTU }
+  BIO_CTRL_DGRAM_SET_MTU            = 42 ; { set cached value for }
+  BIO_CTRL_DGRAM_MTU_EXCEEDED       = 43 ; { check whether the MTU }
+  BIO_CTRL_DGRAM_GET_PEER           = 46 ;
+  BIO_CTRL_DGRAM_SET_PEER           = 44 ; { Destination for the data }
+  BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT   = 45 ; { Next DTLS handshake timeout to }
+  BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE = 50;
+  BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY     = 51;
+  BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY    = 52;
+  BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD    = 53;
+  BIO_CTRL_DGRAM_SCTP_GET_SNDINFO      = 60;
+  BIO_CTRL_DGRAM_SCTP_SET_SNDINFO      = 61;
+  BIO_CTRL_DGRAM_SCTP_GET_RCVINFO      = 62;
+  BIO_CTRL_DGRAM_SCTP_SET_RCVINFO      = 63;
+  BIO_CTRL_DGRAM_SCTP_GET_PRINFO       = 64;
+  BIO_CTRL_DGRAM_SCTP_SET_PRINFO       = 65;
+  BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN    = 70;
+
 //DES modes
 //DES modes
   DES_ENCRYPT = 1;
   DES_ENCRYPT = 1;
   DES_DECRYPT = 0;
   DES_DECRYPT = 0;
@@ -779,6 +824,23 @@ var
   function SSLeay_version(t: cint): PChar;
   function SSLeay_version(t: cint): PChar;
 
 
   // EVP Functions - evp.h
   // EVP Functions - evp.h
+  function EVP_des_ede3_cbc : PEVP_CIPHER;
+  Function EVP_enc_null : PEVP_CIPHER;
+  Function EVP_rc2_cbc : PEVP_CIPHER;
+  Function EVP_rc2_40_cbc : PEVP_CIPHER;
+  Function EVP_rc2_64_cbc : PEVP_CIPHER;
+  Function EVP_rc4 : PEVP_CIPHER;
+  Function EVP_rc4_40 : PEVP_CIPHER;
+  Function EVP_des_cbc : PEVP_CIPHER;
+  Function EVP_aes_128_cbc : PEVP_CIPHER;
+  Function EVP_aes_192_cbc : PEVP_CIPHER;
+  Function EVP_aes_256_cbc : PEVP_CIPHER;
+  Function EVP_aes_128_cfb8 : PEVP_CIPHER;
+  Function EVP_aes_192_cfb8 : PEVP_CIPHER;
+  Function EVP_aes_256_cfb8 : PEVP_CIPHER;
+  Function EVP_camellia_128_cbc : PEVP_CIPHER;
+  Function EVP_camellia_192_cbc : PEVP_CIPHER;
+  Function EVP_camellia_256_cbc : PEVP_CIPHER;
 
 
   procedure OpenSSL_add_all_algorithms;
   procedure OpenSSL_add_all_algorithms;
   procedure OpenSSL_add_all_ciphers;
   procedure OpenSSL_add_all_ciphers;
@@ -1022,6 +1084,7 @@ type
   TEVP_VerifyFinal = function(ctx: pEVP_MD_CTX; sigbuf: pointer;
   TEVP_VerifyFinal = function(ctx: pEVP_MD_CTX; sigbuf: pointer;
     siglen: cardinal; pkey: pEVP_PKEY): integer;  cdecl;
     siglen: cardinal; pkey: pEVP_PKEY): integer;  cdecl;
   //
   //
+  TEVP_CIPHERFunction = function() : PEVP_CIPHER; cdecl;
   TEVP_get_cipherbyname = function(const name: PChar): PEVP_CIPHER; cdecl;
   TEVP_get_cipherbyname = function(const name: PChar): PEVP_CIPHER; cdecl;
   TEVP_get_digestbyname = function(const name: PChar): PEVP_MD; cdecl;
   TEVP_get_digestbyname = function(const name: PChar): PEVP_MD; cdecl;
   //
   //
@@ -1149,6 +1212,23 @@ var
   _Asn1UtctimeFree: TAsn1UtctimeFree = nil;
   _Asn1UtctimeFree: TAsn1UtctimeFree = nil;
   _i2dX509bio: Ti2dX509bio = nil;
   _i2dX509bio: Ti2dX509bio = nil;
   _i2dPrivateKeyBio: Ti2dPrivateKeyBio = nil;
   _i2dPrivateKeyBio: Ti2dPrivateKeyBio = nil;
+  _EVP_enc_null : TEVP_CIPHERFunction = nil;
+  _EVP_rc2_cbc : TEVP_CIPHERFunction = nil;
+  _EVP_rc2_40_cbc : TEVP_CIPHERFunction = nil;
+  _EVP_rc2_64_cbc : TEVP_CIPHERFunction = nil;
+  _EVP_rc4 : TEVP_CIPHERFunction = nil;
+  _EVP_rc4_40 : TEVP_CIPHERFunction = nil;
+  _EVP_des_cbc : TEVP_CIPHERFunction = nil;
+  _EVP_des_ede3_cbc : TEVP_CIPHERFunction = nil;
+  _EVP_aes_128_cbc : TEVP_CIPHERFunction = nil;
+  _EVP_aes_192_cbc : TEVP_CIPHERFunction = nil;
+  _EVP_aes_256_cbc : TEVP_CIPHERFunction = nil;
+  _EVP_aes_128_cfb8 : TEVP_CIPHERFunction = nil;
+  _EVP_aes_192_cfb8 : TEVP_CIPHERFunction = nil;
+  _EVP_aes_256_cfb8 : TEVP_CIPHERFunction = nil;
+  _EVP_camellia_128_cbc : TEVP_CIPHERFunction = nil;
+  _EVP_camellia_192_cbc : TEVP_CIPHERFunction = nil;
+  _EVP_camellia_256_cbc : TEVP_CIPHERFunction = nil;
 
 
   // 3DES functions
   // 3DES functions
   _DESsetoddparity: TDESsetoddparity = nil;
   _DESsetoddparity: TDESsetoddparity = nil;
@@ -2259,6 +2339,142 @@ end;
 
 
 // EVP Functions
 // EVP Functions
 
 
+function EVP_des_ede3_cbc: PEVP_CIPHER;
+begin
+  if InitlibeaInterface and Assigned(_EVP_des_ede3_cbc) then
+    Result := _EVP_des_ede3_cbc()
+  else
+    Result := Nil;
+end;
+
+function EVP_enc_null: PEVP_CIPHER;
+begin
+  if InitlibeaInterface and Assigned(_EVP_enc_null) then
+    Result := _EVP_enc_null()
+  else
+    Result := Nil;
+end;
+
+function EVP_rc2_cbc: PEVP_CIPHER;
+begin
+  if InitlibeaInterface and Assigned(_EVP_rc2_cbc) then
+    Result := _EVP_rc2_cbc()
+  else
+    Result := Nil;
+end;
+
+function EVP_rc2_40_cbc: PEVP_CIPHER;
+begin
+  if InitlibeaInterface and Assigned(_EVP_rc2_40_cbc) then
+    Result := _EVP_rc2_40_cbc()
+  else
+    Result := Nil;
+end;
+
+function EVP_rc2_64_cbc: PEVP_CIPHER;
+begin
+  if InitlibeaInterface and Assigned(_EVP_rc2_64_cbc) then
+    Result := _EVP_rc2_64_cbc()
+  else
+    Result := Nil;
+end;
+
+function EVP_rc4: PEVP_CIPHER;
+begin
+  if InitlibeaInterface and Assigned(_EVP_rc4) then
+    Result := _EVP_rc4()
+  else
+    Result := Nil;
+end;
+
+function EVP_rc4_40: PEVP_CIPHER;
+begin
+  if InitlibeaInterface and Assigned(_EVP_rc4_40) then
+    Result := _EVP_rc4_40()
+  else
+    Result := Nil;
+end;
+
+function EVP_des_cbc: PEVP_CIPHER;
+begin
+  if InitlibeaInterface and Assigned(_EVP_des_cbc) then
+    Result := _EVP_des_cbc()
+  else
+    Result := Nil;
+end;
+
+function EVP_aes_128_cbc: PEVP_CIPHER;
+begin
+  if InitlibeaInterface and Assigned(_EVP_aes_128_cbc) then
+    Result := _EVP_aes_128_cbc()
+  else
+    Result := Nil;
+end;
+
+function EVP_aes_192_cbc: PEVP_CIPHER;
+begin
+  if InitlibeaInterface and Assigned(_EVP_aes_192_cbc) then
+    Result := _EVP_aes_192_cbc()
+  else
+    Result := Nil;
+end;
+
+function EVP_aes_256_cbc: PEVP_CIPHER;
+begin
+  if InitlibeaInterface and Assigned(_EVP_aes_256_cbc) then
+    Result := _EVP_aes_256_cbc()
+  else
+    Result := Nil;
+end;
+
+function EVP_aes_128_cfb8: PEVP_CIPHER;
+begin
+  if InitlibeaInterface and Assigned(_EVP_aes_128_cfb8) then
+    Result := _EVP_aes_128_cfb8()
+  else
+    Result := Nil;
+end;
+
+function EVP_aes_192_cfb8: PEVP_CIPHER;
+begin
+  if InitlibeaInterface and Assigned(_EVP_aes_192_cfb8) then
+    Result := _EVP_aes_192_cfb8()
+  else
+    Result := Nil;
+end;
+
+function EVP_aes_256_cfb8: PEVP_CIPHER;
+begin
+  if InitlibeaInterface and Assigned(_EVP_aes_256_cfb8) then
+    Result := _EVP_aes_256_cfb8()
+  else
+    Result := Nil;
+end;
+
+function EVP_camellia_128_cbc: PEVP_CIPHER;
+begin
+  if InitlibeaInterface and Assigned(_EVP_camellia_128_cbc) then
+    Result := _EVP_camellia_128_cbc()
+  else
+    Result := Nil;
+end;
+
+function EVP_camellia_192_cbc: PEVP_CIPHER;
+begin
+  if InitlibeaInterface and Assigned(_EVP_camellia_192_cbc) then
+    Result := _EVP_camellia_192_cbc()
+  else
+    Result := Nil;
+end;
+
+function EVP_camellia_256_cbc: PEVP_CIPHER;
+begin
+  if InitlibeaInterface and Assigned(_EVP_camellia_256_cbc) then
+    Result := _EVP_camellia_256_cbc()
+  else
+    Result := Nil;
+end;
+
 procedure OpenSSL_add_all_algorithms;
 procedure OpenSSL_add_all_algorithms;
 begin
 begin
   if InitlibeaInterface and Assigned(_OpenSSL_add_all_algorithms) then
   if InitlibeaInterface and Assigned(_OpenSSL_add_all_algorithms) then
@@ -2701,6 +2917,23 @@ begin
         _Asn1UtctimeFree := GetProcAddr(SSLUtilHandle, 'ASN1_UTCTIME_free', AVerboseLoading);
         _Asn1UtctimeFree := GetProcAddr(SSLUtilHandle, 'ASN1_UTCTIME_free', AVerboseLoading);
         _i2dX509bio := GetProcAddr(SSLUtilHandle, 'i2d_X509_bio', AVerboseLoading);
         _i2dX509bio := GetProcAddr(SSLUtilHandle, 'i2d_X509_bio', AVerboseLoading);
         _i2dPrivateKeyBio := GetProcAddr(SSLUtilHandle, 'i2d_PrivateKey_bio', AVerboseLoading);
         _i2dPrivateKeyBio := GetProcAddr(SSLUtilHandle, 'i2d_PrivateKey_bio', AVerboseLoading);
+        _EVP_enc_null := GetProcAddr(SSLUtilHandle, 'EVP_enc_null', AVerboseLoading);;
+        _EVP_rc2_cbc := GetProcAddr(SSLUtilHandle, 'EVP_rc2_cbc', AVerboseLoading);;
+        _EVP_rc2_40_cbc := GetProcAddr(SSLUtilHandle, 'EVP_rc2_40_cbc', AVerboseLoading);;
+        _EVP_rc2_64_cbc := GetProcAddr(SSLUtilHandle, 'EVP_rc2_64_cbc', AVerboseLoading);;
+        _EVP_rc4 := GetProcAddr(SSLUtilHandle, 'EVP_rc4', AVerboseLoading);;
+        _EVP_rc4_40 := GetProcAddr(SSLUtilHandle, 'EVP_rc4_40', AVerboseLoading);;
+        _EVP_des_cbc := GetProcAddr(SSLUtilHandle, 'EVP_des_cbc', AVerboseLoading);;
+        _EVP_des_ede3_cbc := GetProcAddr(SSLUtilHandle, 'EVP_des_ede3_cbc', AVerboseLoading);;
+        _EVP_aes_128_cbc := GetProcAddr(SSLUtilHandle, 'EVP_aes_128_cbc', AVerboseLoading);;
+        _EVP_aes_192_cbc := GetProcAddr(SSLUtilHandle, 'EVP_aes_192_cbc', AVerboseLoading);;
+        _EVP_aes_256_cbc := GetProcAddr(SSLUtilHandle, 'EVP_aes_256_cbc', AVerboseLoading);;
+        _EVP_aes_128_cfb8 := GetProcAddr(SSLUtilHandle, 'EVP_aes_128_cfb8', AVerboseLoading);;
+        _EVP_aes_192_cfb8 := GetProcAddr(SSLUtilHandle, 'EVP_aes_192_cfb8', AVerboseLoading);;
+        _EVP_aes_256_cfb8 := GetProcAddr(SSLUtilHandle, 'EVP_aes_256_cfb8', AVerboseLoading);;
+        _EVP_camellia_128_cbc := GetProcAddr(SSLUtilHandle, 'EVP_camellia_128_cbc', AVerboseLoading);;
+        _EVP_camellia_192_cbc := GetProcAddr(SSLUtilHandle, 'EVP_camellia_192_cbc', AVerboseLoading);;
+        _EVP_camellia_256_cbc := GetProcAddr(SSLUtilHandle, 'EVP_camellia_256_cbc', AVerboseLoading);;
 
 
         // 3DES functions
         // 3DES functions
         _DESsetoddparity := GetProcAddr(SSLUtilHandle, 'des_set_odd_parity', AVerboseLoading);
         _DESsetoddparity := GetProcAddr(SSLUtilHandle, 'des_set_odd_parity', AVerboseLoading);