diff options
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_saos.c')
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_saos.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_saos.c b/src/lib/libcrypto/rsa/rsa_saos.c index 5dbc10dbb2..179217c236 100644 --- a/src/lib/libcrypto/rsa/rsa_saos.c +++ b/src/lib/libcrypto/rsa/rsa_saos.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_saos.c,v 1.19 2015/09/30 18:41:06 jsing Exp $ */ | 1 | /* $OpenBSD: rsa_saos.c,v 1.20 2017/01/29 17:49:23 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -80,13 +80,12 @@ RSA_sign_ASN1_OCTET_STRING(int type, const unsigned char *m, unsigned int m_len, | |||
80 | i = i2d_ASN1_OCTET_STRING(&sig, NULL); | 80 | i = i2d_ASN1_OCTET_STRING(&sig, NULL); |
81 | j = RSA_size(rsa); | 81 | j = RSA_size(rsa); |
82 | if (i > (j - RSA_PKCS1_PADDING_SIZE)) { | 82 | if (i > (j - RSA_PKCS1_PADDING_SIZE)) { |
83 | RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING, | 83 | RSAerror(RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY); |
84 | RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY); | ||
85 | return 0; | 84 | return 0; |
86 | } | 85 | } |
87 | s = malloc(j + 1); | 86 | s = malloc(j + 1); |
88 | if (s == NULL) { | 87 | if (s == NULL) { |
89 | RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING, ERR_R_MALLOC_FAILURE); | 88 | RSAerror(ERR_R_MALLOC_FAILURE); |
90 | return 0; | 89 | return 0; |
91 | } | 90 | } |
92 | p = s; | 91 | p = s; |
@@ -112,15 +111,13 @@ RSA_verify_ASN1_OCTET_STRING(int dtype, const unsigned char *m, | |||
112 | ASN1_OCTET_STRING *sig = NULL; | 111 | ASN1_OCTET_STRING *sig = NULL; |
113 | 112 | ||
114 | if (siglen != (unsigned int)RSA_size(rsa)) { | 113 | if (siglen != (unsigned int)RSA_size(rsa)) { |
115 | RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING, | 114 | RSAerror(RSA_R_WRONG_SIGNATURE_LENGTH); |
116 | RSA_R_WRONG_SIGNATURE_LENGTH); | ||
117 | return 0; | 115 | return 0; |
118 | } | 116 | } |
119 | 117 | ||
120 | s = malloc(siglen); | 118 | s = malloc(siglen); |
121 | if (s == NULL) { | 119 | if (s == NULL) { |
122 | RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING, | 120 | RSAerror(ERR_R_MALLOC_FAILURE); |
123 | ERR_R_MALLOC_FAILURE); | ||
124 | goto err; | 121 | goto err; |
125 | } | 122 | } |
126 | i = RSA_public_decrypt((int)siglen, sigbuf, s, rsa, RSA_PKCS1_PADDING); | 123 | i = RSA_public_decrypt((int)siglen, sigbuf, s, rsa, RSA_PKCS1_PADDING); |
@@ -135,8 +132,7 @@ RSA_verify_ASN1_OCTET_STRING(int dtype, const unsigned char *m, | |||
135 | 132 | ||
136 | if ((unsigned int)sig->length != m_len || | 133 | if ((unsigned int)sig->length != m_len || |
137 | memcmp(m, sig->data, m_len) != 0) { | 134 | memcmp(m, sig->data, m_len) != 0) { |
138 | RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING, | 135 | RSAerror(RSA_R_BAD_SIGNATURE); |
139 | RSA_R_BAD_SIGNATURE); | ||
140 | } else | 136 | } else |
141 | ret = 1; | 137 | ret = 1; |
142 | err: | 138 | err: |