Re: gdb patches to RBS

2014-11-14 Thread Jiri Gaisler


On 11/14/2014 02:34 AM, Chris Johns wrote:
 On 14/11/2014 9:12 am, Jiri Gaisler wrote:

 What is the procedure to add gdb patches to RBS?

 
 Patches are first accepted by the RTEMS Project as the definition of the 
 tools belongs to the project and tool packagers, ie the RSB, need to adopt 
 that definition to get a project tick. Patches should be posted upstream 
 where possible and then referenced from there. If the
 upstream does not have a suitable method to reference patches we can add them 
 to the rtems-tools.git repo under the tools directory. There are specific 
 cases such as the openrisc tools where a specific github instance is 
 referenced as we have a positive undertaking from that
 community the tools are being merged upstream. Examples of upstream patch 
 referencing is qemu and patchworks.
 
 I do not see a patch management system for gdb. There was talk back in April 
 of this year of gdb using patchworks and then something else however it seems 
 to have died out.
 
 I have a few patches that fixes the erc32 simulator and also
 add support for leon2 and leon3. This would allow us to drop
 the sis bsp, and also to test the leon2 and leon3 bsp's with
 sis.
 
 Excellent. I suggest you provide git patches for the rtems-tools.git repo to 
 add the patches and then provide RSB patches for the sparc gdb build to use 
 them. There are specific sparc patches already present which need updating as 
 they are currently stopping us moving off gdb-7.7.

The latest stable gdb version is 7.8.1, while the git head is at 
7.8.50.20141112-cvs .
Should we switch to gdb-7.8.1 or stay at 7.7? It does not really matter to me 
which
one. The existing sparc gdb patch for 7.7 is merged into my patches as I had to
rework it a bit.

I will try to push my patches upstream to gdb but I suspect it will take
while before the are accepted, as they are quite large.

Jiri.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] DEVFS04: make test work on LEON3-FT GR712RC

2014-11-14 Thread Daniel Hellstrom
The LEON3 BSP have support for up to 8 termios consoles, the
LEON3-FT GR712RC uses 6 UARTs.

This does not take into account the BSP maximum devices instead
it is hardcoded to 6. This patch increases it the maximum
devices of DEVFS04 from 6 to 10.
---
 testsuites/libtests/devfs04/init.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/testsuites/libtests/devfs04/init.c 
b/testsuites/libtests/devfs04/init.c
index 5b42173..42f7977 100644
--- a/testsuites/libtests/devfs04/init.c
+++ b/testsuites/libtests/devfs04/init.c
@@ -84,7 +84,7 @@ rtems_task Init(
 
 /* include an extra slot for registering the termios one dynamically */
 #define CONFIGURE_MAXIMUM_DRIVERS 3
-#define CONFIGURE_MAXIMUM_DEVICES 6
+#define CONFIGURE_MAXIMUM_DEVICES 10
 
 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 5
 
-- 
1.7.0.4

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 7/9] libcsupport: Avoid TOCTOU and format errors

2014-11-14 Thread Sebastian Huber
---
 cpukit/libcsupport/src/pwdgrp.c   |  42 ++--
 testsuites/libtests/Makefile.am   |   1 +
 testsuites/libtests/configure.ac  |   1 +
 testsuites/libtests/pwdgrp01/Makefile.am  |  19 ++
 testsuites/libtests/pwdgrp01/init.c   | 107 ++
 testsuites/libtests/pwdgrp01/pwdgrp01.doc |  13 
 testsuites/libtests/pwdgrp01/pwdgrp01.scn |   2 +
 7 files changed, 165 insertions(+), 20 deletions(-)
 create mode 100644 testsuites/libtests/pwdgrp01/Makefile.am
 create mode 100644 testsuites/libtests/pwdgrp01/init.c
 create mode 100644 testsuites/libtests/pwdgrp01/pwdgrp01.doc
 create mode 100644 testsuites/libtests/pwdgrp01/pwdgrp01.scn

diff --git a/cpukit/libcsupport/src/pwdgrp.c b/cpukit/libcsupport/src/pwdgrp.c
index c10cbab..a531b8b 100644
--- a/cpukit/libcsupport/src/pwdgrp.c
+++ b/cpukit/libcsupport/src/pwdgrp.c
@@ -39,40 +39,42 @@
 
 static pthread_once_t pwdgrp_once = PTHREAD_ONCE_INIT;
 
+static void init_file(const char *name, const char *content)
+{
+  FILE *fp = fopen(name, wx);
+
+  if (fp != NULL) {
+fputs(content, fp);
+fclose(fp);
+  }
+}
+
 /**
  *  Initialize useable but dummy databases
  */
 static void pwdgrp_init(void)
 {
-  FILE *fp;
-
   mkdir(/etc, 0777);
 
   /*
*  Initialize /etc/passwd
*/
-  if ((fp = fopen(/etc/passwd, r)) != NULL) {
-fclose(fp);
-  }
-  else if ((fp = fopen(/etc/passwd, w)) != NULL) {
-fprintf(fp, root:*:0:0:root::/:/bin/sh\n
- rtems:*:1:1:RTEMS Application::/:/bin/sh\n
- tty:!:2:2:tty owner::/:/bin/false\n );
-fclose(fp);
-  }
+  init_file(
+/etc/passwd,
+root:*:0:0:root::/:/bin/sh\n
+  rtems:*:1:1:RTEMS Application::/:/bin/sh\n
+  tty:!:2:2:tty owner::/:/bin/false\n
+  );
 
   /*
*  Initialize /etc/group
*/
-  if ((fp = fopen(/etc/group, r)) != NULL) {
-fclose(fp);
-  }
-  else if ((fp = fopen(/etc/group, w)) != NULL) {
-fprintf( fp, root:x:0:root\n
- rtems:x:1:rtems\n
- tty:x:2:tty\n );
-fclose(fp);
-  }
+  init_file(
+/etc/group,
+root:x:0:root\n
+  rtems:x:1:rtems\n
+  tty:x:2:tty\n
+  );
 }
 
 void _libcsupport_pwdgrp_init(void)
diff --git a/testsuites/libtests/Makefile.am b/testsuites/libtests/Makefile.am
index 8475227..8e53204 100644
--- a/testsuites/libtests/Makefile.am
+++ b/testsuites/libtests/Makefile.am
@@ -1,6 +1,7 @@
 ACLOCAL_AMFLAGS = -I ../aclocal
 
 _SUBDIRS = POSIX
+_SUBDIRS += pwdgrp01
 _SUBDIRS += crypt01
 _SUBDIRS += sha01
 _SUBDIRS += i2c01
diff --git a/testsuites/libtests/configure.ac b/testsuites/libtests/configure.ac
index 3882dcd..449a884 100644
--- a/testsuites/libtests/configure.ac
+++ b/testsuites/libtests/configure.ac
@@ -66,6 +66,7 @@ AS_IF([test x$HAVE_LIBDL = xyes],[
 
 # Explicitly list all Makefiles here
 AC_CONFIG_FILES([Makefile
+pwdgrp01/Makefile
 crypt01/Makefile
 sha01/Makefile
 i2c01/Makefile
diff --git a/testsuites/libtests/pwdgrp01/Makefile.am 
b/testsuites/libtests/pwdgrp01/Makefile.am
new file mode 100644
index 000..e624b26
--- /dev/null
+++ b/testsuites/libtests/pwdgrp01/Makefile.am
@@ -0,0 +1,19 @@
+rtems_tests_PROGRAMS = pwdgrp01
+pwdgrp01_SOURCES = init.c
+
+dist_rtems_tests_DATA = pwdgrp01.scn pwdgrp01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(pwdgrp01_OBJECTS)
+LINK_LIBS = $(pwdgrp01_LDLIBS)
+
+pwdgrp01$(EXEEXT): $(pwdgrp01_OBJECTS) $(pwdgrp01_DEPENDENCIES)
+   @rm -f pwdgrp01$(EXEEXT)
+   $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/libtests/pwdgrp01/init.c 
b/testsuites/libtests/pwdgrp01/init.c
new file mode 100644
index 000..4c1f7ff
--- /dev/null
+++ b/testsuites/libtests/pwdgrp01/init.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  rt...@embedded-brains.de
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+  #include config.h
+#endif
+
+#include sys/stat.h
+#include grp.h
+#include pwd.h
+#include stdio.h
+
+#include tmacros.h
+
+const char rtems_test_name[] = PWDGRP 1;
+
+static void test(void)
+{
+  const char passwd[] = moop:foo:1:2:blob:a:b:c\n;
+  const char group[] = blub:bar:3:moop\n;
+  int rv;
+  FILE *fp;
+  struct passwd pwd;
+  struct group grp;
+  struct passwd *pwd_res;
+  struct group *grp_res;
+  char buf[256];
+
+  rv = mkdir(/etc, 0777);
+  rtems_test_assert(rv == 0);
+
+  fp = fopen(/etc/passwd, wx);
+  rtems_test_assert(fp != NULL);
+
+  rv = fputs(passwd[0], fp);
+  rtems_test_assert(rv == 0);
+
+  rv = fclose(fp);
+  rtems_test_assert(rv == 0);
+
+  fp = fopen(/etc/group, wx);
+  

[PATCH 9/9] shell: Use crypt_r() in rtems_shell_login_check()

2014-11-14 Thread Sebastian Huber
Use '* to disable shell login instead of '!' according to the Linux man
page.  Use getpwnam_r() instead of getpwnam().  Do not access the user
environment directly.
---
 cpukit/libmisc/shell/login_check.c | 45 --
 testsuites/samples/fileio/init.c   | 13 +++
 2 files changed, 38 insertions(+), 20 deletions(-)

diff --git a/cpukit/libmisc/shell/login_check.c 
b/cpukit/libmisc/shell/login_check.c
index 8be5be2..4b21aaf 100644
--- a/cpukit/libmisc/shell/login_check.c
+++ b/cpukit/libmisc/shell/login_check.c
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (c) 2009 embedded brains GmbH and others.
+ * Copyright (c) 2009-2014 embedded brains GmbH and others.
  *
  * embedded brains GmbH
  * Obere Lagerstr. 30
@@ -30,34 +30,47 @@
 #include unistd.h
 #include pwd.h
 #include string.h
+#include crypt.h
 
 #include rtems/shell.h
-#include rtems/userenv.h
 
 bool rtems_shell_login_check(
   const char *user,
   const char *passphrase
 )
 {
-  struct passwd *pw = getpwnam( user);
+  char buf[256];
+  struct passwd *pw_res;
+  struct passwd pw;
+  int eno;
+
+  eno = getpwnam_r(user, pw, buf[0], sizeof(buf), pw_res);
 
   /* Valid user? */
-  if (pw != NULL  strcmp( pw-pw_passwd, !) != 0) {
+  if (eno == 0  strcmp(pw.pw_passwd, *) != 0) {
 rtems_shell_env_t *env = rtems_shell_get_current_env();
-setuid( pw-pw_uid);
-setgid( pw-pw_gid);
-rtems_current_user_env-euid = 0;
-rtems_current_user_env-egid = 0;
-if (env)
-  chown( env-devname, pw-pw_uid, 0);
-rtems_current_user_env-euid = pw-pw_uid;
-rtems_current_user_env-egid = pw-pw_gid;
-if (strcmp( pw-pw_passwd, *) == 0) {
-  /* TODO: /etc/shadow */
+
+if (env != NULL) {
+  chown(env-devname, pw.pw_uid, 0);
+}
+
+setuid(pw.pw_uid);
+setgid(pw.pw_gid);
+seteuid(pw.pw_uid);
+setegid(pw.pw_gid);
+
+if (strcmp(pw.pw_passwd, ) == 0) {
   return true;
+} else if (strcmp(pw.pw_passwd, x) == 0) {
+  /* TODO: /etc/shadow */
+  return false;
 } else {
-  /* TODO: crypt() */
-  return true;
+  struct crypt_data data;
+  char *s;
+
+  s = crypt_r(passphrase, pw.pw_passwd, data);
+
+  return strcmp(s, pw.pw_passwd) == 0;
 }
   }
 
diff --git a/testsuites/samples/fileio/init.c b/testsuites/samples/fileio/init.c
index 2b60922..735b588 100644
--- a/testsuites/samples/fileio/init.c
+++ b/testsuites/samples/fileio/init.c
@@ -13,6 +13,7 @@
 
 #define CONFIGURE_INIT
 #include system.h
+#include crypt.h
 #include stdio.h
 #include string.h
 #include unistd.h
@@ -641,10 +642,11 @@ static void fileio_start_shell(void)
   writeFile(
 /etc/passwd,
 0644,
-root:7QR4o148UPtb.:0:0:root::/:/bin/sh\n
-rtems:*:1:1:RTEMS Application::/:/bin/sh\n
-test:8Yy.AaxynxbLI:2:2:test account::/:/bin/sh\n
-tty:!:3:3:tty owner::/:/bin/false\n
+root:$6$$FuPOhnllx6lhW2qqlnmWvZQLJ8Thr/09I7ESTdb9VbnTOn5.65
+  /Vh2Mqa6FoKXwT0nHS/O7F0KfrDc6Svb/sH.:0:0:root::/:/bin/sh\n
+rtems::1:1:RTEMS Application::/:/bin/sh\n
+test:$1$$oPu1Xt2Pw0ngIc7LyDHqu1:2:2:test account::/:/bin/sh\n
+tty:*:3:3:tty owner::/:/bin/false\n
   );
   writeFile(
 /etc/group,
@@ -1225,6 +1227,9 @@ Init (rtems_task_argument ignored)
 
   TEST_BEGIN();
 
+  crypt_add_format(crypt_md5_format);
+  crypt_add_format(crypt_sha512_format);
+
   status = rtems_shell_wait_for_input(
 STDIN_FILENO,
 20,
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 5/9] libcsupport: Split passwd/group support

2014-11-14 Thread Sebastian Huber
---
 cpukit/libcsupport/Makefile.am|   4 +-
 cpukit/libcsupport/src/getgrent.c |  78 
 cpukit/libcsupport/src/getpwent.c | 385 +-
 cpukit/libcsupport/src/pwdgrp.c   | 346 ++
 cpukit/libcsupport/src/pwdgrp.h   |  46 +
 5 files changed, 476 insertions(+), 383 deletions(-)
 create mode 100644 cpukit/libcsupport/src/getgrent.c
 create mode 100644 cpukit/libcsupport/src/pwdgrp.c
 create mode 100644 cpukit/libcsupport/src/pwdgrp.h

diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am
index 40e0800..74b029c 100644
--- a/cpukit/libcsupport/Makefile.am
+++ b/cpukit/libcsupport/Makefile.am
@@ -108,7 +108,9 @@ MALLOC_C_FILES = src/malloc_initialize.c src/calloc.c 
src/malloc.c \
 src/rtems_heap_extend.c \
 src/rtems_heap_greedy.c
 
-PASSWORD_GROUP_C_FILES = src/getpwent.c
+PASSWORD_GROUP_C_FILES = src/pwdgrp.c
+PASSWORD_GROUP_C_FILES += src/getgrent.c
+PASSWORD_GROUP_C_FILES += src/getpwent.c
 
 TERMINAL_IDENTIFICATION_C_FILES = src/ctermid.c
 ## 20 Nov 2008: Now using these from newlib's posix directory
diff --git a/cpukit/libcsupport/src/getgrent.c 
b/cpukit/libcsupport/src/getgrent.c
new file mode 100644
index 000..9b11e2e
--- /dev/null
+++ b/cpukit/libcsupport/src/getgrent.c
@@ -0,0 +1,78 @@
+/**
+ *  @file
+ *
+ *  @brief User Database Access Routines
+ *  @ingroup libcsupport
+ */
+
+/*
+ *  Copyright (c) 1999-2009 Ralf Corsepius corse...@faw.uni-ulm.de
+ *  Copyright (c) 1999-2013 Joel Sherrill joel.sherr...@oarcorp.com
+ *  Copyright (c) 2000-2001 Fernando Ruiz Casas fernando.r...@ctv.es
+ *  Copyright (c) 2002 Eric Norum eric.no...@usask.ca
+ *  Copyright (c) 2003 Till Straumann strau...@slac.stanford.edu
+ *  Copyright (c) 2012 Alex Ivanov alexivano...@gmail.com
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include config.h
+#endif
+
+#include pwdgrp.h
+
+/*
+ * Static, thread-unsafe, buffers
+ */
+static FILE *group_fp;
+static char grbuf[200];
+static struct group grent;
+
+struct group *getgrnam(
+  const char *name
+)
+{
+  struct group *p;
+
+  if(getgrnam_r(name, grent, grbuf, sizeof grbuf, p))
+return NULL;
+  return p;
+}
+
+struct group *getgrgid(
+  gid_t gid
+)
+{
+  struct group *p;
+
+  if(getgrgid_r(gid, grent, grbuf, sizeof grbuf, p))
+return NULL;
+  return p;
+}
+
+struct group *getgrent(void)
+{
+  if (group_fp == NULL)
+return NULL;
+  if (!_libcsupport_scangr(group_fp, grent, grbuf, sizeof grbuf))
+return NULL;
+  return grent;
+}
+
+void setgrent(void)
+{
+  _libcsupport_pwdgrp_init();
+
+  if (group_fp != NULL)
+fclose(group_fp);
+  group_fp = fopen(/etc/group, r);
+}
+
+void endgrent(void)
+{
+  if (group_fp != NULL)
+fclose(group_fp);
+}
diff --git a/cpukit/libcsupport/src/getpwent.c 
b/cpukit/libcsupport/src/getpwent.c
index 483dd95..5a6b444 100644
--- a/cpukit/libcsupport/src/getpwent.c
+++ b/cpukit/libcsupport/src/getpwent.c
@@ -22,23 +22,7 @@
 #include config.h
 #endif
 
-#include stdio.h
-#include sys/types.h
-#include pwd.h
-#include grp.h
-#include errno.h
-#include unistd.h
-#include stdlib.h
-#include string.h
-#include limits.h
-#include ctype.h
-
-#include rtems/libio_.h
-#include rtems/seterr.h
-
-/**
- *  POSIX 1003.1b - 9.2.2 - User Database Access Routines
- */
+#include pwdgrp.h
 
 /*
  * Static, thread-unsafe, buffers
@@ -46,202 +30,6 @@
 static FILE *passwd_fp;
 static char pwbuf[200];
 static struct passwd pwent;
-static FILE *group_fp;
-static char grbuf[200];
-static struct group grent;
-
-/*
- *  Prototype to avoid warning
- */
-void init_etc_passwd_group(void);
-
-/**
- *  Initialize useable but dummy databases
- */
-void init_etc_passwd_group(void)
-{
-  FILE *fp;
-  static char etc_passwd_initted = 0;
-
-  if (etc_passwd_initted)
-return;
-  etc_passwd_initted = 1;
-  mkdir(/etc, 0777);
-
-  /*
-   *  Initialize /etc/passwd
-   */
-  if ((fp = fopen(/etc/passwd, r)) != NULL) {
-fclose(fp);
-  }
-  else if ((fp = fopen(/etc/passwd, w)) != NULL) {
-fprintf(fp, root:*:0:0:root::/:/bin/sh\n
- rtems:*:1:1:RTEMS Application::/:/bin/sh\n
- tty:!:2:2:tty owner::/:/bin/false\n );
-fclose(fp);
-  }
-
-  /*
-   *  Initialize /etc/group
-   */
-  if ((fp = fopen(/etc/group, r)) != NULL) {
-fclose(fp);
-  }
-  else if ((fp = fopen(/etc/group, w)) != NULL) {
-fprintf( fp, root:x:0:root\n
- rtems:x:1:rtems\n
- tty:x:2:tty\n );
-fclose(fp);
-  }
-}
-
-/**
- *  Extract a string value from the database
- */
-static int
-scanString(FILE *fp, char **name, char **bufp, size_t *nleft, int nlFlag)
-{
-  int c;
-
-  *name = *bufp;
-  for (;;) {
-c = getc(fp);
-if (c == ':') {
-if (nlFlag)
-return 0;
-break;
-}
-if (c == '\n') {
-if (!nlFlag)
-

[PATCH 6/9] libcsupport: Use pthread_once()

2014-11-14 Thread Sebastian Huber
---
 cpukit/libcsupport/src/pwdgrp.c | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/cpukit/libcsupport/src/pwdgrp.c b/cpukit/libcsupport/src/pwdgrp.c
index d8e1947..c10cbab 100644
--- a/cpukit/libcsupport/src/pwdgrp.c
+++ b/cpukit/libcsupport/src/pwdgrp.c
@@ -31,22 +31,21 @@
 #include string.h
 #include limits.h
 #include ctype.h
+#include pthread.h
 
 #include rtems/seterr.h
 
 #include pwdgrp.h
 
+static pthread_once_t pwdgrp_once = PTHREAD_ONCE_INIT;
+
 /**
  *  Initialize useable but dummy databases
  */
-void _libcsupport_pwdgrp_init(void)
+static void pwdgrp_init(void)
 {
   FILE *fp;
-  static char etc_passwd_initted = 0;
 
-  if (etc_passwd_initted)
-return;
-  etc_passwd_initted = 1;
   mkdir(/etc, 0777);
 
   /*
@@ -76,6 +75,11 @@ void _libcsupport_pwdgrp_init(void)
   }
 }
 
+void _libcsupport_pwdgrp_init(void)
+{
+  pthread_once(pwdgrp_once, pwdgrp_init);
+}
+
 /**
  *  Extract a string value from the database
  */
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 2/9] Add SHA256 and SHA512 support

2014-11-14 Thread Sebastian Huber
---
 cpukit/Makefile.am|   2 -
 cpukit/libmd/Makefile.am  |  13 +-
 cpukit/libmd/preinstall.am|  30 
 cpukit/libmd/sha256.h |  50 ++
 cpukit/libmd/sha256c.c| 297 +++
 cpukit/libmd/sha512.h |  50 ++
 cpukit/libmd/sha512c.c| 320 ++
 cpukit/preinstall.am  |   8 -
 testsuites/libtests/Makefile.am   |   1 +
 testsuites/libtests/configure.ac  |   1 +
 testsuites/libtests/sha01/Makefile.am |  19 ++
 testsuites/libtests/sha01/init.c  | 191 
 testsuites/libtests/sha01/sha01.doc   |  17 ++
 testsuites/libtests/sha01/sha01.scn   |  16 ++
 14 files changed, 1003 insertions(+), 12 deletions(-)
 create mode 100644 cpukit/libmd/sha256.h
 create mode 100644 cpukit/libmd/sha256c.c
 create mode 100644 cpukit/libmd/sha512.h
 create mode 100644 cpukit/libmd/sha512c.c
 create mode 100644 testsuites/libtests/sha01/Makefile.am
 create mode 100644 testsuites/libtests/sha01/init.c
 create mode 100644 testsuites/libtests/sha01/sha01.doc
 create mode 100644 testsuites/libtests/sha01/sha01.scn

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 8f99983..51cec69 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -47,8 +47,6 @@ include_sysdir = $(includedir)/sys
 include_sys_HEADERS =
 
 include_HEADERS += include/memory.h
-include_HEADERS += libmd/md4.h
-include_HEADERS += libmd/md5.h
 
 include_sys_HEADERS += libcsupport/include/sys/ioccom.h
 include_sys_HEADERS += libcsupport/include/sys/event.h
diff --git a/cpukit/libmd/Makefile.am b/cpukit/libmd/Makefile.am
index f1eb021..95b12da 100644
--- a/cpukit/libmd/Makefile.am
+++ b/cpukit/libmd/Makefile.am
@@ -1,9 +1,18 @@
 include $(top_srcdir)/automake/compile.am
 
 if NEWLIB
+include_HEADERS =
+include_HEADERS += md4.h
+include_HEADERS += md5.h
+include_HEADERS += sha256.h
+include_HEADERS += sha512.h
+
 noinst_LIBRARIES = libmd.a
-libmd_a_SOURCES = md5.h md5.c
-libmd_a_SOURCES += md4.h md4.c
+libmd_a_SOURCES =
+libmd_a_SOURCES += md4.c
+libmd_a_SOURCES += md5.c
+libmd_a_SOURCES += sha256c.c
+libmd_a_SOURCES += sha512c.c
 libmd_a_CPPFLAGS = $(AM_CPPFLAGS)
 endif
 
diff --git a/cpukit/libmd/preinstall.am b/cpukit/libmd/preinstall.am
index dba6cc4..9edfb3d 100644
--- a/cpukit/libmd/preinstall.am
+++ b/cpukit/libmd/preinstall.am
@@ -5,3 +5,33 @@ $(srcdir)/preinstall.am: Makefile.am
$(AMPOLISH3) $(srcdir)/Makefile.am  $(srcdir)/preinstall.am
 endif
 
+PREINSTALL_DIRS =
+DISTCLEANFILES = $(PREINSTALL_DIRS)
+
+all-am: $(PREINSTALL_FILES)
+
+PREINSTALL_FILES =
+CLEANFILES = $(PREINSTALL_FILES)
+
+$(PROJECT_INCLUDE)/$(dirstamp):
+   @$(MKDIR_P) $(PROJECT_INCLUDE)
+   @:  $(PROJECT_INCLUDE)/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
+
+if NEWLIB
+$(PROJECT_INCLUDE)/md4.h: md4.h $(PROJECT_INCLUDE)/$(dirstamp)
+   $(INSTALL_DATA) $ $(PROJECT_INCLUDE)/md4.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/md4.h
+
+$(PROJECT_INCLUDE)/md5.h: md5.h $(PROJECT_INCLUDE)/$(dirstamp)
+   $(INSTALL_DATA) $ $(PROJECT_INCLUDE)/md5.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/md5.h
+
+$(PROJECT_INCLUDE)/sha256.h: sha256.h $(PROJECT_INCLUDE)/$(dirstamp)
+   $(INSTALL_DATA) $ $(PROJECT_INCLUDE)/sha256.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/sha256.h
+
+$(PROJECT_INCLUDE)/sha512.h: sha512.h $(PROJECT_INCLUDE)/$(dirstamp)
+   $(INSTALL_DATA) $ $(PROJECT_INCLUDE)/sha512.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/sha512.h
+endif
diff --git a/cpukit/libmd/sha256.h b/cpukit/libmd/sha256.h
new file mode 100644
index 000..1b6a4f4
--- /dev/null
+++ b/cpukit/libmd/sha256.h
@@ -0,0 +1,50 @@
+/*-
+ * Copyright 2005 Colin Percival
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 

[PATCH 1/9] Add sys/endian.h

2014-11-14 Thread Sebastian Huber
---
 cpukit/Makefile.am  |   1 +
 cpukit/include/sys/endian.h | 195 
 cpukit/preinstall.am|   4 +
 3 files changed, 200 insertions(+)
 create mode 100644 cpukit/include/sys/endian.h

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index b9e9992..8f99983 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -61,6 +61,7 @@ include_sys_HEADERS += libcsupport/include/sys/ttycom.h
 include_sys_HEADERS += libcsupport/include/sys/termios.h
 include_sys_HEADERS += libcsupport/include/sys/utsname.h
 
+include_sys_HEADERS += include/sys/endian.h
 include_sys_HEADERS += include/sys/uio.h
 include_sys_HEADERS += include/sys/_iovec.h
 include_sys_HEADERS += include/sys/priority.h
diff --git a/cpukit/include/sys/endian.h b/cpukit/include/sys/endian.h
new file mode 100644
index 000..abd6f01
--- /dev/null
+++ b/cpukit/include/sys/endian.h
@@ -0,0 +1,195 @@
+/*-
+ * Copyright (c) 2002 Thomas Moestl t...@freebsd.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _SYS_ENDIAN_H_
+#define _SYS_ENDIAN_H_
+
+#include sys/cdefs.h
+#include rtems/endian.h
+ 
+/*
+ * General byte order swapping functions.
+ */
+#definebswap16(x)  CPU_swap_u16(x)
+#definebswap32(x)  CPU_swap_u32(x)
+static __inline uint64_t
+bswap64(uint64_t v)
+{
+#ifdef __GNUC__
+   return __builtin_bswap64(v);
+#else
+   return ((v  56) | ((v  40)  0xff00) | ((v  24)  0xff) |
+   ((v  8)  0xff00) | ((v  8)  ((uint64_t)0xff  32)) |
+   ((v  24)  ((uint64_t)0xff  40)) |
+   ((v  40)  ((uint64_t)0xff  48)) | ((v  56)));
+#endif
+}
+
+/*
+ * Host to big endian, host to little endian, big endian to host, and little
+ * endian to host byte order functions as detailed in byteorder(9).
+ */
+#if BYTE_ORDER == LITTLE_ENDIAN
+#definehtobe16(x)  bswap16((x))
+#definehtobe32(x)  bswap32((x))
+#definehtobe64(x)  bswap64((x))
+#definehtole16(x)  ((uint16_t)(x))
+#definehtole32(x)  ((uint32_t)(x))
+#definehtole64(x)  ((uint64_t)(x))
+
+#definebe16toh(x)  bswap16((x))
+#definebe32toh(x)  bswap32((x))
+#definebe64toh(x)  bswap64((x))
+#definele16toh(x)  ((uint16_t)(x))
+#definele32toh(x)  ((uint32_t)(x))
+#definele64toh(x)  ((uint64_t)(x))
+#else /* BYTE_ORDER != LITTLE_ENDIAN */
+#definehtobe16(x)  ((uint16_t)(x))
+#definehtobe32(x)  ((uint32_t)(x))
+#definehtobe64(x)  ((uint64_t)(x))
+#definehtole16(x)  bswap16((x))
+#definehtole32(x)  bswap32((x))
+#definehtole64(x)  bswap64((x))
+
+#definebe16toh(x)  ((uint16_t)(x))
+#definebe32toh(x)  ((uint32_t)(x))
+#definebe64toh(x)  ((uint64_t)(x))
+#definele16toh(x)  bswap16((x))
+#definele32toh(x)  bswap32((x))
+#definele64toh(x)  bswap64((x))
+#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+
+/* Alignment-agnostic encode/decode bytestream to/from little/big endian. */
+
+static __inline uint16_t
+be16dec(const void *pp)
+{
+   uint8_t const *p = (uint8_t const *)pp;
+
+   return ((p[0]  8) | p[1]);
+}
+
+static __inline uint32_t
+be32dec(const void *pp)
+{
+   uint8_t const *p = (uint8_t const *)pp;
+
+   return (((unsigned)p[0]  24) | (p[1]  16) | (p[2]  8) | p[3]);
+}
+
+static __inline uint64_t
+be64dec(const void *pp)
+{
+   uint8_t const *p = (uint8_t const *)pp;
+
+   return (((uint64_t)be32dec(p)  32) | be32dec(p + 4));
+}
+
+static __inline uint16_t
+le16dec(const void *pp)
+{
+   uint8_t 

[PATCH 4/9] libcsupport: Add copyrights according to rev hist

2014-11-14 Thread Sebastian Huber
---
 cpukit/libcsupport/src/getpwent.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/cpukit/libcsupport/src/getpwent.c 
b/cpukit/libcsupport/src/getpwent.c
index 722cfca..483dd95 100644
--- a/cpukit/libcsupport/src/getpwent.c
+++ b/cpukit/libcsupport/src/getpwent.c
@@ -6,6 +6,13 @@
  */
 
 /*
+ *  Copyright (c) 1999-2009 Ralf Corsepius corse...@faw.uni-ulm.de
+ *  Copyright (c) 1999-2013 Joel Sherrill joel.sherr...@oarcorp.com
+ *  Copyright (c) 2000-2001 Fernando Ruiz Casas fernando.r...@ctv.es
+ *  Copyright (c) 2002 Eric Norum eric.no...@usask.ca
+ *  Copyright (c) 2003 Till Straumann strau...@slac.stanford.edu
+ *  Copyright (c) 2012 Alex Ivanov alexivano...@gmail.com
+ *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
  *  http://www.rtems.org/license/LICENSE.
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 9/9] shell: Use crypt_r() in rtems_shell_login_check()

2014-11-14 Thread Joel Sherrill
Where are crypt.h and the methods coming from?

I don't see them in newlib and
On 11/14/2014 7:46 AM, Sebastian Huber wrote:
 Use '* to disable shell login instead of '!' according to the Linux man
 page.  Use getpwnam_r() instead of getpwnam().  Do not access the user
 environment directly.
 ---
  cpukit/libmisc/shell/login_check.c | 45 
 --
  testsuites/samples/fileio/init.c   | 13 +++
  2 files changed, 38 insertions(+), 20 deletions(-)

 diff --git a/cpukit/libmisc/shell/login_check.c 
 b/cpukit/libmisc/shell/login_check.c
 index 8be5be2..4b21aaf 100644
 --- a/cpukit/libmisc/shell/login_check.c
 +++ b/cpukit/libmisc/shell/login_check.c
 @@ -5,7 +5,7 @@
   */
  
  /*
 - * Copyright (c) 2009 embedded brains GmbH and others.
 + * Copyright (c) 2009-2014 embedded brains GmbH and others.
   *
   * embedded brains GmbH
   * Obere Lagerstr. 30
 @@ -30,34 +30,47 @@
  #include unistd.h
  #include pwd.h
  #include string.h
 +#include crypt.h
  
  #include rtems/shell.h
 -#include rtems/userenv.h
  
  bool rtems_shell_login_check(
const char *user,
const char *passphrase
  )
  {
 -  struct passwd *pw = getpwnam( user);
 +  char buf[256];
 +  struct passwd *pw_res;
 +  struct passwd pw;
 +  int eno;
 +
 +  eno = getpwnam_r(user, pw, buf[0], sizeof(buf), pw_res);
  
/* Valid user? */
 -  if (pw != NULL  strcmp( pw-pw_passwd, !) != 0) {
 +  if (eno == 0  strcmp(pw.pw_passwd, *) != 0) {
  rtems_shell_env_t *env = rtems_shell_get_current_env();
 -setuid( pw-pw_uid);
 -setgid( pw-pw_gid);
 -rtems_current_user_env-euid = 0;
 -rtems_current_user_env-egid = 0;
 -if (env)
 -  chown( env-devname, pw-pw_uid, 0);
 -rtems_current_user_env-euid = pw-pw_uid;
 -rtems_current_user_env-egid = pw-pw_gid;
 -if (strcmp( pw-pw_passwd, *) == 0) {
 -  /* TODO: /etc/shadow */
 +
 +if (env != NULL) {
 +  chown(env-devname, pw.pw_uid, 0);
 +}
 +
 +setuid(pw.pw_uid);
 +setgid(pw.pw_gid);
 +seteuid(pw.pw_uid);
 +setegid(pw.pw_gid);
 +
 +if (strcmp(pw.pw_passwd, ) == 0) {
return true;
 +} else if (strcmp(pw.pw_passwd, x) == 0) {
 +  /* TODO: /etc/shadow */
 +  return false;
  } else {
 -  /* TODO: crypt() */
 -  return true;
 +  struct crypt_data data;
 +  char *s;
 +
 +  s = crypt_r(passphrase, pw.pw_passwd, data);
 +
 +  return strcmp(s, pw.pw_passwd) == 0;
  }
}
  
 diff --git a/testsuites/samples/fileio/init.c 
 b/testsuites/samples/fileio/init.c
 index 2b60922..735b588 100644
 --- a/testsuites/samples/fileio/init.c
 +++ b/testsuites/samples/fileio/init.c
 @@ -13,6 +13,7 @@
  
  #define CONFIGURE_INIT
  #include system.h
 +#include crypt.h
  #include stdio.h
  #include string.h
  #include unistd.h
 @@ -641,10 +642,11 @@ static void fileio_start_shell(void)
writeFile(
  /etc/passwd,
  0644,
 -root:7QR4o148UPtb.:0:0:root::/:/bin/sh\n
 -rtems:*:1:1:RTEMS Application::/:/bin/sh\n
 -test:8Yy.AaxynxbLI:2:2:test account::/:/bin/sh\n
 -tty:!:3:3:tty owner::/:/bin/false\n
 +root:$6$$FuPOhnllx6lhW2qqlnmWvZQLJ8Thr/09I7ESTdb9VbnTOn5.65
 +  /Vh2Mqa6FoKXwT0nHS/O7F0KfrDc6Svb/sH.:0:0:root::/:/bin/sh\n
 +rtems::1:1:RTEMS Application::/:/bin/sh\n
 +test:$1$$oPu1Xt2Pw0ngIc7LyDHqu1:2:2:test account::/:/bin/sh\n
 +tty:*:3:3:tty owner::/:/bin/false\n
);
writeFile(
  /etc/group,
 @@ -1225,6 +1227,9 @@ Init (rtems_task_argument ignored)
  
TEST_BEGIN();
  
 +  crypt_add_format(crypt_md5_format);
 +  crypt_add_format(crypt_sha512_format);
 +
status = rtems_shell_wait_for_input(
  STDIN_FILENO,
  20,

-- 
Joel Sherrill, Ph.D. Director of Research  Development
joel.sherr...@oarcorp.comOn-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available(256) 722-9985

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 2/9] Add SHA256 and SHA512 support

2014-11-14 Thread Gedare Bloom
The test case name SHA 1 is misleading, as there exists a SHA-1 algorithm

On Fri, Nov 14, 2014 at 8:46 AM, Sebastian Huber
sebastian.hu...@embedded-brains.de wrote:
 ---
  cpukit/Makefile.am|   2 -
  cpukit/libmd/Makefile.am  |  13 +-
  cpukit/libmd/preinstall.am|  30 
  cpukit/libmd/sha256.h |  50 ++
  cpukit/libmd/sha256c.c| 297 +++
  cpukit/libmd/sha512.h |  50 ++
  cpukit/libmd/sha512c.c| 320 
 ++
  cpukit/preinstall.am  |   8 -
  testsuites/libtests/Makefile.am   |   1 +
  testsuites/libtests/configure.ac  |   1 +
  testsuites/libtests/sha01/Makefile.am |  19 ++
  testsuites/libtests/sha01/init.c  | 191 
  testsuites/libtests/sha01/sha01.doc   |  17 ++
  testsuites/libtests/sha01/sha01.scn   |  16 ++
  14 files changed, 1003 insertions(+), 12 deletions(-)
  create mode 100644 cpukit/libmd/sha256.h
  create mode 100644 cpukit/libmd/sha256c.c
  create mode 100644 cpukit/libmd/sha512.h
  create mode 100644 cpukit/libmd/sha512c.c
  create mode 100644 testsuites/libtests/sha01/Makefile.am
  create mode 100644 testsuites/libtests/sha01/init.c
  create mode 100644 testsuites/libtests/sha01/sha01.doc
  create mode 100644 testsuites/libtests/sha01/sha01.scn

 diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
 index 8f99983..51cec69 100644
 --- a/cpukit/Makefile.am
 +++ b/cpukit/Makefile.am
 @@ -47,8 +47,6 @@ include_sysdir = $(includedir)/sys
  include_sys_HEADERS =

  include_HEADERS += include/memory.h
 -include_HEADERS += libmd/md4.h
 -include_HEADERS += libmd/md5.h

  include_sys_HEADERS += libcsupport/include/sys/ioccom.h
  include_sys_HEADERS += libcsupport/include/sys/event.h
 diff --git a/cpukit/libmd/Makefile.am b/cpukit/libmd/Makefile.am
 index f1eb021..95b12da 100644
 --- a/cpukit/libmd/Makefile.am
 +++ b/cpukit/libmd/Makefile.am
 @@ -1,9 +1,18 @@
  include $(top_srcdir)/automake/compile.am

  if NEWLIB
 +include_HEADERS =
 +include_HEADERS += md4.h
 +include_HEADERS += md5.h
 +include_HEADERS += sha256.h
 +include_HEADERS += sha512.h
 +
  noinst_LIBRARIES = libmd.a
 -libmd_a_SOURCES = md5.h md5.c
 -libmd_a_SOURCES += md4.h md4.c
 +libmd_a_SOURCES =
 +libmd_a_SOURCES += md4.c
 +libmd_a_SOURCES += md5.c
 +libmd_a_SOURCES += sha256c.c
 +libmd_a_SOURCES += sha512c.c
  libmd_a_CPPFLAGS = $(AM_CPPFLAGS)
  endif

 diff --git a/cpukit/libmd/preinstall.am b/cpukit/libmd/preinstall.am
 index dba6cc4..9edfb3d 100644
 --- a/cpukit/libmd/preinstall.am
 +++ b/cpukit/libmd/preinstall.am
 @@ -5,3 +5,33 @@ $(srcdir)/preinstall.am: Makefile.am
 $(AMPOLISH3) $(srcdir)/Makefile.am  $(srcdir)/preinstall.am
  endif

 +PREINSTALL_DIRS =
 +DISTCLEANFILES = $(PREINSTALL_DIRS)
 +
 +all-am: $(PREINSTALL_FILES)
 +
 +PREINSTALL_FILES =
 +CLEANFILES = $(PREINSTALL_FILES)
 +
 +$(PROJECT_INCLUDE)/$(dirstamp):
 +   @$(MKDIR_P) $(PROJECT_INCLUDE)
 +   @:  $(PROJECT_INCLUDE)/$(dirstamp)
 +PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
 +
 +if NEWLIB
 +$(PROJECT_INCLUDE)/md4.h: md4.h $(PROJECT_INCLUDE)/$(dirstamp)
 +   $(INSTALL_DATA) $ $(PROJECT_INCLUDE)/md4.h
 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/md4.h
 +
 +$(PROJECT_INCLUDE)/md5.h: md5.h $(PROJECT_INCLUDE)/$(dirstamp)
 +   $(INSTALL_DATA) $ $(PROJECT_INCLUDE)/md5.h
 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/md5.h
 +
 +$(PROJECT_INCLUDE)/sha256.h: sha256.h $(PROJECT_INCLUDE)/$(dirstamp)
 +   $(INSTALL_DATA) $ $(PROJECT_INCLUDE)/sha256.h
 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/sha256.h
 +
 +$(PROJECT_INCLUDE)/sha512.h: sha512.h $(PROJECT_INCLUDE)/$(dirstamp)
 +   $(INSTALL_DATA) $ $(PROJECT_INCLUDE)/sha512.h
 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/sha512.h
 +endif
 diff --git a/cpukit/libmd/sha256.h b/cpukit/libmd/sha256.h
 new file mode 100644
 index 000..1b6a4f4
 --- /dev/null
 +++ b/cpukit/libmd/sha256.h
 @@ -0,0 +1,50 @@
 +/*-
 + * Copyright 2005 Colin Percival
 + * All rights reserved.
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions
 + * are met:
 + * 1. Redistributions of source code must retain the above copyright
 + *notice, this list of conditions and the following disclaimer.
 + * 2. Redistributions in binary form must reproduce the above copyright
 + *notice, this list of conditions and the following disclaimer in the
 + *documentation and/or other materials provided with the distribution.
 + *
 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 + * DAMAGES 

Re: [PATCH 9/9] shell: Use crypt_r() in rtems_shell_login_check()

2014-11-14 Thread Sebastian Huber

On 11/14/2014 03:54 PM, Joel Sherrill wrote:

Where are crypt.h and the methods coming from?

I don't see them in newlib and


It is in patch 3/9.  crypt.h is not a POSIX header file.

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 2/9] Add SHA256 and SHA512 support

2014-11-14 Thread Sebastian Huber

On 11/14/2014 04:05 PM, Gedare Bloom wrote:

The test case name SHA 1 is misleading, as there exists a SHA-1 algorithm


Yes, but this is the standard test name pattern.  There is no SHA-01.

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: gdb patches to RBS

2014-11-14 Thread Jiri Gaisler


On 11/14/2014 04:18 PM, Joel Sherrill wrote:
 
 On 11/14/2014 5:27 AM, Jiri Gaisler wrote:

 On 11/14/2014 02:34 AM, Chris Johns wrote:
 On 14/11/2014 9:12 am, Jiri Gaisler wrote:
 What is the procedure to add gdb patches to RBS?

 Patches are first accepted by the RTEMS Project as the definition of the 
 tools belongs to the project and tool packagers, ie the RSB, need to adopt 
 that definition to get a project tick. Patches should be posted upstream 
 where possible and then referenced from there. If the
 upstream does not have a suitable method to reference patches we can add 
 them to the rtems-tools.git repo under the tools directory. There are 
 specific cases such as the openrisc tools where a specific github instance 
 is referenced as we have a positive undertaking from that
 community the tools are being merged upstream. Examples of upstream patch 
 referencing is qemu and patchworks.

 I do not see a patch management system for gdb. There was talk back in 
 April of this year of gdb using patchworks and then something else however 
 it seems to have died out.

 I have a few patches that fixes the erc32 simulator and also
 add support for leon2 and leon3. This would allow us to drop
 the sis bsp, and also to test the leon2 and leon3 bsp's with
 sis.
 Excellent. I suggest you provide git patches for the rtems-tools.git repo 
 to add the patches and then provide RSB patches for the sparc gdb build to 
 use them. There are specific sparc patches already present which need 
 updating as they are currently stopping us moving off gdb-7.7.
 The latest stable gdb version is 7.8.1, while the git head is at 
 7.8.50.20141112-cvs .
 Should we switch to gdb-7.8.1 or stay at 7.7? It does not really matter to 
 me which
 one. The existing sparc gdb patch for 7.7 is merged into my patches as I had 
 to
 rework it a bit.

 I will try to push my patches upstream to gdb but I suspect it will take
 while before the are accepted, as they are quite large.
 It may take a while but realistically the only people who care about the
 sparc simulator are RTEMS folks and AdaCore. And you are certainly
 to be trusted for the patches.
 
 Submit them.  And help the RSB switch to using all the newer patches.
 Then we can get some test time on them. That's what the gdb folks
 will want to hear.
 
 We can move rtems sparc GDB to whereever it needs to be but the
 gdb head is better for submissions and we should base the RSB
 version on a release.


OK, gdb-7.8.1 was released only two weeks ago so I will use this version for 
RBS.

I have found another interesting patch for sparc (pointed out by
Sebastian I believe). It fixes the problem of 'can't compute CFA',
and allows local variables to be printed properly. The patch is
listed below. Is there any reason why we shouldn't add this patch
to RBS? It only affects the sparc port so it should not have any
side-effects on other targets. Without it, debugging with gdb is
seriously limited for RTEMS sparc targets ...



diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 7eb3b18..b26c128 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -1732,6 +1732,8 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct 
gdbarch_list
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);

+  dwarf2_append_unwinders (gdbarch);  /* DWARF CFI frame unwinder */
+
   frame_unwind_append_unwinder (gdbarch, sparc32_frame_unwind);

   /* If we have register sets, enable the generic core file support.  */

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: gdb patches to RBS

2014-11-14 Thread Cudmore, Alan P. (GSFC-5820)
I just wanted to chime in and say that the ability to run the leon BSPs in
gdb/sis will be fantastic!

Thanks,
Alan


On 11/14/14 1:50 PM, Jiri Gaisler j...@gaisler.se wrote:



On 11/14/2014 04:18 PM, Joel Sherrill wrote:
 
 On 11/14/2014 5:27 AM, Jiri Gaisler wrote:

 On 11/14/2014 02:34 AM, Chris Johns wrote:
 On 14/11/2014 9:12 am, Jiri Gaisler wrote:
 What is the procedure to add gdb patches to RBS?

 Patches are first accepted by the RTEMS Project as the definition of
the tools belongs to the project and tool packagers, ie the RSB, need
to adopt that definition to get a project tick. Patches should be
posted upstream where possible and then referenced from there. If the
 upstream does not have a suitable method to reference patches we can
add them to the rtems-tools.git repo under the tools directory. There
are specific cases such as the openrisc tools where a specific github
instance is referenced as we have a positive undertaking from that
 community the tools are being merged upstream. Examples of upstream
patch referencing is qemu and patchworks.

 I do not see a patch management system for gdb. There was talk back
in April of this year of gdb using patchworks and then something else
however it seems to have died out.

 I have a few patches that fixes the erc32 simulator and also
 add support for leon2 and leon3. This would allow us to drop
 the sis bsp, and also to test the leon2 and leon3 bsp's with
 sis.
 Excellent. I suggest you provide git patches for the rtems-tools.git
repo to add the patches and then provide RSB patches for the sparc gdb
build to use them. There are specific sparc patches already present
which need updating as they are currently stopping us moving off
gdb-7.7.
 The latest stable gdb version is 7.8.1, while the git head is at
7.8.50.20141112-cvs .
 Should we switch to gdb-7.8.1 or stay at 7.7? It does not really
matter to me which
 one. The existing sparc gdb patch for 7.7 is merged into my patches as
I had to
 rework it a bit.

 I will try to push my patches upstream to gdb but I suspect it will
take
 while before the are accepted, as they are quite large.
 It may take a while but realistically the only people who care about the
 sparc simulator are RTEMS folks and AdaCore. And you are certainly
 to be trusted for the patches.
 
 Submit them.  And help the RSB switch to using all the newer patches.
 Then we can get some test time on them. That's what the gdb folks
 will want to hear.
 
 We can move rtems sparc GDB to whereever it needs to be but the
 gdb head is better for submissions and we should base the RSB
 version on a release.


OK, gdb-7.8.1 was released only two weeks ago so I will use this version
for RBS.

I have found another interesting patch for sparc (pointed out by
Sebastian I believe). It fixes the problem of 'can't compute CFA',
and allows local variables to be printed properly. The patch is
listed below. Is there any reason why we shouldn't add this patch
to RBS? It only affects the sparc port so it should not have any
side-effects on other targets. Without it, debugging with gdb is
seriously limited for RTEMS sparc targets ...



diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 7eb3b18..b26c128 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -1732,6 +1732,8 @@ sparc32_gdbarch_init (struct gdbarch_info info,
struct gdbarch_list
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);

+  dwarf2_append_unwinders (gdbarch);  /* DWARF CFI frame unwinder */
+
   frame_unwind_append_unwinder (gdbarch, sparc32_frame_unwind);

   /* If we have register sets, enable the generic core file support.  */

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: gdb patches to RBS

2014-11-14 Thread Joel Sherrill

On 11/14/2014 12:50 PM, Jiri Gaisler wrote:

 On 11/14/2014 04:18 PM, Joel Sherrill wrote:
 On 11/14/2014 5:27 AM, Jiri Gaisler wrote:
 On 11/14/2014 02:34 AM, Chris Johns wrote:
 On 14/11/2014 9:12 am, Jiri Gaisler wrote:
 What is the procedure to add gdb patches to RBS?

 Patches are first accepted by the RTEMS Project as the definition of the 
 tools belongs to the project and tool packagers, ie the RSB, need to adopt 
 that definition to get a project tick. Patches should be posted upstream 
 where possible and then referenced from there. If the
 upstream does not have a suitable method to reference patches we can add 
 them to the rtems-tools.git repo under the tools directory. There are 
 specific cases such as the openrisc tools where a specific github instance 
 is referenced as we have a positive undertaking from that
 community the tools are being merged upstream. Examples of upstream patch 
 referencing is qemu and patchworks.

 I do not see a patch management system for gdb. There was talk back in 
 April of this year of gdb using patchworks and then something else however 
 it seems to have died out.

 I have a few patches that fixes the erc32 simulator and also
 add support for leon2 and leon3. This would allow us to drop
 the sis bsp, and also to test the leon2 and leon3 bsp's with
 sis.
 Excellent. I suggest you provide git patches for the rtems-tools.git repo 
 to add the patches and then provide RSB patches for the sparc gdb build to 
 use them. There are specific sparc patches already present which need 
 updating as they are currently stopping us moving off gdb-7.7.
 The latest stable gdb version is 7.8.1, while the git head is at 
 7.8.50.20141112-cvs .
 Should we switch to gdb-7.8.1 or stay at 7.7? It does not really matter to 
 me which
 one. The existing sparc gdb patch for 7.7 is merged into my patches as I 
 had to
 rework it a bit.

 I will try to push my patches upstream to gdb but I suspect it will take
 while before the are accepted, as they are quite large.
 It may take a while but realistically the only people who care about the
 sparc simulator are RTEMS folks and AdaCore. And you are certainly
 to be trusted for the patches.

 Submit them.  And help the RSB switch to using all the newer patches.
 Then we can get some test time on them. That's what the gdb folks
 will want to hear.

 We can move rtems sparc GDB to whereever it needs to be but the
 gdb head is better for submissions and we should base the RSB
 version on a release.

 OK, gdb-7.8.1 was released only two weeks ago so I will use this version for 
 RBS.

 I have found another interesting patch for sparc (pointed out by
 Sebastian I believe). It fixes the problem of 'can't compute CFA',
 and allows local variables to be printed properly. The patch is
 listed below. Is there any reason why we shouldn't add this patch
 to RBS? It only affects the sparc port so it should not have any
 side-effects on other targets. Without it, debugging with gdb is
 seriously limited for RTEMS sparc targets ...
Please include it. Being able to print local variables is important.




 diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
 index 7eb3b18..b26c128 100644
 --- a/gdb/sparc-tdep.c
 +++ b/gdb/sparc-tdep.c
 @@ -1732,6 +1732,8 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct 
 gdbarch_list
/* Hook in ABI-specific overrides, if they have been registered.  */
gdbarch_init_osabi (info, gdbarch);

 +  dwarf2_append_unwinders (gdbarch);  /* DWARF CFI frame unwinder */
 +
frame_unwind_append_unwinder (gdbarch, sparc32_frame_unwind);

/* If we have register sets, enable the generic core file support.  */


-- 
Joel Sherrill, Ph.D. Director of Research  Development
joel.sherr...@oarcorp.comOn-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available(256) 722-9985

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: gdb patches to RBS

2014-11-14 Thread Chris Johns

On 15/11/2014 10:30 am, Jiri Gaisler wrote:



On 11/14/2014 02:34 AM, Chris Johns wrote:

On 14/11/2014 9:12 am, Jiri Gaisler wrote:


What is the procedure to add gdb patches to RBS?



Patches are first accepted by the RTEMS Project as the definition of the tools 
belongs to the project and tool packagers, ie the RSB, need to adopt that 
definition to get a project tick. Patches should be posted upstream where 
possible and then referenced from there. If the
upstream does not have a suitable method to reference patches we can add them 
to the rtems-tools.git repo under the tools directory. There are specific cases 
such as the openrisc tools where a specific github instance is referenced as we 
have a positive undertaking from that
community the tools are being merged upstream. Examples of upstream patch 
referencing is qemu and patchworks.

I do not see a patch management system for gdb. There was talk back in April of 
this year of gdb using patchworks and then something else however it seems to 
have died out.


I have a few patches that fixes the erc32 simulator and also
add support for leon2 and leon3. This would allow us to drop
the sis bsp, and also to test the leon2 and leon3 bsp's with
sis.


Excellent. I suggest you provide git patches for the rtems-tools.git repo to 
add the patches and then provide RSB patches for the sparc gdb build to use 
them. There are specific sparc patches already present which need updating as 
they are currently stopping us moving off gdb-7.7.


I tried to move RBS to gdb-7.8.1, but there were several other
dependency problems that I could not (easily) fix.


Are these gdb, RSB, or rtems-tools patch issues ?


So I have back-ported
my patches to gdb-7.7 which seems to work equally well. I will send the
patches for rtems-tools and rtems-source-builder to Chris off-list as the
patch is quite large (300K). I built the sparc toolchain with RBS
and copied the sis patch to rtems/patches manually since I have not
write access to rtems-tools.git.


Thanks for this. I have the patch and will push to rtems-tools once we 
can commit to the repos again.


Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel