diff options
| author | tb <> | 2018-05-13 14:22:34 +0000 |
|---|---|---|
| committer | tb <> | 2018-05-13 14:22:34 +0000 |
| commit | 386df0807ac92c64c0392775378e1b196e0199a4 (patch) | |
| tree | 2ce42fdc6f6dd9d6d1e1ef1eef770f7652cf37c3 | |
| parent | 0c7a19d0ea69be2bae02c4270b611516553c057b (diff) | |
| download | openbsd-386df0807ac92c64c0392775378e1b196e0199a4.tar.gz openbsd-386df0807ac92c64c0392775378e1b196e0199a4.tar.bz2 openbsd-386df0807ac92c64c0392775378e1b196e0199a4.zip | |
Add const to the X509_ALGOR and other arguments of
PKCS12_item_decrypt_d2i(3), PKCS12_pbe_crypt(3), PKCS12_newpass(3).
tested in a bulk by sthen
ok beck, jsing
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/pkcs12/p12_decr.c | 11 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs12/p12_npas.c | 20 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs12/pkcs12.h | 12 |
3 files changed, 23 insertions, 20 deletions
diff --git a/src/lib/libcrypto/pkcs12/p12_decr.c b/src/lib/libcrypto/pkcs12/p12_decr.c index ca08ee55d5..1ef5c4a898 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.18 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: p12_decr.c,v 1.19 2018/05/13 14:22:34 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 | */ |
| @@ -67,8 +67,9 @@ | |||
| 67 | */ | 67 | */ |
| 68 | 68 | ||
| 69 | unsigned char * | 69 | unsigned char * |
| 70 | PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, int passlen, | 70 | PKCS12_pbe_crypt(const X509_ALGOR *algor, const char *pass, int passlen, |
| 71 | unsigned char *in, int inlen, unsigned char **data, int *datalen, int en_de) | 71 | const unsigned char *in, int inlen, unsigned char **data, int *datalen, |
| 72 | int en_de) | ||
| 72 | { | 73 | { |
| 73 | unsigned char *out; | 74 | unsigned char *out; |
| 74 | int outlen, i; | 75 | int outlen, i; |
| @@ -119,8 +120,8 @@ err: | |||
| 119 | */ | 120 | */ |
| 120 | 121 | ||
| 121 | void * | 122 | void * |
| 122 | PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it, | 123 | PKCS12_item_decrypt_d2i(const X509_ALGOR *algor, const ASN1_ITEM *it, |
| 123 | const char *pass, int passlen, ASN1_OCTET_STRING *oct, int zbuf) | 124 | const char *pass, int passlen, const ASN1_OCTET_STRING *oct, int zbuf) |
| 124 | { | 125 | { |
| 125 | unsigned char *out; | 126 | unsigned char *out; |
| 126 | const unsigned char *p; | 127 | const unsigned char *p; |
diff --git a/src/lib/libcrypto/pkcs12/p12_npas.c b/src/lib/libcrypto/pkcs12/p12_npas.c index 63b3df17ad..d6b12edab3 100644 --- a/src/lib/libcrypto/pkcs12/p12_npas.c +++ b/src/lib/libcrypto/pkcs12/p12_npas.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p12_npas.c,v 1.12 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: p12_npas.c,v 1.13 2018/05/13 14:22:34 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 | */ |
| @@ -65,10 +65,11 @@ | |||
| 65 | 65 | ||
| 66 | /* PKCS#12 password change routine */ | 66 | /* PKCS#12 password change routine */ |
| 67 | 67 | ||
| 68 | static int newpass_p12(PKCS12 *p12, char *oldpass, char *newpass); | 68 | static int newpass_p12(PKCS12 *p12, const char *oldpass, const char *newpass); |
| 69 | static int newpass_bags(STACK_OF(PKCS12_SAFEBAG) *bags, char *oldpass, | 69 | static int newpass_bags(STACK_OF(PKCS12_SAFEBAG) *bags, const char *oldpass, |
| 70 | char *newpass); | 70 | const char *newpass); |
| 71 | static int newpass_bag(PKCS12_SAFEBAG *bag, char *oldpass, char *newpass); | 71 | static int newpass_bag(PKCS12_SAFEBAG *bag, const char *oldpass, |
| 72 | const char *newpass); | ||
| 72 | static int alg_get(X509_ALGOR *alg, int *pnid, int *piter, int *psaltlen); | 73 | static int alg_get(X509_ALGOR *alg, int *pnid, int *piter, int *psaltlen); |
| 73 | 74 | ||
| 74 | /* | 75 | /* |
| @@ -76,7 +77,7 @@ static int alg_get(X509_ALGOR *alg, int *pnid, int *piter, int *psaltlen); | |||
| 76 | */ | 77 | */ |
| 77 | 78 | ||
| 78 | int | 79 | int |
| 79 | PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass) | 80 | PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass) |
| 80 | { | 81 | { |
| 81 | /* Check for NULL PKCS12 structure */ | 82 | /* Check for NULL PKCS12 structure */ |
| 82 | 83 | ||
| @@ -103,7 +104,7 @@ PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass) | |||
| 103 | /* Parse the outer PKCS#12 structure */ | 104 | /* Parse the outer PKCS#12 structure */ |
| 104 | 105 | ||
| 105 | static int | 106 | static int |
| 106 | newpass_p12(PKCS12 *p12, char *oldpass, char *newpass) | 107 | newpass_p12(PKCS12 *p12, const char *oldpass, const char *newpass) |
| 107 | { | 108 | { |
| 108 | STACK_OF(PKCS7) *asafes, *newsafes; | 109 | STACK_OF(PKCS7) *asafes, *newsafes; |
| 109 | STACK_OF(PKCS12_SAFEBAG) *bags; | 110 | STACK_OF(PKCS12_SAFEBAG) *bags; |
| @@ -189,7 +190,8 @@ err: | |||
| 189 | 190 | ||
| 190 | 191 | ||
| 191 | static int | 192 | static int |
| 192 | newpass_bags(STACK_OF(PKCS12_SAFEBAG) *bags, char *oldpass, char *newpass) | 193 | newpass_bags(STACK_OF(PKCS12_SAFEBAG) *bags, const char *oldpass, |
| 194 | const char *newpass) | ||
| 193 | { | 195 | { |
| 194 | int i; | 196 | int i; |
| 195 | 197 | ||
| @@ -204,7 +206,7 @@ newpass_bags(STACK_OF(PKCS12_SAFEBAG) *bags, char *oldpass, char *newpass) | |||
| 204 | /* Change password of safebag: only needs handle shrouded keybags */ | 206 | /* Change password of safebag: only needs handle shrouded keybags */ |
| 205 | 207 | ||
| 206 | static int | 208 | static int |
| 207 | newpass_bag(PKCS12_SAFEBAG *bag, char *oldpass, char *newpass) | 209 | newpass_bag(PKCS12_SAFEBAG *bag, const char *oldpass, const char *newpass) |
| 208 | { | 210 | { |
| 209 | PKCS8_PRIV_KEY_INFO *p8; | 211 | PKCS8_PRIV_KEY_INFO *p8; |
| 210 | X509_SIG *p8new; | 212 | X509_SIG *p8new; |
diff --git a/src/lib/libcrypto/pkcs12/pkcs12.h b/src/lib/libcrypto/pkcs12/pkcs12.h index d6ee0d9a6f..a598eb4f9e 100644 --- a/src/lib/libcrypto/pkcs12/pkcs12.h +++ b/src/lib/libcrypto/pkcs12/pkcs12.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pkcs12.h,v 1.20 2018/05/13 14:15:01 tb Exp $ */ | 1 | /* $OpenBSD: pkcs12.h,v 1.21 2018/05/13 14:22:34 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 | */ |
| @@ -209,11 +209,11 @@ int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage); | |||
| 209 | ASN1_TYPE *PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs, | 209 | ASN1_TYPE *PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs, |
| 210 | int attr_nid); | 210 | int attr_nid); |
| 211 | char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag); | 211 | char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag); |
| 212 | unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, | 212 | unsigned char *PKCS12_pbe_crypt(const X509_ALGOR *algor, const char *pass, |
| 213 | int passlen, unsigned char *in, int inlen, unsigned char **data, | 213 | int passlen, const unsigned char *in, int inlen, unsigned char **data, |
| 214 | int *datalen, int en_de); | 214 | int *datalen, int en_de); |
| 215 | void * PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it, | 215 | void *PKCS12_item_decrypt_d2i(const X509_ALGOR *algor, const ASN1_ITEM *it, |
| 216 | const char *pass, int passlen, ASN1_OCTET_STRING *oct, int zbuf); | 216 | const char *pass, int passlen, const ASN1_OCTET_STRING *oct, int zbuf); |
| 217 | ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, | 217 | ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, |
| 218 | const ASN1_ITEM *it, const char *pass, int passlen, void *obj, int zbuf); | 218 | const ASN1_ITEM *it, const char *pass, int passlen, void *obj, int zbuf); |
| 219 | PKCS12 *PKCS12_init(int mode); | 219 | PKCS12 *PKCS12_init(int mode); |
| @@ -280,7 +280,7 @@ int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12); | |||
| 280 | int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12); | 280 | int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12); |
| 281 | PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12); | 281 | PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12); |
| 282 | PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12); | 282 | PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12); |
| 283 | int PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass); | 283 | int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass); |
| 284 | 284 | ||
| 285 | /* BEGIN ERROR CODES */ | 285 | /* BEGIN ERROR CODES */ |
| 286 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 286 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
