 Timestamp:
 04/16/08 18:38:45 (6 years ago)
 Files:

 1 modified
Legend:
 Unmodified
 Added
 Removed

lang/perl/CryptDHGMP/trunk/GMP.xs
r9570 r9574 13 13 #define DH_PRIVKEY(x) *((x)>priv_key) 14 14 #define DH_PUBKEY(x) *((x)>pub_key) 15 16 #define DH_G_PTR(x) (x)>g 17 #define DH_P_PTR(x) (x)>p 18 #define DH_PRIVKEY_PTR(x) (x)>priv_key 19 #define DH_PUBKEY_PTR(x) (x)>pub_key 15 20 16 21 static … … 57 62 CODE: 58 63 Newxz(dh, 1, DH_gmp_t); 59 Newxz( dh>p,1, mpz_t);60 Newxz( dh>g,1, mpz_t);61 Newxz( dh>priv_key, 1, mpz_t);62 Newxz( dh>pub_key,1, mpz_t);64 Newxz(DH_P_PTR(dh), 1, mpz_t); 65 Newxz(DH_G_PTR(dh), 1, mpz_t); 66 Newxz(DH_PRIVKEY_PTR(dh), 1, mpz_t); 67 Newxz(DH_PUBKEY_PTR(dh), 1, mpz_t); 63 68 64 69 mpz_init(DH_PUBKEY(dh)); … … 86 91 mpz_sub_ui(max, DH_P(dh), 1); 87 92 do { 88 DH_mpz_rand_set( &(DH_PRIVKEY(dh)), mpz_sizeinbase(DH_P(dh), 2));93 DH_mpz_rand_set(DH_PRIVKEY_PTR(dh), mpz_sizeinbase(DH_P(dh), 2)); 89 94 } while ( mpz_cmp(DH_PRIVKEY(dh), max) > 0 ); 90 95 } … … 113 118 DH_gmp_t *dh; 114 119 CODE: 115 RETVAL = DH_mpz2sv_str( &( DH_PRIVKEY(dh)));120 RETVAL = DH_mpz2sv_str(DH_PRIVKEY_PTR(dh)); 116 121 OUTPUT: 117 122 RETVAL … … 121 126 DH_gmp_t *dh; 122 127 CODE: 123 RETVAL = DH_mpz2sv_str( &( DH_PUBKEY(dh)));128 RETVAL = DH_mpz2sv_str(DH_PUBKEY_PTR(dh)); 124 129 OUTPUT: 125 130 RETVAL … … 131 136 STRLEN n_a; 132 137 CODE: 133 RETVAL = DH_mpz2sv_str( &( DH_G(dh)));138 RETVAL = DH_mpz2sv_str(DH_G_PTR(dh)); 134 139 if (items > 1) { 135 140 mpz_init_set_str( DH_G(dh), (char *) SvPV(ST(1), n_a), 0 ); … … 144 149 STRLEN n_a; 145 150 CODE: 146 RETVAL = DH_mpz2sv_str( &( DH_P(dh)));151 RETVAL = DH_mpz2sv_str(DH_P_PTR(dh)); 147 152 if (items > 1) { 148 153 mpz_init_set_str( DH_P(dh), (char *) SvPV(ST(1), n_a), 0 ); … … 160 165 mpz_clear(DH_PRIVKEY(dh)); 161 166 162 Safefree( dh>p);163 Safefree( dh>g);164 Safefree( dh>priv_key);165 Safefree( dh>pub_key);167 Safefree(DH_P_PTR(dh)); 168 Safefree(DH_G_PTR(dh)); 169 Safefree(DH_PRIVKEY_PTR(dh)); 170 Safefree(DH_PUBKEY_PTR(dh)); 166 171 167 172 Safefree(dh);