summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2001-12-20 17:49:48 +0100
committerWerner Koch <wk@gnupg.org>2001-12-20 17:49:48 +0100
commitee1b7e428b1e68d3cf45436e21b578ac88eedc1e (patch)
treeda6bc91bb6e7f8a5fb4669a83aa090b66681652b /common
parent* base64.c (base64_reader_cb): Try to detect an S/MIME body part. (diff)
downloadgnupg2-ee1b7e428b1e68d3cf45436e21b578ac88eedc1e.tar.xz
gnupg2-ee1b7e428b1e68d3cf45436e21b578ac88eedc1e.zip
* maperror.c (map_gcry_err): Add some mappings.
Diffstat (limited to 'common')
-rw-r--r--common/ChangeLog4
-rw-r--r--common/errors.h3
-rw-r--r--common/maperror.c40
3 files changed, 47 insertions, 0 deletions
diff --git a/common/ChangeLog b/common/ChangeLog
index 1d0cec6ea..8323104b4 100644
--- a/common/ChangeLog
+++ b/common/ChangeLog
@@ -1,3 +1,7 @@
+2001-12-20 Werner Koch <wk@gnupg.org>
+
+ * maperror.c (map_gcry_err): Add some mappings.
+
2001-12-18 Werner Koch <wk@gnupg.org>
* Makefile.am (AM_CPPFLAGS): Include flags for gcrypt and ksba
diff --git a/common/errors.h b/common/errors.h
index faa39c7ff..cea4950f3 100644
--- a/common/errors.h
+++ b/common/errors.h
@@ -64,6 +64,9 @@ enum {
GNUPG_Bad_PIN = 35,
GNUPG_Bad_Passphrase = 36,
GNUPG_Invalid_Name = 37,
+ GNUPG_Bad_Public_Key = 38,
+ GNUPG_Bad_Secret_Key = 39,
+ GNUPG_Bad_Data = 40,
};
/* Status codes - fixme: should go into another file */
diff --git a/common/maperror.c b/common/maperror.c
index e073f16fe..0c259ddd0 100644
--- a/common/maperror.c
+++ b/common/maperror.c
@@ -58,10 +58,50 @@ map_gcry_err (int err)
{
switch (err)
{
+ case GCRYERR_EOF:
case -1:
+ err = -1;
+ break;
+
case 0:
break;
+
+ case GCRYERR_WRONG_PK_ALGO:
+ case GCRYERR_INV_PK_ALGO:
+ case GCRYERR_INV_MD_ALGO:
+ case GCRYERR_INV_CIPHER_ALGO:
+ err = GNUPG_Unsupported_Algorithm;
+ break;
+ case GCRYERR_INV_KEYLEN:
+ case GCRYERR_WEAK_KEY:
+ case GCRYERR_BAD_PUBLIC_KEY: err = GNUPG_Bad_Public_Key; break;
+ case GCRYERR_BAD_SECRET_KEY: err = GNUPG_Bad_Secret_Key; break;
+ case GCRYERR_BAD_SIGNATURE: err = GNUPG_Bad_Signature; break;
+
+ case GCRYERR_BAD_MPI:
+ err = GNUPG_Bad_Data;
+ break;
+
+ case GCRYERR_INV_ARG:
+ case GCRYERR_INV_OP:
+ case GCRYERR_INTERNAL:
+ case GCRYERR_INV_CIPHER_MODE:
+ err = GNUPG_Invalid_Value;
+ break;
+
+ case GCRYERR_SELFTEST:
+ err = GNUPG_Bug;
+ break;
+
+ case GCRYERR_NO_MEM: err = GNUPG_Out_Of_Core; break;
+
+ case GCRYERR_NOT_IMPL: err = GNUPG_Not_Implemented; break;
+ case GCRYERR_CONFLICT: err = GNUPG_Conflict; break;
+ case GCRYERR_INV_OBJ: /* an object is not valid */
+ case GCRYERR_TOO_SHORT: /* provided buffer too short */
+ case GCRYERR_TOO_LARGE: /* object is too large */
+ case GCRYERR_NO_OBJ: /* Missing item in an object */
default:
err = seterr (General_Error);
break;