Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 294501 Details for
Bug 346741
Port cryptsetup-luks to use NSS library for cryptography
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch cryptsetup to use NSS for hashing
cryptsetup-1.0.5-nss-0.patch (text/plain), 5.21 KB, created by
W. Michael Petullo
on 2008-02-10 18:21:39 UTC
(
hide
)
Description:
Patch cryptsetup to use NSS for hashing
Filename:
MIME Type:
Creator:
W. Michael Petullo
Created:
2008-02-10 18:21:39 UTC
Size:
5.21 KB
patch
obsolete
>diff -u --recursive --new-file cryptsetup-1.0.5-vanilla/configure.in cryptsetup-1.0.5/configure.in >--- cryptsetup-1.0.5-vanilla/configure.in 2007-05-07 00:04:13.000000000 +0430 >+++ cryptsetup-1.0.5/configure.in 2008-02-03 19:11:42.000000000 +0430 >@@ -91,6 +91,20 @@ > AM_CONDITIONAL(BUILD_LIBGCRYPT, test x$build_static = xyes) > AM_CONDITIONAL(SHARED_LIBGCRYPT, test x$build_shared = xyes) > >+MODULE_HELPER(nss, >+[ --enable-nss enable nss crypto functions [[default=auto]]],auto,[ >+ check=`pkg-config --version 2>/dev/null` >+ if test -n "$check"; then >+ NSS_LIBS=`pkg-config --libs nss` >+ NSS_CFLAGS=`pkg-config --cflags nss` >+ have_module=yes >+ fi >+ AC_SUBST(NSS_LIBS) >+ AC_SUBST(NSS_CFLAGS) >+]) >+AM_CONDITIONAL(BUILD_NSS, test x$build_static = xyes) >+AM_CONDITIONAL(SHARED_NSS, test x$build_shared = xyes) >+ > MODULE_HELPER(libdevmapper, > [ --enable-libdevmapper enable dm-crypt backend through libdevmapper > [[default=auto]]],auto,[ >diff -u --recursive --new-file cryptsetup-1.0.5-vanilla/lib/backends.c cryptsetup-1.0.5/lib/backends.c >--- cryptsetup-1.0.5-vanilla/lib/backends.c 2007-05-01 21:58:00.000000000 +0430 >+++ cryptsetup-1.0.5/lib/backends.c 2008-02-10 22:09:14.000000000 +0430 >@@ -7,6 +7,7 @@ > #include "internal.h" > > extern struct hash_backend hash_gcrypt_backend; >+extern struct hash_backend hash_nss_backend; > extern struct setup_backend setup_libdevmapper_backend; > > #ifdef USE_PLUGINS >@@ -21,6 +22,9 @@ > #ifdef BUILTIN_GCRYPT > &hash_gcrypt_backend, > #endif >+#ifdef BUILTIN_NSS >+ &hash_nss_backend, >+#endif > NULL > }; > >Binary files cryptsetup-1.0.5-vanilla/lib/.gcrypt.c.swp and cryptsetup-1.0.5/lib/.gcrypt.c.swp differ >diff -u --recursive --new-file cryptsetup-1.0.5-vanilla/lib/Makefile.am cryptsetup-1.0.5/lib/Makefile.am >--- cryptsetup-1.0.5-vanilla/lib/Makefile.am 2006-11-21 13:36:47.000000000 +0430 >+++ cryptsetup-1.0.5/lib/Makefile.am 2008-02-03 19:18:52.000000000 +0430 >@@ -24,6 +24,18 @@ > _LIBGCRYPT_SHLIB = libcrypto_gcrypt.la > endif > >+if BUILD_NSS >+_NSS_LIBADD = @NSS_LIBS@ >+_NSS_SOURCES = nss.c >+_NSS_CFLAGS = -DBUILTIN_NSS >+endif >+libcrypto_nss_la_SOURCES = nss.c >+libcrypto_nss_la_LDFLAGS = -avoid-version -module >+libcrypto_nss_la_LIBADD = @NSS_LIBS@ >+if SHARED_NSS >+_NSS_SHLIB = libcrypto_nss.la >+endif >+ > INCLUDES = \ > -I$(top_srcdir) \ > -I$(top_srcdir)/luks \ >@@ -38,14 +50,17 @@ > @LIBDEVMAPPER_CFLAGS@ \ > $(_LIBDEVMAPPER_CFLAGS) \ > @LIBGCRYPT_CFLAGS@ \ >- $(_LIBGCRYPT_CFLAGS) >+ $(_LIBGCRYPT_CFLAGS) \ >+ @NSS_CFLAGS@ \ >+ $(_NSS_CFLAGS) > > lib_LTLIBRARIES = \ > libcryptsetup.la > > module_LTLIBRARIES = \ > $(_LIBDEVMAPPER_SHLIB) \ >- $(_LIBGCRYPT_SHLIB) >+ $(_LIBGCRYPT_SHLIB) \ >+ $(_NSS_SHLIB) > > if STATIC_LIBRARY > _STATIC_LIBRARY = -static >@@ -57,6 +72,7 @@ > libcryptsetup_la_LIBADD = \ > $(_LIBDEVMAPPER_LIBADD) \ > $(_LIBGCRYPT_LIBADD) \ >+ $(_NSS_LIBADD) \ > @UUID_LIBS@ \ > ../luks/libluks.la > >@@ -68,7 +84,8 @@ > utils.c \ > backends.c \ > $(_LIBDEVMAPPER_SOURCES) \ >- $(_LIBGCRYPT_SOURCES) >+ $(_LIBGCRYPT_SOURCES) \ >+ $(_NSS_SOURCES) > > include_HEADERS = \ > libcryptsetup.h >diff -u --recursive --new-file cryptsetup-1.0.5-vanilla/lib/nss.c cryptsetup-1.0.5/lib/nss.c >--- cryptsetup-1.0.5-vanilla/lib/nss.c 1970-01-01 04:30:00.000000000 +0430 >+++ cryptsetup-1.0.5/lib/nss.c 2008-02-10 22:15:17.000000000 +0430 >@@ -0,0 +1,93 @@ >+#include <stdlib.h> >+#include <string.h> >+#include <ctype.h> >+#include <nss.h> >+#include <pk11func.h> >+ >+#include "libcryptsetup.h" >+#include "internal.h" >+ >+#define MAX_DIGESTS 64 >+ >+static int nss_hash(void *data, int size, char *key, >+ int sizep, const char *passphrase) >+{ >+ SECStatus s; >+ unsigned int len; >+ PK11Context *context = NULL; >+ >+ NSS_NoDB_Init("."); >+ >+ memset(key, 0xbc, size); >+ >+ context = PK11_CreateDigestContext(*((int *)data)); >+ if (NULL == context) >+ return -1; >+ >+ s = PK11_DigestBegin(context); >+ if (SECSuccess != s) >+ return -1; >+ >+ s = PK11_DigestOp(context, passphrase, sizep); >+ if (SECSuccess != s) >+ return -1; >+ >+ s = PK11_DigestFinal(context, key, &len, size); >+ if (SECSuccess != s) >+ return -1; >+ >+ PK11_DestroyContext(context, PR_TRUE); >+ >+ return 0; >+} >+ >+static struct hash_type *nss_get_hashes(void) >+{ >+ struct hash_type *hashes; >+ >+ hashes = malloc(sizeof(*hashes) * 2); >+ if (NULL == hashes) >+ goto err; >+ >+ /* Populate by hand as proof of concept. */ >+ hashes[0].name = strdup("sha1"); >+ if (NULL == hashes[0].name) >+ goto err; >+ hashes[0].private = malloc(sizeof(int)); >+ if (NULL == hashes[0].private) >+ goto err; >+ *((int *)hashes[0].private) = SEC_OID_SHA1; >+ hashes[0].fn = nss_hash; >+ >+ hashes[1].name = NULL; >+ hashes[1].private = NULL; >+ hashes[1].fn = NULL; >+ >+ return hashes; >+err: >+ if (NULL != hashes[0].name) >+ free(hashes[0].name); >+ if (NULL != hashes[0].private) >+ free(hashes[0].private); >+ if (NULL != hashes) >+ free(hashes); >+ return NULL; >+} >+ >+static void nss_free_hashes(struct hash_type *hashes) >+{ >+ struct hash_type *hash; >+ >+ for(hash = hashes; hash->name; hash++) { >+ free(hash->name); >+ free(hash->private); >+ } >+ >+ free(hashes); >+} >+ >+struct hash_backend hash_nss_backend = { >+ .name = "nss", >+ .get_hashes = nss_get_hashes, >+ .free_hashes = nss_free_hashes >+};
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 346741
: 294501