GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: lib/libkeynote/base64.c Lines: 0 8 0.0 %
Date: 2017-11-07 Branches: 0 4 0.0 %

Line Branch Exec Source
1
/* $OpenBSD: base64.c,v 1.11 2004/06/29 11:35:56 msf Exp $ */
2
/* $OpenBSD: base64.c,v 1.11 2004/06/29 11:35:56 msf Exp $ */
3
/*
4
 * The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
5
 *
6
 * This code was written by Angelos D. Keromytis in Philadelphia, PA, USA,
7
 * in April-May 1998
8
 *
9
 * Copyright (C) 1998, 1999 by Angelos D. Keromytis.
10
 *
11
 * Permission to use, copy, and modify this software with or without fee
12
 * is hereby granted, provided that this entire notice is included in
13
 * all copies of any software which is or includes a copy or
14
 * modification of this software.
15
 *
16
 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
17
 * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO
18
 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
19
 * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
20
 * PURPOSE.
21
 */
22
23
#include <sys/types.h>
24
25
#include <ctype.h>
26
#include <regex.h>
27
#include <stdio.h>
28
#include <stdlib.h>
29
#include <string.h>
30
31
#include "keynote.h"
32
33
int __b64_ntop(unsigned char const *, size_t, char *, size_t);
34
int __b64_pton(char const *, unsigned char *, size_t);
35
36
int
37
kn_encode_base64(src, srclength, target, targsize)
38
unsigned char const *src;
39
unsigned int srclength;
40
char *target;
41
unsigned int targsize;
42
{
43
    int i;
44
45
    i = __b64_ntop(src, srclength, target, targsize);
46
    if (i == -1)
47
      keynote_errno = ERROR_SYNTAX;
48
    return i;
49
}
50
51
int
52
kn_decode_base64(src, target, targsize)
53
char const *src;
54
unsigned char *target;
55
unsigned int targsize;
56
{
57
    int i;
58
59
    i = __b64_pton(src, target, targsize);
60
    if (i == -1)
61
      keynote_errno = ERROR_SYNTAX;
62
    return i;
63
}