diff options
Diffstat (limited to 'src/lib/libcrypto/pkcs12/p12_key.c')
-rw-r--r-- | src/lib/libcrypto/pkcs12/p12_key.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/libcrypto/pkcs12/p12_key.c b/src/lib/libcrypto/pkcs12/p12_key.c index d419a9d835..2887948144 100644 --- a/src/lib/libcrypto/pkcs12/p12_key.c +++ b/src/lib/libcrypto/pkcs12/p12_key.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: p12_key.c,v 1.26 2017/05/02 03:59:45 deraadt Exp $ */ | 1 | /* $OpenBSD: p12_key.c,v 1.27 2021/07/09 14:08:00 tb 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 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
@@ -143,7 +143,7 @@ PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, | |||
143 | !EVP_DigestFinal_ex(&ctx, Ai, NULL)) | 143 | !EVP_DigestFinal_ex(&ctx, Ai, NULL)) |
144 | goto err; | 144 | goto err; |
145 | } | 145 | } |
146 | memcpy (out, Ai, min (n, u)); | 146 | memcpy(out, Ai, min(n, u)); |
147 | if (u >= n) { | 147 | if (u >= n) { |
148 | ret = 1; | 148 | ret = 1; |
149 | goto end; | 149 | goto end; |
@@ -153,9 +153,9 @@ PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, | |||
153 | for (j = 0; j < v; j++) | 153 | for (j = 0; j < v; j++) |
154 | B[j] = Ai[j % u]; | 154 | B[j] = Ai[j % u]; |
155 | /* Work out B + 1 first then can use B as tmp space */ | 155 | /* Work out B + 1 first then can use B as tmp space */ |
156 | if (!BN_bin2bn (B, v, Bpl1)) | 156 | if (!BN_bin2bn(B, v, Bpl1)) |
157 | goto err; | 157 | goto err; |
158 | if (!BN_add_word (Bpl1, 1)) | 158 | if (!BN_add_word(Bpl1, 1)) |
159 | goto err; | 159 | goto err; |
160 | for (j = 0; j < Ilen; j += v) { | 160 | for (j = 0; j < Ilen; j += v) { |
161 | if (!BN_bin2bn(I + j, v, Ij)) | 161 | if (!BN_bin2bn(I + j, v, Ij)) |
@@ -164,12 +164,12 @@ PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, | |||
164 | goto err; | 164 | goto err; |
165 | if (!BN_bn2bin(Ij, B)) | 165 | if (!BN_bn2bin(Ij, B)) |
166 | goto err; | 166 | goto err; |
167 | Ijlen = BN_num_bytes (Ij); | 167 | Ijlen = BN_num_bytes(Ij); |
168 | /* If more than 2^(v*8) - 1 cut off MSB */ | 168 | /* If more than 2^(v*8) - 1 cut off MSB */ |
169 | if (Ijlen > v) { | 169 | if (Ijlen > v) { |
170 | if (!BN_bn2bin (Ij, B)) | 170 | if (!BN_bn2bin(Ij, B)) |
171 | goto err; | 171 | goto err; |
172 | memcpy (I + j, B + 1, v); | 172 | memcpy(I + j, B + 1, v); |
173 | #ifndef PKCS12_BROKEN_KEYGEN | 173 | #ifndef PKCS12_BROKEN_KEYGEN |
174 | /* If less than v bytes pad with zeroes */ | 174 | /* If less than v bytes pad with zeroes */ |
175 | } else if (Ijlen < v) { | 175 | } else if (Ijlen < v) { |
@@ -177,7 +177,7 @@ PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, | |||
177 | if (!BN_bn2bin(Ij, I + j + v - Ijlen)) | 177 | if (!BN_bn2bin(Ij, I + j + v - Ijlen)) |
178 | goto err; | 178 | goto err; |
179 | #endif | 179 | #endif |
180 | } else if (!BN_bn2bin (Ij, I + j)) | 180 | } else if (!BN_bn2bin(Ij, I + j)) |
181 | goto err; | 181 | goto err; |
182 | } | 182 | } |
183 | } | 183 | } |