1e1051a39Sopenharmony_ci/* 2e1051a39Sopenharmony_ci * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. 3e1051a39Sopenharmony_ci * 4e1051a39Sopenharmony_ci * Licensed under the Apache License 2.0 (the "License"). You may not use 5e1051a39Sopenharmony_ci * this file except in compliance with the License. You can obtain a copy 6e1051a39Sopenharmony_ci * in the file LICENSE in the source distribution or at 7e1051a39Sopenharmony_ci * https://www.openssl.org/source/license.html 8e1051a39Sopenharmony_ci */ 9e1051a39Sopenharmony_ci 10e1051a39Sopenharmony_ci/* 11e1051a39Sopenharmony_ci * DES low level APIs are deprecated for public use, but still ok for internal 12e1051a39Sopenharmony_ci * use. 13e1051a39Sopenharmony_ci */ 14e1051a39Sopenharmony_ci#include "internal/deprecated.h" 15e1051a39Sopenharmony_ci 16e1051a39Sopenharmony_ci#include "des_local.h" 17e1051a39Sopenharmony_ci 18e1051a39Sopenharmony_civoid DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, 19e1051a39Sopenharmony_ci DES_key_schedule *ks1, DES_key_schedule *ks2, 20e1051a39Sopenharmony_ci DES_key_schedule *ks3, int enc) 21e1051a39Sopenharmony_ci{ 22e1051a39Sopenharmony_ci register DES_LONG l0, l1; 23e1051a39Sopenharmony_ci DES_LONG ll[2]; 24e1051a39Sopenharmony_ci const unsigned char *in = &(*input)[0]; 25e1051a39Sopenharmony_ci unsigned char *out = &(*output)[0]; 26e1051a39Sopenharmony_ci 27e1051a39Sopenharmony_ci c2l(in, l0); 28e1051a39Sopenharmony_ci c2l(in, l1); 29e1051a39Sopenharmony_ci ll[0] = l0; 30e1051a39Sopenharmony_ci ll[1] = l1; 31e1051a39Sopenharmony_ci if (enc) 32e1051a39Sopenharmony_ci DES_encrypt3(ll, ks1, ks2, ks3); 33e1051a39Sopenharmony_ci else 34e1051a39Sopenharmony_ci DES_decrypt3(ll, ks1, ks2, ks3); 35e1051a39Sopenharmony_ci l0 = ll[0]; 36e1051a39Sopenharmony_ci l1 = ll[1]; 37e1051a39Sopenharmony_ci l2c(l0, out); 38e1051a39Sopenharmony_ci l2c(l1, out); 39e1051a39Sopenharmony_ci} 40