summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/aes
diff options
context:
space:
mode:
authordjm <>2009-01-09 12:14:11 +0000
committerdjm <>2009-01-09 12:14:11 +0000
commita0fdc9ec41594852f67ec77dfad9cb06bacc4186 (patch)
treec43f6b3a4d93ad2cb3dcf93275295679d895a033 /src/lib/libcrypto/aes
parent5a3c0a05c7f2c5d3c584b7c8d6aec836dd724c80 (diff)
downloadopenbsd-a0fdc9ec41594852f67ec77dfad9cb06bacc4186.tar.gz
openbsd-a0fdc9ec41594852f67ec77dfad9cb06bacc4186.tar.bz2
openbsd-a0fdc9ec41594852f67ec77dfad9cb06bacc4186.zip
import openssl-0.9.8j
Diffstat (limited to 'src/lib/libcrypto/aes')
-rw-r--r--src/lib/libcrypto/aes/aes.h4
-rw-r--r--src/lib/libcrypto/aes/aes_cbc.c2
-rw-r--r--src/lib/libcrypto/aes/aes_core.c8
-rw-r--r--src/lib/libcrypto/aes/asm/aes-586.pl3
-rwxr-xr-xsrc/lib/libcrypto/aes/asm/aes-x86_64.pl7
5 files changed, 20 insertions, 4 deletions
diff --git a/src/lib/libcrypto/aes/aes.h b/src/lib/libcrypto/aes/aes.h
index baf0222d49..450f2b4051 100644
--- a/src/lib/libcrypto/aes/aes.h
+++ b/src/lib/libcrypto/aes/aes.h
@@ -66,6 +66,10 @@
66#define AES_MAXNR 14 66#define AES_MAXNR 14
67#define AES_BLOCK_SIZE 16 67#define AES_BLOCK_SIZE 16
68 68
69#ifdef OPENSSL_FIPS
70#define FIPS_AES_SIZE_T int
71#endif
72
69#ifdef __cplusplus 73#ifdef __cplusplus
70extern "C" { 74extern "C" {
71#endif 75#endif
diff --git a/src/lib/libcrypto/aes/aes_cbc.c b/src/lib/libcrypto/aes/aes_cbc.c
index d2ba6bcdb4..373864cd4b 100644
--- a/src/lib/libcrypto/aes/aes_cbc.c
+++ b/src/lib/libcrypto/aes/aes_cbc.c
@@ -59,6 +59,7 @@
59#include <openssl/aes.h> 59#include <openssl/aes.h>
60#include "aes_locl.h" 60#include "aes_locl.h"
61 61
62#if !defined(OPENSSL_FIPS_AES_ASM)
62void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, 63void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
63 const unsigned long length, const AES_KEY *key, 64 const unsigned long length, const AES_KEY *key,
64 unsigned char *ivec, const int enc) { 65 unsigned char *ivec, const int enc) {
@@ -129,3 +130,4 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
129 } 130 }
130 } 131 }
131} 132}
133#endif
diff --git a/src/lib/libcrypto/aes/aes_core.c b/src/lib/libcrypto/aes/aes_core.c
index 3a80e18b0a..cffdd4daec 100644
--- a/src/lib/libcrypto/aes/aes_core.c
+++ b/src/lib/libcrypto/aes/aes_core.c
@@ -37,6 +37,10 @@
37 37
38#include <stdlib.h> 38#include <stdlib.h>
39#include <openssl/aes.h> 39#include <openssl/aes.h>
40#ifdef OPENSSL_FIPS
41#include <openssl/fips.h>
42#endif
43
40#include "aes_locl.h" 44#include "aes_locl.h"
41 45
42/* 46/*
@@ -631,6 +635,10 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
631 int i = 0; 635 int i = 0;
632 u32 temp; 636 u32 temp;
633 637
638#ifdef OPENSSL_FIPS
639 FIPS_selftest_check();
640#endif
641
634 if (!userKey || !key) 642 if (!userKey || !key)
635 return -1; 643 return -1;
636 if (bits != 128 && bits != 192 && bits != 256) 644 if (bits != 128 && bits != 192 && bits != 256)
diff --git a/src/lib/libcrypto/aes/asm/aes-586.pl b/src/lib/libcrypto/aes/asm/aes-586.pl
index 89fa261794..3bc46a968e 100644
--- a/src/lib/libcrypto/aes/asm/aes-586.pl
+++ b/src/lib/libcrypto/aes/asm/aes-586.pl
@@ -955,8 +955,9 @@ my $mark=&DWP(60+240,"esp"); #copy of aes_key->rounds
955 955
956 &align (4); 956 &align (4);
957 &set_label("enc_tail"); 957 &set_label("enc_tail");
958 &push ($key eq "edi" ? $key : ""); # push ivp 958 &mov ($s0,$key eq "edi" ? $key : "");
959 &mov ($key,$_out); # load out 959 &mov ($key,$_out); # load out
960 &push ($s0); # push ivp
960 &mov ($s1,16); 961 &mov ($s1,16);
961 &sub ($s1,$s2); 962 &sub ($s1,$s2);
962 &cmp ($key,$acc); # compare with inp 963 &cmp ($key,$acc); # compare with inp
diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
index 44e0bf8cae..f616f1751f 100755
--- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
@@ -1198,19 +1198,20 @@ AES_cbc_encrypt:
1198 ret 1198 ret
1199.align 4 1199.align 4
1200.Lcbc_enc_tail: 1200.Lcbc_enc_tail:
1201 cmp $inp,$out 1201 mov %rax,%r11
1202 je .Lcbc_enc_in_place 1202 mov %rcx,%r12
1203 mov %r10,%rcx 1203 mov %r10,%rcx
1204 mov $inp,%rsi 1204 mov $inp,%rsi
1205 mov $out,%rdi 1205 mov $out,%rdi
1206 .long 0xF689A4F3 # rep movsb 1206 .long 0xF689A4F3 # rep movsb
1207.Lcbc_enc_in_place:
1208 mov \$16,%rcx # zero tail 1207 mov \$16,%rcx # zero tail
1209 sub %r10,%rcx 1208 sub %r10,%rcx
1210 xor %rax,%rax 1209 xor %rax,%rax
1211 .long 0xF689AAF3 # rep stosb 1210 .long 0xF689AAF3 # rep stosb
1212 mov $out,$inp # this is not a mistake! 1211 mov $out,$inp # this is not a mistake!
1213 movq \$16,$_len # len=16 1212 movq \$16,$_len # len=16
1213 mov %r11,%rax
1214 mov %r12,%rcx
1214 jmp .Lcbc_enc_loop # one more spin... 1215 jmp .Lcbc_enc_loop # one more spin...
1215#----------------------------- DECRYPT -----------------------------# 1216#----------------------------- DECRYPT -----------------------------#
1216.align 16 1217.align 16