summaryrefslogtreecommitdiff
path: root/lib/dns/sec/dnssafe/ahencryp.h
blob: d2cb28c48f347a3376b788ec29f0d757ba6fe480 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* Copyright (C) RSA Data Security, Inc. created 1993, 1996.  This is an
   unpublished work protected as such under copyright law.  This work
   contains proprietary, confidential, and trade secret information of
   RSA Data Security, Inc.  Use, disclosure or reproduction without the
   express written authorization of RSA Data Security, Inc. is
   prohibited.
 */

#ifndef DNSSAFE_AHENCRYP_H
#define DNSSAFE_AHENCRYP_H 1

#include "btypechk.h"

/* In C++:
class AHEncryptDecrypt : public B_TypeCheck {
  AHEncryptDecrypt ();
  virtual ~AHEncryptDecrypt () = 0;
  
  virtual int getBlockLen (unsigned int *) = 0;
  virtual int encryptInit
    (B_Key *, B_ALGORITHM_CHOOSER, A_SURRENDER_CTX *) = 0;
  virtual int decryptInit
    (B_Key *, B_ALGORITHM_CHOOSER, A_SURRENDER_CTX *) = 0;
  virtual int encryptUpdate
    (unsigned char *, unsigned int *, unsigned int, unsigned char *,
     unsigned int, B_Algorithm *, A_SURRENDER_CTX *) = 0;
  virtual int decryptUpdate
    (unsigned char *, unsigned int *, unsigned int, unsigned char *,
     unsigned int, B_Algorithm *, A_SURRENDER_CTX *) = 0;
  virtual int encryptFinal
    (unsigned char *, unsigned int *, unsigned int, B_Algorithm *,
     A_SURRENDER_CTX *) = 0;
  virtual int decryptFinal
    (unsigned char *, unsigned int *, unsigned int, B_Algorithm *,
     A_SURRENDER_CTX *) = 0;
};
 */

/* Use the THIS_ENCRYPT_DECRYPT macro to define the type of object in the
     virtual function prototype.  It defaults to the most base class, but
     derived modules may define the macro to a more derived class before
     including this header file.
 */
#ifndef THIS_ENCRYPT_DECRYPT
#define THIS_ENCRYPT_DECRYPT struct AHEncryptDecrypt
#endif

struct AHEncryptDecrypt;

typedef struct {
  void (*Destructor) PROTO_LIST ((THIS_ENCRYPT_DECRYPT *));
  int (*GetBlockLen) PROTO_LIST ((THIS_ENCRYPT_DECRYPT *, unsigned int *));
  int (*EncryptInit) PROTO_LIST
    ((THIS_ENCRYPT_DECRYPT *, B_Key *, B_ALGORITHM_CHOOSER,
      A_SURRENDER_CTX *));
  int (*DecryptInit) PROTO_LIST
    ((THIS_ENCRYPT_DECRYPT *, B_Key *, B_ALGORITHM_CHOOSER,
      A_SURRENDER_CTX *));
  int (*EncryptUpdate) PROTO_LIST
    ((THIS_ENCRYPT_DECRYPT *, unsigned char *, unsigned int *, unsigned int,
      unsigned char *, unsigned int, B_Algorithm *, A_SURRENDER_CTX *));
  int (*DecryptUpdate) PROTO_LIST
    ((THIS_ENCRYPT_DECRYPT *, unsigned char *, unsigned int *, unsigned int,
      unsigned char *, unsigned int, B_Algorithm *, A_SURRENDER_CTX *));
  int (*EncryptFinal) PROTO_LIST
    ((THIS_ENCRYPT_DECRYPT *, unsigned char *, unsigned int *, unsigned int,
      B_Algorithm *, A_SURRENDER_CTX *));
  int (*DecryptFinal) PROTO_LIST
    ((THIS_ENCRYPT_DECRYPT *, unsigned char *, unsigned int *, unsigned int,
      B_Algorithm *, A_SURRENDER_CTX *));
} AHEncryptDecryptVTable;

typedef struct AHEncryptDecrypt {
  B_TypeCheck typeCheck;                                        /* inherited */
  AHEncryptDecryptVTable *vTable;                            /* pure virtual */
} AHEncryptDecrypt;

/* The constructor does not set the vTable since this is a pure base class.
 */
void AHEncryptDecryptConstructor PROTO_LIST ((AHEncryptDecrypt *));
/* No destructor because it is pure virtual. Also, do not call destructor
     for B_TypeCheck, since this will just re-invoke this virtual
     destructor. */

#endif /* DNSSAFE_AHENCRYP_H */