forked from pool/ipmitool
Accepting request 514221 from home:scarabeus_iv:branches:systemsmanagement
- Switch to OBS service to generate the tarball and changelog automatically from git "osc service dr" - Update to version git checkout 20170406.ecb4cfb: * Prevent autoreconf from complaining about missing NEWS * Add git hash and dirty mark to ipmitool version - Remove patch ipmitool_1_8_18_ecb4cfbff855_to_HEAD.patch as the patch is directly in the tarball - Rename patch: ipmitool_adjust_suse.paths to ipmitool_adjust_suse_paths.patch - Drop the --pic switch as it was only for static library - Reduce the suse_version for 1210 check to switch systemd on as the package is not building on sle11 anyway * properly depend on systemd-rpm-macros and not full systemd - Enable switch for file-security to be more strict on open files OBS-URL: https://build.opensuse.org/request/show/514221 OBS-URL: https://build.opensuse.org/package/show/systemsmanagement/ipmitool?expand=0&rev=45
This commit is contained in:
parent
3db071d177
commit
db8676f436
14
_service
Normal file
14
_service
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<services>
|
||||||
|
<service mode="disabled" name="tar_scm">
|
||||||
|
<param name="url">https://git.code.sf.net/p/ipmitool/source</param>
|
||||||
|
<param name="scm">git</param>
|
||||||
|
<param name="changesgenerate">enable</param>
|
||||||
|
<param name="filename">ipmitool</param>
|
||||||
|
<param name="versionformat">1.8.18</param>
|
||||||
|
</service>
|
||||||
|
<service mode="disabled" name="recompress">
|
||||||
|
<param name="file">*.tar</param>
|
||||||
|
<param name="compression">xz</param>
|
||||||
|
</service>
|
||||||
|
<service mode="disabled" name="set_version"/>
|
||||||
|
</services>
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:2238d8e6ab9340165918e65e04bfee4b5070635d8821d7c13d3a7aaeb9f25c29
|
|
||||||
size 486341
|
|
3
ipmitool-1.8.18.tar.xz
Normal file
3
ipmitool-1.8.18.tar.xz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:0f4c195b963b549fe325f32e17a9b24fb59fbe6fe0688a6d7d69381a1edf4478
|
||||||
|
size 435312
|
@ -1,3 +1,21 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Jul 27 18:58:24 UTC 2017 - tchvatal@suse.com
|
||||||
|
|
||||||
|
- Switch to OBS service to generate the tarball and changelog
|
||||||
|
automatically from git "osc service dr"
|
||||||
|
- Update to version git checkout 20170406.ecb4cfb:
|
||||||
|
* Prevent autoreconf from complaining about missing NEWS
|
||||||
|
* Add git hash and dirty mark to ipmitool version
|
||||||
|
- Remove patch ipmitool_1_8_18_ecb4cfbff855_to_HEAD.patch as the
|
||||||
|
patch is directly in the tarball
|
||||||
|
- Rename patch:
|
||||||
|
ipmitool_adjust_suse.paths to ipmitool_adjust_suse_paths.patch
|
||||||
|
- Drop the --pic switch as it was only for static library
|
||||||
|
- Reduce the suse_version for 1210 check to switch systemd on as
|
||||||
|
the package is not building on sle11 anyway
|
||||||
|
* properly depend on systemd-rpm-macros and not full systemd
|
||||||
|
- Enable switch for file-security to be more strict on open files
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Jul 5 14:07:41 UTC 2017 - trenn@suse.de
|
Wed Jul 5 14:07:41 UTC 2017 - trenn@suse.de
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package ipmitool
|
# spec file for package ipmitool
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -17,34 +17,25 @@
|
|||||||
|
|
||||||
|
|
||||||
Name: ipmitool
|
Name: ipmitool
|
||||||
BuildRequires: libtool
|
Version: 1.8.18
|
||||||
BuildRequires: openssl-devel
|
Release: 0
|
||||||
BuildRequires: readline-devel
|
|
||||||
%if 0%{?suse_version} >= 1210
|
|
||||||
BuildRequires: systemd
|
|
||||||
%endif
|
|
||||||
Url: http://ipmitool.sourceforge.net/
|
|
||||||
Summary: Utility for IPMI Control
|
Summary: Utility for IPMI Control
|
||||||
License: BSD-3-Clause
|
License: BSD-3-Clause
|
||||||
Group: System/Management
|
Group: System/Management
|
||||||
Version: 1.8.18
|
Url: http://ipmitool.sourceforge.net/
|
||||||
Release: 0
|
Source: %{name}/%{name}-%{version}.tar.xz
|
||||||
Source: http://heanet.dl.sourceforge.net/sourceforge/%{name}/%{name}-%{version}.tar.bz2
|
|
||||||
Source1: ipmievd.service
|
Source1: ipmievd.service
|
||||||
Source2: ipmievd.sysconf
|
Source2: ipmievd.sysconf
|
||||||
Patch0: ipmitool_1_8_18_ecb4cfbff855_to_HEAD.patch
|
|
||||||
|
|
||||||
Patch100: fwum_enhance_output.patch
|
Patch100: fwum_enhance_output.patch
|
||||||
Patch101: fix_file_permissions.patch
|
Patch101: fix_file_permissions.patch
|
||||||
Patch102: several_more_compile_fixes.patch
|
Patch102: several_more_compile_fixes.patch
|
||||||
Patch103: ipmitool_adjust_suse.paths
|
Patch103: ipmitool_adjust_suse_paths.patch
|
||||||
Patch104: hpm_x_compatibility_msg_is_debug_only.patch
|
Patch104: hpm_x_compatibility_msg_is_debug_only.patch
|
||||||
|
BuildRequires: libtool
|
||||||
|
BuildRequires: openssl-devel
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRequires: readline-devel
|
||||||
# bmc-snmp-proxy needs /usr/sbin/snmpd
|
BuildRequires: systemd-rpm-macros
|
||||||
Requires: net-snmp
|
Requires: net-snmp
|
||||||
# ToDo: Convert old init scripts to systemd with next submit iteration
|
|
||||||
%{?systemd_requires}
|
%{?systemd_requires}
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -63,50 +54,38 @@ displaying sensor values, displaying the contents of the System Event
|
|||||||
Log (SEL), printing Field Replaceable Unit (FRU) information, reading
|
Log (SEL), printing Field Replaceable Unit (FRU) information, reading
|
||||||
and setting LAN configuration, and chassis power control.
|
and setting LAN configuration, and chassis power control.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
%patch0 -p1
|
%autopatch -p1
|
||||||
|
|
||||||
%patch100 -p1
|
|
||||||
%patch101 -p1
|
|
||||||
%patch102 -p1
|
|
||||||
%patch103 -p1
|
|
||||||
%patch104 -p1
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
touch INSTALL NEWS
|
|
||||||
autoreconf -fiv
|
autoreconf -fiv
|
||||||
%configure --with-pic
|
# file-security: enables more security checks on files
|
||||||
%{__make} %{?jobs:-j%jobs}
|
%configure \
|
||||||
|
--enable-file-security
|
||||||
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
%install
|
%install
|
||||||
make DESTDIR=$RPM_BUILD_ROOT install
|
%make_install
|
||||||
rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/ipmitool
|
rm -rf %{buildroot}%{_datadir}/doc/ipmitool
|
||||||
# exchange-bmc-os-info service
|
|
||||||
|
|
||||||
install -D -m 0755 contrib/exchange-bmc-os-info.init.redhat "$RPM_BUILD_ROOT\
|
# exchange-bmc-os-info service
|
||||||
"/%{_sbindir}/exchange-bmc-os-info
|
install -D -m 0755 contrib/exchange-bmc-os-info.init.redhat %{buildroot}/%{_sbindir}/exchange-bmc-os-info
|
||||||
install -D -m 0644 contrib/exchange-bmc-os-info.service.redhat "$RPM_BUILD_ROOT"/usr/lib/systemd/system/exchange-bmc-os-info.service
|
install -D -m 0644 contrib/exchange-bmc-os-info.service.redhat %{buildroot}%{_unitdir}/exchange-bmc-os-info.service
|
||||||
install -D -m 0644 contrib/exchange-bmc-os-info.sysconf "$RPM_BUILD_ROOT"/%{_sysconfdir}/exchange-bmc-os-info
|
install -D -m 0644 contrib/exchange-bmc-os-info.sysconf %{buildroot}/%{_sysconfdir}/exchange-bmc-os-info
|
||||||
ln -sf %_sbindir/service ${RPM_BUILD_ROOT}%{_sbindir}/rcexchange-bmc-os-info
|
ln -sf service %{buildroot}%{_sbindir}/rcexchange-bmc-os-info
|
||||||
|
|
||||||
# ipmievd service
|
# ipmievd service
|
||||||
install -D -m 644 %{S:1} "$RPM_BUILD_ROOT"/usr/lib/systemd/system/ipmievd.service
|
install -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/ipmievd.service
|
||||||
install -D -m 644 %{S:2} "$RPM_BUILD_ROOT"/%{_sysconfdir}/ipmievd
|
install -D -m 644 %{SOURCE2} %{buildroot}/%{_sysconfdir}/ipmievd
|
||||||
ln -sf %_sbindir/service ${RPM_BUILD_ROOT}%{_sbindir}/rcipmievd
|
ln -sf service %{buildroot}%{_sbindir}/rcipmievd
|
||||||
|
|
||||||
# bmc-snmp-proxy
|
# bmc-snmp-proxy
|
||||||
install -D -m 755 contrib/bmc-snmp-proxy "$RPM_BUILD_ROOT"/%{_sbindir}/bmc-snmp-proxy
|
install -D -m 755 contrib/bmc-snmp-proxy %{buildroot}/%{_sbindir}/bmc-snmp-proxy
|
||||||
install -D -m 644 contrib/bmc-snmp-proxy.service "$RPM_BUILD_ROOT"/usr/lib/systemd/system/bmc-snmp-proxy.service
|
install -D -m 644 contrib/bmc-snmp-proxy.service %{buildroot}%{_unitdir}/bmc-snmp-proxy.service
|
||||||
install -D -m 755 contrib/bmc-snmp-proxy.sysconf "$RPM_BUILD_ROOT"/%{_sysconfdir}/bmc-snmp-proxy
|
install -D -m 755 contrib/bmc-snmp-proxy.sysconf %{buildroot}/%{_sysconfdir}/bmc-snmp-proxy
|
||||||
ln -sf %_sbindir/service ${RPM_BUILD_ROOT}%{_sbindir}/rcbmc-snmp-proxy
|
ln -sf service %{buildroot}%{_sbindir}/rcbmc-snmp-proxy
|
||||||
|
|
||||||
%clean
|
|
||||||
rm -rf $RPM_BUILD_ROOT
|
|
||||||
|
|
||||||
%if 0%{?suse_version} >= 1210
|
|
||||||
%pre
|
%pre
|
||||||
%service_add_pre bmc-snmp-proxy.service exchange-bmc-os-info.service ipmievd.service
|
%service_add_pre bmc-snmp-proxy.service exchange-bmc-os-info.service ipmievd.service
|
||||||
|
|
||||||
@ -118,10 +97,8 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
|
|
||||||
%postun
|
%postun
|
||||||
%service_del_postun bmc-snmp-proxy.service exchange-bmc-os-info.service ipmievd.service
|
%service_del_postun bmc-snmp-proxy.service exchange-bmc-os-info.service ipmievd.service
|
||||||
%endif
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(644,root,root)
|
|
||||||
%doc AUTHORS COPYING README
|
%doc AUTHORS COPYING README
|
||||||
%{_datadir}/ipmitool
|
%{_datadir}/ipmitool
|
||||||
%attr(755,root,root) %{_bindir}/ipmitool
|
%attr(755,root,root) %{_bindir}/ipmitool
|
||||||
@ -134,10 +111,10 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%config(noreplace) %{_sysconfdir}/exchange-bmc-os-info
|
%config(noreplace) %{_sysconfdir}/exchange-bmc-os-info
|
||||||
%config(noreplace) %{_sysconfdir}/bmc-snmp-proxy
|
%config(noreplace) %{_sysconfdir}/bmc-snmp-proxy
|
||||||
%config(noreplace) %{_sysconfdir}/ipmievd
|
%config(noreplace) %{_sysconfdir}/ipmievd
|
||||||
%{_prefix}/lib/systemd/system/exchange-bmc-os-info.service
|
%{_unitdir}/exchange-bmc-os-info.service
|
||||||
%{_prefix}/lib/systemd/system/ipmievd.service
|
%{_unitdir}/ipmievd.service
|
||||||
%{_prefix}/lib/systemd/system/bmc-snmp-proxy.service
|
%{_unitdir}/bmc-snmp-proxy.service
|
||||||
%doc %{_mandir}/man1/*
|
%{_mandir}/man1/*
|
||||||
%doc %{_mandir}/man8/*
|
%{_mandir}/man8/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
@ -1,649 +0,0 @@
|
|||||||
diff --git a/.gitignore b/.gitignore
|
|
||||||
index 5b8cb0a..58ca89e 100644
|
|
||||||
--- a/.gitignore
|
|
||||||
+++ b/.gitignore
|
|
||||||
@@ -1,12 +1,30 @@
|
|
||||||
+.deps
|
|
||||||
+.libs
|
|
||||||
+*.o
|
|
||||||
+*.lo
|
|
||||||
+*.la
|
|
||||||
+*.*~
|
|
||||||
+Makefile
|
|
||||||
Makefile.in
|
|
||||||
aclocal.m4
|
|
||||||
autom4te.cache
|
|
||||||
compile
|
|
||||||
config.guess
|
|
||||||
+config.h
|
|
||||||
config.h.in
|
|
||||||
+config.log
|
|
||||||
+config.status
|
|
||||||
config.sub
|
|
||||||
configure
|
|
||||||
depcomp
|
|
||||||
install-sh
|
|
||||||
ltmain.sh
|
|
||||||
+libtool
|
|
||||||
missing
|
|
||||||
+stamp-h1
|
|
||||||
+control/ipmitool.spec
|
|
||||||
+control/pkginfo
|
|
||||||
+control/prototype
|
|
||||||
+control/rpmmacros
|
|
||||||
+src/ipmievd
|
|
||||||
+src/ipmitool
|
|
||||||
diff --git a/bootstrap b/bootstrap
|
|
||||||
index 6347427..c38b12b 100755
|
|
||||||
--- a/bootstrap
|
|
||||||
+++ b/bootstrap
|
|
||||||
@@ -31,7 +31,15 @@
|
|
||||||
# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
||||||
|
|
||||||
aclocal
|
|
||||||
-libtoolize --automake --copy
|
|
||||||
+
|
|
||||||
+case `uname` in
|
|
||||||
+ Darwin*)
|
|
||||||
+ glibtoolize --automake --copy
|
|
||||||
+ ;;
|
|
||||||
+ *)
|
|
||||||
+ libtoolize --automake --copy
|
|
||||||
+ ;;
|
|
||||||
+esac
|
|
||||||
|
|
||||||
autoheader
|
|
||||||
automake --foreign --add-missing --copy
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index 88232a6..ad1657d 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -1,10 +1,11 @@
|
|
||||||
dnl
|
|
||||||
dnl autoconf for ipmitool
|
|
||||||
dnl
|
|
||||||
-AC_INIT([ipmitool], [1.8.18-csv])
|
|
||||||
+m4_define([git_suffix], m4_esyscmd_s(./csv-revision))
|
|
||||||
+AC_INIT([ipmitool], [1.8.18git_suffix])
|
|
||||||
AC_CONFIG_SRCDIR([src/ipmitool.c])
|
|
||||||
AC_CANONICAL_SYSTEM
|
|
||||||
-AM_INIT_AUTOMAKE
|
|
||||||
+AM_INIT_AUTOMAKE([foreign])
|
|
||||||
AM_CONFIG_HEADER(config.h)
|
|
||||||
AC_PREREQ(2.50)
|
|
||||||
AC_SUBST(ac_configure_args)
|
|
||||||
diff --git a/csv-revision b/csv-revision
|
|
||||||
new file mode 100755
|
|
||||||
index 0000000..289c133
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/csv-revision
|
|
||||||
@@ -0,0 +1,10 @@
|
|
||||||
+#!/bin/sh
|
|
||||||
+
|
|
||||||
+git describe --first-parent --tags 2>/dev/null | (
|
|
||||||
+ IFS=- read tag rev hash
|
|
||||||
+ if [ $? ] && [ -n "$rev" ]; then
|
|
||||||
+ echo .$rev.$hash
|
|
||||||
+ elif [ -d .git ]; then
|
|
||||||
+ echo .0.gsnapshot
|
|
||||||
+ fi
|
|
||||||
+)
|
|
||||||
diff --git a/include/ipmitool/ipmi_fru.h b/include/ipmitool/ipmi_fru.h
|
|
||||||
index 65696ba..d03abfc 100644
|
|
||||||
--- a/include/ipmitool/ipmi_fru.h
|
|
||||||
+++ b/include/ipmitool/ipmi_fru.h
|
|
||||||
@@ -614,5 +614,6 @@ typedef struct ipmi_fru_bloc {
|
|
||||||
|
|
||||||
int ipmi_fru_main(struct ipmi_intf *intf, int argc, char **argv);
|
|
||||||
int ipmi_fru_print(struct ipmi_intf *intf, struct sdr_record_fru_locator *fru);
|
|
||||||
+char *get_fru_area_str(uint8_t *data, uint32_t *offset);
|
|
||||||
|
|
||||||
#endif /* IPMI_FRU_H */
|
|
||||||
diff --git a/include/ipmitool/ipmi_picmg.h b/include/ipmitool/ipmi_picmg.h
|
|
||||||
index 3d70454..0bcbd93 100644
|
|
||||||
--- a/include/ipmitool/ipmi_picmg.h
|
|
||||||
+++ b/include/ipmitool/ipmi_picmg.h
|
|
||||||
@@ -12,6 +12,7 @@
|
|
||||||
#define PICMG_CPCI_MAJOR_VERSION 1
|
|
||||||
#define PICMG_ATCA_MAJOR_VERSION 2
|
|
||||||
#define PICMG_AMC_MAJOR_VERSION 4
|
|
||||||
+#define PICMG_UTCA_MAJOR_VERSION 5
|
|
||||||
|
|
||||||
/* PICMG commands */
|
|
||||||
#define PICMG_GET_PICMG_PROPERTIES_CMD 0x00
|
|
||||||
diff --git a/include/ipmitool/ipmi_sel.h b/include/ipmitool/ipmi_sel.h
|
|
||||||
index 1c325db..a6a2a42 100644
|
|
||||||
--- a/include/ipmitool/ipmi_sel.h
|
|
||||||
+++ b/include/ipmitool/ipmi_sel.h
|
|
||||||
@@ -579,8 +579,8 @@ static const struct ipmi_event_sensor_types sensor_specific_event_types[] = {
|
|
||||||
{ 0xF1, 0x00, 0xff, "IPMB-A disabled, IPMB-B disabled" },
|
|
||||||
{ 0xF1, 0x01, 0xff, "IPMB-A enabled, IPMB-B disabled" },
|
|
||||||
{ 0xF1, 0x02, 0xff, "IPMB-A disabled, IPMB-B enabled" },
|
|
||||||
- { 0xF1, 0x03, 0xff, "IPMB-A enabled, IPMP-B enabled" },
|
|
||||||
- /* PICNG Moduke Hot Swap */
|
|
||||||
+ { 0xF1, 0x03, 0xff, "IPMB-A enabled, IPMB-B enabled" },
|
|
||||||
+ /* PICMG Module Hot Swap */
|
|
||||||
{ 0xF2, 0x00, 0xff, "Module Handle Closed" },
|
|
||||||
{ 0xF2, 0x01, 0xff, "Module Handle Opened" },
|
|
||||||
{ 0xF2, 0x02, 0xff, "Quiesced" },
|
|
||||||
@@ -599,7 +599,7 @@ static const struct ipmi_event_sensor_types vita_sensor_event_types[] = {
|
|
||||||
{ 0xF1, 0x00, 0xFF, "IPMB-A disabled, IPMB-B disabled" },
|
|
||||||
{ 0xF1, 0x01, 0xFF, "IPMB-A enabled, IPMB-B disabled" },
|
|
||||||
{ 0xF1, 0x02, 0xFF, "IPMB-A disabled, IPMB-B enabled" },
|
|
||||||
- { 0xF1, 0x03, 0xFF, "IPMB-A enabled, IPMP-B enabled" },
|
|
||||||
+ { 0xF1, 0x03, 0xFF, "IPMB-A enabled, IPMB-B enabled" },
|
|
||||||
/* VITA FRU Temperature */
|
|
||||||
{ 0xF3, 0x00, 0xff, "At or below Lower Non-critical" },
|
|
||||||
{ 0xF3, 0x01, 0xff, "At or below Lower Critical" },
|
|
||||||
diff --git a/lib/ipmi_cfgp.c b/lib/ipmi_cfgp.c
|
|
||||||
index b8af80d..dfc4743 100644
|
|
||||||
--- a/lib/ipmi_cfgp.c
|
|
||||||
+++ b/lib/ipmi_cfgp.c
|
|
||||||
@@ -30,7 +30,11 @@
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
-#include <malloc.h>
|
|
||||||
+#ifdef HAVE_MALLOC_H
|
|
||||||
+# include <malloc.h>
|
|
||||||
+#else
|
|
||||||
+# include <stdlib.h>
|
|
||||||
+#endif
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <ipmitool/helper.h>
|
|
||||||
diff --git a/lib/ipmi_ekanalyzer.c b/lib/ipmi_ekanalyzer.c
|
|
||||||
index 7a6c63d..f6d8b90 100644
|
|
||||||
--- a/lib/ipmi_ekanalyzer.c
|
|
||||||
+++ b/lib/ipmi_ekanalyzer.c
|
|
||||||
@@ -37,6 +37,7 @@
|
|
||||||
#include <ipmitool/log.h>
|
|
||||||
#include <ipmitool/helper.h>
|
|
||||||
#include <ipmitool/ipmi_strings.h>
|
|
||||||
+#include <ipmitool/ipmi_fru.h>
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
@@ -2696,12 +2697,19 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
|
|
||||||
int ret = 0;
|
|
||||||
unsigned char len = 0;
|
|
||||||
unsigned int size_board = 0;
|
|
||||||
+ int custom_fields = 0;
|
|
||||||
if (input_file == NULL || board_type == NULL
|
|
||||||
|| board_length == NULL) {
|
|
||||||
return (size_t)(-1);
|
|
||||||
}
|
|
||||||
file_offset = ftell(input_file);
|
|
||||||
|
|
||||||
+ /*
|
|
||||||
+ * TODO: This whole file's code is extremely dirty and wicked.
|
|
||||||
+ * Must eventually switch to using ipmi_fru.c code or some
|
|
||||||
+ * specialized FRU library.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
/* Board length*/
|
|
||||||
ret = fread(&len, 1, 1, input_file);
|
|
||||||
if ((ret != 1) || ferror(input_file)) {
|
|
||||||
@@ -2717,14 +2725,15 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
if (strncmp(board_type, "Custom", 6 ) != 0) {
|
|
||||||
- unsigned char *data;
|
|
||||||
+ unsigned char *data, *str;
|
|
||||||
unsigned int i = 0;
|
|
||||||
- data = malloc(size_board);
|
|
||||||
+ data = malloc(size_board + 1); /* Make room for type/length field */
|
|
||||||
if (data == NULL) {
|
|
||||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
|
||||||
return (size_t)(-1);
|
|
||||||
}
|
|
||||||
- ret = fread(data, size_board, 1, input_file);
|
|
||||||
+ data[0] = len; /* Save the type/length byte in 'data' */
|
|
||||||
+ ret = fread(data + 1, size_board, 1, input_file);
|
|
||||||
if ((ret != 1) || ferror(input_file)) {
|
|
||||||
lprintf(LOG_ERR, "Invalid board type size!");
|
|
||||||
free(data);
|
|
||||||
@@ -2733,17 +2742,11 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
|
|
||||||
}
|
|
||||||
printf("%s type: 0x%02x\n", board_type, len);
|
|
||||||
printf("%s: ", board_type);
|
|
||||||
- for (i = 0; i < size_board; i++) {
|
|
||||||
- if ((len & TYPE_CODE) == TYPE_CODE) {
|
|
||||||
- printf("%c", data[i]);
|
|
||||||
- } else {
|
|
||||||
- /* other than language code (binary, BCD,
|
|
||||||
- * ASCII 6 bit...) is not supported
|
|
||||||
- */
|
|
||||||
- printf("%02x", data[i]);
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
- printf("\n");
|
|
||||||
+ i = 0;
|
|
||||||
+ str = (unsigned char *)get_fru_area_str(data, &i);
|
|
||||||
+ printf("%s\n", str);
|
|
||||||
+ free(str);
|
|
||||||
+ str = NULL;
|
|
||||||
free(data);
|
|
||||||
data = NULL;
|
|
||||||
(*board_length) -= size_board;
|
|
||||||
@@ -2756,7 +2759,12 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
|
|
||||||
/* take the rest of data in the area minus 1 byte of
|
|
||||||
* checksum
|
|
||||||
*/
|
|
||||||
- printf("Additional Custom Mfg. length: 0x%02x\n", len);
|
|
||||||
+ if (custom_fields) {
|
|
||||||
+ printf("End of Custom Mfg. fields (0x%02x)\n", len);
|
|
||||||
+ } else {
|
|
||||||
+ printf("No Additional Custom Mfg. fields (0x%02x)\n", len);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
padding = (*board_length) - 1;
|
|
||||||
if ((padding > 0) && (!feof(input_file))) {
|
|
||||||
printf("Unused space: %d (bytes)\n", padding);
|
|
||||||
@@ -2770,16 +2778,18 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
|
|
||||||
printf("Checksum: 0x%02x\n", checksum);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
+ custom_fields++;
|
|
||||||
printf("Additional Custom Mfg. length: 0x%02x\n", len);
|
|
||||||
if ((size_board > 0) && (size_board < (*board_length))) {
|
|
||||||
- unsigned char * additional_data = NULL;
|
|
||||||
+ unsigned char *additional_data, *str;
|
|
||||||
unsigned int i = 0;
|
|
||||||
- additional_data = malloc(size_board);
|
|
||||||
+ additional_data = malloc(size_board + 1); /* Make room for type/length field */
|
|
||||||
if (additional_data == NULL) {
|
|
||||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
|
||||||
return (size_t)(-1);
|
|
||||||
}
|
|
||||||
- ret = fread(additional_data, size_board, 1, input_file);
|
|
||||||
+ additional_data[0] = len;
|
|
||||||
+ ret = fread(additional_data + 1, size_board, 1, input_file);
|
|
||||||
if ((ret != 1) || ferror(input_file)) {
|
|
||||||
lprintf(LOG_ERR, "Invalid Additional Data!");
|
|
||||||
if (additional_data != NULL) {
|
|
||||||
@@ -2788,18 +2798,27 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
|
|
||||||
}
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
- printf("Additional Custom Mfg. Data: %02x",
|
|
||||||
- additional_data[0]);
|
|
||||||
- for (i = 1; i < size_board; i++) {
|
|
||||||
- printf("-%02x", additional_data[i]);
|
|
||||||
- }
|
|
||||||
- printf("\n");
|
|
||||||
+ printf("Additional Custom Mfg. Data: ");
|
|
||||||
+ i = 0;
|
|
||||||
+ str = (unsigned char *)get_fru_area_str(additional_data, &i);
|
|
||||||
+ printf("%s\n", str);
|
|
||||||
+ free(str);
|
|
||||||
+ str = NULL;
|
|
||||||
free(additional_data);
|
|
||||||
additional_data = NULL;
|
|
||||||
+
|
|
||||||
(*board_length) -= size_board;
|
|
||||||
+ ret = fread(&len, 1, 1, input_file);
|
|
||||||
+ if ((ret != 1) || ferror(input_file)) {
|
|
||||||
+ lprintf(LOG_ERR, "Invalid Length!");
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+ (*board_length)--;
|
|
||||||
+ size_board = (len & 0x3f);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
- printf("No Additional Custom Mfg. %d\n", *board_length);
|
|
||||||
+ printf("ERROR: File has insufficient data (%d bytes) for the "
|
|
||||||
+ "Additional Custom Mfg. field\n", *board_length);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/lib/ipmi_fru.c b/lib/ipmi_fru.c
|
|
||||||
index cf00eff..42c1f19 100644
|
|
||||||
--- a/lib/ipmi_fru.c
|
|
||||||
+++ b/lib/ipmi_fru.c
|
|
||||||
@@ -107,7 +107,7 @@ char * get_fru_area_str(uint8_t * data, uint32_t * offset)
|
|
||||||
{
|
|
||||||
static const char bcd_plus[] = "0123456789 -.:,_";
|
|
||||||
char * str;
|
|
||||||
- int len, off, size, i, j, k, typecode;
|
|
||||||
+ int len, off, size, i, j, k, typecode, char_idx;
|
|
||||||
union {
|
|
||||||
uint32_t bits;
|
|
||||||
char chars[4];
|
|
||||||
@@ -126,15 +126,15 @@ char * get_fru_area_str(uint8_t * data, uint32_t * offset)
|
|
||||||
|
|
||||||
switch (typecode) {
|
|
||||||
case 0: /* 00b: binary/unspecified */
|
|
||||||
- /* hex dump -> 2x length */
|
|
||||||
- size = (len*2);
|
|
||||||
+ case 1: /* 01b: BCD plus */
|
|
||||||
+ /* hex dump or BCD -> 2x length */
|
|
||||||
+ size = (len * 2);
|
|
||||||
break;
|
|
||||||
case 2: /* 10b: 6-bit ASCII */
|
|
||||||
/* 4 chars per group of 1-3 bytes */
|
|
||||||
- size = ((((len+2)*4)/3) & ~3);
|
|
||||||
+ size = (((len * 4 + 2) / 3) & ~3);
|
|
||||||
break;
|
|
||||||
case 3: /* 11b: 8-bit ASCII */
|
|
||||||
- case 1: /* 01b: BCD plus */
|
|
||||||
/* no length adjustment */
|
|
||||||
size = len;
|
|
||||||
break;
|
|
||||||
@@ -149,7 +149,7 @@ char * get_fru_area_str(uint8_t * data, uint32_t * offset)
|
|
||||||
return NULL;
|
|
||||||
memset(str, 0, size+1);
|
|
||||||
|
|
||||||
- if (len == 0) {
|
|
||||||
+ if (size == 0) {
|
|
||||||
str[0] = '\0';
|
|
||||||
*offset = off;
|
|
||||||
return str;
|
|
||||||
@@ -157,30 +157,30 @@ char * get_fru_area_str(uint8_t * data, uint32_t * offset)
|
|
||||||
|
|
||||||
switch (typecode) {
|
|
||||||
case 0: /* Binary */
|
|
||||||
- strncpy(str, buf2str(&data[off], len), len*2);
|
|
||||||
+ strncpy(str, buf2str(&data[off], len), size);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1: /* BCD plus */
|
|
||||||
- for (k=0; k<len; k++)
|
|
||||||
- str[k] = bcd_plus[(data[off+k] & 0x0f)];
|
|
||||||
+ for (k = 0; k < size; k++)
|
|
||||||
+ str[k] = bcd_plus[((data[off + k / 2] >> ((k % 2) ? 0 : 4)) & 0x0f)];
|
|
||||||
str[k] = '\0';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2: /* 6-bit ASCII */
|
|
||||||
- for (i=j=0; i<len; i+=3) {
|
|
||||||
+ for (i = j = 0; i < len; i += 3) {
|
|
||||||
u.bits = 0;
|
|
||||||
- k = ((len-i) < 3 ? (len-i) : 3);
|
|
||||||
+ k = ((len - i) < 3 ? (len - i) : 3);
|
|
||||||
#if WORDS_BIGENDIAN
|
|
||||||
u.chars[3] = data[off+i];
|
|
||||||
u.chars[2] = (k > 1 ? data[off+i+1] : 0);
|
|
||||||
u.chars[1] = (k > 2 ? data[off+i+2] : 0);
|
|
||||||
-#define CHAR_IDX 3
|
|
||||||
+ char_idx = 3;
|
|
||||||
#else
|
|
||||||
memcpy((void *)&u.bits, &data[off+i], k);
|
|
||||||
-#define CHAR_IDX 0
|
|
||||||
+ char_idx = 0;
|
|
||||||
#endif
|
|
||||||
for (k=0; k<4; k++) {
|
|
||||||
- str[j++] = ((u.chars[CHAR_IDX] & 0x3f) + 0x20);
|
|
||||||
+ str[j++] = ((u.chars[char_idx] & 0x3f) + 0x20);
|
|
||||||
u.bits >>= 6;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -188,8 +188,8 @@ char * get_fru_area_str(uint8_t * data, uint32_t * offset)
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
- memcpy(str, &data[off], len);
|
|
||||||
- str[len] = '\0';
|
|
||||||
+ memcpy(str, &data[off], size);
|
|
||||||
+ str[size] = '\0';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/lib/ipmi_picmg.c b/lib/ipmi_picmg.c
|
|
||||||
index c7d9c8e..2166cbe 100644
|
|
||||||
--- a/lib/ipmi_picmg.c
|
|
||||||
+++ b/lib/ipmi_picmg.c
|
|
||||||
@@ -37,11 +37,6 @@
|
|
||||||
#include <ipmitool/ipmi_strings.h>
|
|
||||||
#include <ipmitool/log.h>
|
|
||||||
|
|
||||||
-#define PICMG_EXTENSION_ATCA_MAJOR_VERSION 2
|
|
||||||
-#define PICMG_EXTENSION_AMC0_MAJOR_VERSION 4
|
|
||||||
-#define PICMG_EXTENSION_UTCA_MAJOR_VERSION 5
|
|
||||||
-
|
|
||||||
-
|
|
||||||
#define PICMG_EKEY_MODE_QUERY 0
|
|
||||||
#define PICMG_EKEY_MODE_PRINT_ALL 1
|
|
||||||
#define PICMG_EKEY_MODE_PRINT_ENABLED 2
|
|
||||||
@@ -2367,9 +2362,9 @@ picmg_discover(struct ipmi_intf *intf) {
|
|
||||||
} else if (rsp->data[0] != 0) {
|
|
||||||
lprintf(LOG_INFO,"Invalid Get PICMG Properties group extension %#x",
|
|
||||||
rsp->data[0]);
|
|
||||||
- } else if ((rsp->data[1] & 0x0F) != PICMG_EXTENSION_ATCA_MAJOR_VERSION
|
|
||||||
- && (rsp->data[1] & 0x0F) != PICMG_EXTENSION_AMC0_MAJOR_VERSION
|
|
||||||
- && (rsp->data[1] & 0x0F) != PICMG_EXTENSION_UTCA_MAJOR_VERSION) {
|
|
||||||
+ } else if ((rsp->data[1] & 0x0F) != PICMG_ATCA_MAJOR_VERSION
|
|
||||||
+ && (rsp->data[1] & 0x0F) != PICMG_AMC_MAJOR_VERSION
|
|
||||||
+ && (rsp->data[1] & 0x0F) != PICMG_UTCA_MAJOR_VERSION) {
|
|
||||||
lprintf(LOG_INFO,"Unknown PICMG Extension Version %d.%d",
|
|
||||||
(rsp->data[1] & 0x0F), (rsp->data[1] >> 4));
|
|
||||||
} else {
|
|
||||||
diff --git a/lib/ipmi_sdr.c b/lib/ipmi_sdr.c
|
|
||||||
index 2a9cbe3..167c252 100644
|
|
||||||
--- a/lib/ipmi_sdr.c
|
|
||||||
+++ b/lib/ipmi_sdr.c
|
|
||||||
@@ -4217,7 +4217,7 @@ ipmi_sdr_get_info(struct ipmi_intf *intf,
|
|
||||||
* returns pointer to static buffer
|
|
||||||
*/
|
|
||||||
static char *
|
|
||||||
-ipmi_sdr_timestamp(uint32_t stamp)
|
|
||||||
+ipmi_sdr_timestamp(time_t stamp)
|
|
||||||
{
|
|
||||||
static char tbuf[40];
|
|
||||||
time_t s = (time_t) stamp;
|
|
||||||
@@ -4240,7 +4240,7 @@ ipmi_sdr_timestamp(uint32_t stamp)
|
|
||||||
int
|
|
||||||
ipmi_sdr_print_info(struct ipmi_intf *intf)
|
|
||||||
{
|
|
||||||
- uint32_t timestamp;
|
|
||||||
+ time_t timestamp;
|
|
||||||
uint16_t free_space;
|
|
||||||
|
|
||||||
struct get_sdr_repository_info_rsp sdr_repository_info;
|
|
||||||
@@ -4274,21 +4274,51 @@ ipmi_sdr_print_info(struct ipmi_intf *intf)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
- timestamp =
|
|
||||||
- (sdr_repository_info.most_recent_addition_timestamp[3] << 24) |
|
|
||||||
- (sdr_repository_info.most_recent_addition_timestamp[2] << 16) |
|
|
||||||
- (sdr_repository_info.most_recent_addition_timestamp[1] << 8) |
|
|
||||||
- sdr_repository_info.most_recent_addition_timestamp[0];
|
|
||||||
- printf("Most recent Addition : %s\n",
|
|
||||||
- ipmi_sdr_timestamp(timestamp));
|
|
||||||
-
|
|
||||||
- timestamp =
|
|
||||||
- (sdr_repository_info.most_recent_erase_timestamp[3] << 24) |
|
|
||||||
- (sdr_repository_info.most_recent_erase_timestamp[2] << 16) |
|
|
||||||
- (sdr_repository_info.most_recent_erase_timestamp[1] << 8) |
|
|
||||||
- sdr_repository_info.most_recent_erase_timestamp[0];
|
|
||||||
- printf("Most recent Erase : %s\n",
|
|
||||||
- ipmi_sdr_timestamp(timestamp));
|
|
||||||
+ if(sdr_repository_info.delete_sdr_supported && sdr_repository_info.partial_add_sdr_supported)
|
|
||||||
+ {
|
|
||||||
+ timestamp =
|
|
||||||
+ (sdr_repository_info.most_recent_addition_timestamp[3] << 24) |
|
|
||||||
+ (sdr_repository_info.most_recent_addition_timestamp[2] << 16) |
|
|
||||||
+ (sdr_repository_info.most_recent_addition_timestamp[1] << 8) |
|
|
||||||
+ sdr_repository_info.most_recent_addition_timestamp[0];
|
|
||||||
+ printf("Most recent Addition : %s\n",
|
|
||||||
+ ipmi_sdr_timestamp(timestamp));
|
|
||||||
+
|
|
||||||
+ timestamp =
|
|
||||||
+ (sdr_repository_info.most_recent_erase_timestamp[3] << 24) |
|
|
||||||
+ (sdr_repository_info.most_recent_erase_timestamp[2] << 16) |
|
|
||||||
+ (sdr_repository_info.most_recent_erase_timestamp[1] << 8) |
|
|
||||||
+ sdr_repository_info.most_recent_erase_timestamp[0];
|
|
||||||
+ printf("Most recent Erase : %s\n",
|
|
||||||
+ ipmi_sdr_timestamp(timestamp));
|
|
||||||
+ }
|
|
||||||
+ else if (sdr_repository_info.partial_add_sdr_supported)
|
|
||||||
+ {
|
|
||||||
+ timestamp =
|
|
||||||
+ (sdr_repository_info.most_recent_addition_timestamp[3] << 24) |
|
|
||||||
+ (sdr_repository_info.most_recent_addition_timestamp[2] << 16) |
|
|
||||||
+ (sdr_repository_info.most_recent_addition_timestamp[1] << 8) |
|
|
||||||
+ sdr_repository_info.most_recent_addition_timestamp[0];
|
|
||||||
+ printf("Most recent Addition : %s\n",
|
|
||||||
+ ipmi_sdr_timestamp(timestamp));
|
|
||||||
+ printf("Most recent Erase : NA\n");
|
|
||||||
+ }
|
|
||||||
+ else if(sdr_repository_info.delete_sdr_supported)
|
|
||||||
+ {
|
|
||||||
+ printf("Most recent Addition : NA\n");
|
|
||||||
+ timestamp =
|
|
||||||
+ (sdr_repository_info.most_recent_erase_timestamp[3] << 24) |
|
|
||||||
+ (sdr_repository_info.most_recent_erase_timestamp[2] << 16) |
|
|
||||||
+ (sdr_repository_info.most_recent_erase_timestamp[1] << 8) |
|
|
||||||
+ sdr_repository_info.most_recent_erase_timestamp[0];
|
|
||||||
+ printf("Most recent Erase : %s\n",
|
|
||||||
+ ipmi_sdr_timestamp(timestamp));
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ printf("Most recent Addition : NA\n");
|
|
||||||
+ printf("Most recent Erase : NA\n");
|
|
||||||
+ }
|
|
||||||
|
|
||||||
printf("SDR overflow : %s\n",
|
|
||||||
(sdr_repository_info.overflow_flag ? "yes" : "no"));
|
|
||||||
diff --git a/src/plugins/lanplus/lanplus_crypt_impl.c b/src/plugins/lanplus/lanplus_crypt_impl.c
|
|
||||||
index d5fac37..9652a5e 100644
|
|
||||||
--- a/src/plugins/lanplus/lanplus_crypt_impl.c
|
|
||||||
+++ b/src/plugins/lanplus/lanplus_crypt_impl.c
|
|
||||||
@@ -164,11 +164,7 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
|
|
||||||
uint8_t * output,
|
|
||||||
uint32_t * bytes_written)
|
|
||||||
{
|
|
||||||
- EVP_CIPHER_CTX ctx;
|
|
||||||
- EVP_CIPHER_CTX_init(&ctx);
|
|
||||||
- EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key, iv);
|
|
||||||
- EVP_CIPHER_CTX_set_padding(&ctx, 0);
|
|
||||||
-
|
|
||||||
+ EVP_CIPHER_CTX *ctx = NULL;
|
|
||||||
|
|
||||||
*bytes_written = 0;
|
|
||||||
|
|
||||||
@@ -182,6 +178,14 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
|
|
||||||
printbuf(input, input_length, "encrypting this data");
|
|
||||||
}
|
|
||||||
|
|
||||||
+ ctx = EVP_CIPHER_CTX_new();
|
|
||||||
+ if (ctx == NULL) {
|
|
||||||
+ lprintf(LOG_DEBUG, "ERROR: EVP_CIPHER_CTX_new() failed");
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ EVP_CIPHER_CTX_init(ctx);
|
|
||||||
+ EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
|
|
||||||
+ EVP_CIPHER_CTX_set_padding(ctx, 0);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The default implementation adds a whole block of padding if the input
|
|
||||||
@@ -191,28 +195,28 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
|
|
||||||
assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0);
|
|
||||||
|
|
||||||
|
|
||||||
- if(!EVP_EncryptUpdate(&ctx, output, (int *)bytes_written, input, input_length))
|
|
||||||
+ if(!EVP_EncryptUpdate(ctx, output, (int *)bytes_written, input, input_length))
|
|
||||||
{
|
|
||||||
/* Error */
|
|
||||||
*bytes_written = 0;
|
|
||||||
- return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
uint32_t tmplen;
|
|
||||||
|
|
||||||
- if(!EVP_EncryptFinal_ex(&ctx, output + *bytes_written, (int *)&tmplen))
|
|
||||||
+ if(!EVP_EncryptFinal_ex(ctx, output + *bytes_written, (int *)&tmplen))
|
|
||||||
{
|
|
||||||
+ /* Error */
|
|
||||||
*bytes_written = 0;
|
|
||||||
- return; /* Error */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Success */
|
|
||||||
*bytes_written += tmplen;
|
|
||||||
- EVP_CIPHER_CTX_cleanup(&ctx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+ /* performs cleanup and free */
|
|
||||||
+ EVP_CIPHER_CTX_free(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -239,11 +243,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
|
|
||||||
uint8_t * output,
|
|
||||||
uint32_t * bytes_written)
|
|
||||||
{
|
|
||||||
- EVP_CIPHER_CTX ctx;
|
|
||||||
- EVP_CIPHER_CTX_init(&ctx);
|
|
||||||
- EVP_DecryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key, iv);
|
|
||||||
- EVP_CIPHER_CTX_set_padding(&ctx, 0);
|
|
||||||
-
|
|
||||||
+ EVP_CIPHER_CTX *ctx = NULL;
|
|
||||||
|
|
||||||
if (verbose >= 5)
|
|
||||||
{
|
|
||||||
@@ -252,12 +252,20 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
|
|
||||||
printbuf(input, input_length, "decrypting this data");
|
|
||||||
}
|
|
||||||
|
|
||||||
-
|
|
||||||
*bytes_written = 0;
|
|
||||||
|
|
||||||
if (input_length == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
+ ctx = EVP_CIPHER_CTX_new();
|
|
||||||
+ if (ctx == NULL) {
|
|
||||||
+ lprintf(LOG_DEBUG, "ERROR: EVP_CIPHER_CTX_new() failed");
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ EVP_CIPHER_CTX_init(ctx);
|
|
||||||
+ EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
|
|
||||||
+ EVP_CIPHER_CTX_set_padding(ctx, 0);
|
|
||||||
+
|
|
||||||
/*
|
|
||||||
* The default implementation adds a whole block of padding if the input
|
|
||||||
* data is perfectly aligned. We would like to keep that from happening.
|
|
||||||
@@ -266,33 +274,33 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
|
|
||||||
assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0);
|
|
||||||
|
|
||||||
|
|
||||||
- if (!EVP_DecryptUpdate(&ctx, output, (int *)bytes_written, input, input_length))
|
|
||||||
+ if (!EVP_DecryptUpdate(ctx, output, (int *)bytes_written, input, input_length))
|
|
||||||
{
|
|
||||||
/* Error */
|
|
||||||
lprintf(LOG_DEBUG, "ERROR: decrypt update failed");
|
|
||||||
*bytes_written = 0;
|
|
||||||
- return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
uint32_t tmplen;
|
|
||||||
|
|
||||||
- if (!EVP_DecryptFinal_ex(&ctx, output + *bytes_written, (int *)&tmplen))
|
|
||||||
+ if (!EVP_DecryptFinal_ex(ctx, output + *bytes_written, (int *)&tmplen))
|
|
||||||
{
|
|
||||||
+ /* Error */
|
|
||||||
char buffer[1000];
|
|
||||||
ERR_error_string(ERR_get_error(), buffer);
|
|
||||||
lprintf(LOG_DEBUG, "the ERR error %s", buffer);
|
|
||||||
lprintf(LOG_DEBUG, "ERROR: decrypt final failed");
|
|
||||||
*bytes_written = 0;
|
|
||||||
- return; /* Error */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Success */
|
|
||||||
*bytes_written += tmplen;
|
|
||||||
- EVP_CIPHER_CTX_cleanup(&ctx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+ /* performs cleanup and free */
|
|
||||||
+ EVP_CIPHER_CTX_free(ctx);
|
|
||||||
|
|
||||||
if (verbose >= 5)
|
|
||||||
{
|
|
Loading…
Reference in New Issue
Block a user