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

« back to all changes in this revision

Viewing changes to lib/krb5/crypto-pk.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:
110
110
{
111
111
    KRB5PrincipalName pn;
112
112
    krb5_error_code ret;
113
 
    size_t size;
 
113
    size_t size = 0;
114
114
 
115
115
    pn.principalName = p->name;
116
116
    pn.realm = p->realm;
143
143
    PkinitSuppPubInfo pubinfo;
144
144
    krb5_error_code ret;
145
145
    krb5_data pub;
146
 
    size_t size;
 
146
    size_t size = 0;
147
147
 
148
148
    krb5_data_zero(other);
149
149
    memset(&otherinfo, 0, sizeof(otherinfo));
192
192
    return 0;
193
193
}
194
194
 
 
195
 
 
196
 
195
197
krb5_error_code
196
198
_krb5_pk_kdf(krb5_context context,
197
199
             const struct AlgorithmIdentifier *ai,
211
213
    size_t keylen, offset;
212
214
    uint32_t counter;
213
215
    unsigned char *keydata;
214
 
    unsigned char shaoutput[SHA_DIGEST_LENGTH];
 
216
    unsigned char shaoutput[SHA512_DIGEST_LENGTH];
 
217
    const EVP_MD *md;
215
218
    EVP_MD_CTX *m;
216
219
 
217
 
    if (der_heim_oid_cmp(&asn1_oid_id_pkinit_kdf_ah_sha1, &ai->algorithm) != 0) {
 
220
    if (der_heim_oid_cmp(&asn1_oid_id_pkinit_kdf_ah_sha1, &ai->algorithm) == 0) {
 
221
        md = EVP_sha1();
 
222
    } else if (der_heim_oid_cmp(&asn1_oid_id_pkinit_kdf_ah_sha256, &ai->algorithm) == 0) {
 
223
        md = EVP_sha256();
 
224
    } else if (der_heim_oid_cmp(&asn1_oid_id_pkinit_kdf_ah_sha512, &ai->algorithm) == 0) {
 
225
        md = EVP_sha512();
 
226
    } else {
218
227
        krb5_set_error_message(context, KRB5_PROG_ETYPE_NOSUPP,
219
228
                               N_("KDF not supported", ""));
220
229
        return KRB5_PROG_ETYPE_NOSUPP;
264
273
    do {
265
274
        unsigned char cdata[4];
266
275
 
267
 
        EVP_DigestInit_ex(m, EVP_sha1(), NULL);
 
276
        EVP_DigestInit_ex(m, md, NULL);
268
277
        _krb5_put_int(cdata, counter, 4);
269
278
        EVP_DigestUpdate(m, cdata, 4);
270
279
        EVP_DigestUpdate(m, dhdata, dhsize);
274
283
 
275
284
        memcpy((unsigned char *)keydata + offset,
276
285
               shaoutput,
277
 
               min(keylen - offset, sizeof(shaoutput)));
 
286
               min(keylen - offset, EVP_MD_CTX_size(m)));
278
287
 
279
 
        offset += sizeof(shaoutput);
 
288
        offset += EVP_MD_CTX_size(m);
280
289
        counter++;
281
290
    } while(offset < keylen);
282
291
    memset(shaoutput, 0, sizeof(shaoutput));