cachepc-qemu

Fork of AMDESE/qemu with changes for cachepc side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-qemu
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

base64.h (1870B)


      1/*
      2 * QEMU base64 helpers
      3 *
      4 * Copyright (c) 2015 Red Hat, Inc.
      5 *
      6 * This library is free software; you can redistribute it and/or
      7 * modify it under the terms of the GNU Lesser General Public
      8 * License as published by the Free Software Foundation; either
      9 * version 2.1 of the License, or (at your option) any later version.
     10 *
     11 * This library is distributed in the hope that it will be useful,
     12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14 * Lesser General Public License for more details.
     15 *
     16 * You should have received a copy of the GNU Lesser General Public
     17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
     18 *
     19 */
     20
     21#ifndef QEMU_BASE64_H
     22#define QEMU_BASE64_H
     23
     24
     25
     26/**
     27 * qbase64_decode:
     28 * @input: the (possibly) base64 encoded text
     29 * @in_len: length of @input or -1 if NUL terminated
     30 * @out_len: filled with length of decoded data
     31 * @errp: pointer to a NULL-initialized error object
     32 *
     33 * Attempt to decode the (possibly) base64 encoded
     34 * text provided in @input. If the @input text may
     35 * contain embedded NUL characters, or may not be
     36 * NUL terminated, then @in_len must be set to the
     37 * known size of the @input buffer.
     38 *
     39 * Note that embedded NULs, or lack of a NUL terminator
     40 * are considered invalid base64 data and errors
     41 * will be reported to this effect.
     42 *
     43 * If decoding is successful, the decoded data will
     44 * be returned and @out_len set to indicate the
     45 * number of bytes in the decoded data. The caller
     46 * must use g_free() to free the returned data when
     47 * it is no longer required.
     48 *
     49 * Returns: the decoded data or NULL
     50 */
     51uint8_t *qbase64_decode(const char *input,
     52                        size_t in_len,
     53                        size_t *out_len,
     54                        Error **errp);
     55
     56
     57#endif /* QEMU_BASE64_H */