/optee_os/core/lib/libtomcrypt/src/mac/poly1305/ |
A D | poly1305.c | 31 r0 = st->r[0]; in _poly1305_block() 32 r1 = st->r[1]; in _poly1305_block() 33 r2 = st->r[2]; in _poly1305_block() 34 r3 = st->r[3]; in _poly1305_block() 97 LOAD32L(st->r[0], key + 0); st->r[0] = (st->r[0] ) & 0x3ffffff; in poly1305_init() 98 LOAD32L(st->r[1], key + 3); st->r[1] = (st->r[1] >> 2) & 0x3ffff03; in poly1305_init() 99 LOAD32L(st->r[2], key + 6); st->r[2] = (st->r[2] >> 4) & 0x3ffc0ff; in poly1305_init() 100 LOAD32L(st->r[3], key + 9); st->r[3] = (st->r[3] >> 6) & 0x3f03fff; in poly1305_init() 101 LOAD32L(st->r[4], key + 12); st->r[4] = (st->r[4] >> 8) & 0x00fffff; in poly1305_init() 145 _poly1305_block(st, st->buffer, 16); in poly1305_process() [all …]
|
A D | poly1305_test.c | 31 poly1305_state st; in poly1305_test() 35 if ((err = poly1305_init(&st, k, 32)) != CRYPT_OK) return err; in poly1305_test() 36 if ((err = poly1305_process(&st, (unsigned char*)m, 5)) != CRYPT_OK) return err; in poly1305_test() 37 if ((err = poly1305_process(&st, (unsigned char*)m + 5, 4)) != CRYPT_OK) return err; in poly1305_test() 38 if ((err = poly1305_process(&st, (unsigned char*)m + 9, 3)) != CRYPT_OK) return err; in poly1305_test() 39 if ((err = poly1305_process(&st, (unsigned char*)m + 12, 2)) != CRYPT_OK) return err; in poly1305_test() 40 if ((err = poly1305_process(&st, (unsigned char*)m + 14, 1)) != CRYPT_OK) return err; in poly1305_test() 41 if ((err = poly1305_process(&st, (unsigned char*)m + 15, mlen - 15)) != CRYPT_OK) return err; in poly1305_test() 42 if ((err = poly1305_done(&st, out, &len)) != CRYPT_OK) return err; in poly1305_test() 45 if ((err = poly1305_init(&st, k, 32)) != CRYPT_OK) return err; in poly1305_test() [all …]
|
/optee_os/core/lib/libtomcrypt/src/stream/sober128/ |
A D | sober128_stream.c | 71 t = st->R[OFF(z,0)] + st->R[OFF(z,16)]; \ 74 t = ((t + st->R[OFF(z,1)]) ^ st->konst) + st->R[OFF(z,6)]; \ 92 st->initR[i] = st->R[i]; in s128_savestate() 103 st->R[i] = st->initR[i]; in s128_reloadstate() 129 #define DROUND(z) STEP(st->R,z); NLFUNC(st,(z+1)); st->R[OFF((z+1),FOLDP)] ^= t; 174 st->R[0] = 1; in sober128_stream_setup() 175 st->R[1] = 1; in sober128_stream_setup() 177 st->R[i] = st->R[i-1] + st->R[i-2]; in sober128_stream_setup() 195 st->nbuf = 0; in sober128_stream_setup() 235 st->nbuf = 0; in sober128_stream_setiv() [all …]
|
/optee_os/core/lib/libtomcrypt/src/stream/rabbit/ |
A D | rabbit.c | 215 st->work_ctx.x[i] = st->master_ctx.x[i]; in rabbit_setup() 216 st->work_ctx.c[i] = st->master_ctx.c[i]; in rabbit_setup() 218 st->work_ctx.carry = st->master_ctx.carry; in rabbit_setup() 220 XMEMSET(&(st->block), 0, sizeof(st->block)); in rabbit_setup() 248 st->work_ctx.c[0] = st->master_ctx.c[0] ^ i0; in rabbit_setiv() 249 st->work_ctx.c[1] = st->master_ctx.c[1] ^ i1; in rabbit_setiv() 250 st->work_ctx.c[2] = st->master_ctx.c[2] ^ i2; in rabbit_setiv() 251 st->work_ctx.c[3] = st->master_ctx.c[3] ^ i3; in rabbit_setiv() 259 st->work_ctx.x[i] = st->master_ctx.x[i]; in rabbit_setiv() 261 st->work_ctx.carry = st->master_ctx.carry; in rabbit_setiv() [all …]
|
/optee_os/core/lib/libtomcrypt/src/stream/chacha/ |
A D | chacha_setup.c | 35 LTC_ARGCHK(st != NULL); in chacha_setup() 41 LOAD32L(st->input[4], key + 0); in chacha_setup() 42 LOAD32L(st->input[5], key + 4); in chacha_setup() 43 LOAD32L(st->input[6], key + 8); in chacha_setup() 44 LOAD32L(st->input[7], key + 12); in chacha_setup() 51 LOAD32L(st->input[8], key + 0); in chacha_setup() 52 LOAD32L(st->input[9], key + 4); in chacha_setup() 53 LOAD32L(st->input[10], key + 8); in chacha_setup() 54 LOAD32L(st->input[11], key + 12); in chacha_setup() 55 LOAD32L(st->input[0], constants + 0); in chacha_setup() [all …]
|
A D | chacha_crypt.c | 62 LTC_ARGCHK(st != NULL); in chacha_crypt() 65 LTC_ARGCHK(st->ivlen != 0); in chacha_crypt() 67 if (st->ksleft > 0) { in chacha_crypt() 68 j = MIN(st->ksleft, inlen); in chacha_crypt() 69 for (i = 0; i < j; ++i, st->ksleft--) out[i] = in[i] ^ st->kstream[64 - st->ksleft]; in chacha_crypt() 76 _chacha_block(buf, st->input, st->rounds); in chacha_crypt() 77 if (st->ivlen == 8) { in chacha_crypt() 79 if (0 == ++st->input[12] && 0 == ++st->input[13]) return CRYPT_OVERFLOW; in chacha_crypt() 83 if (0 == ++st->input[12]) return CRYPT_OVERFLOW; in chacha_crypt() 87 st->ksleft = 64 - inlen; in chacha_crypt() [all …]
|
A D | chacha_test.c | 40 chacha_state st; in chacha_test() 46 …if ((err = chacha_setup(&st, k, sizeof(k), 20)) != CRYPT_OK) return err; in chacha_test() 47 …if ((err = chacha_ivctr32(&st, n, sizeof(n), 1)) != CRYPT_OK) return err; in chacha_test() 48 …if ((err = chacha_crypt(&st, (unsigned char*)pt, 35, out )) != CRYPT_OK) return err; in chacha_test() 49 …if ((err = chacha_crypt(&st, (unsigned char*)pt + 35, 35, out + 35)) != CRYPT_OK) return err; in chacha_test() 50 …if ((err = chacha_crypt(&st, (unsigned char*)pt + 70, 5, out + 70)) != CRYPT_OK) return err; in chacha_test() 51 …if ((err = chacha_crypt(&st, (unsigned char*)pt + 75, 5, out + 75)) != CRYPT_OK) return err; in chacha_test() 52 …if ((err = chacha_crypt(&st, (unsigned char*)pt + 80, len - 80, out + 80)) != CRYPT_OK) return err; in chacha_test() 56 …if ((err = chacha_setup(&st, k, sizeof(k), 20)) != CRYPT_OK) return err; in chacha_test() 57 …if ((err = chacha_ivctr32(&st, n, sizeof(n), 1)) != CRYPT_OK) return err; in chacha_test() [all …]
|
/optee_os/core/lib/libtomcrypt/src/stream/salsa20/ |
A D | salsa20_setup.c | 36 LTC_ARGCHK(st != NULL); in salsa20_setup() 43 LOAD32L(st->input[1], key + 0); in salsa20_setup() 44 LOAD32L(st->input[2], key + 4); in salsa20_setup() 45 LOAD32L(st->input[3], key + 8); in salsa20_setup() 46 LOAD32L(st->input[4], key + 12); in salsa20_setup() 53 LOAD32L(st->input[11], key + 0); in salsa20_setup() 54 LOAD32L(st->input[12], key + 4); in salsa20_setup() 55 LOAD32L(st->input[13], key + 8); in salsa20_setup() 56 LOAD32L(st->input[14], key + 12); in salsa20_setup() 57 LOAD32L(st->input[ 0], constants + 0); in salsa20_setup() [all …]
|
A D | xsalsa20_setup.c | 70 LTC_ARGCHK(st != NULL); in xsalsa20_setup() 109 LOAD32L(st->input[ 1], subkey + 0); in xsalsa20_setup() 110 LOAD32L(st->input[ 2], subkey + 4); in xsalsa20_setup() 111 LOAD32L(st->input[ 3], subkey + 8); in xsalsa20_setup() 112 LOAD32L(st->input[ 4], subkey + 12); in xsalsa20_setup() 113 LOAD32L(st->input[11], subkey + 16); in xsalsa20_setup() 114 LOAD32L(st->input[12], subkey + 20); in xsalsa20_setup() 119 st->input[ 8] = 0; in xsalsa20_setup() 120 st->input[ 9] = 0; in xsalsa20_setup() 121 st->rounds = rounds; in xsalsa20_setup() [all …]
|
A D | salsa20_crypt.c | 56 int salsa20_crypt(salsa20_state *st, const unsigned char *in, unsigned long inlen, unsigned char *o… in salsa20_crypt() argument 63 LTC_ARGCHK(st != NULL); in salsa20_crypt() 66 LTC_ARGCHK(st->ivlen == 8 || st->ivlen == 24); in salsa20_crypt() 68 if (st->ksleft > 0) { in salsa20_crypt() 69 j = MIN(st->ksleft, inlen); in salsa20_crypt() 70 for (i = 0; i < j; ++i, st->ksleft--) out[i] = in[i] ^ st->kstream[64 - st->ksleft]; in salsa20_crypt() 77 _salsa20_block(buf, st->input, st->rounds); in salsa20_crypt() 79 if (0 == ++st->input[8] && 0 == ++st->input[9]) return CRYPT_OVERFLOW; in salsa20_crypt() 82 st->ksleft = 64 - inlen; in salsa20_crypt() 83 for (i = inlen; i < 64; ++i) st->kstream[i] = buf[i]; in salsa20_crypt()
|
A D | salsa20_test.c | 26 salsa20_state st; in salsa20_test() 47 …if ((err = salsa20_setup(&st, k, sizeof(k), rounds)) != CRYPT_OK) return er… in salsa20_test() 48 …if ((err = salsa20_ivctr64(&st, n, sizeof(n), counter)) != CRYPT_OK) return er… in salsa20_test() 49 …if ((err = salsa20_crypt(&st, (unsigned char*)pt, 5, out)) != CRYPT_OK) return er… in salsa20_test() 58 if ((err = salsa20_setup(&st, k, sizeof(k), rounds)) != CRYPT_OK) return err; in salsa20_test() 59 if ((err = salsa20_ivctr64(&st, n, sizeof(n), counter)) != CRYPT_OK) return err; in salsa20_test() 60 if ((err = salsa20_crypt(&st, (unsigned char*)pt, len, out)) != CRYPT_OK) return err; in salsa20_test() 82 if ((err = salsa20_setup(&st, k3, sizeof(k3), rounds3)) != CRYPT_OK) return err; in salsa20_test() 83 if ((err = salsa20_ivctr64(&st, n3, sizeof(n3), counter3)) != CRYPT_OK) return err; in salsa20_test() 84 if ((err = salsa20_keystream(&st, out, 64)) != CRYPT_OK) return err; in salsa20_test() [all …]
|
/optee_os/core/lib/libtomcrypt/src/stream/sosemanuk/ |
A D | sosemanuk.c | 408 st->s09 = r3; in sosemanuk_setiv() 409 st->s08 = r1; in sosemanuk_setiv() 410 st->s07 = r0; in sosemanuk_setiv() 411 st->s06 = r2; in sosemanuk_setiv() 435 st->ptr = sizeof(st->buf); in sosemanuk_setiv() 717 st->r1 = r1; in _sosemanuk_internal() 718 st->r2 = r2; in _sosemanuk_internal() 754 if (st->ptr < (sizeof(st->buf))) { in sosemanuk_crypt() 755 unsigned long rlen = (sizeof(st->buf)) - st->ptr; in sosemanuk_crypt() 760 _xorbuf(st->buf + st->ptr, in, out, rlen); in sosemanuk_crypt() [all …]
|
A D | sosemanuk_test.c | 19 sosemanuk_state st; in sosemanuk_test() 34 …if ((err = sosemanuk_setup(&st, k, sizeof(k))) != CRYPT_OK) return … in sosemanuk_test() 35 …if ((err = sosemanuk_setiv(&st, n, sizeof(n))) != CRYPT_OK) return … in sosemanuk_test() 36 …if ((err = sosemanuk_crypt(&st, (unsigned char*)pt, 5, out)) != CRYPT_OK) return … in sosemanuk_test() 43 if ((err = sosemanuk_setup(&st, k, sizeof(k))) != CRYPT_OK) return err; in sosemanuk_test() 44 if ((err = sosemanuk_setiv(&st, n, sizeof(n))) != CRYPT_OK) return err; in sosemanuk_test() 45 if ((err = sosemanuk_crypt(&st, (unsigned char*)pt, len, out)) != CRYPT_OK) return err; in sosemanuk_test() 75 if ((err = sosemanuk_setup(&st, k3, sizeof(k3))) != CRYPT_OK) return err; in sosemanuk_test() 76 if ((err = sosemanuk_setiv(&st, n3, sizeof(n3))) != CRYPT_OK) return err; in sosemanuk_test() 77 if ((err = sosemanuk_keystream(&st, out, 64)) != CRYPT_OK) return err; in sosemanuk_test() [all …]
|
/optee_os/core/lib/libtomcrypt/src/stream/rc4/ |
A D | rc4_stream.c | 28 LTC_ARGCHK(st != NULL); in rc4_stream_setup() 32 s = st->buf; in rc4_stream_setup() 44 st->x = 0; in rc4_stream_setup() 45 st->y = 0; in rc4_stream_setup() 62 LTC_ARGCHK(st != NULL); in rc4_stream_crypt() 66 x = st->x; in rc4_stream_crypt() 67 y = st->y; in rc4_stream_crypt() 68 s = st->buf; in rc4_stream_crypt() 76 st->x = x; in rc4_stream_crypt() 77 st->y = y; in rc4_stream_crypt() [all …]
|
/optee_os/core/drivers/crypto/se050/core/ |
A D | rsa.c | 94 if (st != kStatus_SSS_Success) in se050_inject_public_key() 97 st = se050_get_oid(&oid); in se050_inject_public_key() 98 if (st != kStatus_SSS_Success) in se050_inject_public_key() 110 if (st != kStatus_SSS_Success) in se050_inject_public_key() 137 if (st != kStatus_SSS_Success) in se050_inject_keypair() 143 if (st != kStatus_SSS_Success) in se050_inject_keypair() 148 st = se050_get_oid(&oid); in se050_inject_keypair() 149 if (st != kStatus_SSS_Success) in se050_inject_keypair() 157 if (st != kStatus_SSS_Success) in se050_inject_keypair() 269 if (st != kStatus_SSS_Success) in encrypt_es() [all …]
|
A D | ecc.c | 226 if (st != kStatus_SSS_Success) in se050_inject_public_key() 237 st = se050_get_oid(&oid); in se050_inject_public_key() 238 if (st != kStatus_SSS_Success) in se050_inject_public_key() 246 if (st != kStatus_SSS_Success) in se050_inject_public_key() 283 if (st != kStatus_SSS_Success) in se050_inject_keypair() 289 if (st != kStatus_SSS_Success) in se050_inject_keypair() 303 st = se050_get_oid(&oid); in se050_inject_keypair() 304 if (st != kStatus_SSS_Success) in se050_inject_keypair() 312 if (st != kStatus_SSS_Success) in se050_inject_keypair() 396 if (st != kStatus_SSS_Success) in shared_secret() [all …]
|
A D | ctr.c | 39 sss_status_t st = kStatus_SSS_Success; in se050_aes_ctr_init() local 48 if (st != kStatus_SSS_Success) in se050_aes_ctr_init() 51 st = se050_get_oid(&oid); in se050_aes_ctr_init() 52 if (st != kStatus_SSS_Success) in se050_aes_ctr_init() 59 if (st != kStatus_SSS_Success) in se050_aes_ctr_init() 64 if (st != kStatus_SSS_Success) in se050_aes_ctr_init() 71 if (st != kStatus_SSS_Success) in se050_aes_ctr_init() 75 if (st != kStatus_SSS_Success) in se050_aes_ctr_init() 87 sss_status_t st = kStatus_SSS_Success; in se050_aes_ctr_update() local 97 st = sss_se05x_cipher_update(&c->aes_ctx, in se050_aes_ctr_update() [all …]
|
/optee_os/core/arch/arm/dts/ |
A D | stm32mp151.dtsi | 106 st,syscfg = <&syscfg>; 961 st,mem2mem; 978 st,mem2mem; 1000 st,syscfg = <&syscfg>; 1063 st,proc-id = <0>; 1499 st,non-secure-otp; 1544 st,bank-name = "GPIOA"; 1555 st,bank-name = "GPIOB"; 1566 st,bank-name = "GPIOC"; 1577 st,bank-name = "GPIOD"; [all …]
|
/optee_os/core/lib/libtomcrypt/src/encauth/chachapoly/ |
A D | chacha20poly1305_decrypt.c | 23 int chacha20poly1305_decrypt(chacha20poly1305_state *st, const unsigned char *in, unsigned long inl… in chacha20poly1305_decrypt() argument 29 LTC_ARGCHK(st != NULL); in chacha20poly1305_decrypt() 31 if (st->aadflg) { in chacha20poly1305_decrypt() 32 padlen = 16 - (unsigned long)(st->aadlen % 16); in chacha20poly1305_decrypt() 34 if ((err = poly1305_process(&st->poly, padzero, padlen)) != CRYPT_OK) return err; in chacha20poly1305_decrypt() 36 st->aadflg = 0; /* no more AAD */ in chacha20poly1305_decrypt() 38 if (st->aadflg) st->aadflg = 0; /* no more AAD */ in chacha20poly1305_decrypt() 39 if ((err = poly1305_process(&st->poly, in, inlen)) != CRYPT_OK) return err; in chacha20poly1305_decrypt() 40 if ((err = chacha_crypt(&st->chacha, in, inlen, out)) != CRYPT_OK) return err; in chacha20poly1305_decrypt() 41 st->ctlen += (ulong64)inlen; in chacha20poly1305_decrypt()
|
A D | chacha20poly1305_encrypt.c | 23 int chacha20poly1305_encrypt(chacha20poly1305_state *st, const unsigned char *in, unsigned long inl… in chacha20poly1305_encrypt() argument 29 LTC_ARGCHK(st != NULL); in chacha20poly1305_encrypt() 31 if ((err = chacha_crypt(&st->chacha, in, inlen, out)) != CRYPT_OK) return err; in chacha20poly1305_encrypt() 32 if (st->aadflg) { in chacha20poly1305_encrypt() 33 padlen = 16 - (unsigned long)(st->aadlen % 16); in chacha20poly1305_encrypt() 35 if ((err = poly1305_process(&st->poly, padzero, padlen)) != CRYPT_OK) return err; in chacha20poly1305_encrypt() 37 st->aadflg = 0; /* no more AAD */ in chacha20poly1305_encrypt() 39 if ((err = poly1305_process(&st->poly, out, inlen)) != CRYPT_OK) return err; in chacha20poly1305_encrypt() 40 st->ctlen += (ulong64)inlen; in chacha20poly1305_encrypt()
|
A D | chacha20poly1305_done.c | 22 int chacha20poly1305_done(chacha20poly1305_state *st, unsigned char *tag, unsigned long *taglen) in chacha20poly1305_done() argument 29 LTC_ARGCHK(st != NULL); in chacha20poly1305_done() 31 padlen = 16 - (unsigned long)(st->ctlen % 16); in chacha20poly1305_done() 33 if ((err = poly1305_process(&st->poly, padzero, padlen)) != CRYPT_OK) return err; in chacha20poly1305_done() 35 STORE64L(st->aadlen, buf); in chacha20poly1305_done() 36 STORE64L(st->ctlen, buf + 8); in chacha20poly1305_done() 37 if ((err = poly1305_process(&st->poly, buf, 16)) != CRYPT_OK) return err; in chacha20poly1305_done() 38 if ((err = poly1305_done(&st->poly, tag, taglen)) != CRYPT_OK) return err; in chacha20poly1305_done() 39 if ((err = chacha_done(&st->chacha)) != CRYPT_OK) return err; in chacha20poly1305_done()
|
/optee_os/core/lib/libtomcrypt/src/mac/blake2/ |
A D | blake2bmac.c | 23 int blake2bmac_init(blake2bmac_state *st, unsigned long outlen, const unsigned char *key, unsigned … in blake2bmac_init() argument 25 LTC_ARGCHK(st != NULL); in blake2bmac_init() 27 return blake2b_init(st, outlen, key, keylen); in blake2bmac_init() 37 int blake2bmac_process(blake2bmac_state *st, const unsigned char *in, unsigned long inlen) in blake2bmac_process() argument 40 LTC_ARGCHK(st != NULL); in blake2bmac_process() 42 return blake2b_process(st, in, inlen); in blake2bmac_process() 52 int blake2bmac_done(blake2bmac_state *st, unsigned char *mac, unsigned long *maclen) in blake2bmac_done() argument 54 LTC_ARGCHK(st != NULL); in blake2bmac_done() 57 LTC_ARGCHK(*maclen >= st->blake2b.outlen); in blake2bmac_done() 59 *maclen = st->blake2b.outlen; in blake2bmac_done() [all …]
|
A D | blake2smac.c | 23 int blake2smac_init(blake2smac_state *st, unsigned long outlen, const unsigned char *key, unsigned … in blake2smac_init() argument 25 LTC_ARGCHK(st != NULL); in blake2smac_init() 27 return blake2s_init(st, outlen, key, keylen); in blake2smac_init() 37 int blake2smac_process(blake2smac_state *st, const unsigned char *in, unsigned long inlen) in blake2smac_process() argument 40 LTC_ARGCHK(st != NULL); in blake2smac_process() 42 return blake2s_process(st, in, inlen); in blake2smac_process() 52 int blake2smac_done(blake2smac_state *st, unsigned char *mac, unsigned long *maclen) in blake2smac_done() argument 54 LTC_ARGCHK(st != NULL); in blake2smac_done() 57 LTC_ARGCHK(*maclen >= st->blake2s.outlen); in blake2smac_done() 59 *maclen = st->blake2s.outlen; in blake2smac_done() [all …]
|
A D | blake2bmac_test.c | 282 blake2bmac_state st; in blake2bmac_test() 291 blake2bmac_init(&st, olen, key, klen); in blake2bmac_test() 292 blake2bmac_process(&st, (unsigned char*)inp, 5); in blake2bmac_test() 293 blake2bmac_process(&st, (unsigned char*)inp + 5, 4); in blake2bmac_test() 294 blake2bmac_process(&st, (unsigned char*)inp + 9, 3); in blake2bmac_test() 295 blake2bmac_process(&st, (unsigned char*)inp + 12, 2); in blake2bmac_test() 296 blake2bmac_process(&st, (unsigned char*)inp + 14, 1); in blake2bmac_test() 298 blake2bmac_done(&st, out, &olen); in blake2bmac_test() 302 blake2bmac_init(&st, olen, key, klen); in blake2bmac_test() 303 blake2bmac_process(&st, (unsigned char*)inp, ilen); in blake2bmac_test() [all …]
|
A D | blake2smac_test.c | 282 blake2smac_state st; in blake2smac_test() 291 blake2smac_init(&st, olen, key, klen); in blake2smac_test() 292 blake2smac_process(&st, (unsigned char*)inp, 5); in blake2smac_test() 293 blake2smac_process(&st, (unsigned char*)inp + 5, 4); in blake2smac_test() 294 blake2smac_process(&st, (unsigned char*)inp + 9, 3); in blake2smac_test() 295 blake2smac_process(&st, (unsigned char*)inp + 12, 2); in blake2smac_test() 296 blake2smac_process(&st, (unsigned char*)inp + 14, 1); in blake2smac_test() 298 blake2smac_done(&st, out, &olen); in blake2smac_test() 302 blake2smac_init(&st, olen, key, klen); in blake2smac_test() 303 blake2smac_process(&st, (unsigned char*)inp, ilen); in blake2smac_test() [all …]
|