~ubuntu-branches/ubuntu/trusty/opendkim/trusty

« back to all changes in this revision

Viewing changes to libopendkim/dkim.c

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2012-07-15 00:04:24 UTC
  • mfrom: (1.2.17) (3.2.10 experimental)
  • Revision ID: package-import@ubuntu.com-20120715000424-mp65oxojq6x11uzb
Tags: 2.6.4-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1277
1277
*/
1278
1278
 
1279
1279
static _Bool
1280
 
dkim_key_hashesok(u_char *hashlist)
 
1280
dkim_key_hashesok(DKIM_LIB *lib, u_char *hashlist)
1281
1281
{
1282
1282
        u_char *x, *y;
1283
1283
        u_char tmp[BUFRSZ + 1];
1284
1284
 
 
1285
        assert(lib != NULL);
 
1286
 
1285
1287
        if (hashlist == NULL)
1286
1288
                return TRUE;
1287
1289
 
1295
1297
                {
1296
1298
                        if (x != NULL)
1297
1299
                        {
 
1300
                                int hashcode;
 
1301
 
1298
1302
                                strlcpy((char *) tmp, (char *) x, sizeof tmp);
1299
1303
                                tmp[y - x] = '\0';
1300
 
                                if (dkim_name_to_code(hashes,
1301
 
                                                      (char *) tmp) != -1)
 
1304
 
 
1305
                                hashcode = dkim_name_to_code(hashes,
 
1306
                                                             (char *) tmp);
 
1307
 
 
1308
                                if (hashcode != -1 &&
 
1309
                                    (hashcode != DKIM_HASHTYPE_SHA256 ||
 
1310
                                     dkim_libfeature(lib, DKIM_FEATURE_SHA256)))
1302
1311
                                        return TRUE;
1303
1312
                        }
1304
1313
 
3025
3034
 
3026
3035
        /* then make sure the hash type is something we can handle */
3027
3036
        p = dkim_param_get(set, (u_char *) "h");
3028
 
        if (!dkim_key_hashesok(p))
 
3037
        if (!dkim_key_hashesok(dkim->dkim_libhandle, p))
3029
3038
        {
3030
3039
                dkim_error(dkim, "unknown hash '%s'", p);
3031
3040
                sig->sig_error = DKIM_SIGERROR_KEYUNKNOWNHASH;