Page MenuHomeFreeBSD

D46633.diff
No OneTemporary

D46633.diff

diff --git a/sys/geom/eli/pkcs5v2.h b/sys/geom/eli/pkcs5v2.h
--- a/sys/geom/eli/pkcs5v2.h
+++ b/sys/geom/eli/pkcs5v2.h
@@ -30,6 +30,9 @@
#define _PKCS5V2_H_
void pkcs5v2_genkey(uint8_t *key, unsigned keylen, const uint8_t *salt,
size_t saltsize, const char *passphrase, u_int iterations);
+void pkcs5v2_genkey_raw(uint8_t *key, unsigned keylen, const uint8_t *salt,
+ size_t saltsize, const uint8_t *passphrase, size_t passlen,
+ u_int iterations);
#ifndef _KERNEL
int pkcs5v2_calculate(int usecs);
#endif
diff --git a/sys/geom/eli/pkcs5v2.c b/sys/geom/eli/pkcs5v2.c
--- a/sys/geom/eli/pkcs5v2.c
+++ b/sys/geom/eli/pkcs5v2.c
@@ -51,13 +51,22 @@
pkcs5v2_genkey(uint8_t *key, unsigned keylen, const uint8_t *salt,
size_t saltsize, const char *passphrase, u_int iterations)
{
+
+ pkcs5v2_genkey_raw(key, keylen, salt, saltsize, passphrase,
+ strlen(passphrase), iterations);
+}
+
+void
+pkcs5v2_genkey_raw(uint8_t *key, unsigned keylen, const uint8_t *salt,
+ size_t saltsize, const uint8_t *passphrase, size_t passlen,
+ u_int iterations)
+{
uint8_t md[SHA512_MDLEN], saltcount[saltsize + sizeof(uint32_t)];
uint8_t *counter, *keyp;
- u_int i, bsize, passlen;
+ u_int i, bsize;
uint32_t count;
struct hmac_ctx startpoint, ctx;
- passlen = strlen(passphrase);
bzero(key, keylen);
bcopy(salt, saltcount, saltsize);
counter = saltcount + saltsize;

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 14, 8:59 PM (7 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
11636967
Default Alt Text
D46633.diff (1 KB)

Event Timeline