]>
Commit | Line | Data |
---|---|---|
b1ab9ed8 A |
1 | /* Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. */ |
2 | ||
3 | /* | |
4 | * libDERUtils.c - support routines for libDER tests & examples | |
5 | * | |
6 | * Created Nov. 7 2005 by dmitch | |
7 | */ | |
8 | ||
9 | #include <libDERUtils/libDERUtils.h> | |
10 | #include <stdio.h> | |
11 | ||
12 | const char *DERReturnString( | |
13 | DERReturn drtn) | |
14 | { | |
15 | static char unknown[128]; | |
16 | ||
17 | switch(drtn) { | |
18 | case DR_Success: return "DR_Success"; | |
19 | case DR_EndOfSequence: return "DR_EndOfSequence"; | |
20 | case DR_UnexpectedTag: return "DR_UnexpectedTag"; | |
21 | case DR_DecodeError: return "DR_DecodeError"; | |
22 | case DR_Unimplemented: return "DR_Unimplemented"; | |
23 | case DR_IncompleteSeq: return "DR_IncompleteSeq"; | |
24 | default: | |
25 | sprintf(unknown, "Unknown error (%d)", (int)drtn); | |
26 | return unknown; | |
27 | } | |
28 | } | |
29 | ||
30 | void DERPerror( | |
31 | const char *op, | |
32 | DERReturn drtn) | |
33 | { | |
34 | fprintf(stderr, "*** %s: %s\n", op, DERReturnString(drtn)); | |
35 | } | |
36 |