elfsign.h revision 0dadacbf99d149ded48ff1ca271f5cdf159e6871
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_CRYPTO_ELFSIGN_H
#define _SYS_CRYPTO_ELFSIGN_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
*/
/*
* Project Private structures and types used for communication between kcfd
* and KCF over the door.
*/
typedef enum ELFsign_status_e {
#define KCF_KCFD_VERSION1 1
#define SIG_MAX_LENGTH 1024
#define ELF_SIGNATURE_SECTION ".SUNW_signature"
#define ELFSIGN_CRYPTO "Solaris Cryptographic Framework"
#define USAGELIMITED "OU=UsageLimited"
#define ESA ".esa"
#define ESA_LEN sizeof (".esa")
typedef struct kcf_door_arg_s {
short da_version;
union {
struct kcf_door_result_s { /* For response */
} result;
} da_u;
typedef uint32_t filesig_vers_t;
/*
* File Signature Structure
* Applicable to ELF and other file formats
*/
struct filesignatures {
union {
char filesig_data[1];
struct filesig { /* one of these for each signature */
union {
struct filesig_version1 {
char filesig_v1_data[1];
} filesig_v1;
struct filesig_version3 {
char filesig_v3_data[1];
} filesig_v3;
} _u2;
} filesig_sig;
} _u1;
};
(-sizeof (uint64_t)))
#define FILESIG_UNKNOWN 0 /* unrecognized version */
#ifndef _KERNEL
#define _PATH_KCFD_DOOR "/var/run/kcfd_door"
#define ES_FMT_RSA_MD5_SHA1 "rsa_md5_sha1"
#define ES_FMT_RSA_SHA1 "rsa_sha1"
enum ES_ACTION {
};
#define ES_ACTISUPDATE(a) ((a) >= ES_UPDATE)
/*
* ELF signature handling
*/
struct ELFsign_sig_info {
char *esi_format;
char *esi_signer;
};
extern ELFsign_status_t elfsign_begin(const char *,
struct ELFsign_sig_info **esipp);
extern char const *elfsign_strerror(ELFsign_status_t);
struct ELFsign_sig_info **esipp);
extern void elfsign_sig_info_free(struct ELFsign_sig_info *);
/*
* ELF "Certificate Library"
*/
extern const char _PATH_ELFSIGN_CERTS[];
#define ELFCERT_MAX_DN_LEN 255
const char *path);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_CRYPTO_ELFSIGN_H */