summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa/rsa_x931.c
diff options
context:
space:
mode:
authorbeck <>2017-01-29 17:49:23 +0000
committerbeck <>2017-01-29 17:49:23 +0000
commit957b11334a7afb14537322f0e4795b2e368b3f59 (patch)
tree1a54abba678898ee5270ae4f3404a50ee9a92eea /src/lib/libcrypto/rsa/rsa_x931.c
parentdf96e020e729c6c37a8c7fe311fdd1fe6a8718c5 (diff)
downloadopenbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.gz
openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.bz2
openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.zip
Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing libssl had more reacharounds into this. ok jsing@ inoguchi@
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_x931.c')
-rw-r--r--src/lib/libcrypto/rsa/rsa_x931.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_x931.c b/src/lib/libcrypto/rsa/rsa_x931.c
index 2993b4028d..3579735ab2 100644
--- a/src/lib/libcrypto/rsa/rsa_x931.c
+++ b/src/lib/libcrypto/rsa/rsa_x931.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_x931.c,v 1.9 2014/10/18 17:20:40 jsing Exp $ */ 1/* $OpenBSD: rsa_x931.c,v 1.10 2017/01/29 17:49:23 beck Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2005. 3 * project 2005.
4 */ 4 */
@@ -78,8 +78,7 @@ RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *from,
78 j = tlen - flen - 2; 78 j = tlen - flen - 2;
79 79
80 if (j < 0) { 80 if (j < 0) {
81 RSAerr(RSA_F_RSA_PADDING_ADD_X931, 81 RSAerror(RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
82 RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
83 return -1; 82 return -1;
84 } 83 }
85 84
@@ -110,7 +109,7 @@ RSA_padding_check_X931(unsigned char *to, int tlen, const unsigned char *from,
110 const unsigned char *p = from; 109 const unsigned char *p = from;
111 110
112 if (num != flen || (*p != 0x6A && *p != 0x6B)) { 111 if (num != flen || (*p != 0x6A && *p != 0x6B)) {
113 RSAerr(RSA_F_RSA_PADDING_CHECK_X931, RSA_R_INVALID_HEADER); 112 RSAerror(RSA_R_INVALID_HEADER);
114 return -1; 113 return -1;
115 } 114 }
116 115
@@ -121,15 +120,13 @@ RSA_padding_check_X931(unsigned char *to, int tlen, const unsigned char *from,
121 if (c == 0xBA) 120 if (c == 0xBA)
122 break; 121 break;
123 if (c != 0xBB) { 122 if (c != 0xBB) {
124 RSAerr(RSA_F_RSA_PADDING_CHECK_X931, 123 RSAerror(RSA_R_INVALID_PADDING);
125 RSA_R_INVALID_PADDING);
126 return -1; 124 return -1;
127 } 125 }
128 } 126 }
129 127
130 if (i == 0) { 128 if (i == 0) {
131 RSAerr(RSA_F_RSA_PADDING_CHECK_X931, 129 RSAerror(RSA_R_INVALID_PADDING);
132 RSA_R_INVALID_PADDING);
133 return -1; 130 return -1;
134 } 131 }
135 132
@@ -138,7 +135,7 @@ RSA_padding_check_X931(unsigned char *to, int tlen, const unsigned char *from,
138 j = flen - 2; 135 j = flen - 2;
139 136
140 if (j < 0 || p[j] != 0xCC) { 137 if (j < 0 || p[j] != 0xCC) {
141 RSAerr(RSA_F_RSA_PADDING_CHECK_X931, RSA_R_INVALID_TRAILER); 138 RSAerror(RSA_R_INVALID_TRAILER);
142 return -1; 139 return -1;
143 } 140 }
144 141