Path: blob/main/crypto/krb5/src/tests/asn.1/utility.h
34907 views
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */1/* tests/asn.1/utility.h */2/*3* Copyright (C) 1994 by the Massachusetts Institute of Technology.4* All rights reserved.5*6* Export of this software from the United States of America may7* require a specific license from the United States Government.8* It is the responsibility of any person or organization contemplating9* export to obtain such a license before exporting.10*11* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and12* distribute this software and its documentation for any purpose and13* without fee is hereby granted, provided that the above copyright14* notice appear in all copies and that both that copyright notice and15* this permission notice appear in supporting documentation, and that16* the name of M.I.T. not be used in advertising or publicity pertaining17* to distribution of the software without specific, written prior18* permission. Furthermore if you modify this software you must label19* your software as modified software and not distribute it in such a20* fashion that it might be confused with the original M.I.T. software.21* M.I.T. makes no representations about the suitability of22* this software for any purpose. It is provided "as is" without express23* or implied warranty.24*/2526#ifndef __UTILITY_H__27#define __UTILITY_H__2829#include "k5-int.h"3031/* Aborts on failure. ealloc returns zero-filled memory. */32void *ealloc(size_t size);33char *estrdup(const char *str);3435void asn1_krb5_data_unparse(const krb5_data *code, char **s);36/* modifies *s;37effects Instantiates *s with a string representation of the series38of hex octets in *code. (e.g. "02 02 00 7F") If code==NULL,39the string rep is "<NULL>". If code is empty (it contains no40data or has length <= 0), the string rep is "<EMPTY>".41If *s is non-NULL, then its currently-allocated storage42will be freed prior to the instantiation.43Returns ENOMEM or the string rep cannot be created. */4445void krb5_data_parse(krb5_data *d, const char *s);46/* effects Parses character string *s into krb5_data *d. */4748krb5_error_code krb5_data_hex_parse(krb5_data *d, const char *s);49/* requires *s is the string representation of a sequence of50hexadecimal octets. (e.g. "02 01 00")51effects Parses *s into krb5_data *d. */5253extern krb5int_access acc;54extern void init_access(const char *progname);5556#endif575859