summaryrefslogtreecommitdiff
path: root/lib/auth/srp_sb64.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2016-04-29 19:03:11 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2016-04-29 19:03:11 +0200
commit9b6d6012111ba227851ae0e06207ea7afc4f5a80 (patch)
tree6e54263294eb9732f91f50572e5d154133527c06 /lib/auth/srp_sb64.c
parent6d9b6f4a44eb5228ac26c22a0f7be47ed4bf39ce (diff)
downloadgnutls-9b6d6012111ba227851ae0e06207ea7afc4f5a80.tar.gz
srp base64: return proper gnutls errors codes on error rather than -1
Diffstat (limited to 'lib/auth/srp_sb64.c')
-rw-r--r--lib/auth/srp_sb64.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/auth/srp_sb64.c b/lib/auth/srp_sb64.c
index 533fbc626c..1177e76719 100644
--- a/lib/auth/srp_sb64.c
+++ b/lib/auth/srp_sb64.c
@@ -127,7 +127,7 @@ inline static int encode(uint8_t * result, const uint8_t * rdata, unsigned left)
}
break;
default:
- return -1;
+ return GNUTLS_E_BASE64_ENCODING_ERROR;
}
return ret;
@@ -155,7 +155,7 @@ _gnutls_sbase64_encode(uint8_t * data, size_t data_size, char **result)
(*result) = gnutls_calloc(1, ret + 1);
if ((*result) == NULL)
- return -1;
+ return GNUTLS_E_MEMORY_ERROR;
i = j = 0;
/* encode the bytes that are not a multiple of 3
@@ -203,7 +203,7 @@ inline static int decode(uint8_t * result, const uint8_t * data)
if (a1 != 0xff)
result[2] = a1 & 0xff;
else
- return -1;
+ return GNUTLS_E_BASE64_DECODING_ERROR;
if (a2 != 0xff)
result[2] |= ((a2 & 0x03) << 6) & 0xff;
@@ -252,7 +252,7 @@ _gnutls_sbase64_decode(char *data, size_t idata_size, uint8_t ** result)
(*result) = gnutls_malloc(ret + 1);
if ((*result) == NULL)
- return -1;
+ return GNUTLS_E_MEMORY_ERROR;
/* the first "block" is treated with special care */
tmp = 0;