~ubuntu-branches/ubuntu/precise/krb5/precise-updates

« back to all changes in this revision

Viewing changes to src/plugins/preauth/pkinit/pkinit_kdf_constants.c

  • Committer: Package Import Robot
  • Author(s): Sam Hartman
  • Date: 2011-12-01 19:34:41 UTC
  • mfrom: (28.1.14 sid)
  • Revision ID: package-import@ubuntu.com-20111201193441-9tipg3aru1jsidyv
Tags: 1.10+dfsg~alpha1-6
* Fix segfault with unknown hostnames in krb5_sname_to_principal,
  Closes: #650671
* Indicate that this library breaks libsmbclient versions that depend on
  krb5_locate_kdc, Closes: #650603, #650611

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
 
2
/* plugins/preauth/pkinit/pkinit_kdf_constants.c */
 
3
/*
 
4
 * Copyright (C) 2011 by the Massachusetts Institute of Technology.
 
5
 * All rights reserved.
 
6
 *
 
7
 * Export of this software from the United States of America may
 
8
 *   require a specific license from the United States Government.
 
9
 *   It is the responsibility of any person or organization contemplating
 
10
 *   export to obtain such a license before exporting.
 
11
 *
 
12
 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
 
13
 * distribute this software and its documentation for any purpose and
 
14
 * without fee is hereby granted, provided that the above copyright
 
15
 * notice appear in all copies and that both that copyright notice and
 
16
 * this permission notice appear in supporting documentation, and that
 
17
 * the name of M.I.T. not be used in advertising or publicity pertaining
 
18
 * to distribution of the software without specific, written prior
 
19
 * permission.  Furthermore if you modify this software you must label
 
20
 * your software as modified software and not distribute it in such a
 
21
 * fashion that it might be confused with the original M.I.T. software.
 
22
 * M.I.T. makes no representations about the suitability of
 
23
 * this software for any purpose.  It is provided "as is" without express
 
24
 * or implied warranty.
 
25
 */
 
26
 
 
27
/*
 
28
 * pkinit_kdf_test.c -- Structures and constants for implementation of
 
29
 * pkinit algorithm agility.  Includes definitions of algorithm identifiers
 
30
 * for SHA-1, SHA-256 and SHA-512.
 
31
 */
 
32
 
 
33
#include <errno.h>
 
34
#include <string.h>
 
35
#include <stdio.h>
 
36
#include <stdlib.h>
 
37
#include <dlfcn.h>
 
38
#include <unistd.h>
 
39
#include <dirent.h>
 
40
 
 
41
#include "k5-platform.h"
 
42
#include "krb5.h"
 
43
#include "k5-int-pkinit.h"
 
44
 
 
45
#include "pkinit.h"
 
46
#include "pkinit_crypto.h"
 
47
 
 
48
/* statically declare OID constants for all three algorithms */
 
49
const krb5_octet krb5_pkinit_sha1_oid[8] =
 
50
{0x2B,0x06,0x01,0x05,0x02,0x03,0x06,0x01};
 
51
const size_t krb5_pkinit_sha1_oid_len = 8;
 
52
const krb5_octet krb5_pkinit_sha256_oid[8] =
 
53
{0x2B,0x06,0x01,0x05,0x02,0x03,0x06,0x02};
 
54
const size_t krb5_pkinit_sha256_oid_len = 8;
 
55
const krb5_octet krb5_pkinit_sha512_oid [8] =
 
56
{0x2B,0x06,0x01,0x05,0x02,0x03,0x06,0x03};
 
57
const size_t krb5_pkinit_sha512_oid_len = 8;
 
58
 
 
59
#define oid_as_data(var, oid_base)                      \
 
60
    const krb5_octet_data var =                         \
 
61
    {0, sizeof oid_base, (krb5_octet *) oid_base}
 
62
oid_as_data(sha1_id, krb5_pkinit_sha1_oid);
 
63
oid_as_data(sha256_id, krb5_pkinit_sha256_oid);
 
64
oid_as_data(sha512_id, krb5_pkinit_sha512_oid);
 
65
#undef oid_as_data
 
66
 
 
67
const krb5_octet_data const *supported_kdf_alg_ids[] = {
 
68
    &sha256_id,
 
69
    &sha1_id,
 
70
    &sha512_id,
 
71
    NULL
 
72
};