update serpent module

This commit is contained in:
Zhi Guan
2017-03-26 15:04:30 +08:00
parent 0985cf27f1
commit 019924627e
8 changed files with 61 additions and 6 deletions

View File

@@ -312,7 +312,8 @@ $config{sdirs} = [
"evp", "asn1", "pem", "x509", "x509v3", "conf", "txt_db", "pkcs7", "pkcs12", "comp", "ocsp", "ui",
"cms", "ts", "srp", "cmac", "ct", "async", "kdf",
"sm3", "sms4", "kdf2", "ecies", "ffx", "sm2", "paillier", "cpk", "otp", "gmapi", "ec2",
"bfibe", "bb1ibe", "sm9", "saf", "sdf", "skf", "sof", "zuc"
"bfibe", "bb1ibe", "sm9", "saf", "sdf", "skf", "sof", "zuc",
"serpent"
];
# Known TLS and DTLS protocols
@@ -432,6 +433,7 @@ my @disablables = (
"pem",
"pkcs7",
"pkcs12",
"serpent",
);
foreach my $proto ((@tls, @dtls))
{
@@ -474,6 +476,7 @@ our %disabled = ( # "what" => "comment"
"bb1ibe" => "default",
"saf" => "default",
"sof" => "default",
"serpent" => "default",
);
# Note: => pair form used for aesthetics, not to truly make a hash table

View File

@@ -0,0 +1,2 @@
LIBS=../../libcrypto
SOURCE[../../libcrypto]=serpent.c

View File

@@ -9,7 +9,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "myserpent.h"
#include <openssl/serpent.h>
#define IN
#define OUT

View File

@@ -0,0 +1,2 @@
crypto/serpent/serpent.o: crypto/serpent/serpent.c \
include/openssl/serpent.h

View File

@@ -17,3 +17,22 @@ extern char sb7(char sb7_in);
#define rotr(x,n) (((x) >> ((int)(n))) | ((x) << (32 - (int)(n))))
#endif
/*
The following should be implemented
#define SERPENT_KEY_LENGTH ??
#define SERPENT_BLOCK_SIZE ??
#define SERPENT_IV_LENGTH (SERPENT_BLOCK_SIZE)
#define SERPENT_NUM_ROUNDS ??
typedef struct {
uint32_t rk[SMS4_NUM_ROUNDS];
} serpent_key_t;
void serpent_set_encrypt_key(serpent_key_t *key, const unsigned char *user_key);
void serpent_set_decrypt_key(serpent_key_t *key, const unsigned char *user_key);
void serpent_encrypt(const unsigned char *in, unsigned char *out, const serpent_key_t *key);
void serpent_decrypt(const unsigned char *in, unsigned char *out, const serpent_key_t *key);
*/

View File

@@ -20,7 +20,8 @@ IF[{- !$disabled{tests} -}]
sm3test sms4test kdf2test eciestest ffxtest sm2test \
pailliertest cpktest otptest gmapitest ec2test \
bfibetest bb1ibetest sm9test \
saftest sdftest skftest softest zuctest
saftest sdftest skftest softest zuctest \
serpenttest
SOURCE[aborttest]=aborttest.c
INCLUDE[aborttest]=../include
@@ -363,6 +364,10 @@ IF[{- !$disabled{tests} -}]
INCLUDE[zuctest]=../include
DEPEND[zuctest]=../libcrypto
SOURCE[serpenttest]=serpenttest.c
INCLUDE[serpenttest]=../include
DEPEND[serpenttest]=../libcrypto
IF[{- !$disabled{shared} -}]
PROGRAMS_NO_INST=shlibloadtest
SOURCE[shlibloadtest]=shlibloadtest.c

View File

@@ -0,0 +1,12 @@
#! /usr/bin/env perl
# Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the OpenSSL license (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
use OpenSSL::Test::Simple;
simple_test("test_serpent", "serpenttest", "serpent");

View File

@@ -1,6 +1,18 @@
#include <stdio.h>
#include "myserpent.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "../e_os.h"
#ifdef OPENSSL_NO_SERPENT
int main(int argc, char **argv)
{
printf("No Serpent support\n");
return 0;
}
#else
#include <openssl/serpent.h>
int main(int argc, char* argv[]){
@@ -267,4 +279,4 @@ int main(int argc, char* argv[]){
fclose(fp);
return 0;
}
#endif