Lines Matching refs:arg

1346 static int s390x_aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)  in s390x_aes_gcm_ctrl()  argument
1371 if (arg <= 0) in s390x_aes_gcm_ctrl()
1374 if (arg != 12) { in s390x_aes_gcm_ctrl()
1375 len = S390X_gcm_ivpadlen(arg); in s390x_aes_gcm_ctrl()
1388 memset(gctx->iv + arg, 0, len - arg - 8); in s390x_aes_gcm_ctrl()
1389 *((unsigned long long *)(gctx->iv + len - 8)) = arg << 3; in s390x_aes_gcm_ctrl()
1391 gctx->ivlen = arg; in s390x_aes_gcm_ctrl()
1397 if (arg <= 0 || arg > 16 || enc) in s390x_aes_gcm_ctrl()
1400 memcpy(buf, ptr, arg); in s390x_aes_gcm_ctrl()
1401 gctx->taglen = arg; in s390x_aes_gcm_ctrl()
1406 if (arg <= 0 || arg > 16 || !enc || gctx->taglen < 0) in s390x_aes_gcm_ctrl()
1409 memcpy(ptr, gctx->kma.param.t.b, arg); in s390x_aes_gcm_ctrl()
1414 if (arg == -1) { in s390x_aes_gcm_ctrl()
1423 if ((arg < 4) || (gctx->ivlen - arg) < 8) in s390x_aes_gcm_ctrl()
1426 if (arg) in s390x_aes_gcm_ctrl()
1427 memcpy(gctx->iv, ptr, arg); in s390x_aes_gcm_ctrl()
1430 if (enc && RAND_bytes(gctx->iv + arg, gctx->ivlen - arg) <= 0) in s390x_aes_gcm_ctrl()
1442 if (arg <= 0 || arg > gctx->ivlen) in s390x_aes_gcm_ctrl()
1443 arg = gctx->ivlen; in s390x_aes_gcm_ctrl()
1445 memcpy(ptr, gctx->iv + gctx->ivlen - arg, arg); in s390x_aes_gcm_ctrl()
1459 memcpy(gctx->iv + gctx->ivlen - arg, ptr, arg); in s390x_aes_gcm_ctrl()
1466 if (arg != EVP_AEAD_TLS1_AAD_LEN) in s390x_aes_gcm_ctrl()
1470 memcpy(buf, ptr, arg); in s390x_aes_gcm_ctrl()
1471 gctx->tls_aad_len = arg; in s390x_aes_gcm_ctrl()
1474 len = buf[arg - 2] << 8 | buf[arg - 1]; in s390x_aes_gcm_ctrl()
1487 buf[arg - 2] = len >> 8; in s390x_aes_gcm_ctrl()
1488 buf[arg - 1] = len & 0xff; in s390x_aes_gcm_ctrl()
1693 static int s390x_aes_xts_ctrl(EVP_CIPHER_CTX *, int type, int arg, void *ptr);
2053 static int s390x_aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) in s390x_aes_ccm_ctrl() argument
2075 if (arg != EVP_AEAD_TLS1_AAD_LEN) in s390x_aes_ccm_ctrl()
2080 memcpy(buf, ptr, arg); in s390x_aes_ccm_ctrl()
2081 cctx->aes.ccm.tls_aad_len = arg; in s390x_aes_ccm_ctrl()
2083 len = buf[arg - 2] << 8 | buf[arg - 1]; in s390x_aes_ccm_ctrl()
2099 buf[arg - 2] = len >> 8; in s390x_aes_ccm_ctrl()
2100 buf[arg - 1] = len & 0xff; in s390x_aes_ccm_ctrl()
2106 if (arg != EVP_CCM_TLS_FIXED_IV_LEN) in s390x_aes_ccm_ctrl()
2110 memcpy(c->iv, ptr, arg); in s390x_aes_ccm_ctrl()
2114 arg = 15 - arg; in s390x_aes_ccm_ctrl()
2118 if (arg < 2 || arg > 8) in s390x_aes_ccm_ctrl()
2121 cctx->aes.ccm.l = arg; in s390x_aes_ccm_ctrl()
2125 if ((arg & 1) || arg < 4 || arg > 16) in s390x_aes_ccm_ctrl()
2135 memcpy(buf, ptr, arg); in s390x_aes_ccm_ctrl()
2138 cctx->aes.ccm.m = arg; in s390x_aes_ccm_ctrl()
2146 if(arg < cctx->aes.ccm.m) in s390x_aes_ccm_ctrl()
2177 static int s390x_aes_ocb_ctrl(EVP_CIPHER_CTX *, int type, int arg, void *ptr);
2562 static int aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) in aes_gcm_ctrl() argument
2581 if (arg <= 0) in aes_gcm_ctrl()
2584 if ((arg > EVP_MAX_IV_LENGTH) && (arg > gctx->ivlen)) { in aes_gcm_ctrl()
2587 if ((gctx->iv = OPENSSL_malloc(arg)) == NULL) { in aes_gcm_ctrl()
2592 gctx->ivlen = arg; in aes_gcm_ctrl()
2596 if (arg <= 0 || arg > 16 || c->encrypt) in aes_gcm_ctrl()
2598 memcpy(c->buf, ptr, arg); in aes_gcm_ctrl()
2599 gctx->taglen = arg; in aes_gcm_ctrl()
2603 if (arg <= 0 || arg > 16 || !c->encrypt in aes_gcm_ctrl()
2606 memcpy(ptr, c->buf, arg); in aes_gcm_ctrl()
2611 if (arg == -1) { in aes_gcm_ctrl()
2620 if ((arg < 4) || (gctx->ivlen - arg) < 8) in aes_gcm_ctrl()
2622 if (arg) in aes_gcm_ctrl()
2623 memcpy(gctx->iv, ptr, arg); in aes_gcm_ctrl()
2624 if (c->encrypt && RAND_bytes(gctx->iv + arg, gctx->ivlen - arg) <= 0) in aes_gcm_ctrl()
2633 if (arg <= 0 || arg > gctx->ivlen) in aes_gcm_ctrl()
2634 arg = gctx->ivlen; in aes_gcm_ctrl()
2635 memcpy(ptr, gctx->iv + gctx->ivlen - arg, arg); in aes_gcm_ctrl()
2647 memcpy(gctx->iv + gctx->ivlen - arg, ptr, arg); in aes_gcm_ctrl()
2654 if (arg != EVP_AEAD_TLS1_AAD_LEN) in aes_gcm_ctrl()
2656 memcpy(c->buf, ptr, arg); in aes_gcm_ctrl()
2657 gctx->tls_aad_len = arg; in aes_gcm_ctrl()
2660 unsigned int len = c->buf[arg - 2] << 8 | c->buf[arg - 1]; in aes_gcm_ctrl()
2671 c->buf[arg - 2] = len >> 8; in aes_gcm_ctrl()
2672 c->buf[arg - 1] = len & 0xff; in aes_gcm_ctrl()
3093 static int aes_xts_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) in aes_xts_ctrl() argument
3274 static int aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) in aes_ccm_ctrl() argument
3294 if (arg != EVP_AEAD_TLS1_AAD_LEN) in aes_ccm_ctrl()
3296 memcpy(EVP_CIPHER_CTX_buf_noconst(c), ptr, arg); in aes_ccm_ctrl()
3297 cctx->tls_aad_len = arg; in aes_ccm_ctrl()
3300 EVP_CIPHER_CTX_buf_noconst(c)[arg - 2] << 8 in aes_ccm_ctrl()
3301 | EVP_CIPHER_CTX_buf_noconst(c)[arg - 1]; in aes_ccm_ctrl()
3312 EVP_CIPHER_CTX_buf_noconst(c)[arg - 2] = len >> 8; in aes_ccm_ctrl()
3313 EVP_CIPHER_CTX_buf_noconst(c)[arg - 1] = len & 0xff; in aes_ccm_ctrl()
3320 if (arg != EVP_CCM_TLS_FIXED_IV_LEN) in aes_ccm_ctrl()
3323 memcpy(c->iv, ptr, arg); in aes_ccm_ctrl()
3327 arg = 15 - arg; in aes_ccm_ctrl()
3330 if (arg < 2 || arg > 8) in aes_ccm_ctrl()
3332 cctx->L = arg; in aes_ccm_ctrl()
3336 if ((arg & 1) || arg < 4 || arg > 16) in aes_ccm_ctrl()
3342 memcpy(EVP_CIPHER_CTX_buf_noconst(c), ptr, arg); in aes_ccm_ctrl()
3344 cctx->M = arg; in aes_ccm_ctrl()
3350 if (!CRYPTO_ccm128_tag(&cctx->ccm, ptr, (size_t)arg)) in aes_ccm_ctrl()
3736 static int aes_ocb_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) in aes_ocb_ctrl() argument
3759 if (arg <= 0 || arg > 15) in aes_ocb_ctrl()
3762 octx->ivlen = arg; in aes_ocb_ctrl()
3768 if (arg < 0 || arg > 16) in aes_ocb_ctrl()
3771 octx->taglen = arg; in aes_ocb_ctrl()
3774 if (arg != octx->taglen || EVP_CIPHER_CTX_is_encrypting(c)) in aes_ocb_ctrl()
3776 memcpy(octx->tag, ptr, arg); in aes_ocb_ctrl()
3780 if (arg != octx->taglen || !EVP_CIPHER_CTX_is_encrypting(c)) in aes_ocb_ctrl()
3783 memcpy(ptr, octx->tag, arg); in aes_ocb_ctrl()