~ubuntu-branches/ubuntu/raring/heimdal/raring

« back to all changes in this revision

Viewing changes to lib/hcrypto/test_engine_dso.c

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2011-07-21 17:40:58 UTC
  • mfrom: (1.1.12 upstream) (2.4.10 experimental)
  • Revision ID: james.westby@ubuntu.com-20110721174058-byiuowgocek307cs
Tags: 1.5~pre2+git20110720-2
Fix dependency on pthreads when building on Linux 3.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
198
198
        int keylen;
199
199
        RSA *rsa;
200
200
        FILE *f;
201
 
        
 
201
 
202
202
        f = fopen(rsa_flag, "rb");
203
203
        if (f == NULL)
204
204
            err(1, "could not open file %s", rsa_flag);
205
 
        
 
205
 
206
206
        size = fread(buf, 1, sizeof(buf), f);
207
207
        if (size == 0)
208
208
            err(1, "failed to read file %s", rsa_flag);
209
209
        if (size == sizeof(buf))
210
210
            err(1, "key too long in file %s!", rsa_flag);
211
211
        fclose(f);
212
 
        
 
212
 
213
213
        p = buf;
214
214
        rsa = d2i_RSAPrivateKey(NULL, &p, size);
215
215
        if (rsa == NULL)
216
216
            err(1, "failed to parse key in file %s", rsa_flag);
217
 
        
 
217
 
218
218
        RSA_set_method(rsa, ENGINE_get_RSA(engine));
219
219
 
220
220
        /*
274
274
            "EE386BFB" "5A899FA5" "AE9F2411" "7C4B1FE6" "49286651" "ECE65381"
275
275
            "FFFFFFFF" "FFFFFFFF";
276
276
        const char *g = "02";
277
 
        
 
277
 
278
278
        /*
279
279
         * Try generated keys
280
280
         */
306
306
 
307
307
            server = DH_new_method(engine);
308
308
            client = DH_new_method(engine);
309
 
        
 
309
 
310
310
            BN_hex2bn(&server->p, p);
311
311
            BN_hex2bn(&client->p, p);
312
312
            BN_hex2bn(&server->g, g);
313
313
            BN_hex2bn(&client->g, g);
314
 
        
 
314
 
315
315
            BN_hex2bn(&client->priv_key, dhtests[i].cpriv);
316
316
            BN_hex2bn(&client->pub_key, dhtests[i].cpub);
317
317
            BN_hex2bn(&server->priv_key, dhtests[i].spriv);
318
318
            BN_hex2bn(&server->pub_key, dhtests[i].spub);
319
319
 
320
320
            dh_test(server, client);
321
 
        
 
321
 
322
322
            DH_free(server);
323
323
            DH_free(client);
324
324
        }