Imported Upstream version 1.15.1
[platform/upstream/krb5.git] / src / plugins / preauth / pkinit / pkinit_kdf_constants.c
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 "pkinit.h"
34
35 /* statically declare OID constants for all three algorithms */
36 const krb5_octet krb5_pkinit_sha1_oid[8] =
37 {0x2B,0x06,0x01,0x05,0x02,0x03,0x06,0x01};
38 const size_t krb5_pkinit_sha1_oid_len = 8;
39 const krb5_octet krb5_pkinit_sha256_oid[8] =
40 {0x2B,0x06,0x01,0x05,0x02,0x03,0x06,0x02};
41 const size_t krb5_pkinit_sha256_oid_len = 8;
42 const krb5_octet krb5_pkinit_sha512_oid [8] =
43 {0x2B,0x06,0x01,0x05,0x02,0x03,0x06,0x03};
44 const size_t krb5_pkinit_sha512_oid_len = 8;
45
46 #define oid_as_data(var, oid_base)                      \
47     const krb5_data var =                               \
48     {0, sizeof oid_base, (char *)oid_base}
49 oid_as_data(sha1_id, krb5_pkinit_sha1_oid);
50 oid_as_data(sha256_id, krb5_pkinit_sha256_oid);
51 oid_as_data(sha512_id, krb5_pkinit_sha512_oid);
52 #undef oid_as_data
53
54 krb5_data const * const supported_kdf_alg_ids[] = {
55     &sha256_id,
56     &sha1_id,
57     &sha512_id,
58     NULL
59 };