\doxysection{include/osmocom/core/base64.h File Reference} \label{base64_8h}\index{include/osmocom/core/base64.h@{include/osmocom/core/base64.h}} RFC 1521 base64 encoding/decoding. {\ttfamily \#include $<$stddef.\+h$>$}\newline \doxysubsection*{Functions} \begin{DoxyCompactItemize} \item int \textbf{ osmo\+\_\+base64\+\_\+encode} (unsigned char $\ast$dst, size\+\_\+t dlen, size\+\_\+t $\ast$olen, const unsigned char $\ast$src, size\+\_\+t slen) \begin{DoxyCompactList}\small\item\em Encode a buffer into base64 format. \end{DoxyCompactList}\item int \textbf{ osmo\+\_\+base64\+\_\+decode} (unsigned char $\ast$dst, size\+\_\+t dlen, size\+\_\+t $\ast$olen, const unsigned char $\ast$src, size\+\_\+t slen) \begin{DoxyCompactList}\small\item\em Decode a base64-\/formatted buffer. \end{DoxyCompactList}\end{DoxyCompactItemize} \doxysubsection{Detailed Description} RFC 1521 base64 encoding/decoding. Copyright (C) 2006-\/2015, ARM Limited, All Rights Reserved This file is part of mbed TLS ({\texttt{ https\+://tls.\+mbed.\+org}}) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. \doxysubsection{Function Documentation} \mbox{\label{base64_8h_a1674f5075736ca10c24f00ff6b2f0009}} \index{base64.h@{base64.h}!osmo\_base64\_decode@{osmo\_base64\_decode}} \index{osmo\_base64\_decode@{osmo\_base64\_decode}!base64.h@{base64.h}} \doxysubsubsection{osmo\_base64\_decode()} {\footnotesize\ttfamily int osmo\+\_\+base64\+\_\+decode (\begin{DoxyParamCaption}\item[{unsigned char $\ast$}]{dst, }\item[{size\+\_\+t}]{dlen, }\item[{size\+\_\+t $\ast$}]{olen, }\item[{const unsigned char $\ast$}]{src, }\item[{size\+\_\+t}]{slen }\end{DoxyParamCaption})} Decode a base64-\/formatted buffer. \begin{DoxyParams}{Parameters} {\em dst} & destination buffer (can be NULL for checking size) \\ \hline {\em dlen} & size of the destination buffer \\ \hline {\em olen} & number of bytes written \\ \hline {\em src} & source buffer \\ \hline {\em slen} & amount of data to be decoded\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} 0 if successful, MBEDTLS\+\_\+\+ERR\+\_\+\+BASE64\+\_\+\+BUFFER\+\_\+\+TOO\+\_\+\+SMALL, or MBEDTLS\+\_\+\+ERR\+\_\+\+BASE64\+\_\+\+INVALID\+\_\+\+CHARACTER if the input data is not correct. $\ast$olen is always updated to reflect the amount of data that has (or would have) been written. \end{DoxyReturn} \begin{DoxyNote}{Note} Call this function with $\ast$dst = NULL or dlen = 0 to obtain the required buffer size in $\ast$olen \end{DoxyNote} References \textbf{ base64\+\_\+dec\+\_\+map}, and \textbf{ n}. \mbox{\label{base64_8h_a1808831840f22ba9774b6f108754dea9}} \index{base64.h@{base64.h}!osmo\_base64\_encode@{osmo\_base64\_encode}} \index{osmo\_base64\_encode@{osmo\_base64\_encode}!base64.h@{base64.h}} \doxysubsubsection{osmo\_base64\_encode()} {\footnotesize\ttfamily int osmo\+\_\+base64\+\_\+encode (\begin{DoxyParamCaption}\item[{unsigned char $\ast$}]{dst, }\item[{size\+\_\+t}]{dlen, }\item[{size\+\_\+t $\ast$}]{olen, }\item[{const unsigned char $\ast$}]{src, }\item[{size\+\_\+t}]{slen }\end{DoxyParamCaption})} Encode a buffer into base64 format. \begin{DoxyParams}{Parameters} {\em dst} & destination buffer \\ \hline {\em dlen} & size of the destination buffer \\ \hline {\em olen} & number of bytes written \\ \hline {\em src} & source buffer \\ \hline {\em slen} & amount of data to be encoded\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} 0 if successful, or MBEDTLS\+\_\+\+ERR\+\_\+\+BASE64\+\_\+\+BUFFER\+\_\+\+TOO\+\_\+\+SMALL. $\ast$olen is always updated to reflect the amount of data that has (or would have) been written. \end{DoxyReturn} \begin{DoxyNote}{Note} Call this function with dlen = 0 to obtain the required buffer size in $\ast$olen \end{DoxyNote} References \textbf{ base64\+\_\+enc\+\_\+map}, and \textbf{ n}.