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
  
/* -*- C -*- 
 * 
 * Cmod header-file acting as a template for the hash classes. 
 */ 
 
DOCSTART() @class cmod_CONCAT_EVAL(PIKE_NAME, _Info) 
 *! 
 *! Internal mixin class, intended to be multiply inherited 
 *! together with HashInfo. 
DOCEND() 
PIKECLASS cmod_CONCAT_EVAL(PIKE_NAME, _Info) 
{ 
  INIT 
    { 
      struct HashInfo_struct *HashInfo 
        = (struct HashInfo_struct *) get_storage(Pike_fp->current_object, 
                                                 HashInfo_program); 
 
      werror(cmod_STRFY_EVAL(PIKE_NAME) "_Info->INIT\n"); 
       
      if (HashInfo && !HashInfo->meta) 
        HashInfo->meta = &cmod_CONCAT_EVAL(nettle_, NETTLE_NAME); 
      else { 
        /* Can't call Pike_error here.  
         * Pike_error("Can't initialize this object.\n"); */ 
        werror(cmod_STRFY_EVAL(PIKE_NAME) "_Info->INIT failed\n"); 
      } 
    } 
} 
 
DOCSTART() @endclass cmod_CONCAT_EVAL(PIKE_NAME, _Info) 
DOCEND() 
 
DOCSTART() @class cmod_CONCAT_EVAL(PIKE_NAME, _State) 
 *! 
 *! State for PIKE_NAME hashing. 
DOCEND() 
PIKECLASS cmod_CONCAT_EVAL(PIKE_NAME, _State) 
{ 
  INHERIT cmod_CONCAT_EVAL(PIKE_NAME, _Info); 
  INHERIT HashState; 
  CVAR struct cmod_CONCAT_EVAL(NETTLE_NAME, _ctx) NETTLE_NAME; 
 
  INIT 
    { 
      struct HashState_struct *instance 
        = (struct HashState_struct *) get_storage(Pike_fp->current_object, 
                                                  HashState_program); 
      werror(cmod_STRFY_EVAL(PIKE_NAME) "_State->INIT\n"); 
 
      assert(instance); 
 
      cmod_CONCAT_EVAL(NETTLE_NAME, _init)(&THIS->NETTLE_NAME);       
      instance->ctx = &THIS->NETTLE_NAME; 
    } 
} 
DOCSTART() @endclass cmod_CONCAT_EVAL(PIKE_NAME, _State) 
DOCEND()