Blame src/include/k5-base64.h

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