Blame crypto/des/ecb_enc.c
|
Packit Service |
084de1 |
/*
|
|
Packit Service |
084de1 |
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
|
Packit Service |
084de1 |
*
|
|
Packit Service |
084de1 |
* Licensed under the OpenSSL license (the "License"). You may not use
|
|
Packit Service |
084de1 |
* this file except in compliance with the License. You can obtain a copy
|
|
Packit Service |
084de1 |
* in the file LICENSE in the source distribution or at
|
|
Packit Service |
084de1 |
* https://www.openssl.org/source/license.html
|
|
Packit Service |
084de1 |
*/
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
#include "des_local.h"
|
|
Packit Service |
084de1 |
#include <openssl/opensslv.h>
|
|
Packit Service |
084de1 |
#include <openssl/bio.h>
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
const char *DES_options(void)
|
|
Packit Service |
084de1 |
{
|
|
Packit Service |
084de1 |
static int init = 1;
|
|
Packit Service |
084de1 |
static char buf[12];
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
if (init) {
|
|
Packit Service |
084de1 |
if (sizeof(DES_LONG) != sizeof(long))
|
|
Packit Service |
084de1 |
OPENSSL_strlcpy(buf, "des(int)", sizeof(buf));
|
|
Packit Service |
084de1 |
else
|
|
Packit Service |
084de1 |
OPENSSL_strlcpy(buf, "des(long)", sizeof(buf));
|
|
Packit Service |
084de1 |
init = 0;
|
|
Packit Service |
084de1 |
}
|
|
Packit Service |
084de1 |
return buf;
|
|
Packit Service |
084de1 |
}
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output,
|
|
Packit Service |
084de1 |
DES_key_schedule *ks, int enc)
|
|
Packit Service |
084de1 |
{
|
|
Packit Service |
084de1 |
register DES_LONG l;
|
|
Packit Service |
084de1 |
DES_LONG ll[2];
|
|
Packit Service |
084de1 |
const unsigned char *in = &(*input)[0];
|
|
Packit Service |
084de1 |
unsigned char *out = &(*output)[0];
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
c2l(in, l);
|
|
Packit Service |
084de1 |
ll[0] = l;
|
|
Packit Service |
084de1 |
c2l(in, l);
|
|
Packit Service |
084de1 |
ll[1] = l;
|
|
Packit Service |
084de1 |
DES_encrypt1(ll, ks, enc);
|
|
Packit Service |
084de1 |
l = ll[0];
|
|
Packit Service |
084de1 |
l2c(l, out);
|
|
Packit Service |
084de1 |
l = ll[1];
|
|
Packit Service |
084de1 |
l2c(l, out);
|
|
Packit Service |
084de1 |
l = ll[0] = ll[1] = 0;
|
|
Packit Service |
084de1 |
}
|