![](/media/cache/profiles/debfdc81854eac26ec993b55a659c6e1.jpg.50x50_q85.jpg)
mbed client lightswitch demo
Dependencies: mbed Socket lwip-eth lwip-sys lwip
Fork of mbed-client-classic-example-lwip by
mbedtls/source/aesni.c@11:cada08fc8a70, 2016-06-09 (annotated)
- Committer:
- mbedAustin
- Date:
- Thu Jun 09 17:08:36 2016 +0000
- Revision:
- 11:cada08fc8a70
Commit for public Consumption
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbedAustin | 11:cada08fc8a70 | 1 | /* |
mbedAustin | 11:cada08fc8a70 | 2 | * AES-NI support functions |
mbedAustin | 11:cada08fc8a70 | 3 | * |
mbedAustin | 11:cada08fc8a70 | 4 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved |
mbedAustin | 11:cada08fc8a70 | 5 | * SPDX-License-Identifier: Apache-2.0 |
mbedAustin | 11:cada08fc8a70 | 6 | * |
mbedAustin | 11:cada08fc8a70 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
mbedAustin | 11:cada08fc8a70 | 8 | * not use this file except in compliance with the License. |
mbedAustin | 11:cada08fc8a70 | 9 | * You may obtain a copy of the License at |
mbedAustin | 11:cada08fc8a70 | 10 | * |
mbedAustin | 11:cada08fc8a70 | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
mbedAustin | 11:cada08fc8a70 | 12 | * |
mbedAustin | 11:cada08fc8a70 | 13 | * Unless required by applicable law or agreed to in writing, software |
mbedAustin | 11:cada08fc8a70 | 14 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
mbedAustin | 11:cada08fc8a70 | 15 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
mbedAustin | 11:cada08fc8a70 | 16 | * See the License for the specific language governing permissions and |
mbedAustin | 11:cada08fc8a70 | 17 | * limitations under the License. |
mbedAustin | 11:cada08fc8a70 | 18 | * |
mbedAustin | 11:cada08fc8a70 | 19 | * This file is part of mbed TLS (https://tls.mbed.org) |
mbedAustin | 11:cada08fc8a70 | 20 | */ |
mbedAustin | 11:cada08fc8a70 | 21 | |
mbedAustin | 11:cada08fc8a70 | 22 | /* |
mbedAustin | 11:cada08fc8a70 | 23 | * [AES-WP] http://software.intel.com/en-us/articles/intel-advanced-encryption-standard-aes-instructions-set |
mbedAustin | 11:cada08fc8a70 | 24 | * [CLMUL-WP] http://software.intel.com/en-us/articles/intel-carry-less-multiplication-instruction-and-its-usage-for-computing-the-gcm-mode/ |
mbedAustin | 11:cada08fc8a70 | 25 | */ |
mbedAustin | 11:cada08fc8a70 | 26 | |
mbedAustin | 11:cada08fc8a70 | 27 | #if !defined(MBEDTLS_CONFIG_FILE) |
mbedAustin | 11:cada08fc8a70 | 28 | #include "mbedtls/config.h" |
mbedAustin | 11:cada08fc8a70 | 29 | #else |
mbedAustin | 11:cada08fc8a70 | 30 | #include MBEDTLS_CONFIG_FILE |
mbedAustin | 11:cada08fc8a70 | 31 | #endif |
mbedAustin | 11:cada08fc8a70 | 32 | |
mbedAustin | 11:cada08fc8a70 | 33 | #if defined(MBEDTLS_AESNI_C) |
mbedAustin | 11:cada08fc8a70 | 34 | |
mbedAustin | 11:cada08fc8a70 | 35 | #include "mbedtls/aesni.h" |
mbedAustin | 11:cada08fc8a70 | 36 | |
mbedAustin | 11:cada08fc8a70 | 37 | #include <string.h> |
mbedAustin | 11:cada08fc8a70 | 38 | |
mbedAustin | 11:cada08fc8a70 | 39 | #ifndef asm |
mbedAustin | 11:cada08fc8a70 | 40 | #define asm __asm |
mbedAustin | 11:cada08fc8a70 | 41 | #endif |
mbedAustin | 11:cada08fc8a70 | 42 | |
mbedAustin | 11:cada08fc8a70 | 43 | #if defined(MBEDTLS_HAVE_X86_64) |
mbedAustin | 11:cada08fc8a70 | 44 | |
mbedAustin | 11:cada08fc8a70 | 45 | /* |
mbedAustin | 11:cada08fc8a70 | 46 | * AES-NI support detection routine |
mbedAustin | 11:cada08fc8a70 | 47 | */ |
mbedAustin | 11:cada08fc8a70 | 48 | int mbedtls_aesni_has_support( unsigned int what ) |
mbedAustin | 11:cada08fc8a70 | 49 | { |
mbedAustin | 11:cada08fc8a70 | 50 | static int done = 0; |
mbedAustin | 11:cada08fc8a70 | 51 | static unsigned int c = 0; |
mbedAustin | 11:cada08fc8a70 | 52 | |
mbedAustin | 11:cada08fc8a70 | 53 | if( ! done ) |
mbedAustin | 11:cada08fc8a70 | 54 | { |
mbedAustin | 11:cada08fc8a70 | 55 | asm( "movl $1, %%eax \n\t" |
mbedAustin | 11:cada08fc8a70 | 56 | "cpuid \n\t" |
mbedAustin | 11:cada08fc8a70 | 57 | : "=c" (c) |
mbedAustin | 11:cada08fc8a70 | 58 | : |
mbedAustin | 11:cada08fc8a70 | 59 | : "eax", "ebx", "edx" ); |
mbedAustin | 11:cada08fc8a70 | 60 | done = 1; |
mbedAustin | 11:cada08fc8a70 | 61 | } |
mbedAustin | 11:cada08fc8a70 | 62 | |
mbedAustin | 11:cada08fc8a70 | 63 | return( ( c & what ) != 0 ); |
mbedAustin | 11:cada08fc8a70 | 64 | } |
mbedAustin | 11:cada08fc8a70 | 65 | |
mbedAustin | 11:cada08fc8a70 | 66 | /* |
mbedAustin | 11:cada08fc8a70 | 67 | * Binutils needs to be at least 2.19 to support AES-NI instructions. |
mbedAustin | 11:cada08fc8a70 | 68 | * Unfortunately, a lot of users have a lower version now (2014-04). |
mbedAustin | 11:cada08fc8a70 | 69 | * Emit bytecode directly in order to support "old" version of gas. |
mbedAustin | 11:cada08fc8a70 | 70 | * |
mbedAustin | 11:cada08fc8a70 | 71 | * Opcodes from the Intel architecture reference manual, vol. 3. |
mbedAustin | 11:cada08fc8a70 | 72 | * We always use registers, so we don't need prefixes for memory operands. |
mbedAustin | 11:cada08fc8a70 | 73 | * Operand macros are in gas order (src, dst) as opposed to Intel order |
mbedAustin | 11:cada08fc8a70 | 74 | * (dst, src) in order to blend better into the surrounding assembly code. |
mbedAustin | 11:cada08fc8a70 | 75 | */ |
mbedAustin | 11:cada08fc8a70 | 76 | #define AESDEC ".byte 0x66,0x0F,0x38,0xDE," |
mbedAustin | 11:cada08fc8a70 | 77 | #define AESDECLAST ".byte 0x66,0x0F,0x38,0xDF," |
mbedAustin | 11:cada08fc8a70 | 78 | #define AESENC ".byte 0x66,0x0F,0x38,0xDC," |
mbedAustin | 11:cada08fc8a70 | 79 | #define AESENCLAST ".byte 0x66,0x0F,0x38,0xDD," |
mbedAustin | 11:cada08fc8a70 | 80 | #define AESIMC ".byte 0x66,0x0F,0x38,0xDB," |
mbedAustin | 11:cada08fc8a70 | 81 | #define AESKEYGENA ".byte 0x66,0x0F,0x3A,0xDF," |
mbedAustin | 11:cada08fc8a70 | 82 | #define PCLMULQDQ ".byte 0x66,0x0F,0x3A,0x44," |
mbedAustin | 11:cada08fc8a70 | 83 | |
mbedAustin | 11:cada08fc8a70 | 84 | #define xmm0_xmm0 "0xC0" |
mbedAustin | 11:cada08fc8a70 | 85 | #define xmm0_xmm1 "0xC8" |
mbedAustin | 11:cada08fc8a70 | 86 | #define xmm0_xmm2 "0xD0" |
mbedAustin | 11:cada08fc8a70 | 87 | #define xmm0_xmm3 "0xD8" |
mbedAustin | 11:cada08fc8a70 | 88 | #define xmm0_xmm4 "0xE0" |
mbedAustin | 11:cada08fc8a70 | 89 | #define xmm1_xmm0 "0xC1" |
mbedAustin | 11:cada08fc8a70 | 90 | #define xmm1_xmm2 "0xD1" |
mbedAustin | 11:cada08fc8a70 | 91 | |
mbedAustin | 11:cada08fc8a70 | 92 | /* |
mbedAustin | 11:cada08fc8a70 | 93 | * AES-NI AES-ECB block en(de)cryption |
mbedAustin | 11:cada08fc8a70 | 94 | */ |
mbedAustin | 11:cada08fc8a70 | 95 | int mbedtls_aesni_crypt_ecb( mbedtls_aes_context *ctx, |
mbedAustin | 11:cada08fc8a70 | 96 | int mode, |
mbedAustin | 11:cada08fc8a70 | 97 | const unsigned char input[16], |
mbedAustin | 11:cada08fc8a70 | 98 | unsigned char output[16] ) |
mbedAustin | 11:cada08fc8a70 | 99 | { |
mbedAustin | 11:cada08fc8a70 | 100 | asm( "movdqu (%3), %%xmm0 \n\t" // load input |
mbedAustin | 11:cada08fc8a70 | 101 | "movdqu (%1), %%xmm1 \n\t" // load round key 0 |
mbedAustin | 11:cada08fc8a70 | 102 | "pxor %%xmm1, %%xmm0 \n\t" // round 0 |
mbedAustin | 11:cada08fc8a70 | 103 | "addq $16, %1 \n\t" // point to next round key |
mbedAustin | 11:cada08fc8a70 | 104 | "subl $1, %0 \n\t" // normal rounds = nr - 1 |
mbedAustin | 11:cada08fc8a70 | 105 | "test %2, %2 \n\t" // mode? |
mbedAustin | 11:cada08fc8a70 | 106 | "jz 2f \n\t" // 0 = decrypt |
mbedAustin | 11:cada08fc8a70 | 107 | |
mbedAustin | 11:cada08fc8a70 | 108 | "1: \n\t" // encryption loop |
mbedAustin | 11:cada08fc8a70 | 109 | "movdqu (%1), %%xmm1 \n\t" // load round key |
mbedAustin | 11:cada08fc8a70 | 110 | AESENC xmm1_xmm0 "\n\t" // do round |
mbedAustin | 11:cada08fc8a70 | 111 | "addq $16, %1 \n\t" // point to next round key |
mbedAustin | 11:cada08fc8a70 | 112 | "subl $1, %0 \n\t" // loop |
mbedAustin | 11:cada08fc8a70 | 113 | "jnz 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 114 | "movdqu (%1), %%xmm1 \n\t" // load round key |
mbedAustin | 11:cada08fc8a70 | 115 | AESENCLAST xmm1_xmm0 "\n\t" // last round |
mbedAustin | 11:cada08fc8a70 | 116 | "jmp 3f \n\t" |
mbedAustin | 11:cada08fc8a70 | 117 | |
mbedAustin | 11:cada08fc8a70 | 118 | "2: \n\t" // decryption loop |
mbedAustin | 11:cada08fc8a70 | 119 | "movdqu (%1), %%xmm1 \n\t" |
mbedAustin | 11:cada08fc8a70 | 120 | AESDEC xmm1_xmm0 "\n\t" // do round |
mbedAustin | 11:cada08fc8a70 | 121 | "addq $16, %1 \n\t" |
mbedAustin | 11:cada08fc8a70 | 122 | "subl $1, %0 \n\t" |
mbedAustin | 11:cada08fc8a70 | 123 | "jnz 2b \n\t" |
mbedAustin | 11:cada08fc8a70 | 124 | "movdqu (%1), %%xmm1 \n\t" // load round key |
mbedAustin | 11:cada08fc8a70 | 125 | AESDECLAST xmm1_xmm0 "\n\t" // last round |
mbedAustin | 11:cada08fc8a70 | 126 | |
mbedAustin | 11:cada08fc8a70 | 127 | "3: \n\t" |
mbedAustin | 11:cada08fc8a70 | 128 | "movdqu %%xmm0, (%4) \n\t" // export output |
mbedAustin | 11:cada08fc8a70 | 129 | : |
mbedAustin | 11:cada08fc8a70 | 130 | : "r" (ctx->nr), "r" (ctx->rk), "r" (mode), "r" (input), "r" (output) |
mbedAustin | 11:cada08fc8a70 | 131 | : "memory", "cc", "xmm0", "xmm1" ); |
mbedAustin | 11:cada08fc8a70 | 132 | |
mbedAustin | 11:cada08fc8a70 | 133 | |
mbedAustin | 11:cada08fc8a70 | 134 | return( 0 ); |
mbedAustin | 11:cada08fc8a70 | 135 | } |
mbedAustin | 11:cada08fc8a70 | 136 | |
mbedAustin | 11:cada08fc8a70 | 137 | /* |
mbedAustin | 11:cada08fc8a70 | 138 | * GCM multiplication: c = a times b in GF(2^128) |
mbedAustin | 11:cada08fc8a70 | 139 | * Based on [CLMUL-WP] algorithms 1 (with equation 27) and 5. |
mbedAustin | 11:cada08fc8a70 | 140 | */ |
mbedAustin | 11:cada08fc8a70 | 141 | void mbedtls_aesni_gcm_mult( unsigned char c[16], |
mbedAustin | 11:cada08fc8a70 | 142 | const unsigned char a[16], |
mbedAustin | 11:cada08fc8a70 | 143 | const unsigned char b[16] ) |
mbedAustin | 11:cada08fc8a70 | 144 | { |
mbedAustin | 11:cada08fc8a70 | 145 | unsigned char aa[16], bb[16], cc[16]; |
mbedAustin | 11:cada08fc8a70 | 146 | size_t i; |
mbedAustin | 11:cada08fc8a70 | 147 | |
mbedAustin | 11:cada08fc8a70 | 148 | /* The inputs are in big-endian order, so byte-reverse them */ |
mbedAustin | 11:cada08fc8a70 | 149 | for( i = 0; i < 16; i++ ) |
mbedAustin | 11:cada08fc8a70 | 150 | { |
mbedAustin | 11:cada08fc8a70 | 151 | aa[i] = a[15 - i]; |
mbedAustin | 11:cada08fc8a70 | 152 | bb[i] = b[15 - i]; |
mbedAustin | 11:cada08fc8a70 | 153 | } |
mbedAustin | 11:cada08fc8a70 | 154 | |
mbedAustin | 11:cada08fc8a70 | 155 | asm( "movdqu (%0), %%xmm0 \n\t" // a1:a0 |
mbedAustin | 11:cada08fc8a70 | 156 | "movdqu (%1), %%xmm1 \n\t" // b1:b0 |
mbedAustin | 11:cada08fc8a70 | 157 | |
mbedAustin | 11:cada08fc8a70 | 158 | /* |
mbedAustin | 11:cada08fc8a70 | 159 | * Caryless multiplication xmm2:xmm1 = xmm0 * xmm1 |
mbedAustin | 11:cada08fc8a70 | 160 | * using [CLMUL-WP] algorithm 1 (p. 13). |
mbedAustin | 11:cada08fc8a70 | 161 | */ |
mbedAustin | 11:cada08fc8a70 | 162 | "movdqa %%xmm1, %%xmm2 \n\t" // copy of b1:b0 |
mbedAustin | 11:cada08fc8a70 | 163 | "movdqa %%xmm1, %%xmm3 \n\t" // same |
mbedAustin | 11:cada08fc8a70 | 164 | "movdqa %%xmm1, %%xmm4 \n\t" // same |
mbedAustin | 11:cada08fc8a70 | 165 | PCLMULQDQ xmm0_xmm1 ",0x00 \n\t" // a0*b0 = c1:c0 |
mbedAustin | 11:cada08fc8a70 | 166 | PCLMULQDQ xmm0_xmm2 ",0x11 \n\t" // a1*b1 = d1:d0 |
mbedAustin | 11:cada08fc8a70 | 167 | PCLMULQDQ xmm0_xmm3 ",0x10 \n\t" // a0*b1 = e1:e0 |
mbedAustin | 11:cada08fc8a70 | 168 | PCLMULQDQ xmm0_xmm4 ",0x01 \n\t" // a1*b0 = f1:f0 |
mbedAustin | 11:cada08fc8a70 | 169 | "pxor %%xmm3, %%xmm4 \n\t" // e1+f1:e0+f0 |
mbedAustin | 11:cada08fc8a70 | 170 | "movdqa %%xmm4, %%xmm3 \n\t" // same |
mbedAustin | 11:cada08fc8a70 | 171 | "psrldq $8, %%xmm4 \n\t" // 0:e1+f1 |
mbedAustin | 11:cada08fc8a70 | 172 | "pslldq $8, %%xmm3 \n\t" // e0+f0:0 |
mbedAustin | 11:cada08fc8a70 | 173 | "pxor %%xmm4, %%xmm2 \n\t" // d1:d0+e1+f1 |
mbedAustin | 11:cada08fc8a70 | 174 | "pxor %%xmm3, %%xmm1 \n\t" // c1+e0+f1:c0 |
mbedAustin | 11:cada08fc8a70 | 175 | |
mbedAustin | 11:cada08fc8a70 | 176 | /* |
mbedAustin | 11:cada08fc8a70 | 177 | * Now shift the result one bit to the left, |
mbedAustin | 11:cada08fc8a70 | 178 | * taking advantage of [CLMUL-WP] eq 27 (p. 20) |
mbedAustin | 11:cada08fc8a70 | 179 | */ |
mbedAustin | 11:cada08fc8a70 | 180 | "movdqa %%xmm1, %%xmm3 \n\t" // r1:r0 |
mbedAustin | 11:cada08fc8a70 | 181 | "movdqa %%xmm2, %%xmm4 \n\t" // r3:r2 |
mbedAustin | 11:cada08fc8a70 | 182 | "psllq $1, %%xmm1 \n\t" // r1<<1:r0<<1 |
mbedAustin | 11:cada08fc8a70 | 183 | "psllq $1, %%xmm2 \n\t" // r3<<1:r2<<1 |
mbedAustin | 11:cada08fc8a70 | 184 | "psrlq $63, %%xmm3 \n\t" // r1>>63:r0>>63 |
mbedAustin | 11:cada08fc8a70 | 185 | "psrlq $63, %%xmm4 \n\t" // r3>>63:r2>>63 |
mbedAustin | 11:cada08fc8a70 | 186 | "movdqa %%xmm3, %%xmm5 \n\t" // r1>>63:r0>>63 |
mbedAustin | 11:cada08fc8a70 | 187 | "pslldq $8, %%xmm3 \n\t" // r0>>63:0 |
mbedAustin | 11:cada08fc8a70 | 188 | "pslldq $8, %%xmm4 \n\t" // r2>>63:0 |
mbedAustin | 11:cada08fc8a70 | 189 | "psrldq $8, %%xmm5 \n\t" // 0:r1>>63 |
mbedAustin | 11:cada08fc8a70 | 190 | "por %%xmm3, %%xmm1 \n\t" // r1<<1|r0>>63:r0<<1 |
mbedAustin | 11:cada08fc8a70 | 191 | "por %%xmm4, %%xmm2 \n\t" // r3<<1|r2>>62:r2<<1 |
mbedAustin | 11:cada08fc8a70 | 192 | "por %%xmm5, %%xmm2 \n\t" // r3<<1|r2>>62:r2<<1|r1>>63 |
mbedAustin | 11:cada08fc8a70 | 193 | |
mbedAustin | 11:cada08fc8a70 | 194 | /* |
mbedAustin | 11:cada08fc8a70 | 195 | * Now reduce modulo the GCM polynomial x^128 + x^7 + x^2 + x + 1 |
mbedAustin | 11:cada08fc8a70 | 196 | * using [CLMUL-WP] algorithm 5 (p. 20). |
mbedAustin | 11:cada08fc8a70 | 197 | * Currently xmm2:xmm1 holds x3:x2:x1:x0 (already shifted). |
mbedAustin | 11:cada08fc8a70 | 198 | */ |
mbedAustin | 11:cada08fc8a70 | 199 | /* Step 2 (1) */ |
mbedAustin | 11:cada08fc8a70 | 200 | "movdqa %%xmm1, %%xmm3 \n\t" // x1:x0 |
mbedAustin | 11:cada08fc8a70 | 201 | "movdqa %%xmm1, %%xmm4 \n\t" // same |
mbedAustin | 11:cada08fc8a70 | 202 | "movdqa %%xmm1, %%xmm5 \n\t" // same |
mbedAustin | 11:cada08fc8a70 | 203 | "psllq $63, %%xmm3 \n\t" // x1<<63:x0<<63 = stuff:a |
mbedAustin | 11:cada08fc8a70 | 204 | "psllq $62, %%xmm4 \n\t" // x1<<62:x0<<62 = stuff:b |
mbedAustin | 11:cada08fc8a70 | 205 | "psllq $57, %%xmm5 \n\t" // x1<<57:x0<<57 = stuff:c |
mbedAustin | 11:cada08fc8a70 | 206 | |
mbedAustin | 11:cada08fc8a70 | 207 | /* Step 2 (2) */ |
mbedAustin | 11:cada08fc8a70 | 208 | "pxor %%xmm4, %%xmm3 \n\t" // stuff:a+b |
mbedAustin | 11:cada08fc8a70 | 209 | "pxor %%xmm5, %%xmm3 \n\t" // stuff:a+b+c |
mbedAustin | 11:cada08fc8a70 | 210 | "pslldq $8, %%xmm3 \n\t" // a+b+c:0 |
mbedAustin | 11:cada08fc8a70 | 211 | "pxor %%xmm3, %%xmm1 \n\t" // x1+a+b+c:x0 = d:x0 |
mbedAustin | 11:cada08fc8a70 | 212 | |
mbedAustin | 11:cada08fc8a70 | 213 | /* Steps 3 and 4 */ |
mbedAustin | 11:cada08fc8a70 | 214 | "movdqa %%xmm1,%%xmm0 \n\t" // d:x0 |
mbedAustin | 11:cada08fc8a70 | 215 | "movdqa %%xmm1,%%xmm4 \n\t" // same |
mbedAustin | 11:cada08fc8a70 | 216 | "movdqa %%xmm1,%%xmm5 \n\t" // same |
mbedAustin | 11:cada08fc8a70 | 217 | "psrlq $1, %%xmm0 \n\t" // e1:x0>>1 = e1:e0' |
mbedAustin | 11:cada08fc8a70 | 218 | "psrlq $2, %%xmm4 \n\t" // f1:x0>>2 = f1:f0' |
mbedAustin | 11:cada08fc8a70 | 219 | "psrlq $7, %%xmm5 \n\t" // g1:x0>>7 = g1:g0' |
mbedAustin | 11:cada08fc8a70 | 220 | "pxor %%xmm4, %%xmm0 \n\t" // e1+f1:e0'+f0' |
mbedAustin | 11:cada08fc8a70 | 221 | "pxor %%xmm5, %%xmm0 \n\t" // e1+f1+g1:e0'+f0'+g0' |
mbedAustin | 11:cada08fc8a70 | 222 | // e0'+f0'+g0' is almost e0+f0+g0, ex\tcept for some missing |
mbedAustin | 11:cada08fc8a70 | 223 | // bits carried from d. Now get those\t bits back in. |
mbedAustin | 11:cada08fc8a70 | 224 | "movdqa %%xmm1,%%xmm3 \n\t" // d:x0 |
mbedAustin | 11:cada08fc8a70 | 225 | "movdqa %%xmm1,%%xmm4 \n\t" // same |
mbedAustin | 11:cada08fc8a70 | 226 | "movdqa %%xmm1,%%xmm5 \n\t" // same |
mbedAustin | 11:cada08fc8a70 | 227 | "psllq $63, %%xmm3 \n\t" // d<<63:stuff |
mbedAustin | 11:cada08fc8a70 | 228 | "psllq $62, %%xmm4 \n\t" // d<<62:stuff |
mbedAustin | 11:cada08fc8a70 | 229 | "psllq $57, %%xmm5 \n\t" // d<<57:stuff |
mbedAustin | 11:cada08fc8a70 | 230 | "pxor %%xmm4, %%xmm3 \n\t" // d<<63+d<<62:stuff |
mbedAustin | 11:cada08fc8a70 | 231 | "pxor %%xmm5, %%xmm3 \n\t" // missing bits of d:stuff |
mbedAustin | 11:cada08fc8a70 | 232 | "psrldq $8, %%xmm3 \n\t" // 0:missing bits of d |
mbedAustin | 11:cada08fc8a70 | 233 | "pxor %%xmm3, %%xmm0 \n\t" // e1+f1+g1:e0+f0+g0 |
mbedAustin | 11:cada08fc8a70 | 234 | "pxor %%xmm1, %%xmm0 \n\t" // h1:h0 |
mbedAustin | 11:cada08fc8a70 | 235 | "pxor %%xmm2, %%xmm0 \n\t" // x3+h1:x2+h0 |
mbedAustin | 11:cada08fc8a70 | 236 | |
mbedAustin | 11:cada08fc8a70 | 237 | "movdqu %%xmm0, (%2) \n\t" // done |
mbedAustin | 11:cada08fc8a70 | 238 | : |
mbedAustin | 11:cada08fc8a70 | 239 | : "r" (aa), "r" (bb), "r" (cc) |
mbedAustin | 11:cada08fc8a70 | 240 | : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5" ); |
mbedAustin | 11:cada08fc8a70 | 241 | |
mbedAustin | 11:cada08fc8a70 | 242 | /* Now byte-reverse the outputs */ |
mbedAustin | 11:cada08fc8a70 | 243 | for( i = 0; i < 16; i++ ) |
mbedAustin | 11:cada08fc8a70 | 244 | c[i] = cc[15 - i]; |
mbedAustin | 11:cada08fc8a70 | 245 | |
mbedAustin | 11:cada08fc8a70 | 246 | return; |
mbedAustin | 11:cada08fc8a70 | 247 | } |
mbedAustin | 11:cada08fc8a70 | 248 | |
mbedAustin | 11:cada08fc8a70 | 249 | /* |
mbedAustin | 11:cada08fc8a70 | 250 | * Compute decryption round keys from encryption round keys |
mbedAustin | 11:cada08fc8a70 | 251 | */ |
mbedAustin | 11:cada08fc8a70 | 252 | void mbedtls_aesni_inverse_key( unsigned char *invkey, |
mbedAustin | 11:cada08fc8a70 | 253 | const unsigned char *fwdkey, int nr ) |
mbedAustin | 11:cada08fc8a70 | 254 | { |
mbedAustin | 11:cada08fc8a70 | 255 | unsigned char *ik = invkey; |
mbedAustin | 11:cada08fc8a70 | 256 | const unsigned char *fk = fwdkey + 16 * nr; |
mbedAustin | 11:cada08fc8a70 | 257 | |
mbedAustin | 11:cada08fc8a70 | 258 | memcpy( ik, fk, 16 ); |
mbedAustin | 11:cada08fc8a70 | 259 | |
mbedAustin | 11:cada08fc8a70 | 260 | for( fk -= 16, ik += 16; fk > fwdkey; fk -= 16, ik += 16 ) |
mbedAustin | 11:cada08fc8a70 | 261 | asm( "movdqu (%0), %%xmm0 \n\t" |
mbedAustin | 11:cada08fc8a70 | 262 | AESIMC xmm0_xmm0 "\n\t" |
mbedAustin | 11:cada08fc8a70 | 263 | "movdqu %%xmm0, (%1) \n\t" |
mbedAustin | 11:cada08fc8a70 | 264 | : |
mbedAustin | 11:cada08fc8a70 | 265 | : "r" (fk), "r" (ik) |
mbedAustin | 11:cada08fc8a70 | 266 | : "memory", "xmm0" ); |
mbedAustin | 11:cada08fc8a70 | 267 | |
mbedAustin | 11:cada08fc8a70 | 268 | memcpy( ik, fk, 16 ); |
mbedAustin | 11:cada08fc8a70 | 269 | } |
mbedAustin | 11:cada08fc8a70 | 270 | |
mbedAustin | 11:cada08fc8a70 | 271 | /* |
mbedAustin | 11:cada08fc8a70 | 272 | * Key expansion, 128-bit case |
mbedAustin | 11:cada08fc8a70 | 273 | */ |
mbedAustin | 11:cada08fc8a70 | 274 | static void aesni_setkey_enc_128( unsigned char *rk, |
mbedAustin | 11:cada08fc8a70 | 275 | const unsigned char *key ) |
mbedAustin | 11:cada08fc8a70 | 276 | { |
mbedAustin | 11:cada08fc8a70 | 277 | asm( "movdqu (%1), %%xmm0 \n\t" // copy the original key |
mbedAustin | 11:cada08fc8a70 | 278 | "movdqu %%xmm0, (%0) \n\t" // as round key 0 |
mbedAustin | 11:cada08fc8a70 | 279 | "jmp 2f \n\t" // skip auxiliary routine |
mbedAustin | 11:cada08fc8a70 | 280 | |
mbedAustin | 11:cada08fc8a70 | 281 | /* |
mbedAustin | 11:cada08fc8a70 | 282 | * Finish generating the next round key. |
mbedAustin | 11:cada08fc8a70 | 283 | * |
mbedAustin | 11:cada08fc8a70 | 284 | * On entry xmm0 is r3:r2:r1:r0 and xmm1 is X:stuff:stuff:stuff |
mbedAustin | 11:cada08fc8a70 | 285 | * with X = rot( sub( r3 ) ) ^ RCON. |
mbedAustin | 11:cada08fc8a70 | 286 | * |
mbedAustin | 11:cada08fc8a70 | 287 | * On exit, xmm0 is r7:r6:r5:r4 |
mbedAustin | 11:cada08fc8a70 | 288 | * with r4 = X + r0, r5 = r4 + r1, r6 = r5 + r2, r7 = r6 + r3 |
mbedAustin | 11:cada08fc8a70 | 289 | * and those are written to the round key buffer. |
mbedAustin | 11:cada08fc8a70 | 290 | */ |
mbedAustin | 11:cada08fc8a70 | 291 | "1: \n\t" |
mbedAustin | 11:cada08fc8a70 | 292 | "pshufd $0xff, %%xmm1, %%xmm1 \n\t" // X:X:X:X |
mbedAustin | 11:cada08fc8a70 | 293 | "pxor %%xmm0, %%xmm1 \n\t" // X+r3:X+r2:X+r1:r4 |
mbedAustin | 11:cada08fc8a70 | 294 | "pslldq $4, %%xmm0 \n\t" // r2:r1:r0:0 |
mbedAustin | 11:cada08fc8a70 | 295 | "pxor %%xmm0, %%xmm1 \n\t" // X+r3+r2:X+r2+r1:r5:r4 |
mbedAustin | 11:cada08fc8a70 | 296 | "pslldq $4, %%xmm0 \n\t" // etc |
mbedAustin | 11:cada08fc8a70 | 297 | "pxor %%xmm0, %%xmm1 \n\t" |
mbedAustin | 11:cada08fc8a70 | 298 | "pslldq $4, %%xmm0 \n\t" |
mbedAustin | 11:cada08fc8a70 | 299 | "pxor %%xmm1, %%xmm0 \n\t" // update xmm0 for next time! |
mbedAustin | 11:cada08fc8a70 | 300 | "add $16, %0 \n\t" // point to next round key |
mbedAustin | 11:cada08fc8a70 | 301 | "movdqu %%xmm0, (%0) \n\t" // write it |
mbedAustin | 11:cada08fc8a70 | 302 | "ret \n\t" |
mbedAustin | 11:cada08fc8a70 | 303 | |
mbedAustin | 11:cada08fc8a70 | 304 | /* Main "loop" */ |
mbedAustin | 11:cada08fc8a70 | 305 | "2: \n\t" |
mbedAustin | 11:cada08fc8a70 | 306 | AESKEYGENA xmm0_xmm1 ",0x01 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 307 | AESKEYGENA xmm0_xmm1 ",0x02 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 308 | AESKEYGENA xmm0_xmm1 ",0x04 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 309 | AESKEYGENA xmm0_xmm1 ",0x08 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 310 | AESKEYGENA xmm0_xmm1 ",0x10 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 311 | AESKEYGENA xmm0_xmm1 ",0x20 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 312 | AESKEYGENA xmm0_xmm1 ",0x40 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 313 | AESKEYGENA xmm0_xmm1 ",0x80 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 314 | AESKEYGENA xmm0_xmm1 ",0x1B \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 315 | AESKEYGENA xmm0_xmm1 ",0x36 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 316 | : |
mbedAustin | 11:cada08fc8a70 | 317 | : "r" (rk), "r" (key) |
mbedAustin | 11:cada08fc8a70 | 318 | : "memory", "cc", "0" ); |
mbedAustin | 11:cada08fc8a70 | 319 | } |
mbedAustin | 11:cada08fc8a70 | 320 | |
mbedAustin | 11:cada08fc8a70 | 321 | /* |
mbedAustin | 11:cada08fc8a70 | 322 | * Key expansion, 192-bit case |
mbedAustin | 11:cada08fc8a70 | 323 | */ |
mbedAustin | 11:cada08fc8a70 | 324 | static void aesni_setkey_enc_192( unsigned char *rk, |
mbedAustin | 11:cada08fc8a70 | 325 | const unsigned char *key ) |
mbedAustin | 11:cada08fc8a70 | 326 | { |
mbedAustin | 11:cada08fc8a70 | 327 | asm( "movdqu (%1), %%xmm0 \n\t" // copy original round key |
mbedAustin | 11:cada08fc8a70 | 328 | "movdqu %%xmm0, (%0) \n\t" |
mbedAustin | 11:cada08fc8a70 | 329 | "add $16, %0 \n\t" |
mbedAustin | 11:cada08fc8a70 | 330 | "movq 16(%1), %%xmm1 \n\t" |
mbedAustin | 11:cada08fc8a70 | 331 | "movq %%xmm1, (%0) \n\t" |
mbedAustin | 11:cada08fc8a70 | 332 | "add $8, %0 \n\t" |
mbedAustin | 11:cada08fc8a70 | 333 | "jmp 2f \n\t" // skip auxiliary routine |
mbedAustin | 11:cada08fc8a70 | 334 | |
mbedAustin | 11:cada08fc8a70 | 335 | /* |
mbedAustin | 11:cada08fc8a70 | 336 | * Finish generating the next 6 quarter-keys. |
mbedAustin | 11:cada08fc8a70 | 337 | * |
mbedAustin | 11:cada08fc8a70 | 338 | * On entry xmm0 is r3:r2:r1:r0, xmm1 is stuff:stuff:r5:r4 |
mbedAustin | 11:cada08fc8a70 | 339 | * and xmm2 is stuff:stuff:X:stuff with X = rot( sub( r3 ) ) ^ RCON. |
mbedAustin | 11:cada08fc8a70 | 340 | * |
mbedAustin | 11:cada08fc8a70 | 341 | * On exit, xmm0 is r9:r8:r7:r6 and xmm1 is stuff:stuff:r11:r10 |
mbedAustin | 11:cada08fc8a70 | 342 | * and those are written to the round key buffer. |
mbedAustin | 11:cada08fc8a70 | 343 | */ |
mbedAustin | 11:cada08fc8a70 | 344 | "1: \n\t" |
mbedAustin | 11:cada08fc8a70 | 345 | "pshufd $0x55, %%xmm2, %%xmm2 \n\t" // X:X:X:X |
mbedAustin | 11:cada08fc8a70 | 346 | "pxor %%xmm0, %%xmm2 \n\t" // X+r3:X+r2:X+r1:r4 |
mbedAustin | 11:cada08fc8a70 | 347 | "pslldq $4, %%xmm0 \n\t" // etc |
mbedAustin | 11:cada08fc8a70 | 348 | "pxor %%xmm0, %%xmm2 \n\t" |
mbedAustin | 11:cada08fc8a70 | 349 | "pslldq $4, %%xmm0 \n\t" |
mbedAustin | 11:cada08fc8a70 | 350 | "pxor %%xmm0, %%xmm2 \n\t" |
mbedAustin | 11:cada08fc8a70 | 351 | "pslldq $4, %%xmm0 \n\t" |
mbedAustin | 11:cada08fc8a70 | 352 | "pxor %%xmm2, %%xmm0 \n\t" // update xmm0 = r9:r8:r7:r6 |
mbedAustin | 11:cada08fc8a70 | 353 | "movdqu %%xmm0, (%0) \n\t" |
mbedAustin | 11:cada08fc8a70 | 354 | "add $16, %0 \n\t" |
mbedAustin | 11:cada08fc8a70 | 355 | "pshufd $0xff, %%xmm0, %%xmm2 \n\t" // r9:r9:r9:r9 |
mbedAustin | 11:cada08fc8a70 | 356 | "pxor %%xmm1, %%xmm2 \n\t" // stuff:stuff:r9+r5:r10 |
mbedAustin | 11:cada08fc8a70 | 357 | "pslldq $4, %%xmm1 \n\t" // r2:r1:r0:0 |
mbedAustin | 11:cada08fc8a70 | 358 | "pxor %%xmm2, %%xmm1 \n\t" // xmm1 = stuff:stuff:r11:r10 |
mbedAustin | 11:cada08fc8a70 | 359 | "movq %%xmm1, (%0) \n\t" |
mbedAustin | 11:cada08fc8a70 | 360 | "add $8, %0 \n\t" |
mbedAustin | 11:cada08fc8a70 | 361 | "ret \n\t" |
mbedAustin | 11:cada08fc8a70 | 362 | |
mbedAustin | 11:cada08fc8a70 | 363 | "2: \n\t" |
mbedAustin | 11:cada08fc8a70 | 364 | AESKEYGENA xmm1_xmm2 ",0x01 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 365 | AESKEYGENA xmm1_xmm2 ",0x02 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 366 | AESKEYGENA xmm1_xmm2 ",0x04 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 367 | AESKEYGENA xmm1_xmm2 ",0x08 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 368 | AESKEYGENA xmm1_xmm2 ",0x10 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 369 | AESKEYGENA xmm1_xmm2 ",0x20 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 370 | AESKEYGENA xmm1_xmm2 ",0x40 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 371 | AESKEYGENA xmm1_xmm2 ",0x80 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 372 | |
mbedAustin | 11:cada08fc8a70 | 373 | : |
mbedAustin | 11:cada08fc8a70 | 374 | : "r" (rk), "r" (key) |
mbedAustin | 11:cada08fc8a70 | 375 | : "memory", "cc", "0" ); |
mbedAustin | 11:cada08fc8a70 | 376 | } |
mbedAustin | 11:cada08fc8a70 | 377 | |
mbedAustin | 11:cada08fc8a70 | 378 | /* |
mbedAustin | 11:cada08fc8a70 | 379 | * Key expansion, 256-bit case |
mbedAustin | 11:cada08fc8a70 | 380 | */ |
mbedAustin | 11:cada08fc8a70 | 381 | static void aesni_setkey_enc_256( unsigned char *rk, |
mbedAustin | 11:cada08fc8a70 | 382 | const unsigned char *key ) |
mbedAustin | 11:cada08fc8a70 | 383 | { |
mbedAustin | 11:cada08fc8a70 | 384 | asm( "movdqu (%1), %%xmm0 \n\t" |
mbedAustin | 11:cada08fc8a70 | 385 | "movdqu %%xmm0, (%0) \n\t" |
mbedAustin | 11:cada08fc8a70 | 386 | "add $16, %0 \n\t" |
mbedAustin | 11:cada08fc8a70 | 387 | "movdqu 16(%1), %%xmm1 \n\t" |
mbedAustin | 11:cada08fc8a70 | 388 | "movdqu %%xmm1, (%0) \n\t" |
mbedAustin | 11:cada08fc8a70 | 389 | "jmp 2f \n\t" // skip auxiliary routine |
mbedAustin | 11:cada08fc8a70 | 390 | |
mbedAustin | 11:cada08fc8a70 | 391 | /* |
mbedAustin | 11:cada08fc8a70 | 392 | * Finish generating the next two round keys. |
mbedAustin | 11:cada08fc8a70 | 393 | * |
mbedAustin | 11:cada08fc8a70 | 394 | * On entry xmm0 is r3:r2:r1:r0, xmm1 is r7:r6:r5:r4 and |
mbedAustin | 11:cada08fc8a70 | 395 | * xmm2 is X:stuff:stuff:stuff with X = rot( sub( r7 )) ^ RCON |
mbedAustin | 11:cada08fc8a70 | 396 | * |
mbedAustin | 11:cada08fc8a70 | 397 | * On exit, xmm0 is r11:r10:r9:r8 and xmm1 is r15:r14:r13:r12 |
mbedAustin | 11:cada08fc8a70 | 398 | * and those have been written to the output buffer. |
mbedAustin | 11:cada08fc8a70 | 399 | */ |
mbedAustin | 11:cada08fc8a70 | 400 | "1: \n\t" |
mbedAustin | 11:cada08fc8a70 | 401 | "pshufd $0xff, %%xmm2, %%xmm2 \n\t" |
mbedAustin | 11:cada08fc8a70 | 402 | "pxor %%xmm0, %%xmm2 \n\t" |
mbedAustin | 11:cada08fc8a70 | 403 | "pslldq $4, %%xmm0 \n\t" |
mbedAustin | 11:cada08fc8a70 | 404 | "pxor %%xmm0, %%xmm2 \n\t" |
mbedAustin | 11:cada08fc8a70 | 405 | "pslldq $4, %%xmm0 \n\t" |
mbedAustin | 11:cada08fc8a70 | 406 | "pxor %%xmm0, %%xmm2 \n\t" |
mbedAustin | 11:cada08fc8a70 | 407 | "pslldq $4, %%xmm0 \n\t" |
mbedAustin | 11:cada08fc8a70 | 408 | "pxor %%xmm2, %%xmm0 \n\t" |
mbedAustin | 11:cada08fc8a70 | 409 | "add $16, %0 \n\t" |
mbedAustin | 11:cada08fc8a70 | 410 | "movdqu %%xmm0, (%0) \n\t" |
mbedAustin | 11:cada08fc8a70 | 411 | |
mbedAustin | 11:cada08fc8a70 | 412 | /* Set xmm2 to stuff:Y:stuff:stuff with Y = subword( r11 ) |
mbedAustin | 11:cada08fc8a70 | 413 | * and proceed to generate next round key from there */ |
mbedAustin | 11:cada08fc8a70 | 414 | AESKEYGENA xmm0_xmm2 ",0x00 \n\t" |
mbedAustin | 11:cada08fc8a70 | 415 | "pshufd $0xaa, %%xmm2, %%xmm2 \n\t" |
mbedAustin | 11:cada08fc8a70 | 416 | "pxor %%xmm1, %%xmm2 \n\t" |
mbedAustin | 11:cada08fc8a70 | 417 | "pslldq $4, %%xmm1 \n\t" |
mbedAustin | 11:cada08fc8a70 | 418 | "pxor %%xmm1, %%xmm2 \n\t" |
mbedAustin | 11:cada08fc8a70 | 419 | "pslldq $4, %%xmm1 \n\t" |
mbedAustin | 11:cada08fc8a70 | 420 | "pxor %%xmm1, %%xmm2 \n\t" |
mbedAustin | 11:cada08fc8a70 | 421 | "pslldq $4, %%xmm1 \n\t" |
mbedAustin | 11:cada08fc8a70 | 422 | "pxor %%xmm2, %%xmm1 \n\t" |
mbedAustin | 11:cada08fc8a70 | 423 | "add $16, %0 \n\t" |
mbedAustin | 11:cada08fc8a70 | 424 | "movdqu %%xmm1, (%0) \n\t" |
mbedAustin | 11:cada08fc8a70 | 425 | "ret \n\t" |
mbedAustin | 11:cada08fc8a70 | 426 | |
mbedAustin | 11:cada08fc8a70 | 427 | /* |
mbedAustin | 11:cada08fc8a70 | 428 | * Main "loop" - Generating one more key than necessary, |
mbedAustin | 11:cada08fc8a70 | 429 | * see definition of mbedtls_aes_context.buf |
mbedAustin | 11:cada08fc8a70 | 430 | */ |
mbedAustin | 11:cada08fc8a70 | 431 | "2: \n\t" |
mbedAustin | 11:cada08fc8a70 | 432 | AESKEYGENA xmm1_xmm2 ",0x01 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 433 | AESKEYGENA xmm1_xmm2 ",0x02 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 434 | AESKEYGENA xmm1_xmm2 ",0x04 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 435 | AESKEYGENA xmm1_xmm2 ",0x08 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 436 | AESKEYGENA xmm1_xmm2 ",0x10 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 437 | AESKEYGENA xmm1_xmm2 ",0x20 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 438 | AESKEYGENA xmm1_xmm2 ",0x40 \n\tcall 1b \n\t" |
mbedAustin | 11:cada08fc8a70 | 439 | : |
mbedAustin | 11:cada08fc8a70 | 440 | : "r" (rk), "r" (key) |
mbedAustin | 11:cada08fc8a70 | 441 | : "memory", "cc", "0" ); |
mbedAustin | 11:cada08fc8a70 | 442 | } |
mbedAustin | 11:cada08fc8a70 | 443 | |
mbedAustin | 11:cada08fc8a70 | 444 | /* |
mbedAustin | 11:cada08fc8a70 | 445 | * Key expansion, wrapper |
mbedAustin | 11:cada08fc8a70 | 446 | */ |
mbedAustin | 11:cada08fc8a70 | 447 | int mbedtls_aesni_setkey_enc( unsigned char *rk, |
mbedAustin | 11:cada08fc8a70 | 448 | const unsigned char *key, |
mbedAustin | 11:cada08fc8a70 | 449 | size_t bits ) |
mbedAustin | 11:cada08fc8a70 | 450 | { |
mbedAustin | 11:cada08fc8a70 | 451 | switch( bits ) |
mbedAustin | 11:cada08fc8a70 | 452 | { |
mbedAustin | 11:cada08fc8a70 | 453 | case 128: aesni_setkey_enc_128( rk, key ); break; |
mbedAustin | 11:cada08fc8a70 | 454 | case 192: aesni_setkey_enc_192( rk, key ); break; |
mbedAustin | 11:cada08fc8a70 | 455 | case 256: aesni_setkey_enc_256( rk, key ); break; |
mbedAustin | 11:cada08fc8a70 | 456 | default : return( MBEDTLS_ERR_AES_INVALID_KEY_LENGTH ); |
mbedAustin | 11:cada08fc8a70 | 457 | } |
mbedAustin | 11:cada08fc8a70 | 458 | |
mbedAustin | 11:cada08fc8a70 | 459 | return( 0 ); |
mbedAustin | 11:cada08fc8a70 | 460 | } |
mbedAustin | 11:cada08fc8a70 | 461 | |
mbedAustin | 11:cada08fc8a70 | 462 | #endif /* MBEDTLS_HAVE_X86_64 */ |
mbedAustin | 11:cada08fc8a70 | 463 | |
mbedAustin | 11:cada08fc8a70 | 464 | #endif /* MBEDTLS_AESNI_C */ |