MeterLogger
Functions
base64.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int base64_decode (size_t in_len, const char *in, size_t out_len, unsigned char *out)
 

Function Documentation

◆ base64_decode()

int base64_decode ( size_t  in_len,
const char *  in,
size_t  out_len,
unsigned char *  out 
)

Definition at line 42 of file base64.c.

References base64dec_tab, and isspace.

Referenced by authBasic().

42  {
43  unsigned int ii, io;
44  uint32_t v;
45  unsigned int rem;
46 
47  for(io=0,ii=0,v=0,rem=0;ii<in_len;ii++) {
48  unsigned char ch;
49  if(isspace((int)in[ii])) continue;
50  if(in[ii]=='=') break; /* stop at = */
51  ch=base64dec_tab[(unsigned int)in[ii]];
52  if(ch==255) break; /* stop at a parse error */
53  v=(v<<6)|ch;
54  rem+=6;
55  if(rem>=8) {
56  rem-=8;
57  if(io>=out_len) return -1; /* truncation is failure */
58  out[io++]=(v>>rem)&255;
59  }
60  }
61  if(rem>=8) {
62  rem-=8;
63  if(io>=out_len) return -1; /* truncation is failure */
64  out[io++]=(v>>rem)&255;
65  }
66  return io;
67 }
#define isspace(c)
Definition: ip_addr.c:119
static const uint8_t base64dec_tab[256]
Definition: base64.c:6
Here is the caller graph for this function: