diff options
-rw-r--r-- | src/lib/libcrypto/pkcs12/p12_attr.c | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/pkcs12/p12_crpt.c | 6 | ||||
-rw-r--r-- | src/lib/libcrypto/pkcs12/p12_decr.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/pkcs12/p12_key.c | 16 | ||||
-rw-r--r-- | src/lib/libcrypto/pkcs12/p12_kiss.c | 16 | ||||
-rw-r--r-- | src/lib/libcrypto/pkcs12/p12_mutl.c | 4 |
6 files changed, 28 insertions, 28 deletions
diff --git a/src/lib/libcrypto/pkcs12/p12_attr.c b/src/lib/libcrypto/pkcs12/p12_attr.c index 65bfaa039e..e8e340a2e2 100644 --- a/src/lib/libcrypto/pkcs12/p12_attr.c +++ b/src/lib/libcrypto/pkcs12/p12_attr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: p12_attr.c,v 1.12 2018/08/24 20:07:41 tb Exp $ */ | 1 | /* $OpenBSD: p12_attr.c,v 1.13 2021/07/09 14:07:59 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 | */ |
@@ -125,10 +125,10 @@ PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs, int attr_nid) | |||
125 | 125 | ||
126 | if (!attrs) | 126 | if (!attrs) |
127 | return NULL; | 127 | return NULL; |
128 | for (i = 0; i < sk_X509_ATTRIBUTE_num (attrs); i++) { | 128 | for (i = 0; i < sk_X509_ATTRIBUTE_num(attrs); i++) { |
129 | attrib = sk_X509_ATTRIBUTE_value (attrs, i); | 129 | attrib = sk_X509_ATTRIBUTE_value(attrs, i); |
130 | if (OBJ_obj2nid (attrib->object) == attr_nid) { | 130 | if (OBJ_obj2nid(attrib->object) == attr_nid) { |
131 | if (sk_ASN1_TYPE_num (attrib->value.set)) | 131 | if (sk_ASN1_TYPE_num(attrib->value.set)) |
132 | return sk_ASN1_TYPE_value(attrib->value.set, 0); | 132 | return sk_ASN1_TYPE_value(attrib->value.set, 0); |
133 | else | 133 | else |
134 | return NULL; | 134 | return NULL; |
diff --git a/src/lib/libcrypto/pkcs12/p12_crpt.c b/src/lib/libcrypto/pkcs12/p12_crpt.c index d1f7d71fd3..d21c9c178a 100644 --- a/src/lib/libcrypto/pkcs12/p12_crpt.c +++ b/src/lib/libcrypto/pkcs12/p12_crpt.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: p12_crpt.c,v 1.14 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: p12_crpt.c,v 1.15 2021/07/09 14:07:59 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 | */ |
@@ -101,13 +101,13 @@ PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | |||
101 | } | 101 | } |
102 | salt = pbe->salt->data; | 102 | salt = pbe->salt->data; |
103 | saltlen = pbe->salt->length; | 103 | saltlen = pbe->salt->length; |
104 | if (!PKCS12_key_gen (pass, passlen, salt, saltlen, PKCS12_KEY_ID, | 104 | if (!PKCS12_key_gen(pass, passlen, salt, saltlen, PKCS12_KEY_ID, |
105 | iter, EVP_CIPHER_key_length(cipher), key, md)) { | 105 | iter, EVP_CIPHER_key_length(cipher), key, md)) { |
106 | PKCS12error(PKCS12_R_KEY_GEN_ERROR); | 106 | PKCS12error(PKCS12_R_KEY_GEN_ERROR); |
107 | PBEPARAM_free(pbe); | 107 | PBEPARAM_free(pbe); |
108 | return 0; | 108 | return 0; |
109 | } | 109 | } |
110 | if (!PKCS12_key_gen (pass, passlen, salt, saltlen, PKCS12_IV_ID, | 110 | if (!PKCS12_key_gen(pass, passlen, salt, saltlen, PKCS12_IV_ID, |
111 | iter, EVP_CIPHER_iv_length(cipher), iv, md)) { | 111 | iter, EVP_CIPHER_iv_length(cipher), iv, md)) { |
112 | PKCS12error(PKCS12_R_IV_GEN_ERROR); | 112 | PKCS12error(PKCS12_R_IV_GEN_ERROR); |
113 | PBEPARAM_free(pbe); | 113 | PBEPARAM_free(pbe); |
diff --git a/src/lib/libcrypto/pkcs12/p12_decr.c b/src/lib/libcrypto/pkcs12/p12_decr.c index 1ef5c4a898..8ac7f17cfc 100644 --- a/src/lib/libcrypto/pkcs12/p12_decr.c +++ b/src/lib/libcrypto/pkcs12/p12_decr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: p12_decr.c,v 1.19 2018/05/13 14:22:34 tb Exp $ */ | 1 | /* $OpenBSD: p12_decr.c,v 1.20 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 | */ |
@@ -156,7 +156,7 @@ PKCS12_item_i2d_encrypt(X509_ALGOR *algor, const ASN1_ITEM *it, | |||
156 | unsigned char *in = NULL; | 156 | unsigned char *in = NULL; |
157 | int inlen; | 157 | int inlen; |
158 | 158 | ||
159 | if (!(oct = ASN1_OCTET_STRING_new ())) { | 159 | if (!(oct = ASN1_OCTET_STRING_new())) { |
160 | PKCS12error(ERR_R_MALLOC_FAILURE); | 160 | PKCS12error(ERR_R_MALLOC_FAILURE); |
161 | return NULL; | 161 | return NULL; |
162 | } | 162 | } |
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 | } |
diff --git a/src/lib/libcrypto/pkcs12/p12_kiss.c b/src/lib/libcrypto/pkcs12/p12_kiss.c index e0385393d7..54a8092609 100644 --- a/src/lib/libcrypto/pkcs12/p12_kiss.c +++ b/src/lib/libcrypto/pkcs12/p12_kiss.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: p12_kiss.c,v 1.20 2021/04/24 18:16:39 tb Exp $ */ | 1 | /* $OpenBSD: p12_kiss.c,v 1.21 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 | */ |
@@ -125,7 +125,7 @@ PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, | |||
125 | return 0; | 125 | return 0; |
126 | } | 126 | } |
127 | 127 | ||
128 | if (!parse_pk12 (p12, pass, -1, pkey, ocerts)) { | 128 | if (!parse_pk12(p12, pass, -1, pkey, ocerts)) { |
129 | PKCS12error(PKCS12_R_PARSE_ERROR); | 129 | PKCS12error(PKCS12_R_PARSE_ERROR); |
130 | goto err; | 130 | goto err; |
131 | } | 131 | } |
@@ -179,11 +179,11 @@ parse_pk12(PKCS12 *p12, const char *pass, int passlen, EVP_PKEY **pkey, | |||
179 | int i, bagnid; | 179 | int i, bagnid; |
180 | PKCS7 *p7; | 180 | PKCS7 *p7; |
181 | 181 | ||
182 | if (!(asafes = PKCS12_unpack_authsafes (p12))) | 182 | if (!(asafes = PKCS12_unpack_authsafes(p12))) |
183 | return 0; | 183 | return 0; |
184 | for (i = 0; i < sk_PKCS7_num (asafes); i++) { | 184 | for (i = 0; i < sk_PKCS7_num(asafes); i++) { |
185 | p7 = sk_PKCS7_value (asafes, i); | 185 | p7 = sk_PKCS7_value(asafes, i); |
186 | bagnid = OBJ_obj2nid (p7->type); | 186 | bagnid = OBJ_obj2nid(p7->type); |
187 | if (bagnid == NID_pkcs7_data) { | 187 | if (bagnid == NID_pkcs7_data) { |
188 | bags = PKCS12_unpack_p7data(p7); | 188 | bags = PKCS12_unpack_p7data(p7); |
189 | } else if (bagnid == NID_pkcs7_encrypted) { | 189 | } else if (bagnid == NID_pkcs7_encrypted) { |
@@ -229,10 +229,10 @@ parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, EVP_PKEY **pkey, | |||
229 | ASN1_BMPSTRING *fname = NULL; | 229 | ASN1_BMPSTRING *fname = NULL; |
230 | ASN1_OCTET_STRING *lkid = NULL; | 230 | ASN1_OCTET_STRING *lkid = NULL; |
231 | 231 | ||
232 | if ((attrib = PKCS12_get_attr (bag, NID_friendlyName))) | 232 | if ((attrib = PKCS12_get_attr(bag, NID_friendlyName))) |
233 | fname = attrib->value.bmpstring; | 233 | fname = attrib->value.bmpstring; |
234 | 234 | ||
235 | if ((attrib = PKCS12_get_attr (bag, NID_localKeyID))) | 235 | if ((attrib = PKCS12_get_attr(bag, NID_localKeyID))) |
236 | lkid = attrib->value.octet_string; | 236 | lkid = attrib->value.octet_string; |
237 | 237 | ||
238 | switch (OBJ_obj2nid(bag->type)) { | 238 | switch (OBJ_obj2nid(bag->type)) { |
diff --git a/src/lib/libcrypto/pkcs12/p12_mutl.c b/src/lib/libcrypto/pkcs12/p12_mutl.c index f3132ec75f..d45ab078fd 100644 --- a/src/lib/libcrypto/pkcs12/p12_mutl.c +++ b/src/lib/libcrypto/pkcs12/p12_mutl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: p12_mutl.c,v 1.23 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: p12_mutl.c,v 1.24 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 | */ |
@@ -192,7 +192,7 @@ PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, int saltlen, | |||
192 | if (!salt) | 192 | if (!salt) |
193 | arc4random_buf(p12->mac->salt->data, saltlen); | 193 | arc4random_buf(p12->mac->salt->data, saltlen); |
194 | else | 194 | else |
195 | memcpy (p12->mac->salt->data, salt, saltlen); | 195 | memcpy(p12->mac->salt->data, salt, saltlen); |
196 | p12->mac->dinfo->algor->algorithm = OBJ_nid2obj(EVP_MD_type(md_type)); | 196 | p12->mac->dinfo->algor->algorithm = OBJ_nid2obj(EVP_MD_type(md_type)); |
197 | if (!(p12->mac->dinfo->algor->parameter = ASN1_TYPE_new())) { | 197 | if (!(p12->mac->dinfo->algor->parameter = ASN1_TYPE_new())) { |
198 | PKCS12error(ERR_R_MALLOC_FAILURE); | 198 | PKCS12error(ERR_R_MALLOC_FAILURE); |