aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/c_src/rc4.c
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2019-03-19 14:50:00 +0100
committerHans Nilsson <[email protected]>2019-03-19 14:50:00 +0100
commit757910dbbbbd7e1b9c5e083c67112918835c271c (patch)
tree00b39d40e1c1073f37a4b2b590d37a38a355ab56 /lib/crypto/c_src/rc4.c
parent36561e14686c64a66e99e25942d66797394a825f (diff)
parent449527eb8db8b240569bbc258a3193ea448a059d (diff)
downloadotp-757910dbbbbd7e1b9c5e083c67112918835c271c.tar.gz
otp-757910dbbbbd7e1b9c5e083c67112918835c271c.tar.bz2
otp-757910dbbbbd7e1b9c5e083c67112918835c271c.zip
Merge branch 'hans/crypto/new_api/OTP-15644'
* hans/crypto/new_api/OTP-15644: (26 commits) crypto: Add FIPS testing for a couple of algorithms crypto: Sort ciphers in alphabetic order in testsuite crypto: Better error report in crypto_SUITE crypto: Wrong ifdef symbol used for ENGINE crypto: Handle EVP_CIPHER_CTX copying correctly crypto: Fix bug in ng_api crypto: Better error descriptions crypto: Fix bug for older cryptolib crypto: Fix leak for eddsa detected by Valgrind crypto: Testcase for TLS using new API crypto: Rename SSL special functions crypto: New function for SSL app crypto: Remove compat specials from crypto_init crypto: Exceptions as error return in api_ng crypto: Relocate the new api code inside the crypto.erl file crypto: Cleaning of comments + spec fixing crypto: Remove unused variables in test case crypto: Test fixes for stream api emulated by the new api crypto: Shrink aes.c,h (remove aes_ctr_stream_* funcs) crypto: Remove chacha20.c,h and rc4.c,h ...
Diffstat (limited to 'lib/crypto/c_src/rc4.c')
-rw-r--r--lib/crypto/c_src/rc4.c92
1 files changed, 0 insertions, 92 deletions
diff --git a/lib/crypto/c_src/rc4.c b/lib/crypto/c_src/rc4.c
deleted file mode 100644
index e423661097..0000000000
--- a/lib/crypto/c_src/rc4.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 2010-2018. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-
-#include "rc4.h"
-
-ERL_NIF_TERM rc4_set_key(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
-{/* (Key) */
-#ifndef OPENSSL_NO_RC4
- ErlNifBinary key;
- ERL_NIF_TERM ret;
- RC4_KEY *rc4_key;
-
- CHECK_NO_FIPS_MODE();
-
- ASSERT(argc == 1);
-
- if (!enif_inspect_iolist_as_binary(env, argv[0], &key))
- goto bad_arg;
- if (key.size > INT_MAX)
- goto bad_arg;
-
- if ((rc4_key = (RC4_KEY*)enif_make_new_binary(env, sizeof(RC4_KEY), &ret)) == NULL)
- goto err;
-
- RC4_set_key(rc4_key, (int)key.size, key.data);
- return ret;
-
- bad_arg:
- err:
- return enif_make_badarg(env);
-
-#else
- return enif_raise_exception(env, atom_notsup);
-#endif
-}
-
-ERL_NIF_TERM rc4_encrypt_with_state(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
-{/* (State, Data) */
-#ifndef OPENSSL_NO_RC4
- ErlNifBinary state, data;
- RC4_KEY* rc4_key;
- ERL_NIF_TERM new_state, new_data;
- unsigned char *outp;
-
- CHECK_NO_FIPS_MODE();
-
- ASSERT(argc == 2);
-
- if (!enif_inspect_iolist_as_binary(env, argv[0], &state))
- goto bad_arg;
- if (state.size != sizeof(RC4_KEY))
- goto bad_arg;
- if (!enif_inspect_iolist_as_binary(env, argv[1], &data))
- goto bad_arg;
-
- if ((rc4_key = (RC4_KEY*)enif_make_new_binary(env, sizeof(RC4_KEY), &new_state)) == NULL)
- goto err;
- if ((outp = enif_make_new_binary(env, data.size, &new_data)) == NULL)
- goto err;
-
- memcpy(rc4_key, state.data, sizeof(RC4_KEY));
- RC4(rc4_key, data.size, data.data, outp);
-
- CONSUME_REDS(env, data);
- return enif_make_tuple2(env, new_state, new_data);
-
- bad_arg:
- err:
- return enif_make_badarg(env);
-
-#else
- return enif_raise_exception(env, atom_notsup);
-#endif
-}
-