r2925 - in trunk/libmcrypto: include/libmcrypto source/openssl

mikma at minisip.org mikma at minisip.org
Sat Nov 18 13:41:01 CET 2006


Author: mikma
Date: 2006-11-18 13:41:00 +0100 (Sat, 18 Nov 2006)
New Revision: 2925

Added:
   trunk/libmcrypto/include/libmcrypto/rand.h
   trunk/libmcrypto/source/openssl/rand.cxx
Modified:
   trunk/libmcrypto/include/libmcrypto/Makefile.am
   trunk/libmcrypto/source/openssl/Makefile.am
Log:
Add Rand class to libmcrypto, which generates cryptographically strong
random data.


Modified: trunk/libmcrypto/include/libmcrypto/Makefile.am
===================================================================
--- trunk/libmcrypto/include/libmcrypto/Makefile.am	2006-11-18 10:17:53 UTC (rev 2924)
+++ trunk/libmcrypto/include/libmcrypto/Makefile.am	2006-11-18 12:41:00 UTC (rev 2925)
@@ -25,6 +25,7 @@
 		ZrtpDH.h \
 		hmac.h \
 		rijndael-alg-fst.h \
+		rand.h \
 		$(OTHER_FILES)
 
 MAINTAINERCLEANFILES = $(srcdir)/Makefile.in

Added: trunk/libmcrypto/include/libmcrypto/rand.h
===================================================================
--- trunk/libmcrypto/include/libmcrypto/rand.h	2006-11-18 10:17:53 UTC (rev 2924)
+++ trunk/libmcrypto/include/libmcrypto/rand.h	2006-11-18 12:41:00 UTC (rev 2925)
@@ -0,0 +1,40 @@
+/*
+  Copyright (C) 2006 Mikael Magnusson
+  
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Lesser General Public
+  License as published by the Free Software Foundation; either
+  version 2.1 of the License, or (at your option) any later version.
+
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with this library; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/*
+ * Authors: Mikael Magnusson <mikma at users.sourceforge.net>
+*/
+
+
+#ifndef RAND_H
+#define RAND_H
+
+#include <libmcrypto/config.h>
+#include <stddef.h>
+
+class LIBMCRYPTO_API Rand {
+	public:
+		Rand();
+
+		/**
+		 * Generate cryptographically strong random data
+		 */
+		static bool randomize(void *buffer, size_t length);
+};
+
+#endif

Modified: trunk/libmcrypto/source/openssl/Makefile.am
===================================================================
--- trunk/libmcrypto/source/openssl/Makefile.am	2006-11-18 10:17:53 UTC (rev 2924)
+++ trunk/libmcrypto/source/openssl/Makefile.am	2006-11-18 12:41:00 UTC (rev 2925)
@@ -14,6 +14,7 @@
 		cert.cxx \
 		ZrtpDH.cxx \
 		hmac.cxx \
+		rand.cxx \
 		$(OTHER_FILES)
 
 libmcopenssl_la_LIBADD = $(OPENSSL_LIBS)

Added: trunk/libmcrypto/source/openssl/rand.cxx
===================================================================
--- trunk/libmcrypto/source/openssl/rand.cxx	2006-11-18 10:17:53 UTC (rev 2924)
+++ trunk/libmcrypto/source/openssl/rand.cxx	2006-11-18 12:41:00 UTC (rev 2925)
@@ -0,0 +1,32 @@
+/*
+  Copyright (C) 2006 Mikael Magnusson
+  
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Lesser General Public
+  License as published by the Free Software Foundation; either
+  version 2.1 of the License, or (at your option) any later version.
+
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with this library; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/*
+ * Authors: Mikael Magnusson <mikma at users.sourceforge.net>
+*/
+
+
+#include<config.h>
+
+#include <openssl/rand.h>
+#include <libmcrypto/rand.h>
+
+bool Rand::randomize(void *buffer, size_t length)
+{
+	return RAND_bytes((unsigned char*)buffer, length);
+}


Property changes on: trunk/libmcrypto/source/openssl/rand.cxx
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native



More information about the Minisip-devel mailing list