summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/pkcs12
diff options
context:
space:
mode:
authormiod <>2014-07-10 10:01:23 +0000
committermiod <>2014-07-10 10:01:23 +0000
commit4c842635fbe2aa61878226cb3083d6d178062524 (patch)
treedfbc4a997348653aa514410cfccb02c6807f5673 /src/lib/libcrypto/pkcs12
parent4011d14a361cbf02683ee6a3c4029eaa2669d81b (diff)
downloadopenbsd-4c842635fbe2aa61878226cb3083d6d178062524.tar.gz
openbsd-4c842635fbe2aa61878226cb3083d6d178062524.tar.bz2
openbsd-4c842635fbe2aa61878226cb3083d6d178062524.zip
Remove DEBUG_KEYGEN and DEBUG_DECRYPT support.
Diffstat (limited to 'src/lib/libcrypto/pkcs12')
-rw-r--r--src/lib/libcrypto/pkcs12/p12_decr.c17
-rw-r--r--src/lib/libcrypto/pkcs12/p12_key.c34
2 files changed, 2 insertions, 49 deletions
diff --git a/src/lib/libcrypto/pkcs12/p12_decr.c b/src/lib/libcrypto/pkcs12/p12_decr.c
index 577bb06f80..c06f580de2 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.11 2014/07/08 09:24:53 jsing Exp $ */ 1/* $OpenBSD: p12_decr.c,v 1.12 2014/07/10 10:01:23 miod 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 */
@@ -60,9 +60,6 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/pkcs12.h> 61#include <openssl/pkcs12.h>
62 62
63/* Define this to dump decrypted output to files called DERnnn */
64/*#define DEBUG_DECRYPT*/
65
66 63
67/* Encrypt/Decrypt a buffer based on password and algor, result in a 64/* Encrypt/Decrypt a buffer based on password and algor, result in a
68 * malloc'ed buffer 65 * malloc'ed buffer
@@ -137,18 +134,6 @@ PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it,
137 return NULL; 134 return NULL;
138 } 135 }
139 p = out; 136 p = out;
140#ifdef DEBUG_DECRYPT
141 {
142 FILE *op;
143
144 char fname[30];
145 static int fnm = 1;
146 sprintf(fname, "DER%d", fnm++);
147 op = fopen(fname, "wb");
148 fwrite (p, 1, outlen, op);
149 fclose(op);
150 }
151#endif
152 ret = ASN1_item_d2i(NULL, &p, outlen, it); 137 ret = ASN1_item_d2i(NULL, &p, outlen, it);
153 if (zbuf) 138 if (zbuf)
154 OPENSSL_cleanse(out, outlen); 139 OPENSSL_cleanse(out, outlen);
diff --git a/src/lib/libcrypto/pkcs12/p12_key.c b/src/lib/libcrypto/pkcs12/p12_key.c
index ffa736a04f..a2f7db8267 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.16 2014/07/08 09:24:53 jsing Exp $ */ 1/* $OpenBSD: p12_key.c,v 1.17 2014/07/10 10:01:23 miod 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 */
@@ -61,14 +61,6 @@
61#include <openssl/pkcs12.h> 61#include <openssl/pkcs12.h>
62#include <openssl/bn.h> 62#include <openssl/bn.h>
63 63
64/* Uncomment out this line to get debugging info about key generation */
65/*#define DEBUG_KEYGEN*/
66#ifdef DEBUG_KEYGEN
67#include <openssl/bio.h>
68extern BIO *bio_err;
69void h__dump (unsigned char *p, int len);
70#endif
71
72/* PKCS12 compatible key/IV generation */ 64/* PKCS12 compatible key/IV generation */
73#ifndef min 65#ifndef min
74#define min(a,b) ((a) < (b) ? (a) : (b)) 66#define min(a,b) ((a) < (b) ? (a) : (b))
@@ -112,10 +104,6 @@ PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
112 int ret = 0; 104 int ret = 0;
113 BIGNUM *Ij, *Bpl1; /* These hold Ij and B + 1 */ 105 BIGNUM *Ij, *Bpl1; /* These hold Ij and B + 1 */
114 EVP_MD_CTX ctx; 106 EVP_MD_CTX ctx;
115#ifdef DEBUG_KEYGEN
116 unsigned char *tmpout = out;
117 int tmpn = n;
118#endif
119 107
120#if 0 108#if 0
121 if (!pass) { 109 if (!pass) {
@@ -125,14 +113,6 @@ PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
125#endif 113#endif
126 114
127 EVP_MD_CTX_init(&ctx); 115 EVP_MD_CTX_init(&ctx);
128#ifdef DEBUG_KEYGEN
129 fprintf(stderr, "KEYGEN DEBUG\n");
130 fprintf(stderr, "ID %d, ITER %d\n", id, iter);
131 fprintf(stderr, "Password (length %d):\n", passlen);
132 h__dump(pass, passlen);
133 fprintf(stderr, "Salt (length %d):\n", saltlen);
134 h__dump(salt, saltlen);
135#endif
136 v = EVP_MD_block_size(md_type); 116 v = EVP_MD_block_size(md_type);
137 u = EVP_MD_size(md_type); 117 u = EVP_MD_size(md_type);
138 if (u < 0) 118 if (u < 0)
@@ -172,10 +152,6 @@ PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
172 } 152 }
173 memcpy (out, Ai, min (n, u)); 153 memcpy (out, Ai, min (n, u));
174 if (u >= n) { 154 if (u >= n) {
175#ifdef DEBUG_KEYGEN
176 fprintf(stderr, "Output KEY (length %d)\n", tmpn);
177 h__dump(tmpout, tmpn);
178#endif
179 ret = 1; 155 ret = 1;
180 goto end; 156 goto end;
181 } 157 }
@@ -226,11 +202,3 @@ end:
226 EVP_MD_CTX_cleanup(&ctx); 202 EVP_MD_CTX_cleanup(&ctx);
227 return ret; 203 return ret;
228} 204}
229#ifdef DEBUG_KEYGEN
230void h__dump (unsigned char *p, int len)
231{
232 for (; len --; p++)
233 fprintf(stderr, "%02X", *p);
234 fprintf(stderr, "\n");
235}
236#endif