pemtest.c (1.1.1.3) | pemtest.c (1.1.1.4) |
---|---|
1/* 2 * Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved. 3 * 4 * Licensed under the Apache License 2.0 (the "License"). You may not use 5 * this file except in compliance with the License. You can obtain a copy 6 * in the file LICENSE in the source distribution or at 7 * https://www.openssl.org/source/license.html 8 */ --- 111 unchanged lines hidden (view full) --- 120 err: 121 OPENSSL_free(name); 122 OPENSSL_free(header); 123 OPENSSL_free(data); 124 BIO_free(b); 125 return ret; 126} 127 | 1/* 2 * Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved. 3 * 4 * Licensed under the Apache License 2.0 (the "License"). You may not use 5 * this file except in compliance with the License. You can obtain a copy 6 * in the file LICENSE in the source distribution or at 7 * https://www.openssl.org/source/license.html 8 */ --- 111 unchanged lines hidden (view full) --- 120 err: 121 OPENSSL_free(name); 122 OPENSSL_free(header); 123 OPENSSL_free(data); 124 BIO_free(b); 125 return ret; 126} 127 |
128static int test_protected_params(void) 129{ 130 BIO *b; 131 static char *protectedpay = 132 "-----BEGIN RSA PRIVATE KEY-----\n" 133 "Proc-Type: 4,ENCRYPTED\n" 134 "DEK-Info: AES-256-CBC,4A44448ED28992710556549B35100CEA\n" 135 "\n" 136 "Xw3INxKeH+rUUF57mjATpvj6zknVhedwrlRmRvnwlLv5wqIy5Ae4UVLPh7SUswfC\n" 137 "-----END RSA PRIVATE KEY-----\n"; 138 EVP_PKEY *pkey = NULL; 139 int ret = 0; 140 141 b = BIO_new_mem_buf(protectedpay, strlen(protectedpay)); 142 if (!TEST_ptr(b)) 143 return 0; 144 145 /* Expected to fail because we cannot decrypt protected PEM files */ 146 pkey = PEM_read_bio_Parameters(b, NULL); 147 if (!TEST_ptr_null(pkey)) 148 goto err; 149 150 ret = 1; 151 err: 152 EVP_PKEY_free(pkey); 153 BIO_free(b); 154 return ret; 155} 156 |
|
128int setup_tests(void) 129{ 130 if (!TEST_ptr(pemfile = test_get_argument(0))) 131 return 0; 132 ADD_ALL_TESTS(test_b64, OSSL_NELEM(b64_pem_data)); 133 ADD_TEST(test_invalid); 134 ADD_TEST(test_cert_key_cert); 135 ADD_TEST(test_empty_payload); | 157int setup_tests(void) 158{ 159 if (!TEST_ptr(pemfile = test_get_argument(0))) 160 return 0; 161 ADD_ALL_TESTS(test_b64, OSSL_NELEM(b64_pem_data)); 162 ADD_TEST(test_invalid); 163 ADD_TEST(test_cert_key_cert); 164 ADD_TEST(test_empty_payload); |
165 ADD_TEST(test_protected_params); |
|
136 return 1; 137} | 166 return 1; 167} |