Blame src/include/k5-base64.h

Packit fd8b60
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
Packit fd8b60
/* include/k5-base64.h - base64 declarations */
Packit fd8b60
/*
Packit fd8b60
 * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
Packit fd8b60
 * (Royal Institute of Technology, Stockholm, Sweden).
Packit fd8b60
 * All rights reserved.
Packit fd8b60
 *
Packit fd8b60
 * Redistribution and use in source and binary forms, with or without
Packit fd8b60
 * modification, are permitted provided that the following conditions
Packit fd8b60
 * are met:
Packit fd8b60
 *
Packit fd8b60
 * 1. Redistributions of source code must retain the above copyright
Packit fd8b60
 *    notice, this list of conditions and the following disclaimer.
Packit fd8b60
 *
Packit fd8b60
 * 2. Redistributions in binary form must reproduce the above copyright
Packit fd8b60
 *    notice, this list of conditions and the following disclaimer in the
Packit fd8b60
 *    documentation and/or other materials provided with the distribution.
Packit fd8b60
 *
Packit fd8b60
 * 3. Neither the name of the Institute nor the names of its contributors
Packit fd8b60
 *    may be used to endorse or promote products derived from this software
Packit fd8b60
 *    without specific prior written permission.
Packit fd8b60
 *
Packit fd8b60
 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
Packit fd8b60
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit fd8b60
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit fd8b60
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
Packit fd8b60
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit fd8b60
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
Packit fd8b60
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
Packit fd8b60
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
Packit fd8b60
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
Packit fd8b60
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
Packit fd8b60
 * SUCH DAMAGE.
Packit fd8b60
 */
Packit fd8b60
Packit fd8b60
#ifndef K5_BASE64_H
Packit fd8b60
#define K5_BASE64_H
Packit fd8b60
Packit fd8b60
#include <stddef.h>
Packit fd8b60
Packit fd8b60
/* base64-encode data and return it in an allocated buffer.  Return NULL if out
Packit fd8b60
 * of memory. */
Packit fd8b60
char *k5_base64_encode(const void *data, size_t len);
Packit fd8b60
Packit fd8b60
/*
Packit fd8b60
 * Decode str as base64 and return the result in an allocated buffer, setting
Packit fd8b60
 * *len_out to the length.  Return NULL and *len_out == 0 if out of memory,
Packit fd8b60
 * NULL and *len_out == SIZE_MAX on invalid input.
Packit fd8b60
 */
Packit fd8b60
void *k5_base64_decode(const char *str, size_t *len_out);
Packit fd8b60
Packit fd8b60
#endif /* K5_BASE64_H */