OpenSSL 1.1.1-pre2
This commit is contained in:
+1
-16
@@ -25,8 +25,7 @@ static void h__dump(const unsigned char *p, int len);
|
||||
/*
|
||||
* This is an implementation of PKCS#5 v2.0 password based encryption key
|
||||
* derivation function PBKDF2. SHA1 version verified against test vectors
|
||||
* posted by Peter Gutmann <pgut001@cs.auckland.ac.nz> to the PKCS-TNG
|
||||
* <pkcs-tng@rsa.com> mailing list.
|
||||
* posted by Peter Gutmann to the PKCS-TNG mailing list.
|
||||
*/
|
||||
|
||||
int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
|
||||
@@ -88,7 +87,6 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
|
||||
HMAC_CTX_free(hctx_tpl);
|
||||
return 0;
|
||||
}
|
||||
HMAC_CTX_reset(hctx);
|
||||
memcpy(p, digtmp, cplen);
|
||||
for (j = 1; j < iter; j++) {
|
||||
if (!HMAC_CTX_copy(hctx, hctx_tpl)) {
|
||||
@@ -102,7 +100,6 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
|
||||
HMAC_CTX_free(hctx_tpl);
|
||||
return 0;
|
||||
}
|
||||
HMAC_CTX_reset(hctx);
|
||||
for (k = 0; k < cplen; k++)
|
||||
p[k] ^= digtmp[k];
|
||||
}
|
||||
@@ -132,18 +129,6 @@ int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
|
||||
keylen, out);
|
||||
}
|
||||
|
||||
# ifdef DO_TEST
|
||||
main()
|
||||
{
|
||||
unsigned char out[4];
|
||||
unsigned char salt[] = { 0x12, 0x34, 0x56, 0x78 };
|
||||
PKCS5_PBKDF2_HMAC_SHA1("password", -1, salt, 4, 5, 4, out);
|
||||
fprintf(stderr, "Out %02X %02X %02X %02X\n",
|
||||
out[0], out[1], out[2], out[3]);
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
/*
|
||||
* Now the key derivation function itself. This is a bit evil because it has
|
||||
* to check the ASN1 parameters are valid: and there are quite a few of
|
||||
|
||||
Reference in New Issue
Block a user