aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--HOWTO/INSTALL.md6
-rw-r--r--configure.in26
-rw-r--r--erts/emulator/beam/erl_init.c4
-rw-r--r--erts/emulator/beam/erl_port_task.c23
-rw-r--r--lib/Makefile44
-rw-r--r--lib/public_key/src/pubkey_pbe.erl12
-rw-r--r--lib/public_key/src/public_key.erl7
-rw-r--r--lib/public_key/test/pbe_SUITE.erl8
-rw-r--r--lib/public_key/test/pbe_SUITE_data/aes_128_cbc_enc_key30
10 files changed, 136 insertions, 25 deletions
diff --git a/.gitignore b/.gitignore
index 7ccedd3ff3..9cd91245f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -150,6 +150,7 @@ JAVADOC-GENERATED
/erts/epmd/test/Emakefile
/lib/*/SKIP
+/lib/SKIP-APPLICATIONS
/lib/*/doc/html/*.html
/lib/*/doc/html/*.css
diff --git a/HOWTO/INSTALL.md b/HOWTO/INSTALL.md
index fa1b9d2e89..5bde47e1f6 100644
--- a/HOWTO/INSTALL.md
+++ b/HOWTO/INSTALL.md
@@ -296,6 +296,12 @@ Some of the available `configure` options are:
you can build using a fallback implementation based on mutexes or spinlocks.
Performance of the SMP runtime system will however suffer immensely without
an implementation for native atomic memory accesses.
+* `--without-$app` - By default all applications in Erlang/OTP will be included
+ in a release. If this is not wanted it is possible to specify that Erlang/OTP
+ should be compiled without that applications, i.e. `--without-wx`. There is
+ no automatic dependency handling inbetween applications. So if you disable
+ an application that another depends on, you also have to disable the
+ dependant application.
If you or your system has special requirements please read the `Makefile` for
additional configuration information.
diff --git a/configure.in b/configure.in
index 4b3884864c..bcb0581e0d 100644
--- a/configure.in
+++ b/configure.in
@@ -390,6 +390,15 @@ if test X${enable_native_libs} = Xyes -a X${enable_hipe} != Xno; then
fi
AC_SUBST(NATIVE_LIBS_ENABLED)
+
+rm -f $ERL_TOP/lib/SKIP-APPLICATIONS
+for app in `cd lib && ls -d *`; do
+ var="with_$app"
+ if test X${!var} == Xno; then
+ echo "$app" >> $ERL_TOP/lib/SKIP-APPLICATIONS
+ fi
+done
+
export ERL_TOP
AC_CONFIG_SUBDIRS(lib erts)
@@ -400,15 +409,22 @@ AC_OUTPUT
pattern="lib/*/SKIP"
files=`echo $pattern`
-if test "$files" != "$pattern"; then
+if test "$files" != "$pattern" || test -f $ERL_TOP/lib/SKIP-APPLICATIONS; then
echo '*********************************************************************'
echo '********************** APPLICATIONS DISABLED **********************'
echo '*********************************************************************'
echo
- for skipfile in $files; do
- app=`dirname $skipfile`; app=`basename $app`
- printf "%-15s: " $app; cat $skipfile
- done
+ if test "$files" != "$pattern"; then
+ for skipfile in $files; do
+ app=`dirname $skipfile`; app=`basename $app`
+ printf "%-15s: " $app; cat $skipfile
+ done
+ fi
+ if test -f $ERL_TOP/lib/SKIP-APPLICATIONS; then
+ for skipapp in `cat $ERL_TOP/lib/SKIP-APPLICATIONS`; do
+ printf "%-15s: User gave --without-%s option\n" $skipapp $skipapp
+ done
+ fi
echo
echo '*********************************************************************'
fi
diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c
index f7bfa91b54..8c4fffa75b 100644
--- a/erts/emulator/beam/erl_init.c
+++ b/erts/emulator/beam/erl_init.c
@@ -884,6 +884,10 @@ early_init(int *argc, char **argv) /*
erts_usage();
}
}
+#else
+ /* Silence gcc warnings */
+ (void)schdlrs_percentage;
+ (void)schdlrs_onln_percentage;
#endif
}
diff --git a/erts/emulator/beam/erl_port_task.c b/erts/emulator/beam/erl_port_task.c
index 7d53ce7152..547a42beb2 100644
--- a/erts/emulator/beam/erl_port_task.c
+++ b/erts/emulator/beam/erl_port_task.c
@@ -1838,6 +1838,16 @@ release_port(void *vport)
{
erts_port_dec_refc((Port *) vport);
}
+
+static void
+schedule_release_port(void *vport) {
+ Port *pp = (Port*)vport;
+ /* This is only used when a port release was ordered from a non-scheduler */
+ erts_schedule_thr_prgr_later_op(release_port,
+ (void *) pp,
+ &pp->common.u.release);
+}
+
#endif
static void
@@ -2033,10 +2043,15 @@ begin_port_cleanup(Port *pp, ErtsPortTask **execqp, int *processing_busy_q_p)
* Schedule cleanup of port structure...
*/
#ifdef ERTS_SMP
- /* Has to be more or less immediate to release any driver */
- erts_schedule_thr_prgr_later_op(release_port,
- (void *) pp,
- &pp->common.u.release);
+ /* We might not be a scheduler, eg. traceing to port we are sys_msg_dispatcher */
+ if (!erts_get_scheduler_data()) {
+ erts_schedule_misc_aux_work(1, schedule_release_port, (void*)pp);
+ } else {
+ /* Has to be more or less immediate to release any driver */
+ erts_schedule_thr_prgr_later_op(release_port,
+ (void *) pp,
+ &pp->common.u.release);
+ }
#else
pp->cleanup = 1;
#endif
diff --git a/lib/Makefile b/lib/Makefile
index 9ddf3a0544..47a6d5f9aa 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -19,20 +19,32 @@
include $(ERL_TOP)/make/target.mk
include $(ERL_TOP)/make/$(TARGET)/otp.mk
-ERTS_SUB_DIRECTORIES = stdlib sasl kernel compiler
-OTHER_SUB_DIRECTORIES = tools test_server common_test runtime_tools \
+
+# These have to be built first
+ERTS_APPLICATIONS = stdlib sasl kernel compiler
+
+# Then these have to be build
+ERLANG_APPLICATIONS = tools test_server common_test runtime_tools \
inets xmerl edoc erl_docgen
+
+# These are only build if -a is given to otp_build or make is used directly
+ALL_ERLANG_APPLICATIONS = snmp otp_mibs appmon erl_interface asn1 jinterface \
+ wx debugger reltool gs \
+ ic mnesia crypto orber os_mon parsetools syntax_tools \
+ pman public_key ssl toolbar tv observer odbc diameter \
+ cosTransactions cosEvent cosTime cosNotification \
+ cosProperty cosFileTransfer cosEventDomain et megaco webtool \
+ eunit ssh typer percept eldap dialyzer hipe
+
ifdef BUILD_ALL
- OTHER_SUB_DIRECTORIES += \
- snmp otp_mibs appmon erl_interface asn1 jinterface \
- wx debugger reltool gs \
- ic mnesia crypto orber os_mon parsetools syntax_tools \
- pman public_key ssl toolbar tv observer odbc diameter \
- cosTransactions cosEvent cosTime cosNotification \
- cosProperty cosFileTransfer cosEventDomain et megaco webtool \
- eunit ssh typer percept eldap dialyzer hipe
- EXTRA_FILE := $(wildcard EXTRA-APPLICATIONS)
- EXTRA_APPLICATIONS := $(if $(EXTRA_FILE),$(shell cat $(EXTRA_FILE)))
+ ERLANG_APPLICATIONS += $(ALL_ERLANG_APPLICATIONS)
+
+# We use whildcard */ to figure out if there are any other applications
+# in here.
+ EXPECTED_APPLICATIONS := $(ERTS_APPLICATIONS) $(ERLANG_APPLICATIONS) \
+ autom4te.cache
+ EXTRA_APPLICATIONS += $(filter-out $(EXPECTED_APPLICATIONS),\
+ $(subst /,,$(wildcard */)))
endif
ifdef BOOTSTRAP
@@ -45,13 +57,17 @@ else
ifdef TERTIARY_BOOTSTRAP
SUB_DIRECTORIES = snmp sasl jinterface ic syntax_tools wx
else # Not bootstrap build
- SUB_DIRECTORIES = $(ERTS_SUB_DIRECTORIES) \
- $(OTHER_SUB_DIRECTORIES) \
+ SUB_DIRECTORIES = $(ERTS_APPLICATIONS) \
+ $(ERLANG_APPLICATIONS) \
$(EXTRA_APPLICATIONS)
endif
endif
endif
+# Any applications listed in SKIP-APPLICATIONS should be skipped
+SKIP_FILE := $(wildcard SKIP-APPLICATIONS)
+SKIP_APPLICATIONS := $(if $(SKIP_FILE),$(shell cat $(SKIP_FILE)))
+SUB_DIRECTORIES := $(filter-out $(SKIP_APPLICATIONS),$(SUB_DIRECTORIES))
# ----------------------------------------------------------------------
include $(ERL_TOP)/make/otp_subdir.mk
diff --git a/lib/public_key/src/pubkey_pbe.erl b/lib/public_key/src/pubkey_pbe.erl
index 6f0be53db9..460624163b 100644
--- a/lib/public_key/src/pubkey_pbe.erl
+++ b/lib/public_key/src/pubkey_pbe.erl
@@ -66,7 +66,13 @@ decode(Data, Password,"DES-EDE3-CBC" = Cipher, KeyDevParams) ->
decode(Data, Password,"RC2-CBC"= Cipher, KeyDevParams) ->
{Key, IV} = password_to_key_and_iv(Password, Cipher, KeyDevParams),
- crypto:block_decrypt(rc2_cbc, Key, IV, Data).
+ crypto:block_decrypt(rc2_cbc, Key, IV, Data);
+
+decode(Data, Password,"AES-128-CBC"= Cipher, IV) ->
+ %% PKCS5_SALT_LEN is 8 bytes
+ <<Salt:8/binary,_/binary>> = IV,
+ {Key, _} = password_to_key_and_iv(Password, Cipher, Salt),
+ crypto:block_decrypt(aes_cbc128, Key, IV, Data).
%%--------------------------------------------------------------------
-spec pbdkdf1(string(), iodata(), integer(), atom()) -> binary().
@@ -200,7 +206,9 @@ derived_key_length(Cipher,_) when (Cipher == ?'rc2CBC') or
16;
derived_key_length(Cipher,_) when (Cipher == ?'des-EDE3-CBC') or
(Cipher == "DES-EDE3-CBC") ->
- 24.
+ 24;
+derived_key_length(Cipher,_) when (Cipher == "AES-128-CBC") ->
+ 16.
cipher(#'PBES2-params_encryptionScheme'{algorithm = ?'desCBC'}) ->
"DES-CBC";
diff --git a/lib/public_key/src/public_key.erl b/lib/public_key/src/public_key.erl
index cdbfe6e07c..a4b6b8ad15 100644
--- a/lib/public_key/src/public_key.erl
+++ b/lib/public_key/src/public_key.erl
@@ -118,6 +118,13 @@ pem_entry_decode({Asn1Type, CryptDer, {Cipher, Salt}} = PemEntry,
is_list(Cipher) andalso
is_binary(Salt) andalso
erlang:byte_size(Salt) == 8 ->
+ do_pem_entry_decode(PemEntry, Password);
+pem_entry_decode({Asn1Type, CryptDer, {"AES-128-CBC"=Cipher, IV}} = PemEntry,
+ Password) when is_atom(Asn1Type) andalso
+ is_binary(CryptDer) andalso
+ is_list(Cipher) andalso
+ is_binary(IV) andalso
+ erlang:byte_size(IV) == 16 ->
do_pem_entry_decode(PemEntry, Password).
%%--------------------------------------------------------------------
diff --git a/lib/public_key/test/pbe_SUITE.erl b/lib/public_key/test/pbe_SUITE.erl
index 2c9b17478d..b68ffbd5fd 100644
--- a/lib/public_key/test/pbe_SUITE.erl
+++ b/lib/public_key/test/pbe_SUITE.erl
@@ -218,6 +218,14 @@ encrypted_private_key_info(Config) when is_list(Config) ->
[{'PrivateKeyInfo', _, {"RC2-CBC",_}} = PubEntry2] = PemRc2Entry,
KeyInfo = public_key:pem_entry_decode(PubEntry2, "password"),
+ %% key generated with ssh-keygen -N hello_aes -f aes_128_cbc_enc_key
+ {ok, PemAesCbc} = file:read_file(filename:join(Datadir, "aes_128_cbc_enc_key")),
+
+ PemAesCbcEntry = public_key:pem_decode(PemAesCbc),
+ ct:print("Pem entry: ~p" , [PemAesCbcEntry]),
+ [{'RSAPrivateKey', _, {"AES-128-CBC",_}} = PubAesCbcEntry] = PemAesCbcEntry,
+ #'RSAPrivateKey'{} = public_key:pem_entry_decode(PubAesCbcEntry, "hello_aes"),
+
check_key_info(KeyInfo).
diff --git a/lib/public_key/test/pbe_SUITE_data/aes_128_cbc_enc_key b/lib/public_key/test/pbe_SUITE_data/aes_128_cbc_enc_key
new file mode 100644
index 0000000000..34c7543f30
--- /dev/null
+++ b/lib/public_key/test/pbe_SUITE_data/aes_128_cbc_enc_key
@@ -0,0 +1,30 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: AES-128-CBC,D64FF97327558643763BE17BD50FDDAD
+
+oS4LbrLbQHPxfQILHl0KPswnkC1QqJ4RX6SkcQGVoYJJkPcavupABDYD1PSJf/MD
+aPiN2OHsYAFLHxa1NGEAH6wKSvgdUJyaQ6jbSBNh9we9p2i3tpMnWsJMCZzXsCQh
+RJj23/cFhb2UsqPM3OH6x6/VxX5VmD9Dnt1iU9b+WS6KdU45zP+QWpRd54uBrFab
+Pw0kW7o84VFH6ahUDnzT8JUIk4P4G43G2F7wrOCbiK6AS0S8sCh5E83MrGEoJ6jB
+NIW4xnLdBOLeV65NTgwWEn7bjLz+8IYSg2/wodjj5GL/ciMgiF+/krdQhzbHJhcm
+dXV3SB/lTyjYUUGYU/3wm10f0iLJLFZxVU70yfV0eKhdYtWdR+2RxZjHvstBTGoI
+BMtcaGwfMBh3wBHjS2M9AVh35DU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