2 * Copyright 2006-2017 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
11 #include "internal/cryptlib.h"
12 #include <openssl/asn1t.h>
13 #include <openssl/x509.h>
14 #include <openssl/rsa.h>
15 #include <openssl/bn.h>
16 #include <openssl/evp.h>
17 #include <openssl/x509v3.h>
18 #include <openssl/cms.h>
19 #include "internal/evp_int.h"
22 /* RSA pkey context structure */
25 /* Key gen parameters */
29 /* Keygen callback info */
31 /* RSA padding mode */
35 /* message digest for MGF1 */
39 /* Minimum salt length or -1 if no PSS parameter restriction */
44 unsigned char *oaep_label;
48 /* True if PSS parameters are restricted */
49 #define rsa_pss_restricted(rctx) (rctx->min_saltlen != -1)
51 static int pkey_rsa_init(EVP_PKEY_CTX *ctx)
53 RSA_PKEY_CTX *rctx = OPENSSL_zalloc(sizeof(*rctx));
58 rctx->primes = RSA_DEFAULT_PRIME_NUM;
59 if (pkey_ctx_is_pss(ctx))
60 rctx->pad_mode = RSA_PKCS1_PSS_PADDING;
62 rctx->pad_mode = RSA_PKCS1_PADDING;
63 /* Maximum for sign, auto for verify */
64 rctx->saltlen = RSA_PSS_SALTLEN_AUTO;
65 rctx->min_saltlen = -1;
67 ctx->keygen_info = rctx->gentmp;
68 ctx->keygen_info_count = 2;
73 static int pkey_rsa_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
75 RSA_PKEY_CTX *dctx, *sctx;
77 if (!pkey_rsa_init(dst))
81 dctx->nbits = sctx->nbits;
83 dctx->pub_exp = BN_dup(sctx->pub_exp);
87 dctx->pad_mode = sctx->pad_mode;
89 dctx->mgf1md = sctx->mgf1md;
90 if (sctx->oaep_label) {
91 OPENSSL_free(dctx->oaep_label);
92 dctx->oaep_label = OPENSSL_memdup(sctx->oaep_label, sctx->oaep_labellen);
93 if (!dctx->oaep_label)
95 dctx->oaep_labellen = sctx->oaep_labellen;
100 static int setup_tbuf(RSA_PKEY_CTX *ctx, EVP_PKEY_CTX *pk)
102 if (ctx->tbuf != NULL)
104 ctx->tbuf = OPENSSL_malloc(EVP_PKEY_size(pk->pkey));
105 if (ctx->tbuf == NULL)
110 static void pkey_rsa_cleanup(EVP_PKEY_CTX *ctx)
112 RSA_PKEY_CTX *rctx = ctx->data;
114 BN_free(rctx->pub_exp);
115 OPENSSL_free(rctx->tbuf);
116 OPENSSL_free(rctx->oaep_label);
121 static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig,
122 size_t *siglen, const unsigned char *tbs,
126 RSA_PKEY_CTX *rctx = ctx->data;
127 RSA *rsa = ctx->pkey->pkey.rsa;
130 if (tbslen != (size_t)EVP_MD_size(rctx->md)) {
131 RSAerr(RSA_F_PKEY_RSA_SIGN, RSA_R_INVALID_DIGEST_LENGTH);
135 if (EVP_MD_type(rctx->md) == NID_mdc2) {
137 if (rctx->pad_mode != RSA_PKCS1_PADDING)
139 ret = RSA_sign_ASN1_OCTET_STRING(0,
140 tbs, tbslen, sig, &sltmp, rsa);
145 } else if (rctx->pad_mode == RSA_X931_PADDING) {
146 if ((size_t)EVP_PKEY_size(ctx->pkey) < tbslen + 1) {
147 RSAerr(RSA_F_PKEY_RSA_SIGN, RSA_R_KEY_SIZE_TOO_SMALL);
150 if (!setup_tbuf(rctx, ctx)) {
151 RSAerr(RSA_F_PKEY_RSA_SIGN, ERR_R_MALLOC_FAILURE);
154 memcpy(rctx->tbuf, tbs, tbslen);
155 rctx->tbuf[tbslen] = RSA_X931_hash_id(EVP_MD_type(rctx->md));
156 ret = RSA_private_encrypt(tbslen + 1, rctx->tbuf,
157 sig, rsa, RSA_X931_PADDING);
158 } else if (rctx->pad_mode == RSA_PKCS1_PADDING) {
160 ret = RSA_sign(EVP_MD_type(rctx->md),
161 tbs, tbslen, sig, &sltmp, rsa);
165 } else if (rctx->pad_mode == RSA_PKCS1_PSS_PADDING) {
166 if (!setup_tbuf(rctx, ctx))
168 if (!RSA_padding_add_PKCS1_PSS_mgf1(rsa,
170 rctx->md, rctx->mgf1md,
173 ret = RSA_private_encrypt(RSA_size(rsa), rctx->tbuf,
174 sig, rsa, RSA_NO_PADDING);
179 ret = RSA_private_encrypt(tbslen, tbs, sig, ctx->pkey->pkey.rsa,
188 static int pkey_rsa_verifyrecover(EVP_PKEY_CTX *ctx,
189 unsigned char *rout, size_t *routlen,
190 const unsigned char *sig, size_t siglen)
193 RSA_PKEY_CTX *rctx = ctx->data;
196 if (rctx->pad_mode == RSA_X931_PADDING) {
197 if (!setup_tbuf(rctx, ctx))
199 ret = RSA_public_decrypt(siglen, sig,
200 rctx->tbuf, ctx->pkey->pkey.rsa,
205 if (rctx->tbuf[ret] != RSA_X931_hash_id(EVP_MD_type(rctx->md))) {
206 RSAerr(RSA_F_PKEY_RSA_VERIFYRECOVER,
207 RSA_R_ALGORITHM_MISMATCH);
210 if (ret != EVP_MD_size(rctx->md)) {
211 RSAerr(RSA_F_PKEY_RSA_VERIFYRECOVER,
212 RSA_R_INVALID_DIGEST_LENGTH);
216 memcpy(rout, rctx->tbuf, ret);
217 } else if (rctx->pad_mode == RSA_PKCS1_PADDING) {
219 ret = int_rsa_verify(EVP_MD_type(rctx->md),
220 NULL, 0, rout, &sltmp,
221 sig, siglen, ctx->pkey->pkey.rsa);
229 ret = RSA_public_decrypt(siglen, sig, rout, ctx->pkey->pkey.rsa,
238 static int pkey_rsa_verify(EVP_PKEY_CTX *ctx,
239 const unsigned char *sig, size_t siglen,
240 const unsigned char *tbs, size_t tbslen)
242 RSA_PKEY_CTX *rctx = ctx->data;
243 RSA *rsa = ctx->pkey->pkey.rsa;
247 if (rctx->pad_mode == RSA_PKCS1_PADDING)
248 return RSA_verify(EVP_MD_type(rctx->md), tbs, tbslen,
250 if (tbslen != (size_t)EVP_MD_size(rctx->md)) {
251 RSAerr(RSA_F_PKEY_RSA_VERIFY, RSA_R_INVALID_DIGEST_LENGTH);
254 if (rctx->pad_mode == RSA_X931_PADDING) {
255 if (pkey_rsa_verifyrecover(ctx, NULL, &rslen, sig, siglen) <= 0)
257 } else if (rctx->pad_mode == RSA_PKCS1_PSS_PADDING) {
259 if (!setup_tbuf(rctx, ctx))
261 ret = RSA_public_decrypt(siglen, sig, rctx->tbuf,
262 rsa, RSA_NO_PADDING);
265 ret = RSA_verify_PKCS1_PSS_mgf1(rsa, tbs,
266 rctx->md, rctx->mgf1md,
267 rctx->tbuf, rctx->saltlen);
275 if (!setup_tbuf(rctx, ctx))
277 rslen = RSA_public_decrypt(siglen, sig, rctx->tbuf,
278 rsa, rctx->pad_mode);
283 if ((rslen != tbslen) || memcmp(tbs, rctx->tbuf, rslen))
290 static int pkey_rsa_encrypt(EVP_PKEY_CTX *ctx,
291 unsigned char *out, size_t *outlen,
292 const unsigned char *in, size_t inlen)
295 RSA_PKEY_CTX *rctx = ctx->data;
297 if (rctx->pad_mode == RSA_PKCS1_OAEP_PADDING) {
298 int klen = RSA_size(ctx->pkey->pkey.rsa);
299 if (!setup_tbuf(rctx, ctx))
301 if (!RSA_padding_add_PKCS1_OAEP_mgf1(rctx->tbuf, klen,
305 rctx->md, rctx->mgf1md))
307 ret = RSA_public_encrypt(klen, rctx->tbuf, out,
308 ctx->pkey->pkey.rsa, RSA_NO_PADDING);
310 ret = RSA_public_encrypt(inlen, in, out, ctx->pkey->pkey.rsa,
319 static int pkey_rsa_decrypt(EVP_PKEY_CTX *ctx,
320 unsigned char *out, size_t *outlen,
321 const unsigned char *in, size_t inlen)
324 RSA_PKEY_CTX *rctx = ctx->data;
326 if (rctx->pad_mode == RSA_PKCS1_OAEP_PADDING) {
327 if (!setup_tbuf(rctx, ctx))
329 ret = RSA_private_decrypt(inlen, in, rctx->tbuf,
330 ctx->pkey->pkey.rsa, RSA_NO_PADDING);
333 ret = RSA_padding_check_PKCS1_OAEP_mgf1(out, ret, rctx->tbuf,
337 rctx->md, rctx->mgf1md);
339 ret = RSA_private_decrypt(inlen, in, out, ctx->pkey->pkey.rsa,
348 static int check_padding_md(const EVP_MD *md, int padding)
355 mdnid = EVP_MD_type(md);
357 if (padding == RSA_NO_PADDING) {
358 RSAerr(RSA_F_CHECK_PADDING_MD, RSA_R_INVALID_PADDING_MODE);
362 if (padding == RSA_X931_PADDING) {
363 if (RSA_X931_hash_id(mdnid) == -1) {
364 RSAerr(RSA_F_CHECK_PADDING_MD, RSA_R_INVALID_X931_DIGEST);
369 /* List of all supported RSA digests */
388 RSAerr(RSA_F_CHECK_PADDING_MD, RSA_R_INVALID_DIGEST);
397 static int pkey_rsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
399 RSA_PKEY_CTX *rctx = ctx->data;
402 case EVP_PKEY_CTRL_RSA_PADDING:
403 if ((p1 >= RSA_PKCS1_PADDING) && (p1 <= RSA_PKCS1_PSS_PADDING)) {
404 if (!check_padding_md(rctx->md, p1))
406 if (p1 == RSA_PKCS1_PSS_PADDING) {
407 if (!(ctx->operation &
408 (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY)))
411 rctx->md = EVP_sha1();
412 } else if (pkey_ctx_is_pss(ctx)) {
415 if (p1 == RSA_PKCS1_OAEP_PADDING) {
416 if (!(ctx->operation & EVP_PKEY_OP_TYPE_CRYPT))
419 rctx->md = EVP_sha1();
425 RSAerr(RSA_F_PKEY_RSA_CTRL,
426 RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE);
429 case EVP_PKEY_CTRL_GET_RSA_PADDING:
430 *(int *)p2 = rctx->pad_mode;
433 case EVP_PKEY_CTRL_RSA_PSS_SALTLEN:
434 case EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN:
435 if (rctx->pad_mode != RSA_PKCS1_PSS_PADDING) {
436 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_INVALID_PSS_SALTLEN);
439 if (type == EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN) {
440 *(int *)p2 = rctx->saltlen;
442 if (p1 < RSA_PSS_SALTLEN_MAX)
444 if (rsa_pss_restricted(rctx)) {
445 if (p1 == RSA_PSS_SALTLEN_AUTO
446 && ctx->operation == EVP_PKEY_OP_VERIFY) {
447 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_INVALID_PSS_SALTLEN);
450 if ((p1 == RSA_PSS_SALTLEN_DIGEST
451 && rctx->min_saltlen > EVP_MD_size(rctx->md))
452 || (p1 >= 0 && p1 < rctx->min_saltlen)) {
453 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_PSS_SALTLEN_TOO_SMALL);
461 case EVP_PKEY_CTRL_RSA_KEYGEN_BITS:
463 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_KEY_SIZE_TOO_SMALL);
469 case EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP:
470 if (p2 == NULL || !BN_is_odd((BIGNUM *)p2) || BN_is_one((BIGNUM *)p2)) {
471 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_BAD_E_VALUE);
474 BN_free(rctx->pub_exp);
478 case EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES:
479 if (p1 < RSA_DEFAULT_PRIME_NUM || p1 > RSA_MAX_PRIME_NUM) {
480 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_KEY_PRIME_NUM_INVALID);
486 case EVP_PKEY_CTRL_RSA_OAEP_MD:
487 case EVP_PKEY_CTRL_GET_RSA_OAEP_MD:
488 if (rctx->pad_mode != RSA_PKCS1_OAEP_PADDING) {
489 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_INVALID_PADDING_MODE);
492 if (type == EVP_PKEY_CTRL_GET_RSA_OAEP_MD)
493 *(const EVP_MD **)p2 = rctx->md;
498 case EVP_PKEY_CTRL_MD:
499 if (!check_padding_md(p2, rctx->pad_mode))
501 if (rsa_pss_restricted(rctx)) {
502 if (EVP_MD_type(rctx->md) == EVP_MD_type(p2))
504 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_DIGEST_NOT_ALLOWED);
510 case EVP_PKEY_CTRL_GET_MD:
511 *(const EVP_MD **)p2 = rctx->md;
514 case EVP_PKEY_CTRL_RSA_MGF1_MD:
515 case EVP_PKEY_CTRL_GET_RSA_MGF1_MD:
516 if (rctx->pad_mode != RSA_PKCS1_PSS_PADDING
517 && rctx->pad_mode != RSA_PKCS1_OAEP_PADDING) {
518 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_INVALID_MGF1_MD);
521 if (type == EVP_PKEY_CTRL_GET_RSA_MGF1_MD) {
523 *(const EVP_MD **)p2 = rctx->mgf1md;
525 *(const EVP_MD **)p2 = rctx->md;
527 if (rsa_pss_restricted(rctx)) {
528 if (EVP_MD_type(rctx->mgf1md) == EVP_MD_type(p2))
530 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_MGF1_DIGEST_NOT_ALLOWED);
537 case EVP_PKEY_CTRL_RSA_OAEP_LABEL:
538 if (rctx->pad_mode != RSA_PKCS1_OAEP_PADDING) {
539 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_INVALID_PADDING_MODE);
542 OPENSSL_free(rctx->oaep_label);
544 rctx->oaep_label = p2;
545 rctx->oaep_labellen = p1;
547 rctx->oaep_label = NULL;
548 rctx->oaep_labellen = 0;
552 case EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL:
553 if (rctx->pad_mode != RSA_PKCS1_OAEP_PADDING) {
554 RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_INVALID_PADDING_MODE);
557 *(unsigned char **)p2 = rctx->oaep_label;
558 return rctx->oaep_labellen;
560 case EVP_PKEY_CTRL_DIGESTINIT:
561 case EVP_PKEY_CTRL_PKCS7_SIGN:
562 #ifndef OPENSSL_NO_CMS
563 case EVP_PKEY_CTRL_CMS_SIGN:
567 case EVP_PKEY_CTRL_PKCS7_ENCRYPT:
568 case EVP_PKEY_CTRL_PKCS7_DECRYPT:
569 #ifndef OPENSSL_NO_CMS
570 case EVP_PKEY_CTRL_CMS_DECRYPT:
571 case EVP_PKEY_CTRL_CMS_ENCRYPT:
573 if (!pkey_ctx_is_pss(ctx))
576 case EVP_PKEY_CTRL_PEER_KEY:
577 RSAerr(RSA_F_PKEY_RSA_CTRL,
578 RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
587 static int pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx,
588 const char *type, const char *value)
591 RSAerr(RSA_F_PKEY_RSA_CTRL_STR, RSA_R_VALUE_MISSING);
594 if (strcmp(type, "rsa_padding_mode") == 0) {
597 if (strcmp(value, "pkcs1") == 0) {
598 pm = RSA_PKCS1_PADDING;
599 } else if (strcmp(value, "sslv23") == 0) {
600 pm = RSA_SSLV23_PADDING;
601 } else if (strcmp(value, "none") == 0) {
603 } else if (strcmp(value, "oeap") == 0) {
604 pm = RSA_PKCS1_OAEP_PADDING;
605 } else if (strcmp(value, "oaep") == 0) {
606 pm = RSA_PKCS1_OAEP_PADDING;
607 } else if (strcmp(value, "x931") == 0) {
608 pm = RSA_X931_PADDING;
609 } else if (strcmp(value, "pss") == 0) {
610 pm = RSA_PKCS1_PSS_PADDING;
612 RSAerr(RSA_F_PKEY_RSA_CTRL_STR, RSA_R_UNKNOWN_PADDING_TYPE);
615 return EVP_PKEY_CTX_set_rsa_padding(ctx, pm);
618 if (strcmp(type, "rsa_pss_saltlen") == 0) {
621 if (!strcmp(value, "digest"))
622 saltlen = RSA_PSS_SALTLEN_DIGEST;
623 else if (!strcmp(value, "max"))
624 saltlen = RSA_PSS_SALTLEN_MAX;
625 else if (!strcmp(value, "auto"))
626 saltlen = RSA_PSS_SALTLEN_AUTO;
628 saltlen = atoi(value);
629 return EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, saltlen);
632 if (strcmp(type, "rsa_keygen_bits") == 0) {
633 int nbits = atoi(value);
635 return EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, nbits);
638 if (strcmp(type, "rsa_keygen_pubexp") == 0) {
641 BIGNUM *pubexp = NULL;
642 if (!BN_asc2bn(&pubexp, value))
644 ret = EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, pubexp);
650 if (strcmp(type, "rsa_keygen_primes") == 0) {
651 int nprimes = atoi(value);
653 return EVP_PKEY_CTX_set_rsa_keygen_primes(ctx, nprimes);
656 if (strcmp(type, "rsa_mgf1_md") == 0)
657 return EVP_PKEY_CTX_md(ctx,
658 EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT,
659 EVP_PKEY_CTRL_RSA_MGF1_MD, value);
661 if (pkey_ctx_is_pss(ctx)) {
663 if (strcmp(type, "rsa_pss_keygen_mgf1_md") == 0)
664 return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_KEYGEN,
665 EVP_PKEY_CTRL_RSA_MGF1_MD, value);
667 if (strcmp(type, "rsa_pss_keygen_md") == 0)
668 return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_KEYGEN,
669 EVP_PKEY_CTRL_MD, value);
671 if (strcmp(type, "rsa_pss_keygen_saltlen") == 0) {
672 int saltlen = atoi(value);
674 return EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(ctx, saltlen);
678 if (strcmp(type, "rsa_oaep_md") == 0)
679 return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_TYPE_CRYPT,
680 EVP_PKEY_CTRL_RSA_OAEP_MD, value);
682 if (strcmp(type, "rsa_oaep_label") == 0) {
687 lab = OPENSSL_hexstr2buf(value, &lablen);
690 ret = EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, lab, lablen);
699 /* Set PSS parameters when generating a key, if necessary */
700 static int rsa_set_pss_param(RSA *rsa, EVP_PKEY_CTX *ctx)
702 RSA_PKEY_CTX *rctx = ctx->data;
704 if (!pkey_ctx_is_pss(ctx))
706 /* If all parameters are default values don't set pss */
707 if (rctx->md == NULL && rctx->mgf1md == NULL && rctx->saltlen == -2)
709 rsa->pss = rsa_pss_params_create(rctx->md, rctx->mgf1md,
710 rctx->saltlen == -2 ? 0 : rctx->saltlen);
711 if (rsa->pss == NULL)
716 static int pkey_rsa_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
719 RSA_PKEY_CTX *rctx = ctx->data;
723 if (rctx->pub_exp == NULL) {
724 rctx->pub_exp = BN_new();
725 if (rctx->pub_exp == NULL || !BN_set_word(rctx->pub_exp, RSA_F4))
731 if (ctx->pkey_gencb) {
732 pcb = BN_GENCB_new();
737 evp_pkey_set_cb_translate(pcb, ctx);
741 ret = RSA_generate_multi_prime_key(rsa, rctx->nbits, rctx->primes,
744 if (ret > 0 && !rsa_set_pss_param(rsa, ctx)) {
749 EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, rsa);
755 const EVP_PKEY_METHOD rsa_pkey_meth = {
757 EVP_PKEY_FLAG_AUTOARGLEN,
774 pkey_rsa_verifyrecover,
791 * Called for PSS sign or verify initialisation: checks PSS parameter
792 * sanity and sets any restrictions on key usage.
795 static int pkey_pss_init(EVP_PKEY_CTX *ctx)
798 RSA_PKEY_CTX *rctx = ctx->data;
800 const EVP_MD *mgf1md;
801 int min_saltlen, max_saltlen;
803 /* Should never happen */
804 if (!pkey_ctx_is_pss(ctx))
806 rsa = ctx->pkey->pkey.rsa;
807 /* If no restrictions just return */
808 if (rsa->pss == NULL)
810 /* Get and check parameters */
811 if (!rsa_pss_get_param(rsa->pss, &md, &mgf1md, &min_saltlen))
814 /* See if minimum salt length exceeds maximum possible */
815 max_saltlen = RSA_size(rsa) - EVP_MD_size(md);
816 if ((RSA_bits(rsa) & 0x7) == 1)
818 if (min_saltlen > max_saltlen) {
819 RSAerr(RSA_F_PKEY_PSS_INIT, RSA_R_INVALID_SALT_LENGTH);
823 rctx->min_saltlen = min_saltlen;
826 * Set PSS restrictions as defaults: we can then block any attempt to
827 * use invalid values in pkey_rsa_ctrl
831 rctx->mgf1md = mgf1md;
832 rctx->saltlen = min_saltlen;
837 const EVP_PKEY_METHOD rsa_pss_pkey_meth = {
839 EVP_PKEY_FLAG_AUTOARGLEN,
855 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,